[6000.0] Fixed Custom URP Compile errors#59
Open
JessAtMeta wants to merge 278 commits into
Open
Conversation
Fixed some shader warnings when building a player.
Post-migration step: remove the migrated URP docs files.
Solid Angle culling mode low level support was merged to trunk https://github.cds.internal.unity3d.com/unity/unity/pull/53762 This PR exposed the mode to Ray Tracing Settings volume override in HDRP.  Nice presentation that I made about culling modes: https://docs.google.com/presentation/d/1XegfK-9gZ0lW8OVJzQ8vXISK5hS08HxfkFx4oMHY5YU/edit?usp=sharing
This PR improves the HDRP Sample Water, it removes: - WaterSurfaceBinder.cs: Use the VFXPropertyBinder for settings global texture is hacky - EnableVFXAfter.cs: It was a simple hack to mitigate console error The new approach avoids: - Multiple calls and possible diverging SetGlobalTextures (there is a warning in component inspector in this case) - Displaying a VFX before SetGlobalTextures (it disable component meanwhile) Replace with an independent behavior: `WaterSurfaceBindVFX.cs`: - Supposed to be allocated once per frame - In charge of enabling children VFX once the SetGlobalTextures is applied - Custom Inspector to help debug issue (like the water system being disabled) Improve SampleWaterSurface.cs integration - Add error feedback in case of disabled water system and/or missing SetGlobalBuffer (see functional testing status)
Fix Graphics Corruption on Silicon Device which can generates artifact in every single Unity rendering.  The problem was due to an unexpected call from `Graphics.DrawMeshNow` while *not* being within a Repaint event (see also this [OnSceneGUI documentation](https://docs.unity3d.com/ScriptReference/Editor.OnSceneGUI.html)) - Issue with while rendering mesh in wireframe with mesh module in ParticleSystem, initial repro 🔽 https://media.github.cds.internal.unity3d.com/user/42/files/45a4c51e-b236-4c3a-907a-5610c5e7b55b - Found a repro of the wrong DrawHull in HDRP (this is a theoretical repro, I tested on windows) 🔽 https://media.github.cds.internal.unity3d.com/user/42/files/9057b6d4-c8b4-481e-9421-783e16cbbb6f - Checked other usage of DrawMeshNow in VFX - With DrawCurve ✅  - With Draw Context Border ✅  - With Gizmo rendering `Graphics.DrawMeshNow`, we can trust the `EventType.Repaint` https://github.cds.internal.unity3d.com/unity/unity/blob/eaea05a25d195f7c6e58128434cc9a5130ef3b91/Packages/com.unity.visualeffectgraph/Editor/Gizmo/VFXGizmo.cs#L88
…to Android/Web when using Universal 3D Template The GPU Driven feature officially doesn't support low graphics APIs, so it has been fixed to exclude Web and OpenGLES API for the problematic shaders. Before fixing, there were several warnings happened: ``` Shader warning in 'InstanceDataBufferCopyKernels': Buffer count exceeding default GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS. Shader might not work on all hw. Consider combining separate buffers into one containing struct elements. at kernel MainCopyInstances (on gles3) Shader warning in 'InstanceOcclusionCullingKernels': Buffer count exceeding default GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS. Shader might not work on all hw. Consider combining separate buffers into one containing struct elements. at kernel CullInstances (on gles3) Shader warning in 'InstanceDataBufferUploadKernels': Buffer count exceeding default GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS. Shader might not work on all hw. Consider combining separate buffers into one containing struct elements. at kernel MainUploadScatterInstances (on gles3) ```
This change adds resource stripping logic to the STP RuntimeResources class. This prevents projects that don't use STP from including it in the build. This change allows the empty URP template project to build successfully when targeting Windows from a Mac since STP's resources are now stripped and won't cause build failures. However, it doesn't actually allow STP to build for Windows on a Mac successfully. In order to fix that, we'll need native changes that strip out unsupported variants. That change will be handled by a different PR since it's not required to fix the HUP ticket associated with the template project.
Jira: [UUM-81586](https://jira.unity3d.com/browse/UUM-81586) As reported in JIRA, some shader warnings are thrown after building HDRP 3d template. This PR fixes the following warnings. ``` 1. Shader warning in 'HDRP/Lit': parameter 'pdf' is uninitialized when used here [-Wparameter-usage] at Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/Shaders/PathTracingBSDF.hlsl(74) 2. Shader warning in 'HDRP/Lit': expression result unused [-Wunused-value] (for raytracing shaders) at Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/VaryingMesh.hlsl(134) 3. Shader warning in 'HDRP/Unlit': expression result unused [-Wunused-value] (for raytracing shaders) at Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/VaryingMesh.hlsl(134) 4. Shader warning in 'Hidden/Core/ProbeVolumeOffsetDebug': use of potentially uninitialized variable (o) at Packages/com.unity.render-pipelines.core/Runtime/Debug/ProbeVolumeDebugBase.hlsl(272) ```
Following this recent PR https://github.cds.internal.unity3d.com/unity/unity/pull/51061 The ensure frame settings thingy has been added twice. This PR remove the first one. <img width="396" alt="Double" src="https://media.github.cds.internal.unity3d.com/user/1764/files/5a420507-db33-4c97-aef3-154c7fbd0f55">
Add option to compose hair before color pyramid but after clouds
This reverts commit 215ec324aec975b5a7f72aec432165ea586d8f8f. The changes were causing crashes on the DX12 backend due to the stencil flag being used on a DSV associated with a format with no stencil plane. This was leading to D3D12 runtime errors which cause device removal which results in a crash. We should attempt to set this properly based on the format of the current pass depth attachment, but it requires some non-trivial changes to make the data available. In the meantime, we're reverting the original change to avoid the crash.
Cause: The WorldLightManager.CollectWorldLights() function collects light information for the scene every frame so that it can be processed for render context. During this process, it uses the FindObjectsByType<HDAdditionalReflectionData> function to update the reflection probe data. This is a large part of the load. Solution: I decided to statically declare a HashSet on the HDAdditionalReflectionData itself to manage it. Adding and removing from that HashSet was done by redefining the OnEnable and OnDisable functions to work. The WorldLightManager just needs to use that HashSet data structure on every frame update.
URP RenderGraph [Jira](https://jira.unity3d.com/browse/URP-1297). Update the rendergraph samples to the latest APIs and best practices.
Fix UUM-51358
`Bug`: https://jira.unity3d.com/browse/UUM-71240 When using `camera.Render()` with the `Test Runner` and URP + RenderGraph, we retrieve the `Color BackBuffer` here:  It's fine when rendering in the `Scene View` and `GameView`, since both views set the right `Backbuffers` before retrieving them for the final rendering. In the context of the `Test Runner`, since it's not a real context or a real PlayerLoop, the `camera.Render` is executed at 'a random moment', so it can be while rendering the Console view, the Hierarchy view, etc. So we end up retrieving the wrong current BackBuffer (for the wrong editor view), which explains the dimensions mismatch. The fix is simply to stop using `camera.Render`, since it's a nasty and complex bug to fix, so we decided to "hack it" for now. For the GPUDriven tests, we have to override `ProcessRenderRequests` as well to continue testing the `Culling` code in the way it was intended. Using `SubmitCameraRenderRequest` fixes the problem since we don't render in the BackBuffer anymore, but in a TargetTexture. (Screenshot for my future me, in case I cause a regression. Here we can see all the view being rendered. The one with `IsGameView: 1` is the GameView. The mismatch bug happens when we render the scene (`camera.Render`) right after a non-GameView window (`isGameView: 0`) ) 
There was a compile error when using the lighting debug views when APV and Shadowmask are active https://jira.unity3d.com/browse/UUM-82976
Removed RGBM implementation from URP Bloom as it's not used currently while costs some shader variants and branching. To reintroduce its usage we would have to make changes that would make RGBM Bloom pass twice slower than current SDR Bloom pass. The RGBM mode was targeting low-end devices in the first place, where such performance is not acceptable.
This PR disables instabilities in the XR automation
*[See [this document](https://docs.google.com/document/d/1IREfh8I-uX8NUfyB3H8qjnzRxXIAkZNrtu6g8n4JZIE/edit#heading=h.al4rvw6ezmw6) for details on what can land in 6000.1.]* *[The PR comment commands commands and workflows to ready and land PR's can be found in the [pipeline documentation](https://internaldocs.unity.com/editor_and_runtime_development_guide/DevelopmentProcess/pr-process/evergreen-merge-queue/#rejoin-the-queue).]* Add option to specify an alpha threshold when to write depth and movecs when compositing hq lines. This allows HQ Lines to not write depth when the alpha is deemed too low, mitigating problems from algorithms relying on screen space depth (like DOF).
Document Water functions: `GetCausticsBuffer()` `GetDeformationBuffer()` `GetFoamBuffer()`
Fix volumetric cloud shadow clipping issues when the camera is far from geometry. Fix volumetric cloud clipping when the camera is aligned with the sun direction, FoV is low and sun is at grazing angle.
This PR - removes redundant code, all allocators now use exactly the same RenderTexture creation path, leading to more robust and maintainable code - uses the RenderTextureDescriptor constructor to create the RenderTexture as a micro optimization. This avoids 7 calls to C++ native land per RT allocation - fixes a few small bugs and inconsistencies between the allocators now that they all use the same code path - removes use of RT.format = shadowMap. Only uses explicit fields (graphicsFormat, depthStencilFormat, shadowSamplingMode), no "magic" fields (format=RenderTextureFormat, depthBufferBits)
Remove the disabled menu item that was really confusing for users. This had to do with the fact that in URP render graph is not available if there is the compatibility mode enabled. Removing that code and adding a better message. I've not added a new API to know why is not available as is two much work, the user should see the docs and try to enable the Render Graph support by their own. 
This change adds logic to URP's GPU occlusion culling code to prevent it from being enabled when running on Qualcomm GPUs. This should allow us to avoid the suspected driver issues for now while we get the real solution figured out.
Fixes: [UUM-74040](https://jira.unity3d.com/browse/UUM-74040) If a material has a custom GUI powered by the core package's `MaterialEditorExtension.cs`, and if some properties are animated in the timeline, the UI doesn't update to reflect the animation. This change fixes this issue.
Fix https://jira.unity3d.com/browse/UUM-83481 Adopt the explicit depth stencil format property instead of setting depthBufferBits on RenderTextureDescriptor in URP 2D and 3D This fixes a number of hard to find bugs. The source of these bugs: renderTextureDesc1.depthBufferBits = renderTextureDesc2.depthBufferBits does not always result in renderTextureDesc1.depthStencilFormat== renderTextureDesc2.depthStencilFormat being true. depthBufferBits = 32 -> depending on platform, depthStencilFormat == D32_S8 depthStencilFormat = D32 -> depthBufferBits == 32 etc. Also, renderTextureDesc1.depthBufferBits will call a native c++ method, so is more expensive than a field setter of the depthStencilFormat. So this is also a micro optimization.
This change updates the STP frame index calculation logic to use the same logic as the regular TAA code path. This ensures we always add the jitter frame count offset value and don't end up with inconsistent jitter calculations in different parts of the code. In the previous code, we weren't actually including the jitter frame count offset in the frame index value used by STP's shader constant logic. This was causing the jitter offsets in the constants the jitter offsets used by the projection matrix to diverge in some cases which results in severely degraded visual quality. Fantasy Kingdom Demo: Before:  After:  Aside from the changes that affect STP, this PR also contains one additional commit (0cbd31e681c00095cf04c56b7f45b5a2e574979c) that corrects a similar issue in the very high quality TAA filter weight logic.
JIRA: https://jira.unity3d.com/browse/UUM-76255 Fixed an issue where a NullReferenceException was thrown when updating, undoing, and updating a legacy node. Problem * When Undoing, a new SGBlackboardField instance was created, but SGBlackboardField.SupplyDataToPropertyDrawer() was not called because the user's click and call to InspectorView.Update did not occur. As a result, m_InspectorUpdateDelegate is null, and subsequent calls to m_InspectorUpdateDelegte throw a NullReferenceException when onAfterVersionChange is called with node Update. Solution * perform initialization of all Inspectables (including SGBlackboardField) when Undo/Redo is performed, so that m_InspectorUpdateDelegate is set In addition to the above issue, updating a node placed in the graph immediately upon opening the graph can also cause a NullReferenceException to be thrown, as the onAfterVersionChange of an SGBlackboardField that was never clicked is called and m_InspectorUpdateDelegate is called. I fixed it to avoid throwing a NullReferenceException with ?.Invoke(); when calling m_InspectorUpdateDelegate. I don't think there should be any other issues because the inspector update is done in the onAfterVersionChange callback of the newly added PropertyNodeView.
Add documentation for making APV compatible with AssetBundles and Addressables in URP and HDRP. Jira ticket: https://jira.unity3d.com/browse/DOCG-6049
List new physically based sky custom material environment samples.
…rop frame is used
…s is not properly initialized.
…ternal/6000.0/staging Internal/6000.0/staging
Subpass change for 17.0.4
…erenced from origin/master, wrapped packedMaterialData.isIndirectSupported with conditional compilation in InstanceCullingBatcher.cs, updated constants / keyword usage in ShaderScriptableStripperTests.cs
JessAtMeta
marked this pull request as ready for review
July 6, 2026 21:09
|
|
||
| var materialIndex = rendererData.materialIndex[materialsOffset + matIndex]; | ||
| var packedMaterialData = rendererData.packedMaterialData[materialIndex]; | ||
| #if UNITY_6000_0_76 || UNITY_6000_0_77 || UNITY_6000_0_78 || UNITY_6000_0_79 || UNITY_6000_0_80 || UNITY_6000_1_OR_NEWER || UNITY_6000_2_OR_NEWER || UNITY_6000_3_OR_NEWER |
Collaborator
There was a problem hiding this comment.
Wondering if we should just force this to true. I'm assuming Unity has intentionally changed this for all Unity 6+ versions.
… Unity 6000.0.76f1 built-in Updated ScriptedImporter GUID from 42d537a8a4089e448a99fc57a06d74a9 to 6a2e376a7f79aa2439fd62f49ed5e1b6 to match Unity 6000.0.76f1 built-in UnifiedRTShaderImporter. Also updated shader file to use com.unity.rendering.light-transport includes and match built-in structure, fixing 'Cannot load. Path Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/VirtualOffset/TraceVirtualOffset.urtshader is correct but AssetDatabase cannot load now' error.
….0/asw-fix # Conflicts: # Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/VirtualOffset/TraceVirtualOffset.urtshader # Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentBatcher.cs # Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.cs # Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/InstanceCullingBatcher.cs # Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/MotionVectorPass.hlsl # Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs # Packages/com.unity.render-pipelines.universal/ShaderLibrary/ObjectMotionVectors.hlsl
- Add DestroyDrawInstances alias to InstanceCullingBatcher (forwards to DestroyInstances) - Add DestroyInstances alias to GPUResidentBatcher (forwards to DestroyDrawInstances) - Update BuildBatch signature to add bool registerMaterialsAndMeshes parameter (default true) - Add SchedulePackedMaterialCacheUpdate method to InstanceCullingBatcher These changes restore compatibility with Unity 17.0.4 API while preserving ASW EntityId_Int32 type usage.
- Add UpdatePackedMaterialDataCacheJob struct - Add m_PackedMaterialHash field with initialization and disposal - Add packedMaterialHash property accessor These were added in Unity 17.0.4 upstream but missing from ASW branch after merge.
- Add missing isSceneViewCamera parameter to GetRenderPassInputs calls - Change DepthBits.None to GraphicsFormat.None in GetCompatibleDescriptor call These APIs changed in Unity 17.0.4 upstream.
Using instanceID: 0 allows Unity to resolve the ScriptedImporter dynamically rather than requiring a specific GUID that may not be available when loading from Git packages. This matches other .urtshader.meta files in the package.
Fully qualify UnityEditor.EditorTools.EditorToolManager to resolve ambiguity with UnityEditor.Rendering.Universal.Path2D.EditorToolManager introduced in 17.0.4.
UnityEditor.EditorTools.EditorToolManager does not have IsActiveTool method. Use UnityEditor.Rendering.Universal.Path2D.EditorToolManager instead.
Using explicit GUID reference to UnifiedRTShaderImporter instead of instanceID: 0 to ensure AssetDatabase can resolve importer during build asset postprocessing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed up 6000.0 compilation; restored TraceRayAndQueryHit.hlsl as referenced from origin/master, wrapped packedMaterialData.isIndirectSupported with conditional compilation in InstanceCullingBatcher.cs, updated constants / keyword usage in ShaderScriptableStripperTests.cs
Checklist for PR maker
need-backport-*label. After you backport the PR, the label changes tobackported-*.CHANGELOG.mdfile.Purpose of this PR
Users were getting compile errors when opening projects including the following packages:
The console should be clear of errors when loading these packages.
Testing status
Creating a project and including the above packages should no longer result in an error. To test from this fork instead, use:
Comments to reviewers
This should merge into the Oculus-VR/UnityGraphics fork of Unity's graphics mono-repo