From: Alejandro Piñeiro Date: Wed, 28 Mar 2018 12:59:26 +0000 (+0200) Subject: compiler/link: add linker_util.h, move linker_error/warning to it X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=aa95f0bc5b05fdab4e258d02c1a69abd8317920e;p=mesa.git 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 --- diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources index 252cbed0d26..403490746d5 100644 --- a/src/compiler/Makefile.sources +++ b/src/compiler/Makefile.sources @@ -71,6 +71,7 @@ LIBGLSL_FILES = \ glsl/ir_visitor.h \ glsl/linker.cpp \ glsl/linker.h \ + glsl/linker_util.h \ glsl/link_atomics.cpp \ glsl/link_functions.cpp \ glsl/link_interface_blocks.cpp \ diff --git a/src/compiler/glsl/link_uniform_block_active_visitor.cpp b/src/compiler/glsl/link_uniform_block_active_visitor.cpp index cd1baf78e80..368981852c0 100644 --- a/src/compiler/glsl/link_uniform_block_active_visitor.cpp +++ b/src/compiler/glsl/link_uniform_block_active_visitor.cpp @@ -23,6 +23,7 @@ #include "link_uniform_block_active_visitor.h" #include "program.h" +#include "linker_util.h" static link_uniform_block_active * process_block(void *mem_ctx, struct hash_table *ht, ir_variable *var) diff --git a/src/compiler/glsl/linker.h b/src/compiler/glsl/linker.h index 454b65aebdf..6e9b4861673 100644 --- a/src/compiler/glsl/linker.h +++ b/src/compiler/glsl/linker.h @@ -25,6 +25,8 @@ #ifndef GLSL_LINKER_H #define GLSL_LINKER_H +#include "linker_util.h" + struct gl_shader_program; struct gl_shader; struct gl_linked_shader; @@ -192,12 +194,6 @@ private: 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 * allocate slots to explicit locations. This struct represents a single diff --git a/src/compiler/glsl/linker_util.h b/src/compiler/glsl/linker_util.h new file mode 100644 index 00000000000..162db3e532f --- /dev/null +++ b/src/compiler/glsl/linker_util.h @@ -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 */ diff --git a/src/compiler/glsl/meson.build b/src/compiler/glsl/meson.build index 055a84714c1..686a5a4ac0b 100644 --- a/src/compiler/glsl/meson.build +++ b/src/compiler/glsl/meson.build @@ -112,6 +112,7 @@ files_libglsl = files( 'ir_visitor.h', 'linker.cpp', 'linker.h', + 'linker_util.h', 'link_atomics.cpp', 'link_functions.cpp', 'link_interface_blocks.cpp', diff --git a/src/compiler/glsl/program.h b/src/compiler/glsl/program.h index 480379b10b8..9df42ddc1c4 100644 --- a/src/compiler/glsl/program.h +++ b/src/compiler/glsl/program.h @@ -48,14 +48,6 @@ extern void build_program_resource_list(struct gl_context *ctx, 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 parse_program_resource_name(const GLchar *name, const GLchar **out_base_name_end);