https://github.com/shader-slang/slang
Raw File
Tip revision: a7336f53a6235ef7c8b4a13479befb59c7e9e753 authored by Tim Foley on 14 November 2019, 21:39:23 UTC
Update slang-binaries to include Linux x86 glslang (#1125)
Tip revision: a7336f5
global-type-param-array.slang
//TEST(compute):COMPARE_COMPUTE:
//TEST_INPUT: cbuffer(data=[1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0], stride=4):dxbinding(0),glbinding(0)
//TEST_INPUT: ubuffer(data=[0], stride=4):dxbinding(0),glbinding(0),out
//TEST_INPUT: type Pair<Arr<Base,1>, Pair<Arr<Base,2> , Base> >

RWStructuredBuffer<float> outputBuffer;
import globalTypeParamArrayShared;

float doCompute<T:IBase>(T t)
{
    return t.compute(1.0);
}

[numthreads(1, 1, 1)]
void computeMain<
	TImpl : IBase>(
	uniform ParameterBlock<TImpl> impl,
	uint3 dispatchThreadID : SV_DispatchThreadID)
{
	uint tid = dispatchThreadID.x;
	float outVal = doCompute<TImpl>(impl); 
	outputBuffer[tid] = outVal;
}
back to top