Update ClipSpaceTests to use WGSL
Bug: dawn:572 Change-Id: Iad55df4f39dfa91ef4554908acb9e2bb45703124 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/32502 Reviewed-by: dan sinclair <dsinclair@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
56523dff69
commit
f6958ff783
|
@ -25,28 +25,31 @@ class ClipSpaceTest : public DawnTest {
|
||||||
// Draw two triangles:
|
// Draw two triangles:
|
||||||
// 1. The depth value of the top-left one is >= 0.5
|
// 1. The depth value of the top-left one is >= 0.5
|
||||||
// 2. The depth value of the bottom-right one is <= 0.5
|
// 2. The depth value of the bottom-right one is <= 0.5
|
||||||
const char* vs =
|
pipelineDescriptor.vertexStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
R"(#version 450
|
const pos : array<vec3<f32>, 6> = array<vec3<f32>, 6>(
|
||||||
const vec3 pos[6] = vec3[6](vec3(-1.0f, 1.0f, 1.0f),
|
vec3<f32>(-1.0, 1.0, 1.0),
|
||||||
vec3(-1.0f, -1.0f, 0.5f),
|
vec3<f32>(-1.0, -1.0, 0.5),
|
||||||
vec3( 1.0f, 1.0f, 0.5f),
|
vec3<f32>( 1.0, 1.0, 0.5),
|
||||||
vec3( 1.0f, 1.0f, 0.5f),
|
vec3<f32>( 1.0, 1.0, 0.5),
|
||||||
vec3(-1.0f, -1.0f, 0.5f),
|
vec3<f32>(-1.0, -1.0, 0.5),
|
||||||
vec3( 1.0f, -1.0f, 0.0f));
|
vec3<f32>( 1.0, -1.0, 0.0));
|
||||||
void main() {
|
|
||||||
gl_Position = vec4(pos[gl_VertexIndex], 1.0);
|
|
||||||
})";
|
|
||||||
pipelineDescriptor.vertexStage.module =
|
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, vs);
|
|
||||||
|
|
||||||
const char* fs =
|
[[builtin(vertex_idx)]] var<in> VertexIndex : i32;
|
||||||
R"(#version 450
|
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||||
layout(location = 0) out vec4 fragColor;
|
|
||||||
void main() {
|
[[stage(vertex)]]
|
||||||
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
fn main() -> void {
|
||||||
})";
|
Position = vec4<f32>(pos[VertexIndex], 1.0);
|
||||||
pipelineDescriptor.cFragmentStage.module =
|
return;
|
||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fs);
|
})");
|
||||||
|
|
||||||
|
pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
|
[[location(0)]] var<out> fragColor : vec4<f32>;;
|
||||||
|
[[stage(fragment)]]
|
||||||
|
fn main() -> void {
|
||||||
|
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||||
|
return;
|
||||||
|
})");
|
||||||
|
|
||||||
pipelineDescriptor.cDepthStencilState.depthCompare = wgpu::CompareFunction::LessEqual;
|
pipelineDescriptor.cDepthStencilState.depthCompare = wgpu::CompareFunction::LessEqual;
|
||||||
pipelineDescriptor.depthStencilState = &pipelineDescriptor.cDepthStencilState;
|
pipelineDescriptor.depthStencilState = &pipelineDescriptor.cDepthStencilState;
|
||||||
|
|
Loading…
Reference in New Issue