Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DXIL Inline raytracing does not work with bindless tlases. #3412

Closed
DBouma opened this issue Feb 1, 2021 · 0 comments
Closed

DXIL Inline raytracing does not work with bindless tlases. #3412

DBouma opened this issue Feb 1, 2021 · 0 comments

Comments

@DBouma
Copy link

DBouma commented Feb 1, 2021

When compiled to DXIL, using TraceRayInline() in a pixel shader while having a bindless array of tlases, seems to never hit any geometry.

  • When the tlas is bound using a root srv instead, the inline traces seem to work as intended.
  • Creating the exact same bindless setup but doing it in a CS instead of a PS, then the inline rays do hit geometry.

This problem does not occur in a PS when the exact same shaders are compiled to spirv.

RaytracingAccelerationStructure tlases[] : register(t0, space0);

struct Constants {
    uint tlas_index;
};

ConstantBuffer<Constants> g_constants: register(b0, space0);

float4 PSMain(float4 input : SV_POSITION) : SV_TARGET
{
    float3 wpos = float3(input.xy + 0.5f, -1);
    
    RayDesc ray;
    ray.Origin = wpos;
    ray.TMin = 0.1;
    ray.TMax = 1000.0;
    ray.Direction = float3(0,0,1);
    
	float3 res = 0.0f;
    
    RayQuery<RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH | RAY_FLAG_FORCE_OPAQUE> q;
    q.TraceRayInline(tlases[g_constants.tlas_index], 0, 0xff, ray);
    q.Proceed();

    if (q.CommittedStatus() == COMMITTED_TRIANGLE_HIT) {
        res = float3(1,0,0);
    } else {
        res = float3(0,1,0);
    }
    
	return float4(res,1.0f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant