diff options
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_fs.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c | 24 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_fs.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 53 |
4 files changed, 27 insertions, 68 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index ff2939d4db4..431f31efaf7 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -2212,14 +2212,8 @@ generate_fragment(struct llvmpipe_context *lp, } /* check if writes to cbuf[0] are to be copied to all cbufs */ - cbuf0_write_all = FALSE; - for (i = 0;i < shader->info.base.num_properties; i++) { - if (shader->info.base.properties[i].name == - TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS) { - cbuf0_write_all = TRUE; - break; - } - } + cbuf0_write_all = + shader->info.base.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS][0]; /* TODO: actually pick these based on the fs and color buffer * characteristics. */ diff --git a/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c b/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c index 1f1fba202df..774b14b0a47 100644 --- a/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c +++ b/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c @@ -1138,24 +1138,12 @@ _nvfx_fragprog_translate(uint16_t oclass, struct nv30_fragprog *fp) fpc->num_regs = 2; memset(fp->texcoord, 0xff, sizeof(fp->texcoord)); - for (unsigned i = 0; i < fp->info.num_properties; ++i) { - switch (fp->info.properties[i].name) { - case TGSI_PROPERTY_FS_COORD_ORIGIN: - if (fp->info.properties[i].data[0]) - fp->coord_conventions |= NV30_3D_COORD_CONVENTIONS_ORIGIN_INVERTED; - break; - case TGSI_PROPERTY_FS_COORD_PIXEL_CENTER: - if (fp->info.properties[i].data[0]) - fp->coord_conventions |= NV30_3D_COORD_CONVENTIONS_CENTER_INTEGER; - break; - case TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS: - if (fp->info.properties[i].data[0]) - fp->rt_enable |= NV30_3D_RT_ENABLE_MRT; - break; - default: - break; - } - } + if (fp->info.properties[TGSI_PROPERTY_FS_COORD_ORIGIN][0]) + fp->coord_conventions |= NV30_3D_COORD_CONVENTIONS_ORIGIN_INVERTED; + if (fp->info.properties[TGSI_PROPERTY_FS_COORD_PIXEL_CENTER][0]) + fp->coord_conventions |= NV30_3D_COORD_CONVENTIONS_CENTER_INTEGER; + if (fp->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS][0]) + fp->rt_enable |= NV30_3D_RT_ENABLE_MRT; if (!nvfx_fragprog_prepare(fpc)) goto out_err; diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 6e1b4e44ad3..ddf944a28eb 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -468,12 +468,8 @@ static void r300_translate_fragment_shader( find_output_registers(&compiler, shader); - shader->write_all = FALSE; - for (i = 0; i < shader->info.num_properties; i++) { - if (shader->info.properties[i].name == TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS) { - shader->write_all = TRUE; - } - } + shader->write_all = + shader->info.properties[TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS][0]; 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 276ba814d1d..5c3efd4c5f5 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -2866,52 +2866,33 @@ int si_shader_create(struct si_screen *sscreen, struct si_shader *shader) bld_base->emit_epilogue = si_llvm_emit_vs_epilogue; } break; - case TGSI_PROCESSOR_GEOMETRY: { - int i; - + case TGSI_PROCESSOR_GEOMETRY: si_shader_ctx.radeon_bld.load_input = declare_input_gs; bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_gs; bld_base->emit_epilogue = si_llvm_emit_gs_epilogue; - for (i = 0; i < sel->info.num_properties; i++) { - switch (sel->info.properties[i].name) { - case TGSI_PROPERTY_GS_INPUT_PRIM: - shader->gs_input_prim = sel->info.properties[i].data[0]; - break; - case TGSI_PROPERTY_GS_OUTPUT_PRIM: - shader->gs_output_prim = sel->info.properties[i].data[0]; - break; - case TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES: - shader->gs_max_out_vertices = sel->info.properties[i].data[0]; - break; - } - } + shader->gs_input_prim = + sel->info.properties[TGSI_PROPERTY_GS_INPUT_PRIM][0]; + shader->gs_output_prim = + sel->info.properties[TGSI_PROPERTY_GS_OUTPUT_PRIM][0]; + shader->gs_max_out_vertices = + sel->info.properties[TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES][0]; break; - } - case TGSI_PROCESSOR_FRAGMENT: { - int i; - + case TGSI_PROCESSOR_FRAGMENT: si_shader_ctx.radeon_bld.load_input = declare_input_fs; bld_base->emit_epilogue = si_llvm_emit_fs_epilogue; - for (i = 0; i < sel->info.num_properties; i++) { - switch (sel->info.properties[i].name) { - case TGSI_PROPERTY_FS_DEPTH_LAYOUT: - switch (sel->info.properties[i].data[0]) { - case TGSI_FS_DEPTH_LAYOUT_GREATER: - shader->db_shader_control |= - S_02880C_CONSERVATIVE_Z_EXPORT(V_02880C_EXPORT_GREATER_THAN_Z); - break; - case TGSI_FS_DEPTH_LAYOUT_LESS: - shader->db_shader_control |= - S_02880C_CONSERVATIVE_Z_EXPORT(V_02880C_EXPORT_LESS_THAN_Z); - break; - } - break; - } + switch (sel->info.properties[TGSI_PROPERTY_FS_DEPTH_LAYOUT][0]) { + case TGSI_FS_DEPTH_LAYOUT_GREATER: + shader->db_shader_control |= + S_02880C_CONSERVATIVE_Z_EXPORT(V_02880C_EXPORT_GREATER_THAN_Z); + break; + case TGSI_FS_DEPTH_LAYOUT_LESS: + shader->db_shader_control |= + S_02880C_CONSERVATIVE_Z_EXPORT(V_02880C_EXPORT_LESS_THAN_Z); + break; } break; - } default: assert(!"Unsupported shader type"); return -1; |