1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-12 04:08:52 +01:00

[dxvk] Use access flags rather than usage when tracking gfx barriers

This commit is contained in:
Philip Rebohle 2020-05-12 00:24:09 +02:00
parent 57acbbd7c7
commit 6643c75f37
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -4505,10 +4505,8 @@ namespace dxvk {
void DxvkContext::commitGraphicsBarriers() { void DxvkContext::commitGraphicsBarriers() {
auto layout = m_state.gp.pipeline->layout(); auto layout = m_state.gp.pipeline->layout();
constexpr auto storageBufferUsage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT constexpr auto storageBufferAccess = VK_ACCESS_SHADER_WRITE_BIT | VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT;
| VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT constexpr auto storageImageAccess = VK_ACCESS_SHADER_WRITE_BIT;
| VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT;
constexpr auto storageImageUsage = VK_IMAGE_USAGE_STORAGE_BIT;
bool requiresBarrier = false; bool requiresBarrier = false;
@ -4520,8 +4518,8 @@ namespace dxvk {
}}; }};
for (uint32_t i = 0; i < slices.size() && !requiresBarrier; i++) { for (uint32_t i = 0; i < slices.size() && !requiresBarrier; i++) {
if (slices[i]->defined() if ((slices[i]->defined())
&& slices[i]->bufferInfo().usage & storageBufferUsage) { && (slices[i]->bufferInfo().access & storageBufferAccess)) {
requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(*slices[i], requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(*slices[i],
VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT, VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT,
VK_ACCESS_INDIRECT_COMMAND_READ_BIT).test(DxvkAccess::Write); VK_ACCESS_INDIRECT_COMMAND_READ_BIT).test(DxvkAccess::Write);
@ -4534,8 +4532,8 @@ namespace dxvk {
if (m_flags.test(DxvkContextFlag::GpDirtyIndexBuffer) && !requiresBarrier && Indexed) { if (m_flags.test(DxvkContextFlag::GpDirtyIndexBuffer) && !requiresBarrier && Indexed) {
const auto& indexBufferSlice = m_state.vi.indexBuffer; const auto& indexBufferSlice = m_state.vi.indexBuffer;
if (indexBufferSlice.defined() if ((indexBufferSlice.defined())
&& indexBufferSlice.bufferInfo().usage & storageBufferUsage) { && (indexBufferSlice.bufferInfo().access & storageBufferAccess)) {
requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(indexBufferSlice, requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(indexBufferSlice,
VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
VK_ACCESS_INDEX_READ_BIT).test(DxvkAccess::Write); VK_ACCESS_INDEX_READ_BIT).test(DxvkAccess::Write);
@ -4550,8 +4548,8 @@ namespace dxvk {
uint32_t binding = m_state.gp.state.ilBindings[i].binding(); uint32_t binding = m_state.gp.state.ilBindings[i].binding();
const auto& vertexBufferSlice = m_state.vi.vertexBuffers[binding]; const auto& vertexBufferSlice = m_state.vi.vertexBuffers[binding];
if (vertexBufferSlice.defined() if ((vertexBufferSlice.defined())
&& vertexBufferSlice.bufferInfo().usage & storageBufferUsage) { && (vertexBufferSlice.bufferInfo().access & storageBufferAccess)) {
requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(vertexBufferSlice, requiresBarrier = this->checkGfxBufferBarrier<DoEmit>(vertexBufferSlice,
VK_PIPELINE_STAGE_VERTEX_INPUT_BIT, VK_PIPELINE_STAGE_VERTEX_INPUT_BIT,
VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT).test(DxvkAccess::Write); VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT).test(DxvkAccess::Write);
@ -4590,8 +4588,8 @@ namespace dxvk {
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER: case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC: case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
if (slot.bufferSlice.defined() if ((slot.bufferSlice.defined())
&& slot.bufferSlice.bufferInfo().usage & storageBufferUsage) { && (slot.bufferSlice.bufferInfo().access & storageBufferAccess)) {
srcAccess = this->checkGfxBufferBarrier<DoEmit>(slot.bufferSlice, srcAccess = this->checkGfxBufferBarrier<DoEmit>(slot.bufferSlice,
binding.stages, binding.access); binding.stages, binding.access);
} }
@ -4603,8 +4601,8 @@ namespace dxvk {
/* fall through */ /* fall through */
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER: case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
if (slot.bufferView != nullptr if ((slot.bufferView != nullptr)
&& slot.bufferView->bufferInfo().usage & storageBufferUsage) { && (slot.bufferView->bufferInfo().access & storageBufferAccess)) {
srcAccess = this->checkGfxBufferBarrier<DoEmit>(slot.bufferView->slice(), srcAccess = this->checkGfxBufferBarrier<DoEmit>(slot.bufferView->slice(),
binding.stages, binding.access); binding.stages, binding.access);
} }
@ -4617,8 +4615,8 @@ namespace dxvk {
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
if (slot.imageView != nullptr if ((slot.imageView != nullptr)
&& slot.imageView->imageInfo().usage & storageImageUsage) { && (slot.imageView->imageInfo().access & storageImageAccess)) {
srcAccess = this->checkGfxImageBarrier<DoEmit>(slot.imageView, srcAccess = this->checkGfxImageBarrier<DoEmit>(slot.imageView,
binding.stages, binding.access); binding.stages, binding.access);
} }