tgsi: change tgsi_shader_info::properties to a one-dimensional array
authorMarek Olšák <marek.olsak@amd.com>
Thu, 2 Oct 2014 14:36:51 +0000 (16:36 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Sat, 4 Oct 2014 13:36:39 +0000 (15:36 +0200)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
v2: fix svga too

13 files changed:
src/gallium/auxiliary/draw/draw_gs.c
src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
src/gallium/auxiliary/tgsi/tgsi_scan.c
src/gallium/auxiliary/tgsi/tgsi_scan.h
src/gallium/auxiliary/util/u_pstipple.c
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c
src/gallium/drivers/r300/r300_fs.c
src/gallium/drivers/radeonsi/si_shader.c
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/softpipe/sp_quad_blend.c
src/gallium/drivers/softpipe/sp_setup.c
src/gallium/drivers/svga/svga_state_fs.c

index 0c2f8922dc56f6ce1a6299c66cf2f7a2c748a594..40f7ed352d97f4a98beb349218abb2bc97591fd0 100644 (file)
@@ -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;
 
index 2d7f32d308dc63933ac438fe2df13a42d39b2a8a..05618bc1e6e483796189237f53c680f50fafba33 100644 (file)
@@ -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;
 
index d68dca817137b2ec19cdb80cb620abec78f3ecd5..42bc61eeb4c4ea0f58608e5ec4416fc132fd6e09 100644 (file)
@@ -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;
index 934aceca4c6dd0441bc13d006f666f67e591df1a..b02b018b6335ff5d2e8a8060ac8b7a895991a54a 100644 (file)
@@ -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
index ce1fe5dc683075af09fdeaabc11d956dbff9938f..509f815c53a8903af6eb680736376fbd7bf2d374 100644 (file)
@@ -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,
index c344fc07b0c4f3f3882a2a807d6c432b7311c62b..a7a55f8301cae431c2913d0a3652467a29cad2bb 100644 (file)
@@ -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
index 774b14b0a47e408d9ff94acc94067481fcb7ebbd..81543bae986d207e0b962df6f34ee9a632248df1 100644 (file)
@@ -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))
index ddf944a28ebf74a956707b08984eccd4b8ec9fb9..c00f55f5d903d89a4f9d1b34f76a406a33bd239a 100644 (file)
@@ -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");
index 8680824076ba4e0468406b05c1168fec5c64326c..6ac39e8849600ce7b63a4c1a98986902481eb3fb 100644 (file)
@@ -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);
index 88a50f37651666db4871a3378c49941564708f46..57bfa591c56488935f10e72cc5fbae370c4f62a2 100644 (file)
@@ -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];
index d60e5087ac0a4415cd849847e6d952ff63de6cb5..a32bd7fd24142c847e87f8df12c46d75f2e8eb6c 100644 (file)
@@ -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]) {
index 989ed9c601b4fa97485f0c4e8f7639c20a9ec2b9..6704015112b8eda5607f6530c668343d9b675c60 100644 (file)
@@ -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;
index 1e83d2e2da925a11dcd039b463e7b7e5a5ce9d8d..566a79407e5d3682d2e8701a6439eee061bfb285 100644 (file)
@@ -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;
    }