Skip to content
Permalink
Browse files

Vulkan: Fix validation layer error for unbound texture layouts

  • Loading branch information...
stenzek committed Mar 17, 2019
1 parent 087b11e commit 23a655217c425fcb8bce2cf9c94e770f45f198c6
Showing with 5 additions and 3 deletions.
  1. +5 −3 Source/Core/VideoBackends/Vulkan/StateTracker.cpp
@@ -62,11 +62,13 @@ bool StateTracker::Initialize()
VKTexture::Create(TextureConfig(1, 1, 1, 1, 1, AbstractTextureFormat::RGBA8, 0));
if (!m_dummy_texture)
return false;
m_dummy_texture->TransitionToLayout(g_command_buffer_mgr->GetCurrentInitCommandBuffer(),
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);

// Initialize all samplers to point by default
for (size_t i = 0; i < NUM_PIXEL_SHADER_SAMPLERS; i++)
{
m_bindings.samplers[i].imageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
m_bindings.samplers[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
m_bindings.samplers[i].imageView = m_dummy_texture->GetView();
m_bindings.samplers[i].sampler = g_object_cache->GetPointSampler();
}
@@ -223,14 +225,14 @@ void StateTracker::UnbindTexture(VkImageView view)
if (it.imageView == view)
{
it.imageView = m_dummy_texture->GetView();
it.imageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
it.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
}
}

if (m_bindings.image_texture.imageView == view)
{
m_bindings.image_texture.imageView = m_dummy_texture->GetView();
m_bindings.image_texture.imageLayout = VK_IMAGE_LAYOUT_UNDEFINED;
m_bindings.image_texture.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
}
}

0 comments on commit 23a6552

Please sign in to comment.
You can’t perform that action at this time.