summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2017-10-20 15:53:50 -0700
committerKenneth Graunke <[email protected]>2017-10-24 16:14:04 -0700
commit66b4a7a79e3da03e11233acd32b6e37bf3969dd8 (patch)
treed8a0e85e3f0d7b508de155366c2eec4ce69919f4
parent16096e9119d7f68c0382cf802ff7f3a93668ede9 (diff)
i965: Call gen6_upload_push_constants() even when the stage is disabled.
This properly sets stage_state->push_constant_dirty = true, so that we emit 3DSTATE_CONSTANT_XS to disable the constant buffer for the shader stage. It also sets stage_state->push_const_size = 0. Reviewed-by: Topi Pohjolainen <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/gen6_constant_state.c9
-rw-r--r--src/mesa/drivers/dri/i965/genX_state_upload.c25
2 files changed, 16 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_constant_state.c b/src/mesa/drivers/dri/i965/gen6_constant_state.c
index 6b5d2e66cc9..acf7454cef5 100644
--- a/src/mesa/drivers/dri/i965/gen6_constant_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_constant_state.c
@@ -130,9 +130,14 @@ gen6_upload_push_constants(struct brw_context *brw,
const struct gen_device_info *devinfo = &brw->screen->devinfo;
struct gl_context *ctx = &brw->ctx;
- _mesa_shader_write_subroutine_indices(ctx, stage_state->stage);
+ bool active = prog_data &&
+ (stage_state->stage != MESA_SHADER_TESS_CTRL ||
+ brw->programs[MESA_SHADER_TESS_EVAL]);
- if (prog_data->nr_params == 0) {
+ if (active)
+ _mesa_shader_write_subroutine_indices(ctx, stage_state->stage);
+
+ if (!active || prog_data->nr_params == 0) {
stage_state->push_const_size = 0;
} else {
/* Updates the ParamaterValues[i] pointers for all parameters of the
diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
index f2b3e4570b2..4ccfd489191 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -3165,12 +3165,10 @@ genX(upload_gs_push_constants)(struct brw_context *brw)
/* BRW_NEW_GEOMETRY_PROGRAM */
const struct gl_program *gp = brw->programs[MESA_SHADER_GEOMETRY];
- if (gp) {
- /* BRW_NEW_GS_PROG_DATA */
- struct brw_stage_prog_data *prog_data = brw->gs.base.prog_data;
+ /* BRW_NEW_GS_PROG_DATA */
+ struct brw_stage_prog_data *prog_data = brw->gs.base.prog_data;
- gen6_upload_push_constants(brw, gp, prog_data, stage_state);
- }
+ gen6_upload_push_constants(brw, gp, prog_data, stage_state);
}
static const struct brw_tracked_state genX(gs_push_constants) = {
@@ -4027,11 +4025,9 @@ genX(upload_tes_push_constants)(struct brw_context *brw)
/* BRW_NEW_TESS_PROGRAMS */
const struct gl_program *tep = brw->programs[MESA_SHADER_TESS_EVAL];
- if (tep) {
- /* BRW_NEW_TES_PROG_DATA */
- const struct brw_stage_prog_data *prog_data = brw->tes.base.prog_data;
- gen6_upload_push_constants(brw, tep, prog_data, stage_state);
- }
+ /* BRW_NEW_TES_PROG_DATA */
+ const struct brw_stage_prog_data *prog_data = brw->tes.base.prog_data;
+ gen6_upload_push_constants(brw, tep, prog_data, stage_state);
}
static const struct brw_tracked_state genX(tes_push_constants) = {
@@ -4051,14 +4047,11 @@ genX(upload_tcs_push_constants)(struct brw_context *brw)
struct brw_stage_state *stage_state = &brw->tcs.base;
/* BRW_NEW_TESS_PROGRAMS */
const struct gl_program *tcp = brw->programs[MESA_SHADER_TESS_CTRL];
- bool active = brw->programs[MESA_SHADER_TESS_EVAL];
- if (active) {
- /* BRW_NEW_TCS_PROG_DATA */
- const struct brw_stage_prog_data *prog_data = brw->tcs.base.prog_data;
+ /* BRW_NEW_TCS_PROG_DATA */
+ const struct brw_stage_prog_data *prog_data = brw->tcs.base.prog_data;
- gen6_upload_push_constants(brw, tcp, prog_data, stage_state);
- }
+ gen6_upload_push_constants(brw, tcp, prog_data, stage_state);
}
static const struct brw_tracked_state genX(tcs_push_constants) = {