TextureVk: Transition to the first usage if needed

In Vulkan images are created in no particular layout and must be
transitioned before they can be used. This didn't appear before because
the test were creating the textures with not initial usage and then
transitioned them. This isn't the case with InputStateTest, which is
what uncovered this issue.
This commit is contained in:
Corentin Wallez 2018-01-10 11:48:26 -05:00 committed by Corentin Wallez
parent 2b391dac74
commit a00a5d3d8b
1 changed files with 6 additions and 0 deletions

View File

@ -252,6 +252,12 @@ namespace backend { namespace vulkan {
mMemoryAllocation.GetMemoryOffset()) != VK_SUCCESS) {
ASSERT(false);
}
// Vulkan requires images to be transitioned to their first usage. Do the transition if the
// texture has an initial usage.
if (GetUsage() != nxt::TextureUsageBit::None) {
TransitionUsageImpl(nxt::TextureUsageBit::None, GetUsage());
}
}
Texture::~Texture() {