if (cmd->state.dirty & TU_CMD_DIRTY_PATCH_CONTROL_POINTS) {
bool tess = cmd->state.pipeline->active_stages &
VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
- struct tu_cs cs = tu_cmd_dynamic_state(cmd, TU_DYNAMIC_STATE_PATCH_CONTROL_POINTS,
- tess ? TU6_EMIT_PATCH_CONTROL_POINTS_DWORDS : 0);
+ uint32_t state_size = TU6_EMIT_PATCH_CONTROL_POINTS_DWORDS(
+ pipeline->program.hs_param_dwords);
+ struct tu_cs cs = tu_cmd_dynamic_state(
+ cmd, TU_DYNAMIC_STATE_PATCH_CONTROL_POINTS, tess ? state_size : 0);
tu6_emit_patch_control_points(&cs, cmd->state.pipeline,
cmd->state.patch_control_points);
}
const struct ir3_const_state *hs_const =
&pipeline->program.link[MESA_SHADER_TESS_CTRL].const_state;
- unsigned hs_constlen =
- pipeline->program.link[MESA_SHADER_TESS_CTRL].constlen;
uint32_t hs_base = hs_const->offsets.primitive_param;
- uint32_t hs_param_dwords = MIN2((hs_constlen - hs_base) * 4, ARRAY_SIZE(hs_params));
tu6_emit_const(cs, CP_LOAD_STATE6_GEOM, hs_base, SB6_HS_SHADER, 0,
- hs_param_dwords, hs_params);
+ pipeline->program.hs_param_dwords, hs_params);
uint32_t patch_local_mem_size_16b =
patch_control_points * pipeline->program.vs_param_stride / 4;
pipeline->program.hs_param_stride = hs->output_size;
pipeline->program.hs_vertices_out = hs->tess.tcs_vertices_out;
+ const struct ir3_const_state *hs_const =
+ &pipeline->program.link[MESA_SHADER_TESS_CTRL].const_state;
+ unsigned hs_constlen =
+ pipeline->program.link[MESA_SHADER_TESS_CTRL].constlen;
+ uint32_t hs_base = hs_const->offsets.primitive_param;
+ pipeline->program.hs_param_dwords =
+ MIN2((hs_constlen - hs_base) * 4, 8);
+
+ uint32_t state_size = TU6_EMIT_PATCH_CONTROL_POINTS_DWORDS(
+ pipeline->program.hs_param_dwords);
+
struct tu_cs cs;
if (tu_pipeline_static_state(pipeline, &cs,
TU_DYNAMIC_STATE_PATCH_CONTROL_POINTS,
- TU6_EMIT_PATCH_CONTROL_POINTS_DWORDS)) {
+ state_size)) {
tu6_emit_patch_control_points(&cs, pipeline,
pipeline->tess.patch_control_points);
}
uint32_t vs_param_stride;
uint32_t hs_param_stride;
+ uint32_t hs_param_dwords;
uint32_t hs_vertices_out;
uint32_t cs_instrlen;
} program;
const VkVertexInputAttributeDescription2EXT *attrs);
#define EMIT_CONST_DWORDS(const_dwords) (4 + const_dwords)
-#define TU6_EMIT_PATCH_CONTROL_POINTS_DWORDS \
- (EMIT_CONST_DWORDS(4) + EMIT_CONST_DWORDS(8) + 2 + 2 + 2)
+#define TU6_EMIT_PATCH_CONTROL_POINTS_DWORDS(hs_param_dwords) \
+ (EMIT_CONST_DWORDS(4) + EMIT_CONST_DWORDS(hs_param_dwords) + 2 + 2 + 2)
void tu6_emit_patch_control_points(struct tu_cs *cs,
const struct tu_pipeline *pipeline,
unsigned patch_control_points);