diff --git a/src/tests/end2end/StorageTextureTests.cpp b/src/tests/end2end/StorageTextureTests.cpp index 94b03cd76e..6351974afd 100644 --- a/src/tests/end2end/StorageTextureTests.cpp +++ b/src/tests/end2end/StorageTextureTests.cpp @@ -655,39 +655,6 @@ fn IsEqualTo(pixel : vec4, expected : vec4) -> bool { const char* kComputeExpectedValue = "1 + x + size.x * (y + size.y * layer)"; }; -// Test that using read-only storage texture and write-only storage texture in BindGroupLayout is -// valid on all backends. This test is a regression test for chromium:1061156 and passes by not -// asserting or crashing. -TEST_P(StorageTextureTests, BindGroupLayoutWithStorageTextureBindingType) { - // ReadOnly is a valid storage texture binding type to create a bind group - // layout. - { - wgpu::BindGroupLayoutEntry entry; - entry.binding = 0; - entry.visibility = wgpu::ShaderStage::Compute; - entry.storageTexture.access = wgpu::StorageTextureAccess::ReadOnly; - entry.storageTexture.format = wgpu::TextureFormat::R32Float; - wgpu::BindGroupLayoutDescriptor descriptor; - descriptor.entryCount = 1; - descriptor.entries = &entry; - device.CreateBindGroupLayout(&descriptor); - } - - // WriteOnly is a valid storage texture binding type to create a bind group - // layout. - { - wgpu::BindGroupLayoutEntry entry; - entry.binding = 0; - entry.visibility = wgpu::ShaderStage::Compute; - entry.storageTexture.access = wgpu::StorageTextureAccess::WriteOnly; - entry.storageTexture.format = wgpu::TextureFormat::R32Float; - wgpu::BindGroupLayoutDescriptor descriptor; - descriptor.entryCount = 1; - descriptor.entries = &entry; - device.CreateBindGroupLayout(&descriptor); - } -} - // Test that read-only storage textures are supported in compute shader. TEST_P(StorageTextureTests, ReadonlyStorageTextureInComputeShader) { for (wgpu::TextureFormat format : utils::kAllTextureFormats) { diff --git a/src/tests/unittests/validation/StorageTextureValidationTests.cpp b/src/tests/unittests/validation/StorageTextureValidationTests.cpp index 919ad601a3..6868daeb9b 100644 --- a/src/tests/unittests/validation/StorageTextureValidationTests.cpp +++ b/src/tests/unittests/validation/StorageTextureValidationTests.cpp @@ -95,9 +95,10 @@ class StorageTextureValidationTests : public ValidationTest { wgpu::Texture CreateTexture(wgpu::TextureUsage usage, wgpu::TextureFormat format, uint32_t sampleCount = 1, - uint32_t arrayLayerCount = 1) { + uint32_t arrayLayerCount = 1, + wgpu::TextureDimension dimension = wgpu::TextureDimension::e2D) { wgpu::TextureDescriptor descriptor; - descriptor.dimension = wgpu::TextureDimension::e2D; + descriptor.dimension = dimension; descriptor.size = {16, 16, arrayLayerCount}; descriptor.sampleCount = sampleCount; descriptor.format = format; @@ -686,16 +687,13 @@ TEST_F(StorageTextureValidationTests, StorageTextureFormatInBindGroup) { // bind group must match the corresponding bind group binding. TEST_F(StorageTextureValidationTests, StorageTextureViewDimensionInBindGroup) { constexpr wgpu::TextureFormat kStorageTextureFormat = wgpu::TextureFormat::R32Float; - constexpr uint32_t kArrayLayerCount = 6u; + constexpr uint32_t kDepthOrArrayLayers = 6u; - // Currently we only support creating 2D-compatible texture view dimensions. - // TODO(jiawei.shao@intel.com): test the use of 1D and 3D texture view dimensions when they are + // TODO(crbug.com/dawn/814): test the use of 1D texture view dimensions when they are // supported in Dawn. - constexpr std::array kSupportedDimensions = { - wgpu::TextureViewDimension::e2D, wgpu::TextureViewDimension::e2DArray}; - - wgpu::Texture texture = - CreateTexture(wgpu::TextureUsage::Storage, kStorageTextureFormat, 1, kArrayLayerCount); + constexpr std::array kSupportedDimensions = { + wgpu::TextureViewDimension::e2D, wgpu::TextureViewDimension::e2DArray, + wgpu::TextureViewDimension::e3D}; wgpu::TextureViewDescriptor kDefaultTextureViewDescriptor; kDefaultTextureViewDescriptor.format = kStorageTextureFormat; @@ -720,6 +718,14 @@ TEST_F(StorageTextureValidationTests, StorageTextureViewDimensionInBindGroup) { for (wgpu::TextureViewDimension dimensionOfTextureView : kSupportedDimensions) { // Create a texture view with given texture view dimension. + wgpu::TextureDimension dimension = wgpu::TextureDimension::e2D; + if (dimensionOfTextureView == wgpu::TextureViewDimension::e3D) { + dimension = wgpu::TextureDimension::e3D; + } + wgpu::Texture texture = + CreateTexture(wgpu::TextureUsage::Storage, kStorageTextureFormat, 1, + kDepthOrArrayLayers, dimension); + wgpu::TextureViewDescriptor textureViewDescriptor = kDefaultTextureViewDescriptor; textureViewDescriptor.dimension = dimensionOfTextureView; wgpu::TextureView storageTextureView = texture.CreateView(&textureViewDescriptor);