mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-02 01:24:11 +01:00
[dxvk] Use only one spec constant for fragment shader output component mapping
Let's trust the driver to be able to constant-fold bitfieldExtract operations.
This commit is contained in:
parent
307f43ff1e
commit
3a993d0c5c
@ -5904,16 +5904,15 @@ namespace dxvk {
|
||||
uint32_t specTypeId = getScalarTypeId(DxbcScalarType::Uint32);
|
||||
uint32_t compTypeId = getScalarTypeId(vector.type.ctype);
|
||||
|
||||
uint32_t specId = m_module.specConst32(specTypeId, 0x3210);
|
||||
m_module.decorateSpecId(specId, uint32_t(DxvkSpecConstantId::ColorComponentMappings) + i);
|
||||
m_module.setDebugName(specId, str::format("omap", i).c_str());
|
||||
|
||||
std::array<uint32_t, 4> scalars;
|
||||
|
||||
for (uint32_t c = 0; c < vector.type.ccount; c++) {
|
||||
const char* components = "rgba";
|
||||
|
||||
uint32_t specId = m_module.specConst32(specTypeId, c);
|
||||
m_module.decorateSpecId(specId, uint32_t(DxvkSpecConstantId::ColorComponentMappings) + 4 * i + c);
|
||||
m_module.setDebugName(specId, str::format("omap", i, ".", components[c]).c_str());
|
||||
|
||||
scalars[c] = m_module.opVectorExtractDynamic(compTypeId, vector.id, specId);
|
||||
scalars[c] = m_module.opVectorExtractDynamic(compTypeId, vector.id,
|
||||
m_module.opBitFieldUExtract(specTypeId, specId,
|
||||
m_module.constu32(4 * c), m_module.constu32(4)));
|
||||
}
|
||||
|
||||
uint32_t typeId = getVectorTypeId(vector.type);
|
||||
|
@ -167,11 +167,9 @@ namespace dxvk {
|
||||
|
||||
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
|
||||
if ((m_fsOut & (1 << i)) != 0) {
|
||||
uint32_t specId = uint32_t(DxvkSpecConstantId::ColorComponentMappings) + 4 * i;
|
||||
specData.set(specId + 0, state.omSwizzle[i].rIndex(), 0u);
|
||||
specData.set(specId + 1, state.omSwizzle[i].gIndex(), 1u);
|
||||
specData.set(specId + 2, state.omSwizzle[i].bIndex(), 2u);
|
||||
specData.set(specId + 3, state.omSwizzle[i].aIndex(), 3u);
|
||||
specData.set(uint32_t(DxvkSpecConstantId::ColorComponentMappings) + i,
|
||||
state.omSwizzle[i].rIndex() << 0 | state.omSwizzle[i].gIndex() << 4 |
|
||||
state.omSwizzle[i].bIndex() << 8 | state.omSwizzle[i].aIndex() << 12, 0x3210u);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace dxvk {
|
||||
ColorComponentMappings = MaxNumResourceSlots,
|
||||
|
||||
// Specialization constants for pipeline state
|
||||
SpecConstantRangeStart = ColorComponentMappings + MaxNumRenderTargets * 4,
|
||||
SpecConstantRangeStart = ColorComponentMappings + MaxNumRenderTargets,
|
||||
RasterizerSampleCount = SpecConstantRangeStart + 0,
|
||||
FirstPipelineConstant
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user