Skip to content
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
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ The version number for this package has increased due to a version update of a r
- Adding missing marker for ray tracing profiling (RaytracingDeferredLighting)
- Added the support of eye shader for ray tracing.
- Exposed Refraction Model to the material UI when using a Lit ShaderGraph.
- Added frame setting for Virtual Texturing.

### Fixed
- Fixed several issues with physically-based DoF (TAA ghosting of the CoC buffer, smooth layer transitions, etc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ static void Drawer_SectionRenderingSettings(SerializedFrameSettings serialized,
});

area.AmmendInfo(FrameSettingsField.RayTracing, overrideable: () => hdrpSettings.supportRayTracing);
#if !ENABLE_VIRTUALTEXTURES
area.AmmendInfo(FrameSettingsField.VirtualTexturing, overrideable: () => false);
#endif
area.AmmendInfo(FrameSettingsField.MotionVectors, overrideable: () => hdrpSettings.supportMotionVectors);
area.AmmendInfo(FrameSettingsField.ObjectMotionVectors, overrideable: () => hdrpSettings.supportMotionVectors);
area.AmmendInfo(FrameSettingsField.TransparentsWriteMotionVector, overrideable: () => hdrpSettings.supportMotionVectors);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,29 @@ public void Cleanup()

public void BeginRender(HDCamera hdCamera)
{
int width = hdCamera.actualWidth;
int height = hdCamera.actualHeight;
bool msaa = hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA);
GetResolveDimensions(ref width, ref height);
if (msaa)
m_ResolverMsaa.UpdateSize(width, height);
else
m_Resolver.UpdateSize(width, height);
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.VirtualTexturing))
{
int width = hdCamera.actualWidth;
int height = hdCamera.actualHeight;
bool msaa = hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA);
GetResolveDimensions(ref width, ref height);
if (msaa)
m_ResolverMsaa.UpdateSize(width, height);
else
m_Resolver.UpdateSize(width, height);
}
}

public void Resolve(CommandBuffer cmd, RTHandle rt, HDCamera hdCamera)
{
var parameters = PrepareResolveVTParameters(hdCamera);
var msaaEnabled = hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA);
RTHandle input = msaaEnabled ? FeedbackBufferMsaa : (rt != null ? rt : FeedbackBuffer);
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.VirtualTexturing))
{
var parameters = PrepareResolveVTParameters(hdCamera);
var msaaEnabled = hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA);
RTHandle input = msaaEnabled ? FeedbackBufferMsaa : (rt != null ? rt : FeedbackBuffer);

ResolveVTDispatch(parameters, cmd, input, m_LowresResolver);
ResolveVTDispatch(parameters, cmd, input, m_LowresResolver);
}
}

class ResolveVTData
Expand All @@ -107,21 +113,24 @@ class ResolveVTData

public void Resolve(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle input)
{
using (var builder = renderGraph.AddRenderPass<ResolveVTData>("Resolve VT", out var passData))
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.VirtualTexturing))
{
// The output is never read outside the pass but is still useful for the VT system so we can't cull this pass.
builder.AllowPassCulling(false);

passData.parameters = PrepareResolveVTParameters(hdCamera);
passData.input = builder.ReadTexture(input);
passData.lowres = builder.WriteTexture(renderGraph.ImportTexture(m_LowresResolver));

builder.SetRenderFunc(
(ResolveVTData data, RenderGraphContext ctx) =>
using (var builder = renderGraph.AddRenderPass<ResolveVTData>("Resolve VT", out var passData))
{
ResolveVTDispatch(data.parameters, ctx.cmd, data.input, data.lowres);
VirtualTexturing.System.Update();
});
// The output is never read outside the pass but is still useful for the VT system so we can't cull this pass.
builder.AllowPassCulling(false);

passData.parameters = PrepareResolveVTParameters(hdCamera);
passData.input = builder.ReadTexture(input);
passData.lowres = builder.WriteTexture(renderGraph.ImportTexture(m_LowresResolver));

builder.SetRenderFunc(
(ResolveVTData data, RenderGraphContext ctx) =>
{
ResolveVTDispatch(data.parameters, ctx.cmd, data.input, data.lowres);
VirtualTexturing.System.Update();
});
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2992,12 +2992,15 @@ void Callback(CommandBuffer c, HDCamera cam)
}

#if ENABLE_VIRTUALTEXTURES
m_VtBufferManager.Resolve(cmd, m_GbufferManager.GetVTFeedbackBuffer(), hdCamera);
VirtualTexturing.System.Update();

if(m_VTDebugBlit != null)
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.VirtualTexturing))
{
PushFullScreenVTFeedbackDebugTexture(cmd, GetVTFeedbackBufferForForward(hdCamera), hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA));
m_VtBufferManager.Resolve(cmd, m_GbufferManager.GetVTFeedbackBuffer(), hdCamera);
VirtualTexturing.System.Update();

if (m_VTDebugBlit != null)
{
PushFullScreenVTFeedbackDebugTexture(cmd, GetVTFeedbackBufferForForward(hdCamera), hdCamera.frameSettings.IsEnabled(FrameSettingsField.MSAA));
}
}
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ public enum FrameSettingsField
/// <summary>When enabled, HDRP renders custom passes contained in CustomPassVolume components.</summary>
[FrameSettingsField(0, autoName: CustomPass, customOrderInGroup: 11, tooltip: "When enabled, HDRP renders custom passes contained in CustomPassVolume components.")]
CustomPass = 6,
/// <summary>When enabled, HDRP can use virtual texturing.</summary>
[FrameSettingsField(0, autoName: VirtualTexturing, customOrderInGroup: 105, tooltip: "When enabled, HDRP can use virtual texturing.")]
VirtualTexturing = 67,

/// <summary>When enabled, HDRP processes a motion vector pass for Cameras using these Frame Settings.</summary>
[FrameSettingsField(0, autoName: MotionVectors, customOrderInGroup: 12, tooltip: "When enabled, HDRP processes a motion vector pass for Cameras using these Frame Settings (Depends on \"Motion Vectors\" in current HDRP Asset).")]
Expand Down Expand Up @@ -393,6 +396,7 @@ partial struct FrameSettings
(uint)FrameSettingsField.TransparentPrepass,
(uint)FrameSettingsField.TransparentPostpass,
(uint)FrameSettingsField.CustomPass,
(uint)FrameSettingsField.VirtualTexturing,
(uint)FrameSettingsField.MotionVectors, // Enable/disable whole motion vectors pass (Camera + Object).
(uint)FrameSettingsField.ObjectMotionVectors,
(uint)FrameSettingsField.Decals,
Expand Down Expand Up @@ -468,6 +472,7 @@ partial struct FrameSettings
(uint)FrameSettingsField.TransparentPrepass,
(uint)FrameSettingsField.TransparentPostpass,
(uint)FrameSettingsField.CustomPass,
(uint)FrameSettingsField.VirtualTexturing,
(uint)FrameSettingsField.MotionVectors, // Enable/disable whole motion vectors pass (Camera + Object).
(uint)FrameSettingsField.ObjectMotionVectors,
(uint)FrameSettingsField.Decals,
Expand Down Expand Up @@ -524,6 +529,7 @@ partial struct FrameSettings
(uint)FrameSettingsField.TransparentPrepass,
(uint)FrameSettingsField.TransparentPostpass,
(uint)FrameSettingsField.CustomPass,
(uint)FrameSettingsField.VirtualTexturing,
//(uint)FrameSettingsField.MotionVectors, // Enable/disable whole motion vectors pass (Camera + Object).
//(uint)FrameSettingsField.ObjectMotionVectors,
(uint)FrameSettingsField.Decals,
Expand Down