gpu: implement PA_CL_UCP user clip planes through draw push constants

This commit is contained in:
Mr. Big Britches
2026-10-20 07:00:55 +02:00
committed by nmzik
parent 18e6747dbf
commit feed075a9f
11 changed files with 109 additions and 45 deletions
+13 -6
View File
@@ -1193,13 +1193,14 @@ void RenderExecutor::ExecutePreparedDraw(uint64_t submit_id, CommandBuffer& buff
if (!mesh_active) {
CommitIndexBuffer(vk_buffer, index_binding);
}
const auto draw_dwords = ShaderRecompiler::IR::PushData::GraphicsDrawDwords(
mesh_active, state.ps_input_info.object_primitive_id);
using ShaderRecompiler::IR::PushData;
const auto draw_stages =
vk::ShaderStageFlagBits::eFragment |
(mesh_active ? vk::ShaderStageFlagBits::eMeshEXT : vk::ShaderStageFlagBits::eVertex);
const auto draw_dwords =
PushData::GraphicsDrawDwords(mesh_active, state.ps_input_info.object_primitive_id);
if (draw_dwords != 0) {
std::array<uint32_t, ShaderRecompiler::IR::PushData::MeshDrawDwordCount> draw_data {};
const auto draw_stages = vk::ShaderStageFlagBits::eFragment |
(mesh_active ? vk::ShaderStageFlagBits::eMeshEXT
: vk::ShaderStageFlagBits::eVertex);
std::array<uint32_t, PushData::MeshDrawDwordCount> draw_data {};
if (mesh_active) {
draw_data = {
draw.index_count,
@@ -1213,6 +1214,12 @@ void RenderExecutor::ExecutePreparedDraw(uint64_t submit_id, CommandBuffer& buff
vk_buffer.pushConstants(pipeline.pipeline_layout, draw_stages, 0,
draw_dwords * sizeof(uint32_t), draw_data.data());
}
if (const auto planes = vertex_stages.back().user_clip_planes; planes != 0) {
vk_buffer.pushConstants(pipeline.pipeline_layout, draw_stages,
PushData::UserClipPlaneDword * sizeof(uint32_t),
std::bit_width(planes) * 4u * sizeof(uint32_t),
buffer.GetRegisters().GetUserClipPlanes().data());
}
auto& dynamic_state = m_context.GetCommandScheduler().GetDynamicState();
UpdateGraphicsDynamicState(buffer, dynamic_state, vertex_stages.back(), state.depth_info,