[dxbc] Set output topology for GS and TES correctly

This commit is contained in:
Philip Rebohle 2023-07-19 21:12:30 +02:00
parent 5ece97f769
commit a67c99943a
2 changed files with 15 additions and 10 deletions

View File

@ -257,6 +257,7 @@ namespace dxvk {
info.outputMask = m_outputMask;
info.uniformSize = m_immConstData.size();
info.uniformData = m_immConstData.data();
info.outputTopology = m_outputTopology;
if (m_programInfo.type() == DxbcProgramType::HullShader)
info.patchVertexCount = m_hs.vertexCountIn;
@ -1294,16 +1295,17 @@ namespace dxvk {
// The input primitive topology is stored within in the
// control bits of the opcode token. In SPIR-V, we have
// to define an execution mode.
const spv::ExecutionMode mode = [&] {
auto mode = [&] {
switch (ins.controls.primitiveTopology()) {
case DxbcPrimitiveTopology::PointList: return spv::ExecutionModeOutputPoints;
case DxbcPrimitiveTopology::LineStrip: return spv::ExecutionModeOutputLineStrip;
case DxbcPrimitiveTopology::TriangleStrip: return spv::ExecutionModeOutputTriangleStrip;
case DxbcPrimitiveTopology::PointList: return std::make_pair(VK_PRIMITIVE_TOPOLOGY_POINT_LIST, spv::ExecutionModeOutputPoints);
case DxbcPrimitiveTopology::LineStrip: return std::make_pair(VK_PRIMITIVE_TOPOLOGY_LINE_LIST, spv::ExecutionModeOutputLineStrip);
case DxbcPrimitiveTopology::TriangleStrip: return std::make_pair(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, spv::ExecutionModeOutputTriangleStrip);
default: throw DxvkError("DxbcCompiler: Unsupported primitive topology");
}
}();
m_module.setExecutionMode(m_entryPointId, mode);
m_outputTopology = mode.first;
m_module.setExecutionMode(m_entryPointId, mode.second);
}
@ -1350,16 +1352,17 @@ namespace dxvk {
void DxbcCompiler::emitDclTessDomain(const DxbcShaderInstruction& ins) {
const spv::ExecutionMode executionMode = [&] {
auto mode = [&] {
switch (ins.controls.tessDomain()) {
case DxbcTessDomain::Isolines: return spv::ExecutionModeIsolines;
case DxbcTessDomain::Triangles: return spv::ExecutionModeTriangles;
case DxbcTessDomain::Quads: return spv::ExecutionModeQuads;
case DxbcTessDomain::Isolines: return std::make_pair(VK_PRIMITIVE_TOPOLOGY_LINE_LIST, spv::ExecutionModeIsolines);
case DxbcTessDomain::Triangles: return std::make_pair(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, spv::ExecutionModeTriangles);
case DxbcTessDomain::Quads: return std::make_pair(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, spv::ExecutionModeQuads);
default: throw DxvkError("Dxbc: Invalid tess domain");
}
}();
m_module.setExecutionMode(m_entryPointId, executionMode);
m_outputTopology = mode.first;
m_module.setExecutionMode(m_entryPointId, mode.second);
}

View File

@ -535,6 +535,8 @@ namespace dxvk {
DxbcOpcode m_lastOp = DxbcOpcode::Nop;
DxbcOpcode m_currOp = DxbcOpcode::Nop;
VkPrimitiveTopology m_outputTopology = VK_PRIMITIVE_TOPOLOGY_MAX_ENUM;
/////////////////////////////////////////////////////
// Shader interface and metadata declaration methods
void emitDcl(