Skip to content

[HDRP] Fix issue with previous frame exposure texture being not null, but containing garbage #2574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [11.0.0] - 2020-10-21

### Changed

- Removed the material pass probe volumes evaluation mode.

### Fixed
- Fixed probe volumes debug views.
- Fixed picking for materials with depth offset.

## [10.2.0] - 2020-10-19

Expand Down Expand Up @@ -97,6 +95,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed an issue causing errors in GenerateMaxZ when opaque objects or decals are disabled.
- Fixed an issue with Bake button of Reflection Probe when in custom mode
- Fixed exceptions related to the debug display settings when changing the default frame settings.
- Fixed picking for materials with depth offset.
- Fixed issue with exposure history being uninitialized on second frame.

### Changed
- Combined occlusion meshes into one to reduce draw calls and state changes with XR single-pass.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ private enum SMAAStage

bool m_IsDoFHisotoryValid = false;

void FillEmptyExposureTexture()
static void SetExposureTextureToEmpty(RTHandle exposureTexture)
{
var tex = new Texture2D(1, 1, TextureFormat.RGHalf, false, true);
tex.SetPixel(0, 0, new Color(1f, ColorUtils.ConvertExposureToEV100(1f), 0f, 0f));
tex.Apply();
Graphics.Blit(tex, m_EmptyExposureTexture);
Graphics.Blit(tex, exposureTexture);
CoreUtils.Destroy(tex);
}

Expand Down Expand Up @@ -215,7 +215,7 @@ public PostProcessSystem(HDRenderPipelineAsset hdAsset, RenderPipelineResources
enableRandomWrite: true, name: "Debug Exposure Info"
);

FillEmptyExposureTexture();
SetExposureTextureToEmpty(m_EmptyExposureTexture);
}

public void Cleanup()
Expand Down Expand Up @@ -323,7 +323,7 @@ public void CleanupNonRenderGraphResources()
void CheckRenderTexturesValidity()
{
if (!m_EmptyExposureTexture.rt.IsCreated())
FillEmptyExposureTexture();
SetExposureTextureToEmpty(m_EmptyExposureTexture);

if (!m_NonRenderGraphResourcesAvailable)
return;
Expand Down Expand Up @@ -1369,9 +1369,11 @@ static void GrabExposureHistoryTextures(HDCamera camera, out RTHandle previous,
RTHandle Allocator(string id, int frameIndex, RTHandleSystem rtHandleSystem)
{
// r: multiplier, g: EV100
return rtHandleSystem.Alloc(1, 1, colorFormat: k_ExposureFormat,
var rt = rtHandleSystem.Alloc(1, 1, colorFormat: k_ExposureFormat,
enableRandomWrite: true, name: $"{id} Exposure Texture {frameIndex}"
);
SetExposureTextureToEmpty(rt);
return rt;
}

// We rely on the RT history system that comes with HDCamera, but because it is swapped
Expand Down