mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 15:46:28 +00:00
Format: Move the baseType to be per-aspect.
This also introduces a per-aspect supportedComponentTypes that exactly mirrors baseType for now but will contain additional bits in the future (like DepthComparison for depth textures). It is also a step towards being able to create single-aspect view of depth-stencil textures to sample either the depth or the stencil component. Bug: dawn:527 Change-Id: I3ab224d07c136c682cc2993b9a8599237d318130 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/30103 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
b1938273e4
commit
2a8ada7951
@@ -309,6 +309,42 @@ TEST_F(BindGroupValidationTest, TextureComponentType) {
|
||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, uintTextureView}}));
|
||||
}
|
||||
|
||||
// Test which depth-stencil formats are allowed to be sampled.
|
||||
// This is a regression test for a change in dawn_native mistakenly allowing the depth24plus formats
|
||||
// to be sampled without proper backend support.
|
||||
TEST_F(BindGroupValidationTest, SamplingDepthTexture) {
|
||||
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::BindingType::SampledTexture}});
|
||||
|
||||
wgpu::TextureDescriptor desc;
|
||||
desc.size = {1, 1, 1};
|
||||
desc.usage = wgpu::TextureUsage::Sampled;
|
||||
|
||||
// Depth32Float is allowed to be sampled.
|
||||
{
|
||||
desc.format = wgpu::TextureFormat::Depth32Float;
|
||||
wgpu::Texture texture = device.CreateTexture(&desc);
|
||||
|
||||
utils::MakeBindGroup(device, layout, {{0, texture.CreateView()}});
|
||||
}
|
||||
|
||||
// Depth24Plus is not allowed to be sampled.
|
||||
{
|
||||
desc.format = wgpu::TextureFormat::Depth24Plus;
|
||||
wgpu::Texture texture = device.CreateTexture(&desc);
|
||||
|
||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, texture.CreateView()}}));
|
||||
}
|
||||
|
||||
// Depth24PlusStencil8 is not allowed to be sampled.
|
||||
{
|
||||
desc.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
wgpu::Texture texture = device.CreateTexture(&desc);
|
||||
|
||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, texture.CreateView()}}));
|
||||
}
|
||||
}
|
||||
|
||||
// Check that a texture must have the correct dimension
|
||||
TEST_F(BindGroupValidationTest, TextureDimension) {
|
||||
wgpu::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||
|
||||
Reference in New Issue
Block a user