[Mesa-dev] [PATCH 1/2] i965: drop copy of NumImages
Lionel Landwerlin
llandwerlin at gmail.com
Mon Sep 26 14:31:16 UTC 2016
We can access this value through gl_shader_program.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: Jason Ekstrand <jason at jlekstrand.net>
---
src/mesa/drivers/dri/i965/brw_compiler.h | 1 -
src/mesa/drivers/dri/i965/brw_cs.c | 1 -
src/mesa/drivers/dri/i965/brw_gs.c | 1 -
src/mesa/drivers/dri/i965/brw_tcs.c | 1 -
src/mesa/drivers/dri/i965/brw_tes.c | 1 -
src/mesa/drivers/dri/i965/brw_vs.c | 5 +----
src/mesa/drivers/dri/i965/brw_wm.c | 4 +---
src/mesa/drivers/dri/i965/gen7_l3_state.c | 5 ++++-
8 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h
index 445c166..437528b 100644
--- a/src/mesa/drivers/dri/i965/brw_compiler.h
+++ b/src/mesa/drivers/dri/i965/brw_compiler.h
@@ -344,7 +344,6 @@ struct brw_stage_prog_data {
GLuint nr_params; /**< number of float params/constants */
GLuint nr_pull_params;
- unsigned nr_image_params;
unsigned curb_read_length;
unsigned total_scratch;
diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c
index 4e746fe..febf53a 100644
--- a/src/mesa/drivers/dri/i965/brw_cs.c
+++ b/src/mesa/drivers/dri/i965/brw_cs.c
@@ -106,7 +106,6 @@ brw_codegen_cs_prog(struct brw_context *brw,
prog_data.base.image_param =
rzalloc_array(NULL, struct brw_image_param, cs->base.NumImages);
prog_data.base.nr_params = param_count;
- prog_data.base.nr_image_params = cs->base.NumImages;
brw_nir_setup_glsl_uniforms(cp->program.Base.nir, prog, &cp->program.Base,
&prog_data.base, true);
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index 741216c..486416a 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -128,7 +128,6 @@ brw_codegen_gs_prog(struct brw_context *brw,
prog_data.base.base.image_param =
rzalloc_array(NULL, struct brw_image_param, gs->NumImages);
prog_data.base.base.nr_params = param_count;
- prog_data.base.base.nr_image_params = gs->NumImages;
brw_nir_setup_glsl_uniforms(gp->program.Base.nir, prog, &gp->program.Base,
&prog_data.base.base,
diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index 7e6c69a..88df595 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -216,7 +216,6 @@ brw_codegen_tcs_prog(struct brw_context *brw,
prog_data.base.base.image_param =
rzalloc_array(NULL, struct brw_image_param, tcs->NumImages);
- prog_data.base.base.nr_image_params = tcs->NumImages;
brw_nir_setup_glsl_uniforms(nir, shader_prog, &tcp->program.Base,
&prog_data.base.base,
diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c
index 87ada17..88739b9 100644
--- a/src/mesa/drivers/dri/i965/brw_tes.c
+++ b/src/mesa/drivers/dri/i965/brw_tes.c
@@ -161,7 +161,6 @@ brw_codegen_tes_prog(struct brw_context *brw,
prog_data.base.base.image_param =
rzalloc_array(NULL, struct brw_image_param, tes->NumImages);
prog_data.base.base.nr_params = param_count;
- prog_data.base.base.nr_image_params = tes->NumImages;
prog_data.base.cull_distance_mask =
((1 << tep->program.Base.CullDistanceArraySize) - 1) <<
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index ba7315e..c242190 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -123,9 +123,6 @@ brw_codegen_vs_prog(struct brw_context *brw,
*/
int param_count = vp->program.Base.nir->num_uniforms / 4;
- if (vs)
- prog_data.base.base.nr_image_params = vs->base.NumImages;
-
/* vec4_visitor::setup_uniform_clipplane_values() also uploads user clip
* planes as uniforms.
*/
@@ -137,7 +134,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
rzalloc_array(NULL, const gl_constant_value *, param_count);
stage_prog_data->image_param =
rzalloc_array(NULL, struct brw_image_param,
- stage_prog_data->nr_image_params);
+ vs ? vs->base.NumImages : 0);
stage_prog_data->nr_params = param_count;
if (prog) {
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 6ffe7c8..1af6bf7 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -106,8 +106,6 @@ brw_codegen_wm_prog(struct brw_context *brw,
* by the state cache.
*/
int param_count = fp->program.Base.nir->num_uniforms / 4;
- if (fs)
- prog_data.base.nr_image_params = fs->base.NumImages;
/* The backend also sometimes adds params for texture size. */
param_count += 2 * ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits;
prog_data.base.param =
@@ -116,7 +114,7 @@ brw_codegen_wm_prog(struct brw_context *brw,
rzalloc_array(NULL, const gl_constant_value *, param_count);
prog_data.base.image_param =
rzalloc_array(NULL, struct brw_image_param,
- prog_data.base.nr_image_params);
+ fs ? fs->base.NumImages : 0);
prog_data.base.nr_params = param_count;
if (prog) {
diff --git a/src/mesa/drivers/dri/i965/gen7_l3_state.c b/src/mesa/drivers/dri/i965/gen7_l3_state.c
index ad70491..92e8788 100644
--- a/src/mesa/drivers/dri/i965/gen7_l3_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_l3_state.c
@@ -51,10 +51,13 @@ get_pipeline_state_l3_weights(const struct brw_context *brw)
for (unsigned i = 0; i < ARRAY_SIZE(stage_states); i++) {
const struct gl_shader_program *prog =
brw->ctx._Shader->CurrentProgram[stage_states[i]->stage];
+ const struct gl_linked_shader *shader =
+ prog ? prog->_LinkedShaders[stage_states[i]->stage] : NULL;
const struct brw_stage_prog_data *prog_data = stage_states[i]->prog_data;
needs_dc |= (prog && prog->NumAtomicBuffers) ||
- (prog_data && (prog_data->total_scratch || prog_data->nr_image_params));
+ (shader && shader->NumImages) ||
+ (prog_data && prog_data->total_scratch);
needs_slm |= prog_data && prog_data->total_shared;
}
--
2.9.3
More information about the mesa-dev
mailing list