mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 15:16:16 +00:00
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:
committed by
Commit Bot service account
parent
303c5c2d29
commit
4814bdbdea
@@ -95,23 +95,23 @@ void init() {
|
||||
initBuffers();
|
||||
initTextures();
|
||||
|
||||
wgpu::ShaderModule vsModule =
|
||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||
#version 450
|
||||
layout(location = 0) in vec4 pos;
|
||||
void main() {
|
||||
gl_Position = pos;
|
||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[location(0)]] var<in> pos : vec4<f32>;
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
Position = pos;
|
||||
return;
|
||||
})");
|
||||
|
||||
wgpu::ShaderModule fsModule =
|
||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, R"(
|
||||
#version 450
|
||||
layout(set = 0, binding = 0) uniform sampler mySampler;
|
||||
layout(set = 0, binding = 1) uniform texture2D myTexture;
|
||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
||||
[[set(0), binding(0)]] var<uniform_constant> mySampler: sampler;
|
||||
[[set(0), binding(1)]] var<uniform_constant> myTexture : texture_sampled_2d<f32>;
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
void main() {
|
||||
fragColor = texture(sampler2D(myTexture, mySampler), gl_FragCoord.xy / vec2(640.0, 480.0));
|
||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
FragColor = textureSample(myTexture, mySampler, FragCoord.xy / vec2<f32>(640.0, 480.0));
|
||||
return;
|
||||
})");
|
||||
|
||||
auto bgl = utils::MakeBindGroupLayout(
|
||||
|
||||
Reference in New Issue
Block a user