Port most of the samples to WGSL

Animometer's fragment shaders remains unported because it isn't clear
how to use modf in WGSL.

Bug: dawn:572

Change-Id: I29aa0ee657b813e7308f0300addd1d5795bfc16d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33821
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez
2020-11-26 16:39:46 +00:00
committed by Commit Bot service account
parent 303c5c2d29
commit 4814bdbdea
6 changed files with 180 additions and 155 deletions

View File

@@ -103,13 +103,13 @@ void init() {
gl_Position = vec4(xpos, ypos, 0.0, 1.0);
})");
wgpu::ShaderModule fsModule =
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
#version 450
layout(location = 0) out vec4 fragColor;
layout(location = 0) in vec4 v_color;
void main() {
fragColor = v_color;
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[location(0)]] var<out> FragColor : vec4<f32>;
[[location(0)]] var<in> v_color : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
FragColor = v_color;
return;
})");
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(