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;
|
IsModified = true;
|
||||||
Group.SignalModifying(this, bound, !wasModified);
|
Group.SignalModifying(this, bound, !wasModified);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bound)
|
||||||
|
{
|
||||||
|
IncrementReferenceCount();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DecrementReferenceCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Reference in a new issue