Closed wagshiwei closed 3 months ago
Hello,
I just updated several aspects of the raytracing sample infrastructure. I did not reproduce your issue, which implies to me that it may be coming from your GPU vendor's backend shader compiler. I don't think the error is valid. Please try pulling latest and see how it goes. This will require Visual Studio 2022. Please also have the newest Windows SDK installed. If the compiler error persists, could I please have you identify the GPU you are using? You might need to submit a bug to our HLSL team.
Thank You, James Stanard
Compile successfully if I add select
1>In file included from RTAO\Shaders\Denoising\CalculateMeanVarianceCS.hlsl:27:
1>./RTAO/shaders\RaytracingShaderHelper.hlsli(287,9): error G13DA7946: use of undeclared identifier 'select'
1> return select(x < 0.04045, x / 12.92, pow((x + 0.055) / 1.055, 2.4));
1> ^
1>./RTAO/shaders\RaytracingShaderHelper.hlsli(292,9): error G13DA7946: use of undeclared identifier 'select'
1> return select(x < 0.0031308, 12.92 * x, 1.055 * pow(abs(x), 1.0 / 2.4) - 0.055);
1> ^
1>./RTAO/shaders\RaytracingShaderHelper.hlsli(346,32): error G13DA7946: use of undeclared identifier 'select'
1> return (1.0 - abs(v.yx)) * select(v.xy >= 0.0, 1.0, -1.0);
1> ^
1>./RTAO/shaders\RaytracingShaderHelper.hlsli(365,13): error G13DA7946: use of undeclared identifier 'select'
1> n.xy += select(n.xy >= 0.0, -t, t);
I think this means you didn't install the latest Windows 11 SDK. With the latest shader compiler, HLSL 2021 is enabled by default. In HLSL 2021, vector conditional operators (?:) aren't allowed. The select() intrinsic was introduced to replace it.
You can install the latest SDK with Visual Studio Installer. Click on 'Modify'. Then under 'Individual Components', search for "Windows 11 SDK" and check 10.0.26100.0. Then click on the 'Modify' button in the lower right.
@stanard It might be more robust to add to the sample's code for invoking DXC -HV 2021
to make sure it is using the expected language version.
Easiest way to do that is in each ItemDefinitionGroup
in the vcxproj, add:
<FXCompile>
<AdditionalOptions>-HV 2021 %(AdditionalOptions)</AdditionalOptions>
</FXCompile>
Project D3D12RaytracingRealTimeDenoisedAmbientOcclusion