forked from Mirror/Ryujinx
Hold reference for render targets in use (#2156)
This commit is contained in:
parent
9ae60207c4
commit
f665e1b409
2 changed files with 38 additions and 29 deletions
|
@ -1188,6 +1188,15 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
IsModified = true;
|
||||
Group.SignalModifying(this, bound, !wasModified);
|
||||
}
|
||||
|
||||
if (bound)
|
||||
{
|
||||
IncrementReferenceCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
DecrementReferenceCount();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -197,6 +197,27 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
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>
|
||||
/// Gets the first available bound colour target, or the depth stencil target if not present.
|
||||
/// </summary>
|
||||
|
@ -290,27 +311,6 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
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>
|
||||
/// Commits bindings on the compute pipeline.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in a new issue