Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [nzsl_version("1.1")]
- module;
- import VertOut, VertexShader from Engine.FullscreenVertex;
- option HasTexture: bool; //< a compilation constant set by the application
- [layout(std140)]
- struct Parameters
- {
- colorMultiplier: vec4[f32]
- }
- external
- {
- [binding(0)] params: uniform[Parameters],
- [cond(HasTexture), binding(1)] texture: sampler2D[f32]
- }
- struct FragOut
- {
- [location(0)] color: vec4[f32]
- }
- [entry(frag)]
- fn main(input: VertOut) -> FragOut
- {
- let output: FragOut;
- output.color = params.colorMultiplier;
- const if (HasTexture)
- output.color.rgb *= texture.Sample(input.uv).rgb;
- return output;
- }
Advertisement
Add Comment
Please, Sign In to add comment