Netflix / falcor

A JavaScript library for efficient data fetching
http://netflix.github.io/falcor
Apache License 2.0
10.49k stars 446 forks source link

Crash in Falcor::ComputeStateObject::apiInit with slang shader on vulkan #956

Closed KaChen-Dex closed 5 years ago

KaChen-Dex commented 5 years ago

Hi, On ubuntu, vulkan, there seems to be issues with Falcor/Slang, the following slang shader will crash Falcor during creating PSO in bool ComputeStateObject::apiInit(). It crashes with unknown callstacks below the line of if (VK_FAILED(vkCreateComputePipelines(gpDevice->getApiHandle(), VK_NULL_HANDLE, 1, &info, nullptr, &pipeline)))

I am wondering if it is a known issue or fixed in recent version? we are using falcor 3.1. thanks.

RWTexture3D<uint> gPersistentSamplesCountTexture;

void testRWTexture(inout uint res, RWTexture3D<uint> texture, uint3 crd)
{
    res = texture[crd];
}

[numthreads(16,16,1)]
void main(uint3 groupId : SV_GroupID, uint3 groupThreadId : SV_GroupThreadId)
{
        uint3 posStart = groupId.xyz * uint3(16,16,1);
        uint3 crd = posStart + groupThreadId.xyz;
        uint testResult;
        testRWTexture(testResult, gPersistentSamplesCountTexture, crd);
}

It seems to be related to pass RWTexture as a parameter to the function.

Also a slightly different slang shader crashes at the same place as well:

Texture3D<float4> gPersistentCovarianceTextures[2];
struct testStruct
{
    float3 color[8];
};

void testArrayTexture(inout testStruct res, uint3 crd)
{
    res.color[0] = gPersistentCovarianceTextures[1][crd].xyz;
}
[numthreads(16,16,1)]
void main(uint3 groupId : SV_GroupID, uint3 groupThreadId : SV_GroupThreadId)
{
        uint3 posStart = groupId.xyz * uint3(16,16,1);
        uint3 crd = posStart + groupThreadId.xyz;
        testStruct test;
        testArrayTexture(test, crd);
}
That seems to be related to access the second texture in a texture array.
jcranendonk commented 5 years ago

@KaChen3000 I believe you may be looking for https://github.com/shader-slang/Falcor