Skip to content

Commit 57e3d61

Browse files
SSR: fixed GLES shader compile warning
1 parent 2a164ad commit 57e3d61

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Shaders/PostProcess/ScreenSpaceReflection/private/SSR_ComputeStencilMaskAndExtractRoughness.fx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ Texture2D<float> g_TextureDepth;
1212

1313
float LoadRoughness(int2 PixelCoord)
1414
{
15-
float Roughness = g_TextureMaterialParameters.Load(int3(PixelCoord, 0))[g_SSRAttribs.RoughnessChannel];
15+
float4 MaterialParams = g_TextureMaterialParameters.Load(int3(PixelCoord, 0));
16+
float4 RoughnessSelector = float4(
17+
g_SSRAttribs.RoughnessChannel == 0u ? 1.0 : 0.0,
18+
g_SSRAttribs.RoughnessChannel == 1u ? 1.0 : 0.0,
19+
g_SSRAttribs.RoughnessChannel == 2u ? 1.0 : 0.0,
20+
g_SSRAttribs.RoughnessChannel == 3u ? 1.0 : 0.0);
21+
float Roughness = dot(MaterialParams, RoughnessSelector);
1622
if (!g_SSRAttribs.IsRoughnessPerceptual)
1723
Roughness = sqrt(Roughness);
1824
return Roughness;

0 commit comments

Comments
 (0)