i965: Call gen6_upload_push_constants() even when the stage is disabled.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 20 Oct 2017 22:53:50 +0000 (15:53 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 24 Oct 2017 23:14:04 +0000 (16:14 -0700)
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 <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/gen6_constant_state.c
src/mesa/drivers/dri/i965/genX_state_upload.c

index 6b5d2e66cc940347831ca8587d99497cf046352c..acf7454cef580025795985937ea86deafac6ec8d 100644 (file)
@@ -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
index f2b3e4570b2bda02d9d92ca39ddc6cbdc8c21ded..4ccfd4891913c83719e1f3fb52c1dcce781b1631 100644 (file)
@@ -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) = {