https://github.com/shader-slang/slang
Raw File
Tip revision: 6ee483dc6ddbd372fb509319e0b70f7fc6152278 authored by jsmall-nvidia on 08 November 2019, 23:52:15 UTC
Fix problem when getting default value for a bool, was producing 0, which on glsl could not be coerced. (#1117)
Tip revision: 6ee483d
unused-discard.slang
//TEST_IGNORE_FILE:

// This file implements the "library" code
// that both the HLSL and GLSL shaders share.
//
// This code is written in Slang (more or less
// just HLSL), and will be translated as needed
// for each of the targets.

float3 transformColor(float3 color)
{
	float3 result;

	result.x = sin(20.0 * (color.x + color.y));
	result.y = saturate(cos(color.z * 30.0));
	result.z = sin(color.x * color.y * color.z * 100.0);

	result = 0.5 * (result + 1);

	return result;
}

void doConditionalDiscard(float3 color)
{
	if(color.x < 0.5)
		discard;
}
back to top