mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[dxvk] Remove binding mask from pipeline state
This commit is contained in:
parent
54eaa444a2
commit
8abb5ffc77
@ -83,14 +83,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
DxvkSpecConstants specData;
|
||||
uint32_t bindingIndex = 0;
|
||||
|
||||
for (uint32_t i = 0; i < DxvkDescriptorSets::SetCount; i++) {
|
||||
for (uint32_t j = 0; j < m_bindings->layout().getBindingCount(i); j++) {
|
||||
specData.set(bindingIndex, state.bsBindingMask.test(bindingIndex), true);
|
||||
bindingIndex += 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < MaxNumSpecConstants; i++)
|
||||
specData.set(getSpecId(i), state.sc.specConstants[i], 0u);
|
||||
|
@ -3954,7 +3954,6 @@ namespace dxvk {
|
||||
return false;
|
||||
|
||||
m_descriptorState.dirtyStages(VK_SHADER_STAGE_COMPUTE_BIT);
|
||||
m_state.cp.state.bsBindingMask.clear();
|
||||
|
||||
if (m_state.cp.pipeline->getBindings()->layout().getPushConstantRange().size)
|
||||
m_flags.set(DxvkContextFlag::DirtyPushConstants);
|
||||
@ -4024,7 +4023,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
m_descriptorState.dirtyStages(VK_SHADER_STAGE_ALL_GRAPHICS);
|
||||
m_state.gp.state.bsBindingMask.clear();
|
||||
|
||||
if (newPipeline->getBindings()->layout().getPushConstantRange().size)
|
||||
m_flags.set(DxvkContextFlag::DirtyPushConstants);
|
||||
@ -4095,15 +4093,7 @@ namespace dxvk {
|
||||
// For 64-bit applications, using templates is slower on some drivers.
|
||||
constexpr bool useDescriptorTemplates = env::is32BitHostPlatform();
|
||||
|
||||
// This relies on the bind mask being cleared when the pipeline layout changes.
|
||||
DxvkBindingMask& refBindMask = BindPoint == VK_PIPELINE_BIND_POINT_GRAPHICS
|
||||
? m_state.gp.state.bsBindingMask
|
||||
: m_state.cp.state.bsBindingMask;
|
||||
|
||||
DxvkBindingMask newBindMask = refBindMask;
|
||||
|
||||
uint32_t layoutSetMask = layout->getSetMask();
|
||||
|
||||
uint32_t dirtySetMask = BindPoint == VK_PIPELINE_BIND_POINT_GRAPHICS
|
||||
? m_descriptorState.getDirtyGraphicsSets()
|
||||
: m_descriptorState.getDirtyComputeSets();
|
||||
@ -4120,11 +4110,7 @@ namespace dxvk {
|
||||
|
||||
// Initialize binding mask for the current set, only
|
||||
// clear bits if certain resources are actually unbound.
|
||||
uint32_t bindingIndex = layout->getFirstBinding(setIndex);
|
||||
uint32_t bindingCount = bindings.getBindingCount(setIndex);
|
||||
|
||||
newBindMask.setRange(bindingIndex, bindingCount);
|
||||
|
||||
VkDescriptorSet set = sets[setIndex];
|
||||
|
||||
for (uint32_t j = 0; j < bindingCount; j++) {
|
||||
@ -4166,7 +4152,6 @@ namespace dxvk {
|
||||
}
|
||||
} else {
|
||||
m_descriptors[k].image = VkDescriptorImageInfo();
|
||||
newBindMask.clr(bindingIndex + j);
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -4184,7 +4169,6 @@ namespace dxvk {
|
||||
}
|
||||
} else {
|
||||
m_descriptors[k].image = VkDescriptorImageInfo();
|
||||
newBindMask.clr(bindingIndex + j);
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -4204,7 +4188,6 @@ namespace dxvk {
|
||||
}
|
||||
} else {
|
||||
m_descriptors[k].image = m_common->dummyResources().samplerDescriptor();
|
||||
newBindMask.clr(bindingIndex + j);
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -4221,7 +4204,6 @@ namespace dxvk {
|
||||
}
|
||||
} else {
|
||||
m_descriptors[k].texelBuffer = VK_NULL_HANDLE;
|
||||
newBindMask.clr(bindingIndex + j);
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -4238,7 +4220,6 @@ namespace dxvk {
|
||||
}
|
||||
} else {
|
||||
m_descriptors[k].texelBuffer = VK_NULL_HANDLE;
|
||||
newBindMask.clr(bindingIndex + j);
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -4265,7 +4246,6 @@ namespace dxvk {
|
||||
m_cmd->trackResource<DxvkAccess::Write>(res.bufferSlice.buffer());
|
||||
} else {
|
||||
m_descriptors[k].buffer = VkDescriptorBufferInfo();
|
||||
newBindMask.clr(bindingIndex + j);
|
||||
}
|
||||
} break;
|
||||
|
||||
@ -4304,15 +4284,6 @@ namespace dxvk {
|
||||
|
||||
dirtySetMask &= dirtySetMask - 1;
|
||||
}
|
||||
|
||||
// Update pipeline if there are unbound resources
|
||||
if (refBindMask != newBindMask) {
|
||||
refBindMask = newBindMask;
|
||||
|
||||
m_flags.set(BindPoint == VK_PIPELINE_BIND_POINT_GRAPHICS
|
||||
? DxvkContextFlag::GpDirtyPipelineState
|
||||
: DxvkContextFlag::CpDirtyPipelineState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -154,15 +154,6 @@ namespace dxvk {
|
||||
DxvkSpecConstants specData;
|
||||
specData.set(uint32_t(DxvkSpecConstantId::RasterizerSampleCount), sampleCount, VK_SAMPLE_COUNT_1_BIT);
|
||||
|
||||
uint32_t bindingIndex = 0;
|
||||
|
||||
for (uint32_t i = 0; i < DxvkDescriptorSets::SetCount; i++) {
|
||||
for (uint32_t j = 0; j < m_bindings->layout().getBindingCount(i); j++) {
|
||||
specData.set(bindingIndex, state.bsBindingMask.test(bindingIndex), true);
|
||||
bindingIndex += 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
|
||||
if ((m_fsOut & (1 << i)) != 0) {
|
||||
specData.set(uint32_t(DxvkSpecConstantId::ColorComponentMappings) + i,
|
||||
|
@ -679,7 +679,6 @@ namespace dxvk {
|
||||
return result;
|
||||
}
|
||||
|
||||
DxvkBindingMask bsBindingMask;
|
||||
DxvkIaInfo ia;
|
||||
DxvkIlInfo il;
|
||||
DxvkRsInfo rs;
|
||||
@ -721,7 +720,6 @@ namespace dxvk {
|
||||
return !bit::bcmpeq(this, &other);
|
||||
}
|
||||
|
||||
DxvkBindingMask bsBindingMask;
|
||||
DxvkScInfo sc;
|
||||
};
|
||||
|
||||
|
@ -45,6 +45,10 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
bool read(DxvkBindingMask& data, uint32_t version) {
|
||||
// v11 removes this field
|
||||
if (version >= 11)
|
||||
return true;
|
||||
|
||||
if (version < 9) {
|
||||
DxvkBindingMaskV8 v8;
|
||||
|
||||
@ -551,8 +555,10 @@ namespace dxvk {
|
||||
keys[i] = g_nullShaderKey;
|
||||
}
|
||||
|
||||
DxvkBindingMask dummyBindingMask = { };
|
||||
|
||||
if (stageMask & VK_SHADER_STAGE_COMPUTE_BIT) {
|
||||
if (!data.read(entry.cpState.bsBindingMask, version))
|
||||
if (!data.read(dummyBindingMask, version))
|
||||
return false;
|
||||
} else {
|
||||
// Read packed render pass format
|
||||
@ -582,7 +588,7 @@ namespace dxvk {
|
||||
return false;
|
||||
|
||||
// Read common pipeline state
|
||||
if (!data.read(entry.gpState.bsBindingMask, version)
|
||||
if (!data.read(dummyBindingMask, version)
|
||||
|| !data.read(entry.gpState.ia, version)
|
||||
|| !data.read(entry.gpState.il, version)
|
||||
|| !data.read(entry.gpState.rs, version)
|
||||
@ -659,10 +665,7 @@ namespace dxvk {
|
||||
}
|
||||
}
|
||||
|
||||
if (stageMask & VK_SHADER_STAGE_COMPUTE_BIT) {
|
||||
// Nothing else here to write out
|
||||
data.write(entry.cpState.bsBindingMask);
|
||||
} else {
|
||||
if (!(stageMask & VK_SHADER_STAGE_COMPUTE_BIT)) {
|
||||
// Pack render pass format
|
||||
data.write(uint8_t(entry.format.sampleCount));
|
||||
data.write(uint8_t(entry.format.depth.format));
|
||||
@ -674,7 +677,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
// Write out common pipeline state
|
||||
data.write(entry.gpState.bsBindingMask);
|
||||
data.write(entry.gpState.ia);
|
||||
data.write(entry.gpState.il);
|
||||
data.write(entry.gpState.rs);
|
||||
@ -821,9 +823,6 @@ namespace dxvk {
|
||||
out.hash = in.hash;
|
||||
|
||||
if (in.shaders.cs.eq(g_nullShaderKey)) {
|
||||
// Binding mask
|
||||
out.gpState.bsBindingMask = in.gpState.bsBindingMask.convert();
|
||||
|
||||
// Graphics state
|
||||
out.gpState.ia = DxvkIaInfo(
|
||||
in.gpState.iaPrimitiveTopology,
|
||||
@ -898,9 +897,6 @@ namespace dxvk {
|
||||
for (uint32_t i = 0; i < 8 && i < MaxNumSpecConstants; i++)
|
||||
out.cpState.sc.specConstants[i] = in.cpState.scSpecConstants[i];
|
||||
} else {
|
||||
// Binding mask
|
||||
out.cpState.bsBindingMask = in.cpState.bsBindingMask.convert();
|
||||
|
||||
for (uint32_t i = 0; i < 8 && i < MaxNumSpecConstants; i++)
|
||||
out.gpState.sc.specConstants[i] = in.gpState.scSpecConstants[i];
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace dxvk {
|
||||
*/
|
||||
struct DxvkStateCacheHeader {
|
||||
char magic[4] = { 'D', 'X', 'V', 'K' };
|
||||
uint32_t version = 10;
|
||||
uint32_t version = 11;
|
||||
uint32_t entrySize = 0; /* no longer meaningful */
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user