Revision fec9c42d4c61d1bdd54d020d55a3155e0d54fce7 authored by Yong He on 22 January 2024, 23:19:26 UTC, committed by GitHub on 22 January 2024, 23:19:26 UTC
* Fix GLSL legalization bug that leads to crash.

* Update diagnostic id to avoid conflict.

* Fix std140 layout logic.

---------

Co-authored-by: Yong He <yhe@nvidia.com>
1 parent c4e42ab
Raw File
sampler-array.slang
// sampler-array.slang

// Test sampler array parameters.

struct S1
{
    Texture2D tex[32];
    SamplerState samplers[32];
    float data;
    float test(int i)
    {
        return tex[i].SampleLevel(samplers[i], float2(0.0, 0.0), 0.0).x + data;
    }
}

struct S0
{
    float data;
    RaytracingAccelerationStructure acc;
    ParameterBlock<S1> s;
}

ParameterBlock<S0> g;
RWStructuredBuffer<float> buffer;

[shader("compute")]
[numthreads(1,1,1)]
void computeMain(
    uint3 sv_dispatchThreadID : SV_DispatchThreadID)
{
    buffer[0] = g.data * g.s.test(sv_dispatchThreadID.x);
}
back to top