Harbor

branch main
showing the latest snapshot on main
spec_constant.wgsl 1.0 KB · Plain text
gpu/shader/tests/golden/spec_constant.wgsl 0644 Raw
@id(0) override NUM_LIGHTS: i32 = 4;
@id(1) override BRIGHTNESS: f32 = 1.0;
@id(2) override USE_GAMMA: bool = true;

struct _vs_main_Input {
	@location(0) position: vec3<f32>,
}

struct VertexOutput {
	@builtin(position) position: vec4<f32>,
}

struct _fs_main_Input {
	@location(0) frag_coord: vec4<f32>,
}

struct _fs_main_Output {
	@location(0) color: vec4<f32>,
}

struct Uniforms {
	base_color: vec3<f32>,
	ambient: f32,
}

@group(0) @binding(0) var<uniform> uniforms: Uniforms;

@vertex
fn vs_main(input: _vs_main_Input) -> VertexOutput {
	var __luma_output: VertexOutput;
	__luma_output.position = vec4<f32>(input.position, 1.0);
	return __luma_output;
}

@fragment
fn fs_main(input: _fs_main_Input) -> _fs_main_Output {
	var __luma_output: _fs_main_Output;
	let color = (uniforms.base_color * uniforms.ambient);
	let i = 0;
	while ((i < NUM_LIGHTS)) {
		color = (color + vec3<f32>(0.1, 0.1, 0.1));
		i = (i + 1);
	}
	color = (color * BRIGHTNESS);
	__luma_output.color = vec4<f32>(color, 1.0);
	return __luma_output;
}