From: Eric Anholt Date: Tue, 3 Dec 2019 00:44:52 +0000 (-0800) Subject: turnip: Reuse tu6_stage2opcode() more. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1f4e8f3c46c8ca348e127eff2078bf0ae77a2a49;p=mesa.git turnip: Reuse tu6_stage2opcode() more. A bit of cleanup for adding more stages later. Reviewed-by: Jonathan Marek --- 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) |