Skip to content

Commit 51d3ccb

Browse files
svc-reach-platform-supportEvergreen
authored andcommitted
[Port] [6000.5] Disable APV baking on OpenGL with graceful error message
1 parent 009a380 commit 51d3ccb

2 files changed

Lines changed: 33 additions & 7 deletions

File tree

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.Placement.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ static NativeList<Vector3> RunPlacement(ProbeVolumeProfileInfo profileInfo, Prob
133133
{
134134
Debug.Assert(profileInfo != null);
135135

136+
// APV baking requires compute shader support that is not always available on OpenGL devices
137+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLCore ||
138+
SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES3)
139+
{
140+
Debug.LogError("Adaptive Probe Volume baking is not supported on OpenGL. Please switch to Direct3D, Vulkan, or Metal in Project Settings > Player > Other Settings > Graphics API.");
141+
canceledByUser = true;
142+
return new NativeList<Vector3>(Allocator.Temp);
143+
}
144+
136145
// Overwrite loaded settings with data from profile. Note that the m_BakingSet.profile is already patched up if isFreezingPlacement
137146
float prevBrickSize = refVolume.MinBrickSize();
138147
int prevMaxSubdiv = refVolume.GetMaxSubdivision();

Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbePlacement.cs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,30 @@ static ComputeShader subdivideSceneCS
170170
{
171171
_subdivideSceneCS = GraphicsSettings.GetRenderPipelineSettings<ProbeVolumeBakingResources>().subdivideSceneCS;
172172

173-
s_ClearBufferKernel = subdivideSceneCS.FindKernel("ClearBuffer");
174-
s_ClearKernel = subdivideSceneCS.FindKernel("Clear");
175-
s_JumpFloodingKernel = subdivideSceneCS.FindKernel("JumpFlooding");
176-
s_FillUVKernel = subdivideSceneCS.FindKernel("FillUVMap");
177-
s_FinalPassKernel = subdivideSceneCS.FindKernel("FinalPass");
178-
s_VoxelizeProbeVolumesKernel = subdivideSceneCS.FindKernel("VoxelizeProbeVolumeData");
179-
s_SubdivideKernel = subdivideSceneCS.FindKernel("Subdivide");
173+
// The compute shader is not supported on OpenGL (see #pragma only_renderers in ProbeVolumeSubdivide.compute)
174+
// The kernels won't exist, so we skip initialization. This is caught earlier in RunPlacement with a proper error message.
175+
try
176+
{
177+
s_ClearBufferKernel = subdivideSceneCS.FindKernel("ClearBuffer");
178+
s_ClearKernel = subdivideSceneCS.FindKernel("Clear");
179+
s_JumpFloodingKernel = subdivideSceneCS.FindKernel("JumpFlooding");
180+
s_FillUVKernel = subdivideSceneCS.FindKernel("FillUVMap");
181+
s_FinalPassKernel = subdivideSceneCS.FindKernel("FinalPass");
182+
s_VoxelizeProbeVolumesKernel = subdivideSceneCS.FindKernel("VoxelizeProbeVolumeData");
183+
s_SubdivideKernel = subdivideSceneCS.FindKernel("Subdivide");
184+
}
185+
catch (System.ArgumentException)
186+
{
187+
// Kernels not found - likely running on unsupported graphics API
188+
string message = "ProbeVolumeSubdivide compute shader kernels not found.";
189+
if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLCore ||
190+
SystemInfo.graphicsDeviceType == GraphicsDeviceType.OpenGLES3)
191+
{
192+
message += " This is expected on OpenGL which is not supported for APV baking.";
193+
}
194+
Debug.LogWarning(message);
195+
_subdivideSceneCS = null;
196+
}
180197
}
181198
return _subdivideSceneCS;
182199
}

0 commit comments

Comments
 (0)