Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit caa1bd1

Browse files
authored
Merge branch 'v2' into shader-stripping
2 parents 2a1542b + a184bf0 commit caa1bd1

13 files changed

+199
-167
lines changed

PostProcessing/Runtime/Effects/AmbientOcclusion.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context)
8585
&& context.resources.computeShaders.multiScaleAODownsample2
8686
&& context.resources.computeShaders.multiScaleAORender
8787
&& context.resources.computeShaders.multiScaleAOUpsample
88-
&& SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RFloat)
89-
&& SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RHalf)
90-
&& SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.R8);
88+
&& RenderTextureFormat.RFloat.IsSupported()
89+
&& RenderTextureFormat.RHalf.IsSupported()
90+
&& RenderTextureFormat.R8.IsSupported();
9191
#else
9292
state = false;
9393
#endif

PostProcessing/Runtime/Effects/AutoExposure.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context)
4040
{
4141
return enabled.value
4242
&& SystemInfo.supportsComputeShaders
43-
&& SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RFloat)
43+
&& RenderTextureFormat.RFloat.IsSupported()
4444
&& context.resources.shaders.autoExposure
4545
&& context.resources.shaders.autoExposure.isSupported
4646
&& context.resources.computeShaders.exposureHistogram;
@@ -127,7 +127,7 @@ public override void Render(PostProcessRenderContext context)
127127
m_AutoExposurePingPong[context.xrActiveEye] = ++pp % 2;
128128
m_CurrentAutoExposure = dst;
129129
}
130-
130+
131131
cmd.EndSample("AutoExposureLookup");
132132

133133
context.autoExposureTexture = m_CurrentAutoExposure;

PostProcessing/Runtime/Effects/ColorGrading.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,14 +545,14 @@ static RenderTextureFormat GetLutFormat()
545545
// Use ARGBHalf if possible, fallback on ARGB2101010 and ARGB32 otherwise
546546
var format = RenderTextureFormat.ARGBHalf;
547547

548-
if (!SystemInfo.SupportsRenderTextureFormat(format))
548+
if (!format.IsSupported())
549549
{
550550
format = RenderTextureFormat.ARGB2101010;
551551

552552
// Note that using a log lut in ARGB32 is a *very* bad idea but we need it for
553553
// compatibility reasons (else if a platform doesn't support one of the previous
554554
// format it'll output a black screen, or worse will segfault on the user).
555-
if (!SystemInfo.SupportsRenderTextureFormat(format))
555+
if (!format.IsSupported())
556556
format = RenderTextureFormat.ARGB32;
557557
}
558558

PostProcessing/Runtime/Effects/DepthOfField.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context)
3535
&& SystemInfo.graphicsShaderLevel >= 35;
3636
}
3737
}
38-
38+
3939
// TODO: Look into minimum blur amount in the distance, right now it's lerped until a point
4040
// TODO: Doesn't play nice with alpha propagation, see if it can be fixed without killing performances
4141
public sealed class DepthOfFieldRenderer : PostProcessEffectRenderer<DepthOfField>
@@ -81,10 +81,10 @@ public override DepthTextureMode GetCameraFlags()
8181

8282
RenderTextureFormat SelectFormat(RenderTextureFormat primary, RenderTextureFormat secondary)
8383
{
84-
if (SystemInfo.SupportsRenderTextureFormat(primary))
84+
if (primary.IsSupported())
8585
return primary;
8686

87-
if (SystemInfo.SupportsRenderTextureFormat(secondary))
87+
if (secondary.IsSupported())
8888
return secondary;
8989

9090
return RenderTextureFormat.Default;
@@ -159,7 +159,7 @@ public override void Render(PostProcessRenderContext context)
159159
float motionBlending = context.temporalAntialiasing.motionBlending;
160160
float blend = m_ResetHistory ? 0f : motionBlending; // Handles first frame blending
161161
var jitter = context.temporalAntialiasing.jitter;
162-
162+
163163
sheet.properties.SetVector(ShaderIDs.TaaParams, new Vector3(jitter.x, jitter.y, blend));
164164

165165
int pp = m_HistoryPingPong[context.xrActiveEye];

PostProcessing/Runtime/Effects/Grain.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context)
2424
&& intensity.value > 0f;
2525
}
2626
}
27-
27+
2828
public sealed class GrainRenderer : PostProcessEffectRenderer<Grain>
2929
{
3030
RenderTexture m_GrainLookupRT;
31-
31+
3232
const int k_SampleCount = 1024;
3333
int m_SampleIndex;
3434

@@ -63,7 +63,7 @@ public override void Render(PostProcessRenderContext context)
6363

6464
m_GrainLookupRT.Create();
6565
}
66-
66+
6767
var sheet = context.propertySheets.Get(context.resources.shaders.grainBaker);
6868
sheet.properties.Clear();
6969
sheet.properties.SetFloat(ShaderIDs.Phase, time % 10f);
@@ -82,7 +82,7 @@ public override void Render(PostProcessRenderContext context)
8282

8383
RenderTextureFormat GetLookupFormat()
8484
{
85-
if (SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf))
85+
if (RenderTextureFormat.ARGBHalf.IsSupported())
8686
return RenderTextureFormat.ARGBHalf;
8787

8888
return RenderTextureFormat.ARGB32;

PostProcessing/Runtime/Effects/MotionBlur.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ public override bool IsEnabledAndSupported(PostProcessRenderContext context)
2222
&& Application.isPlaying
2323
#endif
2424
&& SystemInfo.supportsMotionVectors
25-
&& SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGHalf)
25+
&& RenderTextureFormat.RGHalf.IsSupported()
2626
&& !RuntimeUtilities.isVREnabled;
2727
}
2828
}
29-
29+
3030
public sealed class MotionBlurRenderer : PostProcessEffectRenderer<MotionBlur>
3131
{
3232
enum Pass
@@ -57,7 +57,7 @@ public override void Render(PostProcessRenderContext context)
5757

5858
const float kMaxBlurRadius = 5f;
5959
var vectorRTFormat = RenderTextureFormat.RGHalf;
60-
var packedRTFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGB2101010)
60+
var packedRTFormat = RenderTextureFormat.ARGB2101010.IsSupported()
6161
? RenderTextureFormat.ARGB2101010
6262
: RenderTextureFormat.ARGB32;
6363

PostProcessing/Runtime/PostProcessLayer.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ void BuildCommandBuffers()
375375
// We need to use the internal Blit method to copy the camera target or it'll fail
376376
// on tiled GPU as it won't be able to resolve
377377
int tempTarget0 = m_TargetPool.Get();
378-
context.GetScreenSpaceTemporaryRT(cmd, tempTarget0, 24, sourceFormat);
378+
context.GetScreenSpaceTemporaryRT(cmd, tempTarget0, 0, sourceFormat);
379379
cmd.Blit(cameraTarget, tempTarget0);
380380
context.source = tempTarget0;
381381

@@ -384,7 +384,7 @@ void BuildCommandBuffers()
384384
if (opaqueOnlyEffects > 1)
385385
{
386386
tempTarget1 = m_TargetPool.Get();
387-
context.GetScreenSpaceTemporaryRT(cmd, tempTarget1, 24, sourceFormat);
387+
context.GetScreenSpaceTemporaryRT(cmd, tempTarget1, 0, sourceFormat);
388388
context.destination = tempTarget1;
389389
}
390390
else context.destination = cameraTarget;
@@ -420,7 +420,7 @@ void BuildCommandBuffers()
420420
// Same as before, first blit needs to use the builtin Blit command to properly handle
421421
// tiled GPUs
422422
int tempRt = m_TargetPool.Get();
423-
context.GetScreenSpaceTemporaryRT(m_LegacyCmdBuffer, tempRt, 24, sourceFormat, RenderTextureReadWrite.sRGB);
423+
context.GetScreenSpaceTemporaryRT(m_LegacyCmdBuffer, tempRt, 0, sourceFormat, RenderTextureReadWrite.sRGB);
424424
m_LegacyCmdBuffer.Blit(cameraTarget, tempRt, RuntimeUtilities.copyStdMaterial, stopNaNPropagation ? 1 : 0);
425425
m_NaNKilled = stopNaNPropagation;
426426

@@ -633,7 +633,7 @@ public void Render(PostProcessRenderContext context)
633633
if (stopNaNPropagation && !m_NaNKilled)
634634
{
635635
lastTarget = m_TargetPool.Get();
636-
context.GetScreenSpaceTemporaryRT(cmd, lastTarget, 24, context.sourceFormat);
636+
context.GetScreenSpaceTemporaryRT(cmd, lastTarget, 0, context.sourceFormat);
637637
cmd.BlitFullscreenTriangle(context.source, lastTarget, RuntimeUtilities.copySheet, 1);
638638
context.source = lastTarget;
639639
m_NaNKilled = true;
@@ -658,7 +658,7 @@ public void Render(PostProcessRenderContext context)
658658

659659
var taaTarget = m_TargetPool.Get();
660660
var finalDestination = context.destination;
661-
context.GetScreenSpaceTemporaryRT(cmd, taaTarget, 24, context.sourceFormat);
661+
context.GetScreenSpaceTemporaryRT(cmd, taaTarget, 0, context.sourceFormat);
662662
context.destination = taaTarget;
663663
temporalAntialiasing.Render(context);
664664
context.source = taaTarget;
@@ -708,7 +708,7 @@ int RenderInjectionPoint(PostProcessEvent evt, PostProcessRenderContext context,
708708
var finalDestination = context.destination;
709709

710710
var cmd = context.command;
711-
context.GetScreenSpaceTemporaryRT(cmd, tempTarget, 24, context.sourceFormat);
711+
context.GetScreenSpaceTemporaryRT(cmd, tempTarget, 0, context.sourceFormat);
712712
context.destination = tempTarget;
713713
RenderList(sortedBundles[evt], context, marker);
714714
context.source = tempTarget;
@@ -759,9 +759,9 @@ void RenderList(List<SerializedBundleRef> list, PostProcessRenderContext context
759759
m_Targets.Add(context.destination); // Last target is always destination
760760

761761
// Render
762-
context.GetScreenSpaceTemporaryRT(cmd, tempTarget1, 24, context.sourceFormat);
762+
context.GetScreenSpaceTemporaryRT(cmd, tempTarget1, 0, context.sourceFormat);
763763
if (count > 2)
764-
context.GetScreenSpaceTemporaryRT(cmd, tempTarget2, 24, context.sourceFormat);
764+
context.GetScreenSpaceTemporaryRT(cmd, tempTarget2, 0, context.sourceFormat);
765765

766766
for (int i = 0; i < count; i++)
767767
{
@@ -797,7 +797,7 @@ int RenderBuiltins(PostProcessRenderContext context, bool isFinalPass, int relea
797797
{
798798
// Render to an intermediate target as this won't be the final pass
799799
tempTarget = m_TargetPool.Get();
800-
context.GetScreenSpaceTemporaryRT(cmd, tempTarget, 24, context.sourceFormat);
800+
context.GetScreenSpaceTemporaryRT(cmd, tempTarget, 0, context.sourceFormat);
801801
context.destination = tempTarget;
802802

803803
// Handle FXAA's keep alpha mode
@@ -889,7 +889,7 @@ void RenderFinalPass(PostProcessRenderContext context, int releaseTargetAfterUse
889889
{
890890
tempTarget = m_TargetPool.Get();
891891
var finalDestination = context.destination;
892-
context.GetScreenSpaceTemporaryRT(context.command, tempTarget, 24, context.sourceFormat);
892+
context.GetScreenSpaceTemporaryRT(context.command, tempTarget, 0, context.sourceFormat);
893893
context.destination = tempTarget;
894894
subpixelMorphologicalAntialiasing.Render(context);
895895
context.source = tempTarget;
@@ -929,7 +929,7 @@ int RenderEffect<T>(PostProcessRenderContext context, bool useTempTarget = false
929929

930930
var finalDestination = context.destination;
931931
var tempTarget = m_TargetPool.Get();
932-
context.GetScreenSpaceTemporaryRT(context.command, tempTarget, 24, context.sourceFormat);
932+
context.GetScreenSpaceTemporaryRT(context.command, tempTarget, 0, context.sourceFormat);
933933
context.destination = tempTarget;
934934
effect.renderer.Render(context);
935935
context.source = tempTarget;

0 commit comments

Comments
 (0)