Closed mbugni closed 7 months ago
same problem, dont understand shaders to much, but following the provided links and reading the docs i was able to fix and compile rbdoom on my arch-based system
diff --git a/neo/shaders/builtin/SSAO/ssao_compute.cs.hlsl b/neo/shaders/builtin/SSAO/ssao_compute.cs.hlsl
index 4ded9a85..bd17a6b6 100644
--- a/neo/shaders/builtin/SSAO/ssao_compute.cs.hlsl
+++ b/neo/shaders/builtin/SSAO/ssao_compute.cs.hlsl
@@ -104,7 +104,7 @@ static const float g_RandomValues[16] =
// over the diagonals in the octahedral map
float2 octWrap( float2 v )
{
- return ( 1.f - abs( v.yx ) ) * ( v.xy >= 0.f ? 1.f : -1.f );
+ return ( 1.f - abs( v.yx ) ) *select(v.xy >= 0.f, 1.f , -1.f );
}
/**********************/
@@ -127,7 +127,7 @@ float3 octToNdirSigned( float2 p )
// https://twitter.com/Stubbesaurus/status/937994790553227264
float3 n = float3( p.x, p.y, 1.0 - abs( p.x ) - abs( p.y ) );
float t = max( 0, -n.z );
- n.xy += n.xy >= 0.0 ? -t : t;
+ n.xy += select(n.xy >= 0.0, -t, t);
return normalize( n );
}
Hello @auledoom1 , I have the same issue as mbugni, how to apply your solution? I do not know how to use it.
I encountered the same compilation issue on my macOS M1 while trying to compile RBDOOM-3-BFG. I applied the fix provided by @auledoom1, replacing the ternary operators with the select function on lines 107 and 130 in ssao_compute.cs.hlsl, and it resolved the compilation errors successfully on my machine.
This fix seems to work not only for Linux systems but for macOS as well.
I tryed to compile v1.5.1 on Linux (Fedora 38). Following the instructions, I downloaded the latest DX Compiler release for August 2023. Unfortunatly, I found a compilation issue related to ternary operator like this one. It should be related to HLSL 2021, since it is enabled by default now (see release notes):
So I used previuos release for December 2022 and it works. You should fix the code or mention in README what DirectXShaderCompiler version to download.
Thanks