[glsl][ir] Support depth multisampled texture types
This CL adds support for the `DepthMultisampledTexture` type.
Bug: 42251044
Change-Id: Id1f79204f73845954a622a8750bbd1d2f027fe1b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/204517
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/glsl/writer/printer/printer.cc b/src/tint/lang/glsl/writer/printer/printer.cc
index f70583e..6fb0740 100644
--- a/src/tint/lang/glsl/writer/printer/printer.cc
+++ b/src/tint/lang/glsl/writer/printer/printer.cc
@@ -54,6 +54,7 @@
#include "src/tint/lang/core/texel_format.h"
#include "src/tint/lang/core/type/array.h"
#include "src/tint/lang/core/type/bool.h"
+#include "src/tint/lang/core/type/depth_multisampled_texture.h"
#include "src/tint/lang/core/type/depth_texture.h"
#include "src/tint/lang/core/type/f16.h"
#include "src/tint/lang/core/type/f32.h"
@@ -452,6 +453,7 @@
auto* storage = t->As<core::type::StorageTexture>();
auto* sampled = t->As<core::type::SampledTexture>();
auto* ms = t->As<core::type::MultisampledTexture>();
+ auto* depth_ms = t->As<core::type::DepthMultisampledTexture>();
out << "highp ";
@@ -504,7 +506,7 @@
break;
case core::type::TextureDimension::k2d:
out << "2D";
- if (ms) {
+ if (ms || depth_ms) {
out << "MS";
}
break;
diff --git a/src/tint/lang/glsl/writer/type_test.cc b/src/tint/lang/glsl/writer/type_test.cc
index 9e73ee5..2bc7a60 100644
--- a/src/tint/lang/glsl/writer/type_test.cc
+++ b/src/tint/lang/glsl/writer/type_test.cc
@@ -559,19 +559,19 @@
GlslDepthTextureData{core::type::TextureDimension::kCube, "samplerCubeShadow"},
GlslDepthTextureData{core::type::TextureDimension::kCubeArray, "samplerCubeArrayShadow"}));
-// TODO(dsinclair): Add depth multisampled support
-TEST_F(GlslWriterTest, DISABLED_EmitType_DepthMultisampledTexture) {
+TEST_F(GlslWriterTest, EmitType_DepthMultisampledTexture) {
auto* t = ty.Get<core::type::DepthMultisampledTexture>(core::type::TextureDimension::k2d);
- auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kCompute);
+ auto* func = b.Function("foo", ty.void_());
auto* param = b.FunctionParam("a", t);
func->SetParams({param});
- func->SetWorkgroupSize(1, 1, 1);
b.Append(func->Block(), [&] { b.Return(func); });
ASSERT_TRUE(Generate()) << err_ << output_.glsl;
- EXPECT_EQ(output_.glsl, R"(
+ EXPECT_EQ(output_.glsl, GlslHeader() + R"(
+void foo(highp sampler2DMS a) {
+}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
-void main(sampler2DMS a) {
+void main() {
}
)");
}