Shader: Switch type<subtype> to type[subtype]

This commit is contained in:
Jérôme Leclercq
2022-01-26 19:24:46 +01:00
parent 29a01e975c
commit e6951d54a5
27 changed files with 506 additions and 510 deletions

View File

@@ -6,52 +6,52 @@ option AlphaTest: bool = false;
struct BasicSettings
{
AlphaThreshold: f32,
DiffuseColor: vec4<f32>
DiffuseColor: vec4[f32]
}
[layout(std140)]
struct InstanceData
{
worldMatrix: mat4<f32>,
invWorldMatrix: mat4<f32>
worldMatrix: mat4[f32],
invWorldMatrix: mat4[f32]
}
[layout(std140)]
struct ViewerData
{
projectionMatrix: mat4<f32>,
invProjectionMatrix: mat4<f32>,
viewMatrix: mat4<f32>,
invViewMatrix: mat4<f32>,
viewProjMatrix: mat4<f32>,
invViewProjMatrix: mat4<f32>,
renderTargetSize: vec2<f32>,
invRenderTargetSize: vec2<f32>,
eyePosition: vec3<f32>
projectionMatrix: mat4[f32],
invProjectionMatrix: mat4[f32],
viewMatrix: mat4[f32],
invViewMatrix: mat4[f32],
viewProjMatrix: mat4[f32],
invViewProjMatrix: mat4[f32],
renderTargetSize: vec2[f32],
invRenderTargetSize: vec2[f32],
eyePosition: vec3[f32]
}
external
{
[binding(0)] settings: uniform<BasicSettings>,
[binding(1)] MaterialDiffuseMap: sampler2D<f32>,
[binding(2)] MaterialAlphaMap: sampler2D<f32>,
[binding(3)] TextureOverlay: sampler2D<f32>,
[binding(4)] instanceData: uniform<InstanceData>,
[binding(5)] viewerData: uniform<ViewerData>,
[binding(0)] settings: uniform[BasicSettings],
[binding(1)] MaterialDiffuseMap: sampler2D[f32],
[binding(2)] MaterialAlphaMap: sampler2D[f32],
[binding(3)] TextureOverlay: sampler2D[f32],
[binding(4)] instanceData: uniform[InstanceData],
[binding(5)] viewerData: uniform[ViewerData],
}
struct InputData
{
[location(0)] normal: vec3<f32>,
[location(1)] uv: vec2<f32>,
[location(2)] pos: vec3<f32>
[location(0)] normal: vec3[f32],
[location(1)] uv: vec2[f32],
[location(2)] pos: vec3[f32]
}
struct OutputData
{
[location(0)] diffuseMap: vec4<f32>,
[location(1)] normalMap: vec4<f32>,
[location(2)] positionMap: vec4<f32>
[location(0)] diffuseMap: vec4[f32],
[location(1)] normalMap: vec4[f32],
[location(2)] positionMap: vec4[f32]
}
[entry(frag)]
@@ -72,7 +72,7 @@ fn main(input: InputData) -> OutputData
let output: OutputData;
output.diffuseMap = diffuseColor;
output.normalMap = vec4<f32>((vec3<f32>(1.0, 1.0, 1.0) + input.normal) * 0.5, 1.0);
output.positionMap = vec4<f32>(input.pos, 1.0);
output.normalMap = vec4[f32]((vec3[f32](1.0, 1.0, 1.0) + input.normal) * 0.5, 1.0);
output.positionMap = vec4[f32](input.pos, 1.0);
return output;
}