Skip to content

Commit fe61d65

Browse files
authored
Remove deprecated UNITY_USE_NATIVE_HDR keyword from shader code. (#5569)
1 parent 5ea5ce4 commit fe61d65

File tree

4 files changed

+10
-20
lines changed

4 files changed

+10
-20
lines changed

com.unity.render-pipelines.universal/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
4848
- Fixed a regression bug where XR camera postion can not be modified in beginCameraRendering [case 1365000]
4949
- Fixed an issue in where installing the Adaptive Performance package caused errors to the inspector UI [1368161](https://issuetracker.unity3d.com/issues/urp-package-throws-compilation-error-cs1525-when-imported-together-with-adaptive-performance-package)
5050

51+
### Changed
52+
- Remove use of deprecated UNITY_USE_NATIVE_HDR keyword in shaders.
53+
5154
## [12.0.0] - 2021-01-11
5255
### Added
5356
- Added support for default sprite mask shaders for the 2D Renderer in URP.

com.unity.render-pipelines.universal/ShaderLibrary/GlobalIllumination.hlsl

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,7 @@ half3 CalculateIrradianceFromReflectionProbes(half3 reflectVector, float3 positi
220220

221221
half4 encodedIrradiance = half4(SAMPLE_TEXTURECUBE_LOD(unity_SpecCube0, samplerunity_SpecCube0, reflectVector, mip));
222222

223-
#if defined(UNITY_USE_NATIVE_HDR)
224-
irradiance += weightProbe0 * encodedIrradiance.rbg;
225-
#else
226223
irradiance += weightProbe0 * DecodeHDREnvironment(encodedIrradiance, unity_SpecCube0_HDR);
227-
#endif // UNITY_USE_NATIVE_HDR
228224
}
229225

230226
// Sample the second reflection probe
@@ -235,23 +231,23 @@ half3 CalculateIrradianceFromReflectionProbes(half3 reflectVector, float3 positi
235231
#endif // _REFLECTION_PROBE_BOX_PROJECTION
236232
half4 encodedIrradiance = half4(SAMPLE_TEXTURECUBE_LOD(unity_SpecCube1, samplerunity_SpecCube1, reflectVector, mip));
237233

238-
#if defined(UNITY_USE_NATIVE_HDR) || defined(UNITY_DOTS_INSTANCING_ENABLED)
234+
#if defined(UNITY_DOTS_INSTANCING_ENABLED)
239235
irradiance += weightProbe1 * encodedIrradiance.rbg;
240236
#else
241237
irradiance += weightProbe1 * DecodeHDREnvironment(encodedIrradiance, unity_SpecCube1_HDR);
242-
#endif // UNITY_USE_NATIVE_HDR || UNITY_DOTS_INSTANCING_ENABLED
238+
#endif // UNITY_DOTS_INSTANCING_ENABLED
243239
}
244240

245241
// Use any remaining weight to blend to environment reflection cube map
246242
if (totalWeight < 0.99f)
247243
{
248244
half4 encodedIrradiance = half4(SAMPLE_TEXTURECUBE_LOD(_GlossyEnvironmentCubeMap, sampler_GlossyEnvironmentCubeMap, originalReflectVector, mip));
249245

250-
#if defined(UNITY_USE_NATIVE_HDR) || defined(UNITY_DOTS_INSTANCING_ENABLED)
246+
#if defined(UNITY_DOTS_INSTANCING_ENABLED)
251247
irradiance += (1.0f - totalWeight) * encodedIrradiance.rbg;
252248
#else
253249
irradiance += (1.0f - totalWeight) * DecodeHDREnvironment(encodedIrradiance, _GlossyEnvironmentCubeMap_HDR);
254-
#endif // UNITY_USE_NATIVE_HDR || UNITY_DOTS_INSTANCING_ENABLED
250+
#endif // UNITY_DOTS_INSTANCING_ENABLED
255251
}
256252

257253
return irradiance;
@@ -271,11 +267,7 @@ half3 GlossyEnvironmentReflection(half3 reflectVector, float3 positionWS, half p
271267
half mip = PerceptualRoughnessToMipmapLevel(perceptualRoughness);
272268
half4 encodedIrradiance = half4(SAMPLE_TEXTURECUBE_LOD(unity_SpecCube0, samplerunity_SpecCube0, reflectVector, mip));
273269

274-
#if defined(UNITY_USE_NATIVE_HDR)
275-
irradiance = encodedIrradiance.rgb;
276-
#else
277270
irradiance = DecodeHDREnvironment(encodedIrradiance, unity_SpecCube0_HDR);
278-
#endif // UNITY_USE_NATIVE_HDR
279271
#endif // _REFLECTION_PROBE_BLENDING
280272
return irradiance * occlusion;
281273
#else
@@ -290,11 +282,7 @@ half3 GlossyEnvironmentReflection(half3 reflectVector, half perceptualRoughness,
290282
half mip = PerceptualRoughnessToMipmapLevel(perceptualRoughness);
291283
half4 encodedIrradiance = half4(SAMPLE_TEXTURECUBE_LOD(unity_SpecCube0, samplerunity_SpecCube0, reflectVector, mip));
292284

293-
#if defined(UNITY_USE_NATIVE_HDR)
294-
irradiance = encodedIrradiance.rgb;
295-
#else
296285
irradiance = DecodeHDREnvironment(encodedIrradiance, unity_SpecCube0_HDR);
297-
#endif // UNITY_USE_NATIVE_HDR
298286

299287
return irradiance * occlusion;
300288
#else

com.unity.shadergraph/CHANGELOG.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1212
- Fixed unhandled exception when loading a subgraph with duplicate slots [1366200] (https://issuetracker.unity3d.com/product/unity/issues/guid/1366200/)
1313

1414
## [13.0.0] - 2021-09-01
15-
16-
Version Updated
17-
The version number for this package has increased due to a version update of a related graphics package.
15+
### Changed
16+
- Remove use of deprecated UNITY_USE_NATIVE_HDR keyword in shaders.
1817

1918
### Added
2019
- Adding control of anisotropic settings on inline Sampler state nodes in ShaderGraph.

com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Lighting.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ half3 GlossyEnvironmentReflection(half3 reflectVector, half perceptualRoughness,
647647
half4 encodedIrradiance = SAMPLE_TEXTURECUBE_LOD(unity_SpecCube0, samplerunity_SpecCube0, reflectVector, mip);
648648

649649
//TODO:DOTS - we need to port probes to live in c# so we can manage this manually.
650-
#if defined(UNITY_USE_NATIVE_HDR) || defined(UNITY_DOTS_INSTANCING_ENABLED)
650+
#if defined(UNITY_DOTS_INSTANCING_ENABLED)
651651
half3 irradiance = encodedIrradiance.rgb;
652652
#else
653653
half3 irradiance = DecodeHDREnvironment(encodedIrradiance, unity_SpecCube0_HDR);

0 commit comments

Comments
 (0)