Vulkan: Implement textures in bindgroups

Also enable the sampler tests on the Vulkan backend
This commit is contained in:
Corentin Wallez 2018-04-17 22:33:20 -04:00 committed by Corentin Wallez
parent e44b900861
commit 5ec9683800
2 changed files with 13 additions and 2 deletions

View File

@ -18,6 +18,7 @@
#include "BufferVk.h"
#include "FencedDeleter.h"
#include "SamplerVk.h"
#include "TextureVk.h"
#include "VulkanBackend.h"
namespace backend { namespace vulkan {
@ -95,7 +96,17 @@ namespace backend { namespace vulkan {
write.pImageInfo = &writeImageInfo[numWrites];
} break;
case nxt::BindingType::SampledTexture:
case nxt::BindingType::SampledTexture: {
TextureView* view = ToBackend(GetBindingAsTextureView(bindingIndex));
writeImageInfo[numWrites].imageView = view->GetHandle();
// TODO(cwallez@chromium.org): This isn't true in general: if the image can has
// two read-only usages one of which is Sampled. Works for now though :)
writeImageInfo[numWrites].imageLayout =
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
write.pImageInfo = &writeImageInfo[numWrites];
} break;
default:
UNREACHABLE();
}

View File

@ -168,4 +168,4 @@ TEST_P(SamplerTest, AddressMode) {
}
}
NXT_INSTANTIATE_TEST(SamplerTest, D3D12Backend, MetalBackend, OpenGLBackend)
NXT_INSTANTIATE_TEST(SamplerTest, D3D12Backend, MetalBackend, OpenGLBackend, VulkanBackend)