[tint][ir][ToProgram] Fix vars with handle address space
Change-Id: I55e31be3e6cb05ecbdbc5fd7c9e47862f89c098b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/140985
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
diff --git a/src/tint/ir/to_program.cc b/src/tint/ir/to_program.cc
index d35863b..34fa1a3 100644
--- a/src/tint/ir/to_program.cc
+++ b/src/tint/ir/to_program.cc
@@ -520,6 +520,9 @@
case builtin::AddressSpace::kStorage:
b.GlobalVar(name, ty, init, ptr->Access(), ptr->AddressSpace(), std::move(attrs));
return;
+ case builtin::AddressSpace::kHandle:
+ b.GlobalVar(name, ty, init, std::move(attrs));
+ return;
default:
b.GlobalVar(name, ty, init, ptr->AddressSpace(), std::move(attrs));
return;
diff --git a/src/tint/ir/to_program_roundtrip_test.cc b/src/tint/ir/to_program_roundtrip_test.cc
index e737032..af2f4b5 100644
--- a/src/tint/ir/to_program_roundtrip_test.cc
+++ b/src/tint/ir/to_program_roundtrip_test.cc
@@ -1681,6 +1681,17 @@
TEST_F(IRToProgramRoundtripTest, ModuleScopeVar_StorageReadWrite_i32) {
Test("@group(10) @binding(20) var<storage, read_write> v : i32;");
}
+TEST_F(IRToProgramRoundtripTest, ModuleScopeVar_Handle_Texture2D) {
+ Test("@group(0) @binding(0) var t : texture_2d<f32>;");
+}
+
+TEST_F(IRToProgramRoundtripTest, ModuleScopeVar_Handle_Sampler) {
+ Test("@group(0) @binding(0) var s : sampler;");
+}
+
+TEST_F(IRToProgramRoundtripTest, ModuleScopeVar_Handle_SamplerCmp) {
+ Test("@group(0) @binding(0) var s : sampler_comparison;");
+}
////////////////////////////////////////////////////////////////////////////////
// Function-scope var