From e646e77e185a3f2b451f0f97221c9d9919311375 Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Tue, 14 Jul 2020 10:11:11 -0400 Subject: [PATCH] turnip: use patchControlPoints for HS_INPUT_SIZE value It should be calculated from patchControlPoints, not tcs_vertices_out. Signed-off-by: Jonathan Marek Part-of: --- src/freedreno/registers/a6xx.xml | 4 ++-- src/freedreno/vulkan/tu_clear_blit.c | 2 +- src/freedreno/vulkan/tu_cmd_buffer.c | 1 - src/freedreno/vulkan/tu_pipeline.c | 14 +++++++------- src/freedreno/vulkan/tu_private.h | 3 ++- src/gallium/drivers/freedreno/a6xx/fd6_program.c | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/freedreno/registers/a6xx.xml b/src/freedreno/registers/a6xx.xml index 8f02c6f1296..1e7eefb1bef 100644 --- a/src/freedreno/registers/a6xx.xml +++ b/src/freedreno/registers/a6xx.xml @@ -2765,8 +2765,8 @@ to upconvert to 32b float internally? - - + + diff --git a/src/freedreno/vulkan/tu_clear_blit.c b/src/freedreno/vulkan/tu_clear_blit.c index 486dc7db284..dc92cf43a21 100644 --- a/src/freedreno/vulkan/tu_clear_blit.c +++ b/src/freedreno/vulkan/tu_clear_blit.c @@ -451,7 +451,7 @@ r3d_common(struct tu_cmd_buffer *cmd, struct tu_cs *cs, bool blit, uint32_t num_ tu_cs_emit_regs(cs, A6XX_PC_PRIMITIVE_CNTL_0()); tu_cs_emit_regs(cs, A6XX_VFD_CONTROL_0()); - tu6_emit_vpc(cs, &vs, NULL, NULL, NULL, &fs); + tu6_emit_vpc(cs, &vs, NULL, NULL, NULL, &fs, 0); /* REPL_MODE for varying with RECTLIST (2 vertices only) */ tu_cs_emit_regs(cs, A6XX_VPC_VARYING_INTERP_MODE(0, 0)); diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c index 1c43b421b6a..7142ea53fb3 100644 --- a/src/freedreno/vulkan/tu_cmd_buffer.c +++ b/src/freedreno/vulkan/tu_cmd_buffer.c @@ -816,7 +816,6 @@ tu6_init_hw(struct tu_cmd_buffer *cmd, struct tu_cs *cs) tu_cs_emit_regs(cs, A6XX_VPC_SO_DISABLE(true)); - tu_cs_emit_write_reg(cs, REG_A6XX_PC_UNKNOWN_9801, 0); tu_cs_emit_write_reg(cs, REG_A6XX_PC_UNKNOWN_9980, 0); tu_cs_emit_write_reg(cs, REG_A6XX_PC_PRIMITIVE_CNTL_6, 0); diff --git a/src/freedreno/vulkan/tu_pipeline.c b/src/freedreno/vulkan/tu_pipeline.c index 679e76fffa4..20e9a4050d9 100644 --- a/src/freedreno/vulkan/tu_pipeline.c +++ b/src/freedreno/vulkan/tu_pipeline.c @@ -740,7 +740,8 @@ tu6_emit_vpc(struct tu_cs *cs, const struct ir3_shader_variant *hs, const struct ir3_shader_variant *ds, const struct ir3_shader_variant *gs, - const struct ir3_shader_variant *fs) + const struct ir3_shader_variant *fs, + uint32_t patch_control_points) { /* note: doesn't compile as static because of the array regs.. */ const struct reg_config { @@ -916,9 +917,8 @@ tu6_emit_vpc(struct tu_cs *cs, tu_cs_emit(cs, hs_info->tess.tcs_vertices_out); /* Total attribute slots in HS incoming patch. */ - tu_cs_emit_pkt4(cs, REG_A6XX_PC_UNKNOWN_9801, 1); - tu_cs_emit(cs, - hs_info->tess.tcs_vertices_out * vs->output_size / 4); + tu_cs_emit_pkt4(cs, REG_A6XX_PC_HS_INPUT_SIZE, 1); + tu_cs_emit(cs, patch_control_points * vs->output_size / 4); tu_cs_emit_pkt4(cs, REG_A6XX_SP_HS_UNKNOWN_A831, 1); tu_cs_emit(cs, vs->output_size); @@ -1371,6 +1371,8 @@ tu6_emit_program(struct tu_cs *cs, const struct ir3_shader_variant *gs = builder->variants[MESA_SHADER_GEOMETRY]; const struct ir3_shader_variant *fs = builder->variants[MESA_SHADER_FRAGMENT]; gl_shader_stage stage = MESA_SHADER_VERTEX; + uint32_t cps_per_patch = builder->create_info->pTessellationState ? + builder->create_info->pTessellationState->patchControlPoints : 0; STATIC_ASSERT(MESA_SHADER_VERTEX == 0); @@ -1403,7 +1405,7 @@ tu6_emit_program(struct tu_cs *cs, tu_cs_emit_pkt4(cs, REG_A6XX_SP_HS_UNKNOWN_A831, 1); tu_cs_emit(cs, 0); - tu6_emit_vpc(cs, vs, hs, ds, gs, fs); + tu6_emit_vpc(cs, vs, hs, ds, gs, fs, cps_per_patch); tu6_emit_vpc_varying_modes(cs, fs); if (fs) { @@ -1423,8 +1425,6 @@ tu6_emit_program(struct tu_cs *cs, } if (gs || hs) { - uint32_t cps_per_patch = builder->create_info->pTessellationState ? - builder->create_info->pTessellationState->patchControlPoints : 0; tu6_emit_geom_tess_consts(cs, vs, hs, ds, gs, cps_per_patch); } } diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h index ff55e379a02..a387afb5a47 100644 --- a/src/freedreno/vulkan/tu_private.h +++ b/src/freedreno/vulkan/tu_private.h @@ -1188,7 +1188,8 @@ tu6_emit_vpc(struct tu_cs *cs, const struct ir3_shader_variant *hs, const struct ir3_shader_variant *ds, const struct ir3_shader_variant *gs, - const struct ir3_shader_variant *fs); + const struct ir3_shader_variant *fs, + uint32_t patch_control_points); void tu6_emit_fs_inputs(struct tu_cs *cs, const struct ir3_shader_variant *fs); diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.c b/src/gallium/drivers/freedreno/a6xx/fd6_program.c index fb547560c44..973086ddd00 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_program.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.c @@ -565,7 +565,7 @@ setup_stateobj(struct fd_ringbuffer *ring, struct fd_screen *screen, OUT_RING(ring, hs_info->tess.tcs_vertices_out); /* Total attribute slots in HS incoming patch. */ - OUT_PKT4(ring, REG_A6XX_PC_UNKNOWN_9801, 1); + OUT_PKT4(ring, REG_A6XX_PC_HS_INPUT_SIZE, 1); OUT_RING(ring, hs_info->tess.tcs_vertices_out * vs->output_size / 4); OUT_PKT4(ring, REG_A6XX_SP_HS_UNKNOWN_A831, 1); -- 2.30.2