Update DepthStencilStateTests to use WGSL
Bug: dawn:572 Change-Id: Ia0bc64304cfa91e3c5f0179781eeef0eab21323a Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33761 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
7faa362ea9
commit
424fd82889
|
@ -52,32 +52,38 @@ class DepthStencilStateTest : public DawnTest {
|
||||||
|
|
||||||
depthTextureView = depthTexture.CreateView();
|
depthTextureView = depthTexture.CreateView();
|
||||||
|
|
||||||
vsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
#version 450
|
[[block]] struct UBO {
|
||||||
layout(set = 0, binding = 0) uniform myBlock {
|
[[offset(0)]] color : vec3<f32>;
|
||||||
vec3 color;
|
[[offset(12)]] depth : f32;
|
||||||
float depth;
|
};
|
||||||
} myUbo;
|
[[set(0), binding(0)]] var<uniform> ubo : UBO;
|
||||||
void main() {
|
[[builtin(vertex_idx)]] var<in> VertexIndex : u32;
|
||||||
const vec2 pos[6] = vec2[6](
|
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||||
vec2(-1.f, 1.f), vec2(-1.f, -1.f), vec2(1.f, -1.f), // front-facing
|
|
||||||
vec2(-1.f, 1.f), vec2(1.f, 1.f), vec2(1.f, -1.f) // back-facing
|
|
||||||
);
|
|
||||||
gl_Position = vec4(pos[gl_VertexIndex], myUbo.depth, 1.f);
|
|
||||||
}
|
|
||||||
)");
|
|
||||||
|
|
||||||
fsModule = utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
[[stage(vertex)]] fn main() -> void {
|
||||||
#version 450
|
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
||||||
layout(set = 0, binding = 0) uniform myBlock {
|
vec2<f32>(-1.0, 1.0),
|
||||||
vec3 color;
|
vec2<f32>(-1.0, -1.0),
|
||||||
float depth;
|
vec2<f32>( 1.0, -1.0), # front-facing
|
||||||
} myUbo;
|
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)); # back-facing
|
||||||
fragColor = vec4(myUbo.color, 1.f);
|
Position = vec4<f32>(pos[VertexIndex], ubo.depth, 1.0);
|
||||||
}
|
})");
|
||||||
)");
|
|
||||||
|
fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
|
[[block]] struct UBO {
|
||||||
|
[[offset(0)]] color : vec3<f32>;
|
||||||
|
[[offset(12)]] depth : f32;
|
||||||
|
};
|
||||||
|
[[set(0), binding(0)]] var<uniform> ubo : UBO;
|
||||||
|
|
||||||
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
|
|
||||||
|
[[stage(fragment)]] fn main() -> void {
|
||||||
|
fragColor = vec4<f32>(ubo.color, 1.0);
|
||||||
|
})");
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TestSpec {
|
struct TestSpec {
|
||||||
|
|
Loading…
Reference in New Issue