Skip to content

Commit b4eb140

Browse files
Fix HDRP warnings on 2020.X (#260)
* Fix HDRP warnings on 2020.2 * Updating changelog * Fixing HDRP version expression on 2019.4
1 parent 7365292 commit b4eb140

File tree

6 files changed

+49
-3
lines changed

6 files changed

+49
-3
lines changed

com.unity.perception/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2121

2222
### Fixed
2323

24+
Fixed compiler warnings in projects with HDRP on 2020.1 and later
25+
2426
## [0.8.0-preview.2] - 2021-03-15
2527

2628
### Upgrade Notes

com.unity.perception/Runtime/GroundTruth/RenderPasses/HdrpPasses/GroundTruthPass.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,18 @@ protected override void Setup(ScriptableRenderContext renderContext, CommandBuff
3030
targetDepthBuffer = TargetBuffer.Custom;
3131
}
3232

33-
protected sealed override void Execute(
34-
ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult)
33+
//overrides obsolete member in HDRP on 2020.1+. Re-address when removing 2019.4 support or the API is dropped
34+
#if HDRP_9_OR_NEWER
35+
protected override void Execute(CustomPassContext ctx)
3536
{
37+
ScriptableRenderContext renderContext = ctx.renderContext;
38+
var cmd = ctx.cmd;
39+
var hdCamera = ctx.hdCamera;
40+
var cullingResult = ctx.cullingResults;
41+
#else
42+
protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult)
43+
{
44+
#endif
3645
// CustomPasses are executed for each camera. We only want to run for the target camera
3746
if (hdCamera.camera != targetCamera)
3847
return;

com.unity.perception/Runtime/GroundTruth/RenderPasses/HdrpPasses/InstanceSegmentationPass.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,18 @@ public class InstanceSegmentationPass : CustomPass
2020
[UsedImplicitly]
2121
public InstanceSegmentationPass() {}
2222

23+
//overrides obsolete member in HDRP on 2020.1+. Re-address when removing 2019.4 support or the API is dropped
24+
#if HDRP_9_OR_NEWER
25+
protected override void Execute(CustomPassContext ctx)
26+
{
27+
ScriptableRenderContext renderContext = ctx.renderContext;
28+
var cmd = ctx.cmd;
29+
var hdCamera = ctx.hdCamera;
30+
var cullingResult = ctx.cullingResults;
31+
#else
2332
protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult)
2433
{
34+
#endif
2535
CoreUtils.SetRenderTarget(cmd, targetTexture, ClearFlag.All);
2636
m_InstanceSegmentationCrossPipelinePass.Execute(renderContext, cmd, hdCamera.camera, cullingResult);
2737
}

com.unity.perception/Runtime/GroundTruth/RenderPasses/HdrpPasses/LensDistortionPass.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,18 @@ protected override void Setup(ScriptableRenderContext renderContext, CommandBuff
3838
lensDistortionCrossPipelinePass.Setup();
3939
}
4040

41+
//overrides obsolete member in HDRP on 2020.1+. Re-address when removing 2019.4 support or the API is dropped
42+
#if HDRP_9_OR_NEWER
43+
protected override void Execute(CustomPassContext ctx)
44+
{
45+
ScriptableRenderContext renderContext = ctx.renderContext;
46+
var cmd = ctx.cmd;
47+
var hdCamera = ctx.hdCamera;
48+
var cullingResult = ctx.cullingResults;
49+
#else
4150
protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult)
4251
{
52+
#endif
4353
CoreUtils.SetRenderTarget(cmd, targetTexture);
4454
lensDistortionCrossPipelinePass.Execute(renderContext, cmd, hdCamera.camera, cullingResult);
4555
}

com.unity.perception/Runtime/GroundTruth/RenderPasses/HdrpPasses/SemanticSegmentationPass.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,18 @@ protected override void Setup(ScriptableRenderContext renderContext, CommandBuff
4040
m_SemanticSegmentationCrossPipelinePass.Setup();
4141
}
4242

43+
//overrides obsolete member in HDRP on 2020.1+. Re-address when removing 2019.4 support or the API is dropped
44+
#if HDRP_9_OR_NEWER
45+
protected override void Execute(CustomPassContext ctx)
46+
{
47+
ScriptableRenderContext renderContext = ctx.renderContext;
48+
var cmd = ctx.cmd;
49+
var hdCamera = ctx.hdCamera;
50+
var cullingResult = ctx.cullingResults;
51+
#else
4352
protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult)
4453
{
54+
#endif
4555
CoreUtils.SetRenderTarget(cmd, targetTexture);
4656
m_SemanticSegmentationCrossPipelinePass.Execute(renderContext, cmd, hdCamera.camera, cullingResult);
4757
}

com.unity.perception/Runtime/Unity.Perception.Runtime.asmdef

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@
3636
"name": "com.unity.simulation.capture",
3737
"expression": "0.0.10-preview.16",
3838
"define": "SIMULATION_CAPTURE_0_0_10_PREVIEW_16_OR_NEWER"
39+
},
40+
{
41+
"name": "com.unity.render-pipelines.high-definition",
42+
"expression": "9.0",
43+
"define": "HDRP_9_OR_NEWER"
3944
}
4045
],
4146
"noEngineReferences": false
42-
}
47+
}

0 commit comments

Comments
 (0)