mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-25 16:54:15 +01:00
Revert "[dxbc] Do not emit per-vertex input block"
This reverts commit 4ce64bd8865bbb25baa25d622437c9258126c4d2. Fixes a regression in Sniper: Ghost Warrior 2 and Dishonored 2.
This commit is contained in:
parent
54382ae319
commit
ac94c42380
@ -588,9 +588,6 @@ namespace dxvk {
|
|||||||
bool skipSv = sv == DxbcSystemValue::ClipDistance
|
bool skipSv = sv == DxbcSystemValue::ClipDistance
|
||||||
|| sv == DxbcSystemValue::CullDistance;
|
|| sv == DxbcSystemValue::CullDistance;
|
||||||
|
|
||||||
if (m_version.type() != DxbcProgramType::PixelShader)
|
|
||||||
skipSv = skipSv || sv == DxbcSystemValue::Position;
|
|
||||||
|
|
||||||
if (!skipSv)
|
if (!skipSv)
|
||||||
m_vMappings.push_back({ regIdx, regMask, sv });
|
m_vMappings.push_back({ regIdx, regMask, sv });
|
||||||
}
|
}
|
||||||
@ -1083,7 +1080,11 @@ namespace dxvk {
|
|||||||
m_gs.inputPrimitive = ins.controls.primitive;
|
m_gs.inputPrimitive = ins.controls.primitive;
|
||||||
m_module.setExecutionMode(m_entryPointId, mode);
|
m_module.setExecutionMode(m_entryPointId, mode);
|
||||||
|
|
||||||
emitDclInputArray(primitiveVertexCount(m_gs.inputPrimitive));
|
const uint32_t vertexCount
|
||||||
|
= primitiveVertexCount(m_gs.inputPrimitive);
|
||||||
|
|
||||||
|
emitDclInputArray(vertexCount);
|
||||||
|
emitDclInputPerVertex(vertexCount, "gs_vertex_in");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4929,9 +4930,34 @@ namespace dxvk {
|
|||||||
DxbcSystemValue sv,
|
DxbcSystemValue sv,
|
||||||
DxbcRegMask mask,
|
DxbcRegMask mask,
|
||||||
uint32_t vertexId) {
|
uint32_t vertexId) {
|
||||||
|
switch (sv) {
|
||||||
|
case DxbcSystemValue::Position: {
|
||||||
|
const std::array<uint32_t, 2> indices = {
|
||||||
|
m_module.consti32(vertexId),
|
||||||
|
m_module.consti32(PerVertex_Position),
|
||||||
|
};
|
||||||
|
|
||||||
|
DxbcRegisterPointer ptrIn;
|
||||||
|
ptrIn.type.ctype = DxbcScalarType::Float32;
|
||||||
|
ptrIn.type.ccount = 4;
|
||||||
|
|
||||||
|
ptrIn.id = m_module.opAccessChain(
|
||||||
|
m_module.defPointerType(
|
||||||
|
getVectorTypeId(ptrIn.type),
|
||||||
|
spv::StorageClassInput),
|
||||||
|
m_perVertexIn,
|
||||||
|
indices.size(),
|
||||||
|
indices.data());
|
||||||
|
|
||||||
|
return emitRegisterExtract(
|
||||||
|
emitValueLoad(ptrIn), mask);
|
||||||
|
} break;
|
||||||
|
|
||||||
|
default:
|
||||||
throw DxvkError(str::format(
|
throw DxvkError(str::format(
|
||||||
"DxbcCompiler: Unhandled GS SV input: ", sv));
|
"DxbcCompiler: Unhandled GS SV input: ", sv));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DxbcRegisterValue DxbcCompiler::emitPsSystemValueLoad(
|
DxbcRegisterValue DxbcCompiler::emitPsSystemValueLoad(
|
||||||
@ -5672,6 +5698,25 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DxbcCompiler::emitDclInputPerVertex(
|
||||||
|
uint32_t vertexCount,
|
||||||
|
const char* varName) {
|
||||||
|
uint32_t typeId = getPerVertexBlockId();
|
||||||
|
|
||||||
|
if (vertexCount != 0) {
|
||||||
|
typeId = m_module.defArrayType(typeId,
|
||||||
|
m_module.constu32(vertexCount));
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint32_t ptrTypeId = m_module.defPointerType(
|
||||||
|
typeId, spv::StorageClassInput);
|
||||||
|
|
||||||
|
m_perVertexIn = m_module.newVar(
|
||||||
|
ptrTypeId, spv::StorageClassInput);
|
||||||
|
m_module.setDebugName(m_perVertexIn, varName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t DxbcCompiler::emitDclClipCullDistanceArray(
|
uint32_t DxbcCompiler::emitDclClipCullDistanceArray(
|
||||||
uint32_t length,
|
uint32_t length,
|
||||||
spv::BuiltIn builtIn,
|
spv::BuiltIn builtIn,
|
||||||
|
@ -390,6 +390,7 @@ namespace dxvk {
|
|||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
// Per-vertex input and output blocks. Depending on
|
// Per-vertex input and output blocks. Depending on
|
||||||
// the shader stage, these may be declared as arrays.
|
// the shader stage, these may be declared as arrays.
|
||||||
|
uint32_t m_perVertexIn = 0;
|
||||||
uint32_t m_perVertexOut = 0;
|
uint32_t m_perVertexOut = 0;
|
||||||
|
|
||||||
uint32_t m_clipDistances = 0;
|
uint32_t m_clipDistances = 0;
|
||||||
@ -943,6 +944,10 @@ namespace dxvk {
|
|||||||
void emitDclInputArray(
|
void emitDclInputArray(
|
||||||
uint32_t vertexCount);
|
uint32_t vertexCount);
|
||||||
|
|
||||||
|
void emitDclInputPerVertex(
|
||||||
|
uint32_t vertexCount,
|
||||||
|
const char* varName);
|
||||||
|
|
||||||
uint32_t emitDclClipCullDistanceArray(
|
uint32_t emitDclClipCullDistanceArray(
|
||||||
uint32_t length,
|
uint32_t length,
|
||||||
spv::BuiltIn builtIn,
|
spv::BuiltIn builtIn,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user