Mesa (master): tgsi: change tgsi_shader_info:: properties to a one-dimensional array

Marek Olšák mareko at kemper.freedesktop.org
Sat Oct 4 13:37:12 UTC 2014


Module: Mesa
Branch: master
Commit: 0c4bc1e29223ffec4617999c0c03d722bdcc170a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c4bc1e29223ffec4617999c0c03d722bdcc170a

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Thu Oct  2 16:36:51 2014 +0200

tgsi: change tgsi_shader_info::properties to a one-dimensional array

Reviewed-by: Roland Scheidegger <sroland at vmware.com>

v2: fix svga too

---

 src/gallium/auxiliary/draw/draw_gs.c             |    6 +++---
 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c  |    2 +-
 src/gallium/auxiliary/tgsi/tgsi_scan.c           |    5 ++---
 src/gallium/auxiliary/tgsi/tgsi_scan.h           |    2 +-
 src/gallium/auxiliary/util/u_pstipple.c          |    2 +-
 src/gallium/drivers/llvmpipe/lp_state_fs.c       |    4 ++--
 src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c |    6 +++---
 src/gallium/drivers/r300/r300_fs.c               |    2 +-
 src/gallium/drivers/radeonsi/si_shader.c         |    4 ++--
 src/gallium/drivers/radeonsi/si_state.c          |    6 +++---
 src/gallium/drivers/softpipe/sp_quad_blend.c     |    2 +-
 src/gallium/drivers/softpipe/sp_setup.c          |    4 ++--
 src/gallium/drivers/svga/svga_state_fs.c         |    2 +-
 13 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 0c2f892..40f7ed3 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -766,11 +766,11 @@ draw_create_geometry_shader(struct draw_context *draw,
    }
 
    gs->input_primitive =
-         gs->info.properties[TGSI_PROPERTY_GS_INPUT_PRIM][0];
+         gs->info.properties[TGSI_PROPERTY_GS_INPUT_PRIM];
    gs->output_primitive =
-         gs->info.properties[TGSI_PROPERTY_GS_OUTPUT_PRIM][0];
+         gs->info.properties[TGSI_PROPERTY_GS_OUTPUT_PRIM];
    gs->max_output_vertices =
-         gs->info.properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES][0];
+         gs->info.properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES];
    if (!gs->max_output_vertices)
       gs->max_output_vertices = 32;
 
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 2d7f32d..05618bc 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -3865,7 +3865,7 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
       bld.bld_base.op_actions[TGSI_OPCODE_ENDPRIM].emit = end_primitive;
 
       max_output_vertices =
-            info->properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES][0];
+            info->properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES];
       if (!max_output_vertices)
          max_output_vertices = 32;
 
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c
index d68dca8..42bc61e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c
@@ -280,8 +280,7 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
             unsigned name = fullprop->Property.PropertyName;
 
             assert(name < Elements(info->properties));
-            memcpy(info->properties[name],
-                   fullprop->u, 8 * sizeof(unsigned));
+            info->properties[name] = fullprop->u[0].Data;
          }
          break;
 
@@ -298,7 +297,7 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
     */
    if (procType == TGSI_PROCESSOR_GEOMETRY) {
       unsigned input_primitive =
-            info->properties[TGSI_PROPERTY_GS_INPUT_PRIM][0];
+            info->properties[TGSI_PROPERTY_GS_INPUT_PRIM];
       int num_verts = u_vertices_per_prim(input_primitive);
       int j;
       info->file_count[TGSI_FILE_INPUT] = num_verts;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h
index 934acec..b02b018 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_scan.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h
@@ -88,7 +88,7 @@ struct tgsi_shader_info
     */
    unsigned indirect_files;
 
-   unsigned properties[TGSI_PROPERTY_COUNT][8]; /* index with TGSI_PROPERTY_ */
+   unsigned properties[TGSI_PROPERTY_COUNT]; /* index with TGSI_PROPERTY_ */
 };
 
 extern void
diff --git a/src/gallium/auxiliary/util/u_pstipple.c b/src/gallium/auxiliary/util/u_pstipple.c
index ce1fe5d..509f815 100644
--- a/src/gallium/auxiliary/util/u_pstipple.c
+++ b/src/gallium/auxiliary/util/u_pstipple.c
@@ -433,7 +433,7 @@ util_pstipple_create_fragment_shader(struct pipe_context *pipe,
    tgsi_scan_shader(fs->tokens, &transform.info);
 
    transform.coordOrigin =
-      transform.info.properties[TGSI_PROPERTY_FS_COORD_ORIGIN][0];
+      transform.info.properties[TGSI_PROPERTY_FS_COORD_ORIGIN];
 
    tgsi_transform_shader(fs->tokens,
                          (struct tgsi_token *) new_fs->tokens,
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index c344fc0..a7a55f8 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -2213,7 +2213,7 @@ generate_fragment(struct llvmpipe_context *lp,
 
    /* check if writes to cbuf[0] are to be copied to all cbufs */
    cbuf0_write_all =
-     shader->info.base.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS][0];
+     shader->info.base.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS];
 
    /* TODO: actually pick these based on the fs and color buffer
     * characteristics. */
@@ -2324,7 +2324,7 @@ generate_fragment(struct llvmpipe_context *lp,
                                                       num_loop, "mask_store");
       LLVMValueRef color_store[PIPE_MAX_COLOR_BUFS][TGSI_NUM_CHANNELS];
       boolean pixel_center_integer =
-         shader->info.base.properties[TGSI_PROPERTY_FS_COORD_PIXEL_CENTER][0];
+         shader->info.base.properties[TGSI_PROPERTY_FS_COORD_PIXEL_CENTER];
 
       /*
        * The shader input interpolation info is not explicitely baked in the
diff --git a/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c b/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c
index 774b14b..81543ba 100644
--- a/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c
+++ b/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c
@@ -1138,11 +1138,11 @@ _nvfx_fragprog_translate(uint16_t oclass, struct nv30_fragprog *fp)
    fpc->num_regs = 2;
    memset(fp->texcoord, 0xff, sizeof(fp->texcoord));
 
-   if (fp->info.properties[TGSI_PROPERTY_FS_COORD_ORIGIN][0])
+   if (fp->info.properties[TGSI_PROPERTY_FS_COORD_ORIGIN])
       fp->coord_conventions |= NV30_3D_COORD_CONVENTIONS_ORIGIN_INVERTED;
-   if (fp->info.properties[TGSI_PROPERTY_FS_COORD_PIXEL_CENTER][0])
+   if (fp->info.properties[TGSI_PROPERTY_FS_COORD_PIXEL_CENTER])
       fp->coord_conventions |= NV30_3D_COORD_CONVENTIONS_CENTER_INTEGER;
-   if (fp->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS][0])
+   if (fp->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS])
       fp->rt_enable |= NV30_3D_RT_ENABLE_MRT;
 
    if (!nvfx_fragprog_prepare(fpc))
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c
index ddf944a..c00f55f 100644
--- a/src/gallium/drivers/r300/r300_fs.c
+++ b/src/gallium/drivers/r300/r300_fs.c
@@ -469,7 +469,7 @@ static void r300_translate_fragment_shader(
     find_output_registers(&compiler, shader);
 
     shader->write_all =
-          shader->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS][0];
+          shader->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS];
 
     if (compiler.Base.Debug & RC_DBG_LOG) {
         DBG(r300, DBG_FP, "r300: Initial fragment program\n");
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 8680824..6ac39e8 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1487,7 +1487,7 @@ static void si_llvm_emit_fs_epilogue(struct lp_build_tgsi_context * bld_base)
 				memcpy(last_args, args, sizeof(args));
 
 				/* Handle FS_COLOR0_WRITES_ALL_CBUFS. */
-				if (shader->selector->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS][0] &&
+				if (shader->selector->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS] &&
                                     shader->output[i].sid == 0 &&
 				    si_shader_ctx->shader->key.ps.nr_cbufs > 1) {
 					for (int c = 1; c < si_shader_ctx->shader->key.ps.nr_cbufs; c++) {
@@ -2867,7 +2867,7 @@ int si_shader_create(struct si_screen *sscreen, struct si_shader *shader)
 		si_shader_ctx.radeon_bld.load_input = declare_input_fs;
 		bld_base->emit_epilogue = si_llvm_emit_fs_epilogue;
 
-		switch (sel->info.properties[TGSI_PROPERTY_FS_DEPTH_LAYOUT][0]) {
+		switch (sel->info.properties[TGSI_PROPERTY_FS_DEPTH_LAYOUT]) {
 		case TGSI_FS_DEPTH_LAYOUT_GREATER:
 			shader->db_shader_control |=
 				S_02880C_CONSERVATIVE_Z_EXPORT(V_02880C_EXPORT_GREATER_THAN_Z);
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 88a50f3..57bfa59 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -2214,7 +2214,7 @@ static INLINE void si_shader_selector_key(struct pipe_context *ctx,
 			key->vs.gs_used_inputs = sctx->gs_shader->gs_used_inputs;
 		}
 	} else if (sel->type == PIPE_SHADER_FRAGMENT) {
-		if (sel->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS][0])
+		if (sel->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS])
 			key->ps.nr_cbufs = sctx->framebuffer.state.nr_cbufs;
 		key->ps.export_16bpc = sctx->framebuffer.export_16bpc;
 
@@ -2312,9 +2312,9 @@ static void *si_create_shader_state(struct pipe_context *ctx,
 	switch (pipe_shader_type) {
 	case PIPE_SHADER_GEOMETRY:
 		sel->gs_output_prim =
-			sel->info.properties[TGSI_PROPERTY_GS_OUTPUT_PRIM][0];
+			sel->info.properties[TGSI_PROPERTY_GS_OUTPUT_PRIM];
 		sel->gs_max_out_vertices =
-			sel->info.properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES][0];
+			sel->info.properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES];
 
 		for (i = 0; i < sel->info.num_inputs; i++) {
 			unsigned name = sel->info.input_semantic_name[i];
diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c
index d60e508..a32bd7f 100644
--- a/src/gallium/drivers/softpipe/sp_quad_blend.c
+++ b/src/gallium/drivers/softpipe/sp_quad_blend.c
@@ -924,7 +924,7 @@ blend_fallback(struct quad_stage *qs,
    const struct pipe_blend_state *blend = softpipe->blend;
    unsigned cbuf;
    boolean write_all =
-      softpipe->fs_variant->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS][0];
+      softpipe->fs_variant->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS];
 
    for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) {
       if (softpipe->framebuffer.cbufs[cbuf]) {
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
index 989ed9c..6704015 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -563,9 +563,9 @@ setup_fragcoord_coeff(struct setup_context *setup, uint slot)
 {
    const struct tgsi_shader_info *fsInfo = &setup->softpipe->fs_variant->info;
    boolean origin_lower_left =
-         fsInfo->properties[TGSI_PROPERTY_FS_COORD_ORIGIN][0];
+         fsInfo->properties[TGSI_PROPERTY_FS_COORD_ORIGIN];
    boolean pixel_center_integer =
-         fsInfo->properties[TGSI_PROPERTY_FS_COORD_PIXEL_CENTER][0];
+         fsInfo->properties[TGSI_PROPERTY_FS_COORD_PIXEL_CENTER];
 
    /*X*/
    setup->coef[slot].a0[0] = pixel_center_integer ? 0.0f : 0.5f;
diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c
index 1e83d2e..566a794 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -338,7 +338,7 @@ make_fs_key(const struct svga_context *svga,
                                     == PIPE_SPRITE_COORD_LOWER_LEFT);
 
    /* SVGA_NEW_FRAME_BUFFER */
-   if (fs->base.info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS][0]) {
+   if (fs->base.info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS]) {
       /* Replicate color0 output to N colorbuffers */
       key->write_color0_to_n_cbufs = svga->curr.framebuffer.nr_cbufs;
    }




More information about the mesa-commit mailing list