1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-04 18:42:01 +00:00

Hold reference for render targets in use (#2156)

This commit is contained in:
gdkchan 2021-04-02 11:33:39 -03:00 committed by GitHub
parent 9ae60207c4
commit f665e1b409
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 29 deletions

View file

@ -1188,6 +1188,15 @@ namespace Ryujinx.Graphics.Gpu.Image
IsModified = true; IsModified = true;
Group.SignalModifying(this, bound, !wasModified); Group.SignalModifying(this, bound, !wasModified);
} }
if (bound)
{
IncrementReferenceCount();
}
else
{
DecrementReferenceCount();
}
} }
/// <summary> /// <summary>

View file

@ -197,6 +197,27 @@ namespace Ryujinx.Graphics.Gpu.Image
return changesScale || (hasValue && color.ScaleMode != TextureScaleMode.Blacklisted && color.ScaleFactor != GraphicsConfig.ResScale); return changesScale || (hasValue && color.ScaleMode != TextureScaleMode.Blacklisted && color.ScaleFactor != GraphicsConfig.ResScale);
} }
/// <summary>
/// Sets the render target depth-stencil buffer.
/// </summary>
/// <param name="depthStencil">The depth-stencil buffer texture</param>
/// <returns>True if render target scale must be updated.</returns>
public bool SetRenderTargetDepthStencil(Texture depthStencil)
{
bool hasValue = depthStencil != null;
bool changesScale = (hasValue != (_rtDepthStencil != null)) || (hasValue && RenderTargetScale != depthStencil.ScaleFactor);
if (_rtDepthStencil != depthStencil)
{
_rtDepthStencil?.SignalModifying(false);
depthStencil?.SignalModifying(true);
_rtDepthStencil = depthStencil;
}
return changesScale || (hasValue && depthStencil.ScaleMode != TextureScaleMode.Blacklisted && depthStencil.ScaleFactor != GraphicsConfig.ResScale);
}
/// <summary> /// <summary>
/// Gets the first available bound colour target, or the depth stencil target if not present. /// Gets the first available bound colour target, or the depth stencil target if not present.
/// </summary> /// </summary>
@ -290,27 +311,6 @@ namespace Ryujinx.Graphics.Gpu.Image
RenderTargetScale = targetScale; RenderTargetScale = targetScale;
} }
/// <summary>
/// Sets the render target depth-stencil buffer.
/// </summary>
/// <param name="depthStencil">The depth-stencil buffer texture</param>
/// <returns>True if render target scale must be updated.</returns>
public bool SetRenderTargetDepthStencil(Texture depthStencil)
{
bool hasValue = depthStencil != null;
bool changesScale = (hasValue != (_rtDepthStencil != null)) || (hasValue && RenderTargetScale != depthStencil.ScaleFactor);
if (_rtDepthStencil != depthStencil)
{
_rtDepthStencil?.SignalModifying(false);
depthStencil?.SignalModifying(true);
_rtDepthStencil = depthStencil;
}
return changesScale || (hasValue && depthStencil.ScaleMode != TextureScaleMode.Blacklisted && depthStencil.ScaleFactor != GraphicsConfig.ResScale);
}
/// <summary> /// <summary>
/// Commits bindings on the compute pipeline. /// Commits bindings on the compute pipeline.
/// </summary> /// </summary>