[Mesa-dev] [PATCH 1/3] i965: Move _mesa_shader_write_subroutine_indices down a level.

Kenneth Graunke kenneth at whitecape.org
Mon Oct 23 18:57:51 UTC 2017


Now we call it in one place instead of making every caller do it.
---
 src/mesa/drivers/dri/i965/gen6_constant_state.c | 3 +++
 src/mesa/drivers/dri/i965/genX_state_upload.c   | 6 ------
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_constant_state.c b/src/mesa/drivers/dri/i965/gen6_constant_state.c
index 121ba672575..6b5d2e66cc9 100644
--- a/src/mesa/drivers/dri/i965/gen6_constant_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_constant_state.c
@@ -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 {
diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c b/src/mesa/drivers/dri/i965/genX_state_upload.c
index 63ad02ff499..66b1ad9dbda 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -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);
    }
 }
-- 
2.14.2



More information about the mesa-dev mailing list