Fix RenderTest shader code

This commit is contained in:
Jérôme Leclercq 2021-04-15 15:01:58 +02:00
parent 9fd4249a87
commit 7da02c8708
1 changed files with 12 additions and 12 deletions

View File

@ -9,7 +9,7 @@
#include <iostream> #include <iostream>
const char shaderSource[] = R"( const char shaderSource[] = R"(
[[layout(std140)]] [layout(std140)]
struct Data struct Data
{ {
projectionMatrix: mat4<f32>, projectionMatrix: mat4<f32>,
@ -19,30 +19,30 @@ struct Data
external external
{ {
[[binding(0)]] viewerData: uniform<Data>, [binding(0)] viewerData: uniform<Data>,
[[binding(1)]] tex: sampler2D<f32> [binding(1)] tex: sampler2D<f32>
} }
struct VertIn struct VertIn
{ {
[[location(0)]] position: vec3<f32>, [location(0)] position: vec3<f32>,
[[location(1)]] normal: vec3<f32>, [location(1)] normal: vec3<f32>,
[[location(2)]] uv: vec2<f32> [location(2)] uv: vec2<f32>
} }
struct VertOut struct VertOut
{ {
[[builtin(position)]] position: vec4<f32>, [builtin(position)] position: vec4<f32>,
[[location(0)]] normal: vec3<f32>, [location(0)] normal: vec3<f32>,
[[location(1)]] uv: vec2<f32> [location(1)] uv: vec2<f32>
} }
struct FragOut struct FragOut
{ {
[[location(0)]] color: vec4<f32> [location(0)] color: vec4<f32>
} }
[[entry(frag)]] [entry(frag)]
fn main(fragIn: VertOut) -> FragOut fn main(fragIn: VertOut) -> FragOut
{ {
let lightDir = vec3<f32>(0.0, -0.707, 0.707); let lightDir = vec3<f32>(0.0, -0.707, 0.707);
@ -54,7 +54,7 @@ fn main(fragIn: VertOut) -> FragOut
return fragOut; return fragOut;
} }
[[entry(vert)]] [entry(vert)]
fn main(vertIn: VertIn) -> VertOut fn main(vertIn: VertIn) -> VertOut
{ {
let vertOut: VertOut; let vertOut: VertOut;