diff --git a/src/dawn_native/BindGroupLayout.cpp b/src/dawn_native/BindGroupLayout.cpp index 907462a6c2..891fb890c7 100644 --- a/src/dawn_native/BindGroupLayout.cpp +++ b/src/dawn_native/BindGroupLayout.cpp @@ -38,10 +38,9 @@ namespace dawn_native { } case wgpu::BindingType::WriteonlyStorageTexture: { - if ((shaderStageVisibility & - (wgpu::ShaderStage::Vertex | wgpu::ShaderStage::Fragment)) != 0) { + if ((shaderStageVisibility & wgpu::ShaderStage::Vertex) != 0) { return DAWN_VALIDATION_ERROR( - "write-only storage texture binding is only supported in compute shader"); + "write-only storage texture binding is not supported in vertex shader"); } break; } diff --git a/src/dawn_native/PipelineLayout.cpp b/src/dawn_native/PipelineLayout.cpp index 6dc39c7384..7626c04b1c 100644 --- a/src/dawn_native/PipelineLayout.cpp +++ b/src/dawn_native/PipelineLayout.cpp @@ -36,10 +36,8 @@ namespace dawn_native { // TODO(jiawei.shao@intel.com): support read-only and read-write storage textures. switch (bindingType) { case wgpu::BindingType::StorageBuffer: - return wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute; - case wgpu::BindingType::WriteonlyStorageTexture: - return wgpu::ShaderStage::Compute; + return wgpu::ShaderStage::Fragment | wgpu::ShaderStage::Compute; case wgpu::BindingType::StorageTexture: UNREACHABLE(); diff --git a/src/tests/unittests/validation/StorageTextureValidationTests.cpp b/src/tests/unittests/validation/StorageTextureValidationTests.cpp index 910a650fc2..af6e8eb3ca 100644 --- a/src/tests/unittests/validation/StorageTextureValidationTests.cpp +++ b/src/tests/unittests/validation/StorageTextureValidationTests.cpp @@ -188,8 +188,8 @@ class StorageTextureValidationTests : public ValidationTest { wgpu::BindingType::ReadonlyStorageTexture, wgpu::BindingType::WriteonlyStorageTexture}; }; -// Validate read-only storage textures can be declared in vertex and fragment -// shaders, while writeonly storage textures can't. +// Validate read-only storage textures can be declared in vertex and fragment shaders, while +// writeonly storage textures cannot be used in vertex shaders. TEST_F(StorageTextureValidationTests, RenderPipeline) { // Readonly storage texture can be declared in a vertex shader. { @@ -243,7 +243,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) { ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor)); } - // Write-only storage textures cannot be declared in a fragment shader. + // Write-only storage textures can be declared in a fragment shader. { wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"( @@ -257,7 +257,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) { descriptor.layout = nullptr; descriptor.vertexStage.module = mDefaultVSModule; descriptor.cFragmentStage.module = fsModule; - ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor)); + device.CreateRenderPipeline(&descriptor); } } @@ -374,7 +374,7 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutWithStorageTextureBindingTy {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::WriteonlyStorageTexture, true}, {wgpu::ShaderStage::Fragment, wgpu::BindingType::StorageTexture, false}, {wgpu::ShaderStage::Compute, wgpu::BindingType::ReadonlyStorageTexture, true}, {wgpu::ShaderStage::Compute, wgpu::BindingType::WriteonlyStorageTexture, true},