Skip to content

AmdGetLastHitToken broken with latest DXC #54

@BleuBleu

Description

@BleuBleu

Hi.

With the latest DXC (Feb 2025), I cannot use the AmdGetLastHitToken anymore.

Create this shader (change the include path to point to where your AGS includes are), save it as Test.hlsl

#include "ags_shader_intrinsics_dx12.hlsl"

RWStructuredBuffer<uint2> TestBuffer;

[shader("raygeneration")] void TestRGS()
{
	const uint DispatchThreadId = DispatchRaysIndex().x;
	TestBuffer[DispatchThreadId] = AmdGetLastHitToken();
}

Compile with:

dxc.exe /auto-binding-space 1 /exports TestRGS /Zpr /O3 /enable-16bit-types /Zss /Qembed_debug /HV 2018 /Zi /Fd .\ /T lib_6_3 /Fc Test.d3dasm /Fo Test.dxil Test.hlsl

You will get:

error: Entry function performs some operation that is incompatible with the shader stage or other entry properties.  See other errors for details.
error: Function requires a visible group, but is called from a shader without one.

DXC doesnt seem to like that the token is groupshared, to my understanding, ray-tracing shaders arent allowed to make use of groupshared memory.

-Mat

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions