mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 00:47:13 +00:00
Validate creating bind group layout with storage textures
This patch adds the validation on the creation of the bind group layout with read-only storage texture, write-only storage texture and read-write storage texture. Currently read-write storage textures are not supported in any shader stages. This patch also fixes chromium:1061156. BUG=chromium:1061156, dawn:267 TEST=dawn_unittests, dawn_end2end_tests Change-Id: Ib42678719df48565a46e39f21c34ec640960dcdc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16920 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
463c394905
commit
1a56ce54e0
@@ -205,3 +205,36 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
|
||||
ASSERT_DEVICE_ERROR(device.CreateComputePipeline(&descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
// Test that using read-only storage texture and write-only storage texture in
|
||||
// BindGroupLayout is valid, while using read-write storage texture is not allowed now.
|
||||
TEST_F(StorageTextureValidationTests, BindGroupLayoutWithStorageTextureBindingType) {
|
||||
struct TestSpec {
|
||||
wgpu::ShaderStage stage;
|
||||
wgpu::BindingType type;
|
||||
bool valid;
|
||||
};
|
||||
constexpr std::array<TestSpec, 9> kTestSpecs = {
|
||||
{{wgpu::ShaderStage::Vertex, wgpu::BindingType::ReadonlyStorageTexture, true},
|
||||
{wgpu::ShaderStage::Vertex, wgpu::BindingType::WriteonlyStorageTexture, false},
|
||||
{wgpu::ShaderStage::Vertex, wgpu::BindingType::StorageTexture, false},
|
||||
{wgpu::ShaderStage::Fragment, wgpu::BindingType::ReadonlyStorageTexture, true},
|
||||
{wgpu::ShaderStage::Fragment, wgpu::BindingType::WriteonlyStorageTexture, false},
|
||||
{wgpu::ShaderStage::Fragment, wgpu::BindingType::StorageTexture, false},
|
||||
{wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture, true},
|
||||
{wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture, true},
|
||||
{wgpu::ShaderStage::Compute, wgpu::BindingType::StorageTexture, false}}};
|
||||
|
||||
for (const auto& testSpec : kTestSpecs) {
|
||||
wgpu::BindGroupLayoutBinding binding = {0, testSpec.stage, testSpec.type};
|
||||
wgpu::BindGroupLayoutDescriptor descriptor;
|
||||
descriptor.bindingCount = 1;
|
||||
descriptor.bindings = &binding;
|
||||
|
||||
if (testSpec.valid) {
|
||||
device.CreateBindGroupLayout(&descriptor);
|
||||
} else {
|
||||
ASSERT_DEVICE_ERROR(device.CreateBindGroupLayout(&descriptor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user