https://github.com/shader-slang/slang
Raw File
Tip revision: 28ca4dc60aecc0acda8b364d0553a72d2e6c7964 authored by Tim Foley on 11 October 2017, 23:05:09 UTC
Fixup: re-enable exception guard (#208)
Tip revision: 28ca4dc
binding0.hlsl
//TEST:COMPARE_HLSL:-no-mangle -use-ir -target dxbc-assembly -profile ps_4_0 -entry main

// Let's first confirm that Spire can reproduce what the
// HLSL compiler would already do in the simple case (when
// all shader parameters are actually used).

#ifdef __SPIRE__
#define R(X) /**/
#else
#define R(X) X
#endif

float4 use(float4 val) { return val; };
float4 use(Texture2D t, SamplerState s) { return t.Sample(s, 0.0); }

Texture2D 		t R(: register(t0));
SamplerState 	s R(: register(s0));

cbuffer C R(: register(b0))
{
	float c;
}

float4 main() : SV_Target
{
	return use(t,s) + use(c);
}
back to top