From 41c0874c3bab3d4dfc09756c67f22532d0f5c94f Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Thu, 26 Nov 2020 12:23:45 +0000 Subject: [PATCH] Port ShaderModuleValidationTests to WGSL Bug: dawn:572 Change-Id: I112a8f5805e6b673aa51ac00d2471a74c4a5ea92 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33931 Reviewed-by: Ben Clayton Commit-Queue: Corentin Wallez --- .../validation/ShaderModuleValidationTests.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/tests/unittests/validation/ShaderModuleValidationTests.cpp b/src/tests/unittests/validation/ShaderModuleValidationTests.cpp index 60f1df0625..70f298c0c1 100644 --- a/src/tests/unittests/validation/ShaderModuleValidationTests.cpp +++ b/src/tests/unittests/validation/ShaderModuleValidationTests.cpp @@ -97,14 +97,11 @@ TEST_F(ShaderModuleValidationTest, DISABLED_OpUndef) { // be compiled. TEST_F(ShaderModuleValidationTest, FragmentOutputLocationExceedsMaxColorAttachments) { std::ostringstream stream; - stream << R"(#version 450 - layout(location = )" - << static_cast(kMaxColorAttachments) << R"() out vec4 fragColor; - void main() { - fragColor = vec4(0.0, 1.0, 0.0, 1.0); - })"; - ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, - stream.str().c_str())); + stream << "[[location(" << kMaxColorAttachments << R"()]] var fragColor : vec4; + [[stage(fragment)]] fn main() -> void { + fragColor = vec4(0.0, 1.0, 0.0, 1.0); + })"; + ASSERT_DEVICE_ERROR(utils::CreateShaderModuleFromWGSL(device, stream.str().c_str())); } // Test that it is invalid to create a shader module with no chained descriptor. (It must be @@ -115,6 +112,7 @@ TEST_F(ShaderModuleValidationTest, NoChainedDescriptor) { } // Test that it is not allowed to use combined texture and sampler. +// TODO(cwallez@chromium.org): Convert them to SPIRV ASM to remove the dependency on glslang. TEST_F(ShaderModuleValidationTest, CombinedTextureAndSampler) { const char* shader = R"( #version 450