Skip to content

Commit cf2a1ac

Browse files
JarkkoUnityEvergreen
authored andcommitted
Fixed _FOVEATED_RENDERING_NON_UNIFORM_RASTER shader compilation errors
Fixed _FOVEATED_RENDERING_NON_UNIFORM_RASTER shader compilation errors
1 parent 6e36834 commit cf2a1ac

File tree

4 files changed

+14
-23
lines changed

4 files changed

+14
-23
lines changed

Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRendering.hlsl

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,8 @@
55
#error Use #include_with_pragmas "FoveatedRenderingKeywords.hlsl" before including this file
66
#endif*/
77

8-
#if (!defined(UNITY_COMPILER_DXC) && (defined(UNITY_PLATFORM_OSX) || defined(UNITY_PLATFORM_IOS) || defined(UNITY_PLATFORM_VISIONOS))) || defined(SHADER_API_PS5)
8+
#if defined(SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER)
99

10-
#if defined(SHADER_API_PS5) || defined(SHADER_API_METAL)
11-
#define SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER 1
12-
#endif
13-
#endif
14-
15-
#if SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER
1610
#if defined(SHADER_API_PS5)
1711
#include "Packages/com.unity.render-pipelines.ps5/ShaderLibrary/API/FoveatedRendering_PSSL.hlsl"
1812
#endif
@@ -90,12 +84,12 @@ float2 FoveatedRemapPrevFrameNonUniformToLinear(float2 uv)
9084
}
9185
#undef FOVEATED_FLIP_Y
9286

93-
int2 FoveatedRemapLinearToNonUniformCS(int2 positionCS)
87+
float2 FoveatedRemapLinearToNonUniformCS(float2 positionCS)
9488
{
95-
return FoveatedRemapLinearToNonUniform((positionCS + float2(0.5, 0.5)) * _ScreenSize.zw) * _ScreenSize.xy;
89+
return FoveatedRemapLinearToNonUniform(positionCS * _ScreenSize.zw) * _ScreenSize.xy;
9690
}
9791

98-
int2 FoveatedRemapNonUniformToLinearCS(int2 positionCS)
92+
float2 FoveatedRemapNonUniformToLinearCS(float2 positionCS)
9993
{
10094
UNITY_BRANCH if(_FOVEATED_RENDERING_NON_UNIFORM_RASTER)
10195
positionCS = RemapFoveatedRenderingNonUniformToLinearCS(positionCS, true);
@@ -111,8 +105,8 @@ float2 FoveatedRemapDensity(float2 uv) {return uv;}
111105
float2 FoveatedRemapPrevFrameDensity(float2 uv) {return uv;}
112106
float2 FoveatedRemapNonUniformToLinear(float2 uv) {return uv;}
113107
float2 FoveatedRemapPrevFrameNonUniformToLinear(float2 uv) {return uv;}
114-
int2 FoveatedRemapLinearToNonUniformCS(int2 positionCS) {return positionCS;}
115-
int2 FoveatedRemapNonUniformToLinearCS(int2 positionCS) {return positionCS;}
108+
float2 FoveatedRemapLinearToNonUniformCS(float2 positionCS) {return positionCS;}
109+
float2 FoveatedRemapNonUniformToLinearCS(float2 positionCS) {return positionCS;}
116110

117111
#endif
118112

Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,15 @@
33

44
#if (!defined(UNITY_COMPILER_DXC) && (defined(UNITY_PLATFORM_OSX) || defined(UNITY_PLATFORM_IOS) || defined(UNITY_PLATFORM_VISIONOS))) || defined(SHADER_API_PS5)
55

6-
#if defined(SHADER_API_PS5) || defined(SHADER_API_METAL)
6+
#define SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER 1
77

8-
#define SUPPORTS_FOVEATED_RENDERING_NON_UNIFORM_RASTER 1
8+
// On Metal Foveated Rendering is currently not supported with DXC
9+
#pragma warning (disable : 3568) // unknown pragma ignored
910

10-
// On Metal Foveated Rendering is currently not supported with DXC
11-
#pragma warning (disable : 3568) // unknown pragma ignored
11+
#pragma never_use_dxc metal
12+
#pragma dynamic_branch _ _FOVEATED_RENDERING_NON_UNIFORM_RASTER
1213

13-
#pragma never_use_dxc metal
14-
#pragma dynamic_branch _ _FOVEATED_RENDERING_NON_UNIFORM_RASTER
15-
16-
#pragma warning (default : 3568) // restore unknown pragma ignored
17-
18-
#endif
14+
#pragma warning (default : 3568) // restore unknown pragma ignored
1915

2016
#endif
2117

Packages/com.unity.render-pipelines.universal/Runtime/VFXGraph/Shaders/VFXDefines.hlsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl"
12
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
23
#if defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2)
34
#define USE_FOG 1

Packages/com.unity.visualeffectgraph/Editor/Compiler/VFXCodeGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ static private StringBuilder Build(
762762
var spaceable = contextData as ISpaceable;
763763
globalIncludeContent.WriteLineFormat("#define {0} 1", spaceable.space == VFXSpace.World ? "VFX_WORLD_SPACE" : "VFX_LOCAL_SPACE");
764764
}
765-
globalIncludeContent.WriteLineFormat("#include \"{0}/VFXDefines.hlsl\"", renderRuntimePipePath);
765+
globalIncludeContent.WriteLineFormat("#include_with_pragmas \"{0}/VFXDefines.hlsl\"", renderRuntimePipePath);
766766

767767
if (needsGraphValueStruct)
768768
globalIncludeContent.WriteLine("#define VFX_USE_GRAPH_VALUES 1");

0 commit comments

Comments
 (0)