From d5db214564bd781d5a6438a5fa48e39c9ba021b5 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Thu, 26 Mar 2020 00:46:38 +0000 Subject: [PATCH] Collect if a storage texture is declared as multisampled in shader This patch records if a storage texture is declared as multisampled or not in shaders after a fix in shaderc. BUG=dawn:267 TEST=dawn_unittests Change-Id: I3914ccd3bfa4d0b6ab9c7cfb650352b70ba067a5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17600 Commit-Queue: Jiawei Shao Reviewed-by: Kai Ninomiya --- DEPS | 2 +- src/dawn_native/ShaderModule.cpp | 4 ++-- .../StorageTextureValidationTests.cpp | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index dca27e2e23..ea9a36cf9f 100644 --- a/DEPS +++ b/DEPS @@ -69,7 +69,7 @@ deps = { 'condition': 'dawn_standalone', }, 'third_party/shaderc': { - 'url': '{chromium_git}/external/github.com/google/shaderc@eb7bd643ef43ffb9ba091e39a389d0a2a923b1aa', + 'url': '{chromium_git}/external/github.com/google/shaderc@3d915b2802667f44a359463f1f420ac33576001b', 'condition': 'dawn_standalone', }, diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp index 8732a51520..1a7c6b5c8b 100644 --- a/src/dawn_native/ShaderModule.cpp +++ b/src/dawn_native/ShaderModule.cpp @@ -412,8 +412,7 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR( "The storage texture format is not supported"); } - // TODO(jiawei.shao@intel.com): extract info->multisampled when it is - // supported for storage images in SPVC. + info->multisampled = binding.multisampled; info->storageTextureFormat = storageTextureFormat; info->textureDimension = ToWGPUTextureViewDimension(binding.texture_dimension); @@ -615,6 +614,7 @@ namespace dawn_native { return DAWN_VALIDATION_ERROR( "The storage texture format is not supported"); } + info->multisampled = imageType.ms; info->storageTextureFormat = storageTextureFormat; info->textureDimension = SpirvDimToTextureViewDimension(imageType.dim, imageType.arrayed); diff --git a/src/tests/unittests/validation/StorageTextureValidationTests.cpp b/src/tests/unittests/validation/StorageTextureValidationTests.cpp index 3fe0a0c7de..46cc28015b 100644 --- a/src/tests/unittests/validation/StorageTextureValidationTests.cpp +++ b/src/tests/unittests/validation/StorageTextureValidationTests.cpp @@ -846,3 +846,20 @@ TEST_F(StorageTextureValidationTests, StorageTextureViewDimensionInBindGroup) { } } } + +// Verify multisampled storage textures cannot be supported now. +TEST_F(StorageTextureValidationTests, MultisampledStorageTexture) { + for (wgpu::BindingType bindingType : kSupportedStorageTextureBindingTypes) { + std::string computeShader = + CreateComputeShaderWithStorageTexture(bindingType, "rgba8", "", "image2DMS"); + wgpu::ShaderModule csModule = utils::CreateShaderModule( + device, utils::SingleShaderStage::Compute, computeShader.c_str()); + + wgpu::ComputePipelineDescriptor descriptor; + descriptor.layout = nullptr; + descriptor.computeStage.module = csModule; + descriptor.computeStage.entryPoint = "main"; + + ASSERT_DEVICE_ERROR(device.CreateComputePipeline(&descriptor)); + } +}