[Mesa-dev] [PATCH 3/5] i965: use new subroutine index uploader.

Dave Airlie airlied at gmail.com
Tue Jun 7 05:25:57 UTC 2016


From: Dave Airlie <airlied at redhat.com>

This plugs the subroutine index updates into the i965 backend,
where it loads constants.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/mesa/drivers/dri/i965/brw_gs_surface_state.c  | 2 ++
 src/mesa/drivers/dri/i965/brw_tcs_surface_state.c | 2 ++
 src/mesa/drivers/dri/i965/brw_tes_surface_state.c | 2 ++
 src/mesa/drivers/dri/i965/brw_vs_surface_state.c  | 3 ++-
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c  | 3 ++-
 src/mesa/drivers/dri/i965/gen6_gs_state.c         | 2 ++
 src/mesa/drivers/dri/i965/gen6_vs_state.c         | 2 ++
 src/mesa/drivers/dri/i965/gen6_wm_state.c         | 3 +++
 src/mesa/drivers/dri/i965/gen7_cs_state.c         | 3 +++
 src/mesa/drivers/dri/i965/gen7_ds_state.c         | 2 ++
 src/mesa/drivers/dri/i965/gen7_hs_state.c         | 3 +++
 11 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
index 63b40d1..f8c0b96 100644
--- a/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_gs_surface_state.c
@@ -23,6 +23,7 @@
 
 #include "main/mtypes.h"
 #include "program/prog_parameter.h"
+#include "main/shaderapi.h"
 
 #include "brw_context.h"
 #include "brw_state.h"
@@ -49,6 +50,7 @@ brw_upload_gs_pull_constants(struct brw_context *brw)
    /* BRW_NEW_GS_PROG_DATA */
    const struct brw_vue_prog_data *prog_data = &brw->gs.prog_data->base;
 
+   _mesa_shader_write_subroutine_indicies(&brw->ctx, MESA_SHADER_GEOMETRY);
    /* _NEW_PROGRAM_CONSTANTS */
    brw_upload_pull_constants(brw, BRW_NEW_GS_CONSTBUF, &gp->program.Base,
                              stage_state, &prog_data->base);
diff --git a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
index 164f05f..0b9aa8d 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c
@@ -23,6 +23,7 @@
 
 #include "main/mtypes.h"
 #include "program/prog_parameter.h"
+#include "main/shaderapi.h"
 
 #include "brw_context.h"
 #include "brw_state.h"
@@ -49,6 +50,7 @@ brw_upload_tcs_pull_constants(struct brw_context *brw)
    /* BRW_NEW_TCS_PROG_DATA */
    const struct brw_stage_prog_data *prog_data = &brw->tcs.prog_data->base.base;
 
+   _mesa_shader_write_subroutine_indicies(&brw->ctx, MESA_SHADER_TESS_CTRL);
    /* _NEW_PROGRAM_CONSTANTS */
    brw_upload_pull_constants(brw, BRW_NEW_TCS_CONSTBUF, &tcp->program.Base,
                              stage_state, prog_data);
diff --git a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
index 2fa954d..6d94b91 100644
--- a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c
@@ -23,6 +23,7 @@
 
 #include "main/mtypes.h"
 #include "program/prog_parameter.h"
+#include "main/shaderapi.h"
 
 #include "brw_context.h"
 #include "brw_state.h"
@@ -49,6 +50,7 @@ brw_upload_tes_pull_constants(struct brw_context *brw)
    /* BRW_NEW_TES_PROG_DATA */
    const struct brw_stage_prog_data *prog_data = &brw->tes.prog_data->base.base;
 
+   _mesa_shader_write_subroutine_indicies(&brw->ctx, MESA_SHADER_TESS_EVAL);
    /* _NEW_PROGRAM_CONSTANTS */
    brw_upload_pull_constants(brw, BRW_NEW_TES_CONSTBUF, &dp->program.Base,
                              stage_state, prog_data);
diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
index 1036cda..b12c3d0 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c
@@ -31,7 +31,7 @@
 
 #include "main/mtypes.h"
 #include "program/prog_parameter.h"
-
+#include "main/shaderapi.h"
 #include "brw_context.h"
 #include "brw_state.h"
 #include "intel_buffer_objects.h"
@@ -118,6 +118,7 @@ brw_upload_vs_pull_constants(struct brw_context *brw)
    /* BRW_NEW_VS_PROG_DATA */
    const struct brw_stage_prog_data *prog_data = &brw->vs.prog_data->base.base;
 
+   _mesa_shader_write_subroutine_indicies(&brw->ctx, MESA_SHADER_VERTEX);
    /* _NEW_PROGRAM_CONSTANTS */
    brw_upload_pull_constants(brw, BRW_NEW_VS_CONSTBUF, &vp->program.Base,
                              stage_state, prog_data);
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index b73d5d5..651480e 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -38,7 +38,7 @@
 #include "program/prog_parameter.h"
 #include "program/prog_instruction.h"
 #include "main/framebuffer.h"
-
+#include "main/shaderapi.h"
 #include "isl/isl.h"
 
 #include "intel_mipmap_tree.h"
@@ -534,6 +534,7 @@ brw_upload_wm_pull_constants(struct brw_context *brw)
    /* BRW_NEW_FS_PROG_DATA */
    struct brw_stage_prog_data *prog_data = &brw->wm.prog_data->base;
 
+   _mesa_shader_write_subroutine_indicies(&brw->ctx, MESA_SHADER_FRAGMENT);
    /* _NEW_PROGRAM_CONSTANTS */
    brw_upload_pull_constants(brw, BRW_NEW_SURFACES, &fp->program.Base,
                              stage_state, prog_data);
diff --git a/src/mesa/drivers/dri/i965/gen6_gs_state.c b/src/mesa/drivers/dri/i965/gen6_gs_state.c
index 4e4b9463..a79bbee 100644
--- a/src/mesa/drivers/dri/i965/gen6_gs_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_gs_state.c
@@ -29,6 +29,7 @@
 #include "brw_state.h"
 #include "brw_defines.h"
 #include "intel_batchbuffer.h"
+#include "main/shaderapi.h"
 
 static void
 gen6_upload_gs_push_constants(struct brw_context *brw)
@@ -43,6 +44,7 @@ gen6_upload_gs_push_constants(struct brw_context *brw)
       /* BRW_NEW_GS_PROG_DATA */
       struct brw_stage_prog_data *prog_data = &brw->gs.prog_data->base.base;
 
+      _mesa_shader_write_subroutine_indicies(&brw->ctx, MESA_SHADER_GEOMETRY);
       gen6_upload_push_constants(brw, &gp->program.Base, prog_data,
                                  stage_state, AUB_TRACE_VS_CONSTANTS);
    }
diff --git a/src/mesa/drivers/dri/i965/gen6_vs_state.c b/src/mesa/drivers/dri/i965/gen6_vs_state.c
index 3ae00ec..36286d8 100644
--- a/src/mesa/drivers/dri/i965/gen6_vs_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_vs_state.c
@@ -31,6 +31,7 @@
 #include "brw_util.h"
 #include "program/prog_parameter.h"
 #include "program/prog_statevars.h"
+#include "main/shaderapi.h"
 #include "intel_batchbuffer.h"
 
 static void
@@ -44,6 +45,7 @@ gen6_upload_vs_push_constants(struct brw_context *brw)
    /* BRW_NEW_VS_PROG_DATA */
    const struct brw_stage_prog_data *prog_data = &brw->vs.prog_data->base.base;
 
+   _mesa_shader_write_subroutine_indicies(&brw->ctx, MESA_SHADER_VERTEX);
    gen6_upload_push_constants(brw, &vp->program.Base, prog_data,
                               stage_state, AUB_TRACE_VS_CONSTANTS);
 
diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c
index 3e872af..6fa4f0f 100644
--- a/src/mesa/drivers/dri/i965/gen6_wm_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c
@@ -33,6 +33,7 @@
 #include "program/program.h"
 #include "program/prog_parameter.h"
 #include "program/prog_statevars.h"
+#include "main/shaderapi.h"
 #include "main/framebuffer.h"
 #include "intel_batchbuffer.h"
 
@@ -46,6 +47,8 @@ gen6_upload_wm_push_constants(struct brw_context *brw)
    /* BRW_NEW_FS_PROG_DATA */
    const struct brw_wm_prog_data *prog_data = brw->wm.prog_data;
 
+   _mesa_shader_write_subroutine_indicies(&brw->ctx, MESA_SHADER_FRAGMENT);
+
    gen6_upload_push_constants(brw, &fp->program.Base, &prog_data->base,
                               stage_state, AUB_TRACE_WM_CONSTANTS);
 
diff --git a/src/mesa/drivers/dri/i965/gen7_cs_state.c b/src/mesa/drivers/dri/i965/gen7_cs_state.c
index 750aa2c..495ece7 100644
--- a/src/mesa/drivers/dri/i965/gen7_cs_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_cs_state.c
@@ -32,6 +32,7 @@
 #include "brw_state.h"
 #include "program/prog_statevars.h"
 #include "compiler/glsl/ir_uniform.h"
+#include "main/shaderapi.h"
 
 static void
 brw_upload_cs_state(struct brw_context *brw)
@@ -276,6 +277,7 @@ gen7_upload_cs_push_constants(struct brw_context *brw)
       /* CACHE_NEW_CS_PROG */
       struct brw_cs_prog_data *cs_prog_data = brw->cs.prog_data;
 
+      _mesa_shader_write_subroutine_indicies(&brw->ctx, MESA_SHADER_COMPUTE);
       brw_upload_cs_push_constants(brw, &cp->program.Base, cs_prog_data,
                                    stage_state, AUB_TRACE_WM_CONSTANTS);
    }
@@ -308,6 +310,7 @@ brw_upload_cs_pull_constants(struct brw_context *brw)
    /* BRW_NEW_CS_PROG_DATA */
    const struct brw_stage_prog_data *prog_data = &brw->cs.prog_data->base;
 
+   _mesa_shader_write_subroutine_indicies(&brw->ctx, MESA_SHADER_COMPUTE);
    /* _NEW_PROGRAM_CONSTANTS */
    brw_upload_pull_constants(brw, BRW_NEW_SURFACES, &cp->program.Base,
                              stage_state, prog_data);
diff --git a/src/mesa/drivers/dri/i965/gen7_ds_state.c b/src/mesa/drivers/dri/i965/gen7_ds_state.c
index 2fe0d88..fa63a19 100644
--- a/src/mesa/drivers/dri/i965/gen7_ds_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_ds_state.c
@@ -25,6 +25,7 @@
 #include "brw_state.h"
 #include "brw_defines.h"
 #include "intel_batchbuffer.h"
+#include "main/shaderapi.h"
 
 static void
 gen7_upload_tes_push_constants(struct brw_context *brw)
@@ -37,6 +38,7 @@ gen7_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.prog_data->base.base;
+      _mesa_shader_write_subroutine_indicies(&brw->ctx, MESA_SHADER_TESS_EVAL);
       gen6_upload_push_constants(brw, &tep->program.Base, prog_data,
                                       stage_state, AUB_TRACE_VS_CONSTANTS);
    }
diff --git a/src/mesa/drivers/dri/i965/gen7_hs_state.c b/src/mesa/drivers/dri/i965/gen7_hs_state.c
index 4f948dc..bf459d4 100644
--- a/src/mesa/drivers/dri/i965/gen7_hs_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_hs_state.c
@@ -25,6 +25,7 @@
 #include "brw_state.h"
 #include "brw_defines.h"
 #include "intel_batchbuffer.h"
+#include "main/shaderapi.h"
 
 static void
 gen7_upload_tcs_push_constants(struct brw_context *brw)
@@ -38,6 +39,8 @@ gen7_upload_tcs_push_constants(struct brw_context *brw)
    if (active) {
       /* BRW_NEW_TCS_PROG_DATA */
       const struct brw_stage_prog_data *prog_data = &brw->tcs.prog_data->base.base;
+
+      _mesa_shader_write_subroutine_indicies(&brw->ctx, MESA_SHADER_TESS_CTRL);
       gen6_upload_push_constants(brw, &tcp->program.Base, prog_data,
                                       stage_state, AUB_TRACE_VS_CONSTANTS);
    }
-- 
2.5.5



More information about the mesa-dev mailing list