compiler/link: add linker_util.h, move linker_error/warning to it

Linker utilities common to the GLSL IR and NIR linker (the latter to
be used for ARB_gl_spirv).

We need to move it to a new header as the NIR linker doesn't need to
know about ir_variable, and others, included at linker.h.

v2: move from src/compiler to src/compiler/glsl (Timothy Arceri)

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
Alejandro Piñeiro
2018-03-28 14:59:26 +02:00
parent b995bda9bc
commit aa95f0bc5b
6 changed files with 48 additions and 14 deletions

View File

@@ -71,6 +71,7 @@ LIBGLSL_FILES = \
glsl/ir_visitor.h \ glsl/ir_visitor.h \
glsl/linker.cpp \ glsl/linker.cpp \
glsl/linker.h \ glsl/linker.h \
glsl/linker_util.h \
glsl/link_atomics.cpp \ glsl/link_atomics.cpp \
glsl/link_functions.cpp \ glsl/link_functions.cpp \
glsl/link_interface_blocks.cpp \ glsl/link_interface_blocks.cpp \

View File

@@ -23,6 +23,7 @@
#include "link_uniform_block_active_visitor.h" #include "link_uniform_block_active_visitor.h"
#include "program.h" #include "program.h"
#include "linker_util.h"
static link_uniform_block_active * static link_uniform_block_active *
process_block(void *mem_ctx, struct hash_table *ht, ir_variable *var) process_block(void *mem_ctx, struct hash_table *ht, ir_variable *var)

View File

@@ -25,6 +25,8 @@
#ifndef GLSL_LINKER_H #ifndef GLSL_LINKER_H
#define GLSL_LINKER_H #define GLSL_LINKER_H
#include "linker_util.h"
struct gl_shader_program; struct gl_shader_program;
struct gl_shader; struct gl_shader;
struct gl_linked_shader; struct gl_linked_shader;
@@ -192,12 +194,6 @@ private:
const glsl_struct_field *named_ifc_member); const glsl_struct_field *named_ifc_member);
}; };
void
linker_error(gl_shader_program *prog, const char *fmt, ...);
void
linker_warning(gl_shader_program *prog, const char *fmt, ...);
/** /**
* Sometimes there are empty slots left over in UniformRemapTable after we * Sometimes there are empty slots left over in UniformRemapTable after we
* allocate slots to explicit locations. This struct represents a single * allocate slots to explicit locations. This struct represents a single

View File

@@ -0,0 +1,43 @@
/*
* Copyright © 2018 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef GLSL_LINKER_UTIL_H
#define GLSL_LINKER_UTIL_H
struct gl_shader_program;
#ifdef __cplusplus
extern "C" {
#endif
void
linker_error(struct gl_shader_program *prog, const char *fmt, ...);
void
linker_warning(struct gl_shader_program *prog, const char *fmt, ...);
#ifdef __cplusplus
}
#endif
#endif /* GLSL_LINKER_UTIL_H */

View File

@@ -112,6 +112,7 @@ files_libglsl = files(
'ir_visitor.h', 'ir_visitor.h',
'linker.cpp', 'linker.cpp',
'linker.h', 'linker.h',
'linker_util.h',
'link_atomics.cpp', 'link_atomics.cpp',
'link_functions.cpp', 'link_functions.cpp',
'link_interface_blocks.cpp', 'link_interface_blocks.cpp',

View File

@@ -48,14 +48,6 @@ extern void
build_program_resource_list(struct gl_context *ctx, build_program_resource_list(struct gl_context *ctx,
struct gl_shader_program *shProg); struct gl_shader_program *shProg);
extern void
linker_error(struct gl_shader_program *prog, const char *fmt, ...)
PRINTFLIKE(2, 3);
extern void
linker_warning(struct gl_shader_program *prog, const char *fmt, ...)
PRINTFLIKE(2, 3);
extern long extern long
parse_program_resource_name(const GLchar *name, parse_program_resource_name(const GLchar *name,
const GLchar **out_base_name_end); const GLchar **out_base_name_end);