mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-14 22:29:15 +01:00
[dxvk] Don't use dynamic storage buffers
Doesn't really help in pracrice, but getting rid of them reduces the number of dynamic offsets we have to update per draw/dispatch.
This commit is contained in:
parent
0068740341
commit
d8c3002b92
@ -3860,18 +3860,6 @@ namespace dxvk {
|
|||||||
descriptors[i].buffer = m_common->dummyResources().bufferDescriptor();
|
descriptors[i].buffer = m_common->dummyResources().bufferDescriptor();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
|
||||||
if (res.bufferSlice.defined()) {
|
|
||||||
descriptors[i] = res.bufferSlice.getDescriptor();
|
|
||||||
descriptors[i].buffer.offset = 0;
|
|
||||||
|
|
||||||
if (m_rcTracked.set(binding.slot))
|
|
||||||
m_cmd->trackResource<DxvkAccess::Write>(res.bufferSlice.buffer());
|
|
||||||
} else {
|
|
||||||
bindMask.clr(i);
|
|
||||||
descriptors[i].buffer = m_common->dummyResources().bufferDescriptor();
|
|
||||||
} break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Logger::err(str::format("DxvkContext: Unhandled descriptor type: ", binding.type));
|
Logger::err(str::format("DxvkContext: Unhandled descriptor type: ", binding.type));
|
||||||
}
|
}
|
||||||
@ -4236,7 +4224,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
switch (binding.type) {
|
switch (binding.type) {
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
|
||||||
if (binding.access & VK_ACCESS_SHADER_WRITE_BIT)
|
if (binding.access & VK_ACCESS_SHADER_WRITE_BIT)
|
||||||
dstAccess.set(DxvkAccess::Write);
|
dstAccess.set(DxvkAccess::Write);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
@ -4305,7 +4292,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
switch (binding.type) {
|
switch (binding.type) {
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
|
||||||
if (binding.access & VK_ACCESS_SHADER_WRITE_BIT)
|
if (binding.access & VK_ACCESS_SHADER_WRITE_BIT)
|
||||||
access |= VK_ACCESS_SHADER_WRITE_BIT;
|
access |= VK_ACCESS_SHADER_WRITE_BIT;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
@ -7,7 +7,7 @@ namespace dxvk {
|
|||||||
: m_vkd(vkd) {
|
: m_vkd(vkd) {
|
||||||
constexpr uint32_t MaxSets = 2048;
|
constexpr uint32_t MaxSets = 2048;
|
||||||
|
|
||||||
std::array<VkDescriptorPoolSize, 10> pools = {{
|
std::array<VkDescriptorPoolSize, 9> pools = {{
|
||||||
{ VK_DESCRIPTOR_TYPE_SAMPLER, MaxSets * 2 },
|
{ VK_DESCRIPTOR_TYPE_SAMPLER, MaxSets * 2 },
|
||||||
{ VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, MaxSets * 3 },
|
{ VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, MaxSets * 3 },
|
||||||
{ VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, MaxSets / 8 },
|
{ VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, MaxSets / 8 },
|
||||||
@ -16,7 +16,6 @@ namespace dxvk {
|
|||||||
{ VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, MaxSets * 3 },
|
{ VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, MaxSets * 3 },
|
||||||
{ VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, MaxSets / 8 },
|
{ VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, MaxSets / 8 },
|
||||||
{ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, MaxSets * 3 },
|
{ VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, MaxSets * 3 },
|
||||||
{ VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, MaxSets / 8 },
|
|
||||||
{ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, MaxSets * 2 } }};
|
{ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, MaxSets * 2 } }};
|
||||||
|
|
||||||
VkDescriptorPoolCreateInfo info;
|
VkDescriptorPoolCreateInfo info;
|
||||||
|
@ -57,9 +57,6 @@ namespace dxvk {
|
|||||||
uint32_t storageBuffers) {
|
uint32_t storageBuffers) {
|
||||||
if (this->countDescriptors(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) <= uniformBuffers)
|
if (this->countDescriptors(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) <= uniformBuffers)
|
||||||
this->replaceDescriptors(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC);
|
this->replaceDescriptors(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC);
|
||||||
|
|
||||||
if (this->countDescriptors(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) <= storageBuffers)
|
|
||||||
this->replaceDescriptors(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -115,8 +112,7 @@ namespace dxvk {
|
|||||||
tEntries[i].offset = sizeof(DxvkDescriptorInfo) * i;
|
tEntries[i].offset = sizeof(DxvkDescriptorInfo) * i;
|
||||||
tEntries[i].stride = 0;
|
tEntries[i].stride = 0;
|
||||||
|
|
||||||
if (bindingInfos[i].type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC
|
if (bindingInfos[i].type == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC)
|
||||||
|| bindingInfos[i].type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)
|
|
||||||
m_dynamicSlots.push_back(i);
|
m_dynamicSlots.push_back(i);
|
||||||
|
|
||||||
m_descriptorTypes.set(bindingInfos[i].type);
|
m_descriptorTypes.set(bindingInfos[i].type);
|
||||||
|
@ -235,13 +235,12 @@ namespace dxvk {
|
|||||||
* \brief Checks for static buffer bindings
|
* \brief Checks for static buffer bindings
|
||||||
*
|
*
|
||||||
* Returns \c true if there is at least one
|
* Returns \c true if there is at least one
|
||||||
* descriptor of the static uniform or storage
|
* descriptor of the static uniform buffer
|
||||||
* buffer type.
|
* type.
|
||||||
*/
|
*/
|
||||||
bool hasStaticBufferBindings() const {
|
bool hasStaticBufferBindings() const {
|
||||||
return m_descriptorTypes.any(
|
return m_descriptorTypes.test(
|
||||||
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
|
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
|
||||||
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user