Skip to content

Commit

Permalink
[dxbc] Do not emit GS system values if rasterization is disabled
Browse files Browse the repository at this point in the history
Fixes issue in Star Citizen, which declares a max output vertex count
of 128 in a geometry shader which emits eight components per vertex,
which becomes 12 components in DXVK due to the gl_Position builtin.
This should keep us below the magic limit of 1024 output components.
  • Loading branch information
doitsujin committed Apr 15, 2019
1 parent 496b77e commit 2210489
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/dxbc/dxbc_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2196,7 +2196,8 @@ namespace dxvk {
bool doCut = ins.op != DxbcOpcode::Emit && ins.op != DxbcOpcode::EmitStream;

if (doEmit) {
emitOutputSetup();
if (m_perVertexOut)
emitOutputSetup();
emitClipCullStore(DxbcSystemValue::ClipDistance, m_clipDistances);
emitClipCullStore(DxbcSystemValue::CullDistance, m_cullDistances);
emitXfbOutputSetup(streamId, false);
Expand Down Expand Up @@ -6427,14 +6428,16 @@ namespace dxvk {
// Declare the per-vertex output block. Outputs are not
// declared as arrays, instead they will be flushed when
// calling EmitVertex.
const uint32_t perVertexStruct = this->getPerVertexBlockId();
const uint32_t perVertexPointer = m_module.defPointerType(
perVertexStruct, spv::StorageClassOutput);

m_perVertexOut = m_module.newVar(
perVertexPointer, spv::StorageClassOutput);
m_entryPointInterfaces.push_back(m_perVertexOut);
m_module.setDebugName(m_perVertexOut, "gs_vertex_out");
if (!m_moduleInfo.xfb || m_moduleInfo.xfb->rasterizedStream >= 0) {
const uint32_t perVertexStruct = this->getPerVertexBlockId();
const uint32_t perVertexPointer = m_module.defPointerType(
perVertexStruct, spv::StorageClassOutput);

m_perVertexOut = m_module.newVar(
perVertexPointer, spv::StorageClassOutput);
m_entryPointInterfaces.push_back(m_perVertexOut);
m_module.setDebugName(m_perVertexOut, "gs_vertex_out");
}

// Cull/clip distances as outputs
m_clipDistances = emitDclClipCullDistanceArray(
Expand Down

0 comments on commit 2210489

Please sign in to comment.