From 1f9b5960d8b20a7aa82cbf1adebea8380f49c936 Mon Sep 17 00:00:00 2001 From: Ryan Harrison <rharrison@chromium.org> Date: Wed, 18 Mar 2020 16:33:58 +0000 Subject: [PATCH] Use new binding type reflection provided by spvc This adds parity for reflection features in the spvc-only code path up to 421684f. Additionally changes will be needed to bring support to parity up to HEAD. BUG=dawn:337 Change-Id: I2143587c54018da766934fa60d80aedd1ccd151b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17165 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org> --- src/dawn_native/ShaderModule.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp index 1908264e4a..9e0165c204 100644 --- a/src/dawn_native/ShaderModule.cpp +++ b/src/dawn_native/ShaderModule.cpp @@ -113,16 +113,12 @@ namespace dawn_native { return wgpu::BindingType::Sampler; case shaderc_spvc_binding_type_sampled_texture: return wgpu::BindingType::SampledTexture; - - // TODO(jiawei.shao@intel.com): add convertion to read-only and write-only storage - // textures when they are supported as shaderc_spvc binding types. + case shaderc_spvc_binding_type_readonly_storage_texture: + return wgpu::BindingType::ReadonlyStorageTexture; + case shaderc_spvc_binding_type_writeonly_storage_texture: + return wgpu::BindingType::WriteonlyStorageTexture; case shaderc_spvc_binding_type_storage_texture: return wgpu::BindingType::StorageTexture; - default: - // TODO(rharrison): Remove this case once I am done changing the - // values in shaderc_spvc_binding_type - UNREACHABLE(); - return wgpu::BindingType::StorageTexture; } UNREACHABLE(); } @@ -357,6 +353,13 @@ namespace dawn_native { "Unable to get binding info for storage buffers from shader")); DAWN_TRY(ExtractResourcesBinding(resource_bindings)); + DAWN_TRY(CheckSpvcSuccess( + mSpvcContext.GetBindingInfo(shaderc_spvc_shader_resource_storage_images, + shaderc_spvc_binding_type_storage_texture, + &resource_bindings), + "Unable to get binding info for storage textures from shader")); + DAWN_TRY(ExtractResourcesBinding(resource_bindings)); + std::vector<shaderc_spvc_resource_location_info> input_stage_locations; DAWN_TRY(CheckSpvcSuccess(mSpvcContext.GetInputStageLocationInfo(&input_stage_locations), "Unable to get input stage location information from shader"));