[Mesa-dev] [PATCH 1/2] mesa/i965: create Driver.ProcessGLSLIR()
Timothy Arceri
timothy.arceri at collabora.com
Wed Jul 20 10:57:26 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 | 14 +++++++-------
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, 15 insertions(+), 7 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp
index 5374685..523b923 100644
--- a/src/mesa/drivers/dri/i965/brw_link.cpp
+++ b/src/mesa/drivers/dri/i965/brw_link.cpp
@@ -85,13 +85,13 @@ brw_lower_packing_builtins(struct brw_context *brw,
lower_packing_builtins(ir, LOWER_PACK_HALF_2x16 | LOWER_UNPACK_HALF_2x16);
}
-static void
-process_glsl_ir(gl_shader_stage stage,
- struct brw_context *brw,
- struct gl_shader_program *shader_prog,
- struct gl_linked_shader *shader)
+extern "C" void
+brw_process_glsl_ir(gl_shader_stage stage,
+ 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];
@@ -220,7 +220,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((gl_shader_stage) stage, brw, shProg, shader);
+ brw_process_glsl_ir((gl_shader_stage) stage, 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 dd9eb2d..9151de8 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(gl_shader_stage stage, 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..fe65246 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)(gl_shader_stage stage, 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