Mesa (android-radeonsi-build-fix): turnip: Reuse tu6_stage2opcode() more.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 5 08:08:28 UTC 2019


Module: Mesa
Branch: android-radeonsi-build-fix
Commit: 1f4e8f3c46c8ca348e127eff2078bf0ae77a2a49
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f4e8f3c46c8ca348e127eff2078bf0ae77a2a49

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Dec  2 16:44:52 2019 -0800

turnip: Reuse tu6_stage2opcode() more.

A bit of cleanup for adding more stages later.

Reviewed-by: Jonathan Marek <jonathan at marek.ca>

---

 src/freedreno/vulkan/tu_cmd_buffer.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c
index b5da64627ef..516bbc19e5b 100644
--- a/src/freedreno/vulkan/tu_cmd_buffer.c
+++ b/src/freedreno/vulkan/tu_cmd_buffer.c
@@ -2413,27 +2413,24 @@ tu6_emit_textures(struct tu_device *device, struct tu_cs *draw_state,
    if (!size)
       return (struct tu_cs_entry) {};
 
-   unsigned opcode, tex_samp_reg, tex_const_reg, tex_count_reg;
+   unsigned tex_samp_reg, tex_const_reg, tex_count_reg;
    enum a6xx_state_block sb;
 
    switch (type) {
    case MESA_SHADER_VERTEX:
       sb = SB6_VS_TEX;
-      opcode = CP_LOAD_STATE6_GEOM;
       tex_samp_reg = REG_A6XX_SP_VS_TEX_SAMP_LO;
       tex_const_reg = REG_A6XX_SP_VS_TEX_CONST_LO;
       tex_count_reg = REG_A6XX_SP_VS_TEX_COUNT;
       break;
    case MESA_SHADER_FRAGMENT:
       sb = SB6_FS_TEX;
-      opcode = CP_LOAD_STATE6_FRAG;
       tex_samp_reg = REG_A6XX_SP_FS_TEX_SAMP_LO;
       tex_const_reg = REG_A6XX_SP_FS_TEX_CONST_LO;
       tex_count_reg = REG_A6XX_SP_FS_TEX_COUNT;
       break;
    case MESA_SHADER_COMPUTE:
       sb = SB6_CS_TEX;
-      opcode = CP_LOAD_STATE6_FRAG;
       tex_samp_reg = REG_A6XX_SP_CS_TEX_SAMP_LO;
       tex_const_reg = REG_A6XX_SP_CS_TEX_CONST_LO;
       tex_count_reg = REG_A6XX_SP_CS_TEX_COUNT;
@@ -2469,7 +2466,7 @@ tu6_emit_textures(struct tu_device *device, struct tu_cs *draw_state,
    tu_cs_begin_sub_stream(device, draw_state, 64, &cs);
 
    /* output sampler state: */
-   tu_cs_emit_pkt7(&cs, opcode, 3);
+   tu_cs_emit_pkt7(&cs, tu6_stage2opcode(type), 3);
    tu_cs_emit(&cs, CP_LOAD_STATE6_0_DST_OFF(0) |
       CP_LOAD_STATE6_0_STATE_TYPE(ST6_SHADER) |
       CP_LOAD_STATE6_0_STATE_SRC(SS6_INDIRECT) |
@@ -2481,7 +2478,7 @@ tu6_emit_textures(struct tu_device *device, struct tu_cs *draw_state,
    tu_cs_emit_qw(&cs, samp_addr); /* SRC_ADDR_LO/HI */
 
    /* emit texture state: */
-   tu_cs_emit_pkt7(&cs, opcode, 3);
+   tu_cs_emit_pkt7(&cs, tu6_stage2opcode(type), 3);
    tu_cs_emit(&cs, CP_LOAD_STATE6_0_DST_OFF(0) |
       CP_LOAD_STATE6_0_STATE_TYPE(ST6_CONSTANTS) |
       CP_LOAD_STATE6_0_STATE_SRC(SS6_INDIRECT) |




More information about the mesa-commit mailing list