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>
diff --git a/src/dawn_native/ShaderModule.cpp b/src/dawn_native/ShaderModule.cpp
index 1908264..9e0165c 100644
--- a/src/dawn_native/ShaderModule.cpp
+++ b/src/dawn_native/ShaderModule.cpp
@@ -113,16 +113,12 @@
                     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 @@
                                   "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"));