Update RenderPassLoadOpTests to use WGSL

Bug: dawn:572
Change-Id: Ib955b4cff1a43dfa42a6cebfcbd88bf128e22644
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33770
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Austin Eng 2020-11-30 20:48:21 +00:00 committed by Commit Bot service account
parent 6a7095d8c7
commit 70b9db3ffc
1 changed files with 21 additions and 16 deletions

View File

@ -26,8 +26,8 @@ class DrawQuad {
DrawQuad() { DrawQuad() {
} }
DrawQuad(wgpu::Device device, const char* vsSource, const char* fsSource) : device(device) { DrawQuad(wgpu::Device device, const char* vsSource, const char* fsSource) : device(device) {
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vsSource); vsModule = utils::CreateShaderModuleFromWGSL(device, vsSource);
fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fsSource); fsModule = utils::CreateShaderModuleFromWGSL(device, fsSource);
pipelineLayout = utils::MakeBasicPipelineLayout(device, nullptr); pipelineLayout = utils::MakeBasicPipelineLayout(device, nullptr);
} }
@ -77,21 +77,26 @@ class RenderPassLoadOpTests : public DawnTest {
// draws a blue quad on the right half of the screen // draws a blue quad on the right half of the screen
const char* vsSource = R"( const char* vsSource = R"(
#version 450 [[builtin(vertex_idx)]] var<in> VertexIndex : u32;
void main() { [[builtin(position)]] var<out> Position : vec4<f32>;
const vec2 pos[6] = vec2[6](
vec2(0, -1), vec2(1, -1), vec2(0, 1), [[stage(vertex)]] fn main() -> void {
vec2(0, 1), vec2(1, -1), vec2(1, 1)); const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
gl_Position = vec4(pos[gl_VertexIndex], 0.f, 1.f); vec2<f32>( 0.0, -1.0),
} vec2<f32>( 1.0, -1.0),
)"; vec2<f32>( 0.0, 1.0),
vec2<f32>( 0.0, 1.0),
vec2<f32>( 1.0, -1.0),
vec2<f32>( 1.0, 1.0));
Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
})";
const char* fsSource = R"( const char* fsSource = R"(
#version 450 [[location(0)]] var<out> fragColor : vec4<f32>;
layout(location = 0) out vec4 color; [[stage(fragment)]] fn main() -> void {
void main() { fragColor = vec4<f32>(0.0, 0.0, 1.0, 1.0);
color = vec4(0.f, 0.f, 1.f, 1.f); })";
}
)";
blueQuad = DrawQuad(device, vsSource, fsSource); blueQuad = DrawQuad(device, vsSource, fsSource);
} }