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 <jiawei.shao@intel.com>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Jiawei Shao
2020-03-26 00:46:38 +00:00
committed by Commit Bot service account
parent 046389926f
commit d5db214564
3 changed files with 20 additions and 3 deletions

View File

@@ -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);

View File

@@ -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));
}
}