[dxbc] Take used components into account for PS inputs

This commit is contained in:
Philip Rebohle 2024-04-16 17:40:29 +02:00
parent c2489d5a45
commit 617ebf4e05
3 changed files with 15 additions and 2 deletions

View File

@ -23,7 +23,11 @@ namespace dxvk {
entry.systemValue = static_cast<DxbcSystemValue>(reader.readu32());
entry.componentType = componentTypes.at(reader.readu32());
entry.registerId = reader.readu32();
entry.componentMask = bit::extract(reader.readu32(), 0, 3);
uint32_t mask = reader.readu32();
entry.componentMask = bit::extract(mask, 0, 3);
entry.componentUsed = bit::extract(mask, 8, 11);
if (hasPrecision)
reader.readu32();

View File

@ -20,6 +20,7 @@ namespace dxvk {
uint32_t semanticIndex;
uint32_t registerId;
DxbcRegMask componentMask;
DxbcRegMask componentUsed;
DxbcScalarType componentType;
DxbcSystemValue systemValue;
uint32_t streamId;

View File

@ -7777,10 +7777,18 @@ namespace dxvk {
return result;
DxbcRegMask mask(0u);
DxbcRegMask used(0u);
for (const auto& e : *m_isgn) {
if (e.registerId == regIdx && !ignoreInputSystemValue(e.systemValue))
if (e.registerId == regIdx && !ignoreInputSystemValue(e.systemValue)) {
mask |= e.componentMask;
used |= e.componentUsed;
}
}
if (m_programInfo.type() == DxbcProgramType::PixelShader) {
if ((used.raw() & mask.raw()) == used.raw())
mask = used;
}
result.ccount = mask.minComponents();