Harbor

branch main
showing the latest snapshot on main
spec_constant.hlsl 1.0 KB · Plain text
gpu/shader/tests/golden/spec_constant.hlsl 0644 Raw
[[vk::constant_id(0)]] const int NUM_LIGHTS = 4;
[[vk::constant_id(1)]] const float BRIGHTNESS = 1.0;
[[vk::constant_id(2)]] const bool USE_GAMMA = true;

struct Uniforms {
	float3 base_color;
	float ambient;
};
cbuffer uniforms_CB : register(b0, space0) {
	Uniforms uniforms;
};

struct _vs_main_Input {
	float3 position : TEXCOORD0;
};

struct VertexOutput {
	float4 position : SV_Position;
};

struct _fs_main_Input {
	float4 _sv_position : SV_Position;
	float4 frag_coord : TEXCOORD0;
};

struct _fs_main_Output {
	float4 color : SV_Target0;
};

VertexOutput vs_main(_vs_main_Input input) {
	VertexOutput __luma_output;
	__luma_output.position = float4(input.position, 1.0);
	return __luma_output;
}

_fs_main_Output fs_main(_fs_main_Input input) {
	_fs_main_Output __luma_output;
	float3 color = (uniforms.base_color * uniforms.ambient);
	int i = 0;
	while ((i < NUM_LIGHTS)) {
		color = (color + float3(0.1, 0.1, 0.1));
		i = (i + 1);
	}
	color = (color * BRIGHTNESS);
	__luma_output.color = float4(color, 1.0);
	return __luma_output;
}