yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Tim FoleyMerge pull request #70 from tfoleyNV/support-more-sv-semantics98b3e5bc9

master
559 B27 linesraw
1//TEST_IGNORE_FILE:
2
3// This file implements the "library" code
4// that both the HLSL and GLSL shaders share.
5//
6// This code is written in Slang (more or less
7// just HLSL), and will be translated as needed
8// for each of the targets.
9
10float3 transformColor(float3 color)
11{
12	float3 result;
13
14	result.x = sin(20.0 * (color.x + color.y));
15	result.y = saturate(cos(color.z * 30.0));
16	result.z = sin(color.x * color.y * color.z * 100.0);
17
18	result = 0.5 * (result + 1);
19
20	return result;
21}
22
23void doConditionalDiscard(float3 color)
24{
25	if(color.x < 0.5)
26		discard;
27}