1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-03 13:24:20 +01:00

[dxvk] Do not commit compute barriers for unbound resources

Fixes a crash in Neptunia VII.
This commit is contained in:
Philip Rebohle 2018-02-14 16:18:18 +01:00
parent 17cdccd1ce
commit ba707f95b7
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -1565,36 +1565,38 @@ namespace dxvk {
auto layout = m_state.cp.pipeline->layout();
for (uint32_t i = 0; i < layout->bindingCount(); i++) {
const DxvkDescriptorSlot binding = layout->binding(i);
const DxvkShaderResourceSlot& slot = m_rc[binding.slot];
if (binding.type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) {
m_barriers.accessBuffer(
slot.bufferSlice.physicalSlice(),
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
VK_ACCESS_SHADER_READ_BIT |
VK_ACCESS_SHADER_WRITE_BIT,
slot.bufferSlice.bufferInfo().stages,
slot.bufferSlice.bufferInfo().access);
} else if (binding.type == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER) {
m_barriers.accessBuffer(
slot.bufferView->slice(),
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
VK_ACCESS_SHADER_READ_BIT |
VK_ACCESS_SHADER_WRITE_BIT,
slot.bufferView->bufferInfo().stages,
slot.bufferView->bufferInfo().access);
} else if (binding.type == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) {
m_barriers.accessImage(
slot.imageView->image(),
slot.imageView->subresources(),
slot.imageView->imageInfo().layout,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
VK_ACCESS_SHADER_READ_BIT |
VK_ACCESS_SHADER_WRITE_BIT,
slot.imageView->imageInfo().layout,
slot.imageView->imageInfo().stages,
slot.imageView->imageInfo().access);
if (m_state.cp.bs.isBound(i)) {
const DxvkDescriptorSlot binding = layout->binding(i);
const DxvkShaderResourceSlot& slot = m_rc[binding.slot];
if (binding.type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) {
m_barriers.accessBuffer(
slot.bufferSlice.physicalSlice(),
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
VK_ACCESS_SHADER_READ_BIT |
VK_ACCESS_SHADER_WRITE_BIT,
slot.bufferSlice.bufferInfo().stages,
slot.bufferSlice.bufferInfo().access);
} else if (binding.type == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER) {
m_barriers.accessBuffer(
slot.bufferView->slice(),
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
VK_ACCESS_SHADER_READ_BIT |
VK_ACCESS_SHADER_WRITE_BIT,
slot.bufferView->bufferInfo().stages,
slot.bufferView->bufferInfo().access);
} else if (binding.type == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) {
m_barriers.accessImage(
slot.imageView->image(),
slot.imageView->subresources(),
slot.imageView->imageInfo().layout,
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
VK_ACCESS_SHADER_READ_BIT |
VK_ACCESS_SHADER_WRITE_BIT,
slot.imageView->imageInfo().layout,
slot.imageView->imageInfo().stages,
slot.imageView->imageInfo().access);
}
}
}