yum-mirror/slang

Making it easier to work with shaders

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

Darren WihandiAdd base vertex and base instance system values (#5918)a00db74d1

master
701 B19 linesraw
1//TEST:SIMPLE(filecheck=CHECK_SPIRV): -entry main -stage vertex -target spirv
2//TEST:SIMPLE(filecheck=CHECK_GLSL): -entry main -stage vertex -target glsl
3//TEST:SIMPLE(filecheck=CHECK_HLSL): -entry main -stage vertex -target hlsl
4//TEST:SIMPLE(filecheck=CHECK_METAL): -entry main -stage vertex -target metal
5
6#version 460
7
8void main()
9{
10    float x = float(gl_VertexIndex + gl_BaseVertex) * 0.1f;
11    float y = float(gl_InstanceIndex + gl_BaseInstance) * 0.2f;
12    gl_Position = vec4(x, y, 0.0f, 1.0f); // Output 2D position with z=0 and w=1.
13
14    // CHECK_SPIRV: BuiltIn BaseInstance
15    // CHECK_GLSL: gl_BaseInstance
16    // CHECK_HLSL: SV_StartInstanceLocation
17    // CHECK_METAL: base_instance
18}
19