[Mesa-dev] [PATCH 11/13] mesa/i965: create Driver.ProcessGLSLIR()
Timothy Arceri
timothy.arceri at collabora.com
Wed Jul 27 05:20:52 UTC 2016
This allows us to do backend specific processing on GLSL IR from
the shared linker.
---
src/mesa/drivers/dri/i965/brw_link.cpp | 12 ++++++------
src/mesa/drivers/dri/i965/brw_program.c | 1 +
src/mesa/drivers/dri/i965/brw_shader.h | 4 ++++
src/mesa/main/dd.h | 3 +++
4 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index e56df93..244c8f0 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -114,12 +114,12 @@ brw_common_opts(struct gl_linked_shader *shader, struct gl_context *ctx,
} while (progress);
}
-static void
-process_glsl_ir(struct brw_context *brw,
- struct gl_shader_program *shader_prog,
- struct gl_linked_shader *shader)
+extern "C" void
+brw_process_glsl_ir(struct gl_context *ctx,
+ struct gl_shader_program *shader_prog,
+ struct gl_linked_shader *shader)
{
- struct gl_context *ctx = &brw->ctx;
+ struct brw_context *brw = brw_context(ctx);
const struct brw_compiler *compiler = brw->intelScreen->compiler;
const struct gl_shader_compiler_options *options =
&ctx->Const.ShaderCompilerOptions[shader->Stage];
@@ -233,7 +233,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
_mesa_copy_linked_program_data((gl_shader_stage) stage, shProg, prog);
- process_glsl_ir(brw, shProg, shader);
+ brw_process_glsl_ir(ctx, shProg, shader);
/* Make a pass over the IR to add state references for any built-in
* uniforms that are used. This has to be done now (during linking).
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 7785490..559bb4d 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -377,6 +377,7 @@ void brwInitFragProgFuncs( struct dd_function_table *functions )
functions->NewShader = brw_new_shader;
functions->LinkShader = brw_link_shader;
+ functions->ProcessGLSLIR = brw_process_glsl_ir;
functions->MemoryBarrier = brw_memory_barrier;
}
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index e61c080..65acc30 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -290,6 +290,10 @@ bool brw_cs_precompile(struct gl_context *ctx,
GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
struct gl_linked_shader *brw_new_shader(gl_shader_stage stage);
+void
+brw_process_glsl_ir(struct gl_context *ctx,
+ struct gl_shader_program *shader_prog,
+ struct gl_linked_shader *shader);
int type_size_scalar(const struct glsl_type *type);
int type_size_vec4(const struct glsl_type *type);
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 114cbd2..3f9ebdf 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -786,6 +786,9 @@ struct dd_function_table {
/*@{*/
struct gl_linked_shader *(*NewShader)(gl_shader_stage stage);
void (*UseProgram)(struct gl_context *ctx, struct gl_shader_program *shProg);
+ void (*ProcessGLSLIR)(struct gl_context *ctx,
+ struct gl_shader_program *shader_prog,
+ struct gl_linked_shader *shader);
/*@}*/
/**
--
2.7.4
More information about the mesa-dev
mailing list