Skip to content

Commit e354586

Browse files
thomas-zengEvergreen
authored andcommitted
[URP] [XR] Fixed transient textures dynamic scaling when using RG NRP API
1 parent 66979b0 commit e354586

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,28 +1783,24 @@ internal unsafe void ExecuteBeginRenderPass(InternalRenderGraphContext rgContext
17831783
currBeginAttachment = new AttachmentDescriptor(renderTargetInfo.format);
17841784

17851785
// Set up the RT pointers
1786-
if (attachments[i].memoryless == false)
1786+
var rtHandle = resources.GetTexture(currAttachmentHandle.index);
1787+
1788+
//HACK: Always set the loadstore target even if StoreAction == DontCare or Resolve
1789+
//and LoadAction == Clear or DontCare
1790+
//in these cases you could argue setting the loadStoreTarget to NULL and only set the resolveTarget
1791+
//but this confuses the backend (on vulkan) and in general is not how the lower level APIs tend to work.
1792+
//because of the RenderTexture duality where we always bundle store+resolve targets as one RTex
1793+
//it does become impossible to have a memoryless loadStore texture with a memoryfull resolve
1794+
//but that is why we mark this as a hack and future work to fix.
1795+
//The proper (and planned) solution would be to move away from the render texture duality.
1796+
RenderTargetIdentifier rtidAllSlices = rtHandle;
1797+
currBeginAttachment.loadStoreTarget = new RenderTargetIdentifier(rtidAllSlices, attachments[i].mipLevel, CubemapFace.Unknown, attachments[i].depthSlice);
1798+
1799+
if (attachments[i].storeAction == RenderBufferStoreAction.Resolve ||
1800+
attachments[i].storeAction == RenderBufferStoreAction.StoreAndResolve)
17871801
{
1788-
var rtHandle = resources.GetTexture(currAttachmentHandle.index);
1789-
1790-
//HACK: Always set the loadstore target even if StoreAction == DontCare or Resolve
1791-
//and LoadAction == Clear or DontCare
1792-
//in these cases you could argue setting the loadStoreTarget to NULL and only set the resolveTarget
1793-
//but this confuses the backend (on vulkan) and in general is not how the lower level APIs tend to work.
1794-
//because of the RenderTexture duality where we always bundle store+resolve targets as one RTex
1795-
//it does become impossible to have a memoryless loadStore texture with a memoryfull resolve
1796-
//but that is why we mark this as a hack and future work to fix.
1797-
//The proper (and planned) solution would be to move away from the render texture duality.
1798-
RenderTargetIdentifier rtidAllSlices = rtHandle;
1799-
currBeginAttachment.loadStoreTarget = new RenderTargetIdentifier(rtidAllSlices, attachments[i].mipLevel, CubemapFace.Unknown, attachments[i].depthSlice);
1800-
1801-
if (attachments[i].storeAction == RenderBufferStoreAction.Resolve ||
1802-
attachments[i].storeAction == RenderBufferStoreAction.StoreAndResolve)
1803-
{
1804-
currBeginAttachment.resolveTarget = rtHandle;
1805-
}
1802+
currBeginAttachment.resolveTarget = rtHandle;
18061803
}
1807-
// In the memoryless case it's valid to not set both loadStoreTarget/and resolveTarget as the backend will allocate a transient one
18081804

18091805
currBeginAttachment.loadAction = attachments[i].loadAction;
18101806
currBeginAttachment.storeAction = attachments[i].storeAction;

0 commit comments

Comments
 (0)