[Mesa-dev] [PATCH 02/68] glsl: Prepare standalone compiler to be able to use parameter lists

Timothy Arceri timothy.arceri at collabora.com
Wed Jun 1 06:22:43 UTC 2016


From: Carl Worth <cworth at cworth.org>

As part of the shader-cache work an upcoming change will add new
references to _mesa_add_parameter and _mesa_new_parameter_list from
the glsl code. To prepare for that, and to allow the standalone
glsl_compiler to still link, here we add mesa/program/prog_parameter.c
to the libglsl_util sources.

Then, in order to get *that* to work, we also add to stubs to
standalone_scaffolding:

	_mesa_program_state_flags
	_mesa_program_state_strin

These functions aren't actually used by the two functions in
prog_parameter.c that we are actually calling. They are used in other
functions in the same file. So we don't care what the implementation
of these stubs is, (they won't be called by glsl_compiler). We just
need the stubs present so that it can link.

Signed-off-by: Timothy Arceri <timothy.arceri at collabora.com>
---
 src/Makefile.am                              |  3 +++
 src/compiler/glsl/standalone_scaffolding.cpp | 12 ++++++++++++
 src/compiler/glsl/standalone_scaffolding.h   |  8 ++++++++
 3 files changed, 23 insertions(+)

diff --git a/src/Makefile.am b/src/Makefile.am
index f5c0773..472a082 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -87,6 +87,8 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/include/ \
 	-I$(top_srcdir)/src/mapi/ \
 	-I$(top_srcdir)/src/mesa/ \
+	-I$(top_srcdir)/src/gallium/include \
+	-I$(top_srcdir)/src/gallium/auxiliary \
 	$(DEFINES)
 
 noinst_LTLIBRARIES = libglsl_util.la
@@ -94,5 +96,6 @@ noinst_LTLIBRARIES = libglsl_util.la
 libglsl_util_la_SOURCES = \
 	mesa/main/imports.c \
 	mesa/program/prog_hash_table.c \
+	mesa/program/prog_parameter.c \
 	mesa/program/symbol_table.c \
 	mesa/program/dummy_errors.c
diff --git a/src/compiler/glsl/standalone_scaffolding.cpp b/src/compiler/glsl/standalone_scaffolding.cpp
index 4edb767..49abe92 100644
--- a/src/compiler/glsl/standalone_scaffolding.cpp
+++ b/src/compiler/glsl/standalone_scaffolding.cpp
@@ -85,6 +85,18 @@ _mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
    return shader;
 }
 
+GLbitfield
+_mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
+{
+   return 0;
+}
+
+char *
+_mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
+{
+   return NULL;
+}
+
 void
 _mesa_delete_shader(struct gl_context *ctx, struct gl_shader *sh)
 {
diff --git a/src/compiler/glsl/standalone_scaffolding.h b/src/compiler/glsl/standalone_scaffolding.h
index f853a18..31c69a3 100644
--- a/src/compiler/glsl/standalone_scaffolding.h
+++ b/src/compiler/glsl/standalone_scaffolding.h
@@ -33,6 +33,7 @@
 
 #include <assert.h>
 #include "main/mtypes.h"
+#include "program/prog_statevars.h"
 
 extern "C" void
 _mesa_warning(struct gl_context *ctx, const char *fmtString, ... );
@@ -54,6 +55,13 @@ extern "C" void
 _mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint *id,
                    const char *msg);
 
+extern "C" GLbitfield
+_mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]);
+
+
+extern "C" char *
+_mesa_program_state_string(const gl_state_index state[STATE_LENGTH]);
+
 static inline gl_shader_stage
 _mesa_shader_enum_to_shader_stage(GLenum v)
 {
-- 
2.5.5



More information about the mesa-dev mailing list