i965: Move _mesa_shader_write_subroutine_indices down a level.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 20 Oct 2017 22:50:28 +0000 (15:50 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 24 Oct 2017 23:13:59 +0000 (16:13 -0700)
Now we call it in one place instead of making every caller do it.

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 121ba6725754a0708b640e95373e5e3a93f594f1..6b5d2e66cc940347831ca8587d99497cf046352c 100644 (file)
@@ -28,6 +28,7 @@
 #include "intel_batchbuffer.h"
 #include "intel_buffer_objects.h"
 #include "program/prog_parameter.h"
+#include "main/shaderapi.h"
 
 static uint32_t
 f_as_u32(float f)
@@ -129,6 +130,8 @@ 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);
+
    if (prog_data->nr_params == 0) {
       stage_state->push_const_size = 0;
    } else {
index 63ad02ff49972c4df1204b11b8d76f3d39665e73..66b1ad9dbdab06afb339c9017727fc1e76ef0f59 100644 (file)
@@ -3143,7 +3143,6 @@ genX(upload_vs_push_constants)(struct brw_context *brw)
    /* BRW_NEW_VS_PROG_DATA */
    const struct brw_stage_prog_data *prog_data = brw->vs.base.prog_data;
 
-   _mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_VERTEX);
    gen6_upload_push_constants(brw, &vp->program, prog_data, stage_state);
 }
 
@@ -3172,7 +3171,6 @@ genX(upload_gs_push_constants)(struct brw_context *brw)
       /* BRW_NEW_GS_PROG_DATA */
       struct brw_stage_prog_data *prog_data = brw->gs.base.prog_data;
 
-      _mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_GEOMETRY);
       gen6_upload_push_constants(brw, &gp->program, prog_data, stage_state);
    }
 }
@@ -3199,8 +3197,6 @@ genX(upload_wm_push_constants)(struct brw_context *brw)
    /* BRW_NEW_FS_PROG_DATA */
    const struct brw_stage_prog_data *prog_data = brw->wm.base.prog_data;
 
-   _mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_FRAGMENT);
-
    gen6_upload_push_constants(brw, &fp->program, prog_data, stage_state);
 }
 
@@ -4038,7 +4034,6 @@ genX(upload_tes_push_constants)(struct brw_context *brw)
    if (tep) {
       /* BRW_NEW_TES_PROG_DATA */
       const struct brw_stage_prog_data *prog_data = brw->tes.base.prog_data;
-      _mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_TESS_EVAL);
       gen6_upload_push_constants(brw, &tep->program, prog_data, stage_state);
    }
 }
@@ -4067,7 +4062,6 @@ genX(upload_tcs_push_constants)(struct brw_context *brw)
       /* BRW_NEW_TCS_PROG_DATA */
       const struct brw_stage_prog_data *prog_data = brw->tcs.base.prog_data;
 
-      _mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_TESS_CTRL);
       gen6_upload_push_constants(brw, &tcp->program, prog_data, stage_state);
    }
 }