yum-mirror/slang

Making it easier to work with shaders

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

Tim FoleyRework command-line options handling for entry points and targets (#697)725985528

master
807 B35 linesraw
1//TEST_DISABLED:COMPARE_HLSL: -profile vs_5_0
2
3// Check output for `do` loops
4
5cbuffer C : register(b0)
6{
7	int n;
8};
9
10float4 main() : SV_Position
11{
12	float4 x = 0;
13	int i = n;
14	{
15		do
16		{
17			x = (x + (float)1) * x;
18
19			// Note(tfoley): The "right" thing here would be
20			// `i--`, but that leads to a subtle difference
21			// in the final code between just invokeing `fxc`
22			// and invoking it on the Slang-generated output
23			// (despite the generated HLSL for this line being
24			// identical, modulo some `#line` directives).
25			//
26			// I'm using a binary operator that will yield
27			// the same code with its operands swapped, just
28			// to work around it. A better long-term fix
29			// is to have this test be an end-to-end test
30			// that we execute.
31			i = i*i;
32		} while((bool) i);
33	}
34    return x;
35}