mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 18:59:21 +00:00
Implement BGLBinding::textureDimension
In WebGPU the BGLBinding needs to know the texture dimension for compatibility reasons between the texture views passed and the pipelines. This adds the member and implements the restriction. BUG=dawn:22 Change-Id: I95204de1cd621c936994739e840c76351fea9035 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10960 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
dbe74bc4a2
commit
86e74e0dc1
@@ -303,12 +303,12 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
|
||||
TEST_F(BindGroupValidationTest, TextureComponentType) {
|
||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture, false, false,
|
||||
dawn::TextureComponentType::Float}});
|
||||
dawn::TextureViewDimension::e2D, dawn::TextureComponentType::Float}});
|
||||
|
||||
// Control case: setting a Float typed texture view works.
|
||||
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
|
||||
|
||||
// Make an output attachment texture and try to set it for a SampledTexture binding
|
||||
// Make a Uint component typed texture and try to set it to a Float component binding.
|
||||
dawn::TextureDescriptor descriptor;
|
||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||
descriptor.size = {16, 16, 1};
|
||||
@@ -323,6 +323,30 @@ TEST_F(BindGroupValidationTest, TextureComponentType) {
|
||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, uintTextureView}}));
|
||||
}
|
||||
|
||||
// Check that a texture must have the correct dimension
|
||||
TEST_F(BindGroupValidationTest, TextureDimension) {
|
||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||
device, {{0, dawn::ShaderStage::Fragment, dawn::BindingType::SampledTexture, false, false,
|
||||
dawn::TextureViewDimension::e2D, dawn::TextureComponentType::Float}});
|
||||
|
||||
// Control case: setting a 2D texture view works.
|
||||
utils::MakeBindGroup(device, layout, {{0, mSampledTextureView}});
|
||||
|
||||
// Make a 2DArray texture and try to set it to a 2D binding.
|
||||
dawn::TextureDescriptor descriptor;
|
||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||
descriptor.size = {16, 16, 1};
|
||||
descriptor.arrayLayerCount = 2;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Uint;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsage::Sampled;
|
||||
dawn::Texture arrayTexture = device.CreateTexture(&descriptor);
|
||||
dawn::TextureView arrayTextureView = arrayTexture.CreateView();
|
||||
|
||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, arrayTextureView}}));
|
||||
}
|
||||
|
||||
// Check that a UBO must have the correct usage
|
||||
TEST_F(BindGroupValidationTest, BufferUsageUBO) {
|
||||
dawn::BindGroupLayout layout = utils::MakeBindGroupLayout(
|
||||
|
||||
Reference in New Issue
Block a user