Update RenderPassTests to use WGSL

Bug: dawn:572
Change-Id: I4a892249dfcb1b1badffd8fb7bd6e509eb654234
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33767
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Austin Eng 2020-11-26 15:36:56 +00:00 committed by Commit Bot service account
parent d7f4e808e7
commit 303c5c2d29
1 changed files with 20 additions and 19 deletions

View File

@ -26,21 +26,24 @@ class RenderPassTest : public DawnTest {
DawnTest::SetUp(); DawnTest::SetUp();
// Shaders to draw a bottom-left triangle in blue. // Shaders to draw a bottom-left triangle in blue.
mVSModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"( mVSModule = utils::CreateShaderModuleFromWGSL(device, R"(
#version 450 [[builtin(vertex_idx)]] var<in> VertexIndex : u32;
void main() { [[builtin(position)]] var<out> Position : vec4<f32>;
const vec2 pos[3] = vec2[3](
vec2(-1.f, 1.f), vec2(1.f, -1.f), vec2(-1.f, -1.f));
gl_Position = vec4(pos[gl_VertexIndex], 0.f, 1.f);
})");
wgpu::ShaderModule fsModule = [[stage(vertex)]] fn main() -> void {
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"( const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
#version 450 vec2<f32>(-1.0, 1.0),
layout(location = 0) out vec4 fragColor; vec2<f32>( 1.0, -1.0),
void main() { vec2<f32>(-1.0, -1.0));
fragColor = vec4(0.0, 0.0, 1.0, 1.0);
})"); Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[location(0)]] var<out> fragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
fragColor = vec4<f32>(0.0, 0.0, 1.0, 1.0);
})");
utils::ComboRenderPipelineDescriptor descriptor(device); utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.vertexStage.module = mVSModule; descriptor.vertexStage.module = mVSModule;
@ -137,11 +140,9 @@ TEST_P(RenderPassTest, NoCorrespondingFragmentShaderOutputs) {
{ {
// Next we use a pipeline whose fragment shader has no outputs. // Next we use a pipeline whose fragment shader has no outputs.
wgpu::ShaderModule fsModule = wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"( [[stage(fragment)]] fn main() -> void {
#version 450 })");
void main() {
})");
utils::ComboRenderPipelineDescriptor descriptor(device); utils::ComboRenderPipelineDescriptor descriptor(device);
descriptor.vertexStage.module = mVSModule; descriptor.vertexStage.module = mVSModule;
descriptor.cFragmentStage.module = fsModule; descriptor.cFragmentStage.module = fsModule;