Update ViewportTests to use WGSL
Bug: dawn:572 Change-Id: I08672a402205d4bcac278a1bdcf5d1befa46015c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33771 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
6442400bdd
commit
65ae78ef52
|
@ -22,26 +22,26 @@ class ViewportTest : public DawnTest {
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
DawnTest::SetUp();
|
DawnTest::SetUp();
|
||||||
|
|
||||||
// TODO(crbug.com/tint/398): GLSL builtins don't work with SPIR-V reader.
|
mQuadVS = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
DAWN_SKIP_TEST_IF(HasToggleEnabled("use_tint_generator"));
|
[[builtin(vertex_idx)]] var<in> VertexIndex : u32;
|
||||||
|
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||||
|
|
||||||
mQuadVS =
|
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(#version 450
|
vec2<f32>(-1.0, 1.0),
|
||||||
const vec2 pos[6] = vec2[6](vec2(-1.0f, 1.0f),
|
vec2<f32>(-1.0, -1.0),
|
||||||
vec2(-1.0f, -1.0f),
|
vec2<f32>( 1.0, 1.0),
|
||||||
vec2( 1.0f, 1.0f),
|
vec2<f32>( 1.0, 1.0),
|
||||||
vec2( 1.0f, 1.0f),
|
vec2<f32>(-1.0, -1.0),
|
||||||
vec2(-1.0f, -1.0f),
|
vec2<f32>( 1.0, -1.0));
|
||||||
vec2( 1.0f, -1.0f));
|
|
||||||
void main() {
|
[[stage(vertex)]] fn main() -> void {
|
||||||
gl_Position = vec4(pos[gl_VertexIndex], 0.0, 1.0);
|
Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
mQuadFS =
|
mQuadFS = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(#version 450
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
layout(location = 0) out vec4 fragColor;
|
[[stage(fragment)]] fn main() -> void {
|
||||||
void main() {
|
fragColor = vec4<f32>(1.0, 1.0, 1.0, 1.0);
|
||||||
fragColor = vec4(1.0);
|
|
||||||
})");
|
})");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,14 +95,17 @@ class ViewportTest : public DawnTest {
|
||||||
void TestViewportDepth(float minDepth, float maxDepth, bool doViewportCall = true) {
|
void TestViewportDepth(float minDepth, float maxDepth, bool doViewportCall = true) {
|
||||||
// Create a pipeline drawing 3 points at depth 1.0, 0.5 and 0.0.
|
// Create a pipeline drawing 3 points at depth 1.0, 0.5 and 0.0.
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
utils::ComboRenderPipelineDescriptor pipelineDesc(device);
|
||||||
pipelineDesc.vertexStage.module =
|
pipelineDesc.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(#version 450
|
[[builtin(vertex_idx)]] var<in> VertexIndex : u32;
|
||||||
const vec3 points[3] = vec3[3](vec3(-0.9f, 0.0f, 1.0f),
|
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||||
vec3( 0.0f, 0.0f, 0.5f),
|
|
||||||
vec3( 0.9f, 0.0f, 0.0f));
|
const points : array<vec3<f32>, 3> = array<vec3<f32>, 3>(
|
||||||
void main() {
|
vec3<f32>(-0.9, 0.0, 1.0),
|
||||||
gl_Position = vec4(points[gl_VertexIndex], 1.0);
|
vec3<f32>( 0.0, 0.0, 0.5),
|
||||||
gl_PointSize = 1.0;
|
vec3<f32>( 0.9, 0.0, 0.0));
|
||||||
|
|
||||||
|
[[stage(vertex)]] fn main() -> void {
|
||||||
|
Position = vec4<f32>(points[VertexIndex], 1.0);
|
||||||
})");
|
})");
|
||||||
pipelineDesc.cFragmentStage.module = mQuadFS;
|
pipelineDesc.cFragmentStage.module = mQuadFS;
|
||||||
pipelineDesc.colorStateCount = 0;
|
pipelineDesc.colorStateCount = 0;
|
||||||
|
|
Loading…
Reference in New Issue