Port ShaderModuleValidationTests to WGSL

Bug: dawn:572
Change-Id: I112a8f5805e6b673aa51ac00d2471a74c4a5ea92
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33931
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-11-26 12:23:45 +00:00 committed by Commit Bot service account
parent 71279dcde7
commit 41c0874c3b
1 changed files with 6 additions and 8 deletions

View File

@ -97,14 +97,11 @@ TEST_F(ShaderModuleValidationTest, DISABLED_OpUndef) {
// be compiled. // be compiled.
TEST_F(ShaderModuleValidationTest, FragmentOutputLocationExceedsMaxColorAttachments) { TEST_F(ShaderModuleValidationTest, FragmentOutputLocationExceedsMaxColorAttachments) {
std::ostringstream stream; std::ostringstream stream;
stream << R"(#version 450 stream << "[[location(" << kMaxColorAttachments << R"()]] var<out> fragColor : vec4<f32>;
layout(location = )" [[stage(fragment)]] fn main() -> void {
<< static_cast<unsigned>(kMaxColorAttachments) << R"() out vec4 fragColor; fragColor = vec4<f32>(0.0, 1.0, 0.0, 1.0);
void main() {
fragColor = vec4(0.0, 1.0, 0.0, 1.0);
})"; })";
ASSERT_DEVICE_ERROR(utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, ASSERT_DEVICE_ERROR(utils::CreateShaderModuleFromWGSL(device, stream.str().c_str()));
stream.str().c_str()));
} }
// Test that it is invalid to create a shader module with no chained descriptor. (It must be // 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. // 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) { TEST_F(ShaderModuleValidationTest, CombinedTextureAndSampler) {
const char* shader = R"( const char* shader = R"(
#version 450 #version 450