mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-05 01:24:14 +01:00
[dxbc] Generate smallest possible vectors for local arrays
FXC is buggy and always emits vec4 in the array declaration, so we'll have to analyze the used components ourselves.
This commit is contained in:
parent
b2f22d5719
commit
c590736fec
@ -78,7 +78,14 @@ namespace dxvk {
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < ins.dstCount; i++) {
|
||||||
|
if (ins.dst[0].type == DxbcOperandType::IndexableTemp) {
|
||||||
|
uint32_t index = ins.dst[0].idx[0].offset;
|
||||||
|
m_analysis->xRegMasks[index] |= ins.dst[0].mask;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
struct DxbcAnalysisInfo {
|
struct DxbcAnalysisInfo {
|
||||||
std::array<DxbcUavInfo, 64> uavInfos;
|
std::array<DxbcUavInfo, 64> uavInfos;
|
||||||
|
std::array<DxbcRegMask, 4096> xRegMasks;
|
||||||
|
|
||||||
DxbcClipCullInfo clipCullIn;
|
DxbcClipCullInfo clipCullIn;
|
||||||
DxbcClipCullInfo clipCullOut;
|
DxbcClipCullInfo clipCullOut;
|
||||||
|
@ -381,15 +381,16 @@ namespace dxvk {
|
|||||||
// dcl_indexable_temps has three operands:
|
// dcl_indexable_temps has three operands:
|
||||||
// (imm0) Array register index (x#)
|
// (imm0) Array register index (x#)
|
||||||
// (imm1) Number of vectors stored in the array
|
// (imm1) Number of vectors stored in the array
|
||||||
// (imm2) Component count of each individual vector
|
// (imm2) Component count of each individual vector. This is
|
||||||
|
// always 4 in fxc-generated binaries and therefore useless.
|
||||||
|
const uint32_t regId = ins.imm[0].u32;
|
||||||
|
|
||||||
DxbcRegisterInfo info;
|
DxbcRegisterInfo info;
|
||||||
info.type.ctype = DxbcScalarType::Float32;
|
info.type.ctype = DxbcScalarType::Float32;
|
||||||
info.type.ccount = ins.imm[2].u32;
|
info.type.ccount = m_analysis->xRegMasks.at(regId).minComponents();
|
||||||
info.type.alength = ins.imm[1].u32;
|
info.type.alength = ins.imm[1].u32;
|
||||||
info.sclass = spv::StorageClassPrivate;
|
info.sclass = spv::StorageClassPrivate;
|
||||||
|
|
||||||
const uint32_t regId = ins.imm[0].u32;
|
|
||||||
|
|
||||||
if (regId >= m_xRegs.size())
|
if (regId >= m_xRegs.size())
|
||||||
m_xRegs.resize(regId + 1);
|
m_xRegs.resize(regId + 1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user