Fix res scale parameters not being updated in vertex shader (#3046)
This fixes an issue where the render scale array would not be updated when technically the scales on the flat array were the same, but the start index for the vertex scales was different.
This commit is contained in:
parent
0a0a95fd81
commit
fd6d3ec88f
1 changed files with 19 additions and 14 deletions
|
@ -49,6 +49,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
|
|
||||||
private readonly float[] _scales;
|
private readonly float[] _scales;
|
||||||
private bool _scaleChanged;
|
private bool _scaleChanged;
|
||||||
|
private int _lastFragmentTotal;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs a new instance of the texture bindings manager.
|
/// Constructs a new instance of the texture bindings manager.
|
||||||
|
@ -288,26 +289,30 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void CommitRenderScale()
|
private void CommitRenderScale()
|
||||||
{
|
{
|
||||||
|
// Stage 0 total: Compute or Vertex.
|
||||||
|
int total = _textureBindingsCount[0] + _imageBindingsCount[0];
|
||||||
|
|
||||||
|
int fragmentIndex = (int)ShaderStage.Fragment - 1;
|
||||||
|
int fragmentTotal = _isCompute ? 0 : (_textureBindingsCount[fragmentIndex] + _imageBindingsCount[fragmentIndex]);
|
||||||
|
|
||||||
|
if (total != 0 && fragmentTotal != _lastFragmentTotal)
|
||||||
|
{
|
||||||
|
// Must update scales in the support buffer if:
|
||||||
|
// - Vertex stage has bindings.
|
||||||
|
// - Fragment stage binding count has been updated since last render scale update.
|
||||||
|
|
||||||
|
_scaleChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (_scaleChanged)
|
if (_scaleChanged)
|
||||||
{
|
{
|
||||||
int fragmentTotal = 0;
|
|
||||||
int total;
|
|
||||||
|
|
||||||
if (!_isCompute)
|
if (!_isCompute)
|
||||||
{
|
{
|
||||||
int fragmentIndex = (int)ShaderStage.Fragment - 1;
|
total += fragmentTotal; // Add the fragment bindings to the total.
|
||||||
fragmentTotal = _textureBindingsCount[fragmentIndex] + _imageBindingsCount[fragmentIndex];
|
|
||||||
|
|
||||||
int vertexIndex = (int)ShaderStage.Vertex - 1;
|
|
||||||
int vertexTotal = _textureBindingsCount[vertexIndex] + _imageBindingsCount[vertexIndex];
|
|
||||||
|
|
||||||
total = fragmentTotal + vertexTotal;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
total = _textureBindingsCount[0] + _imageBindingsCount[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_lastFragmentTotal = fragmentTotal;
|
||||||
|
|
||||||
_context.Renderer.Pipeline.UpdateRenderScale(_scales, total, fragmentTotal);
|
_context.Renderer.Pipeline.UpdateRenderScale(_scales, total, fragmentTotal);
|
||||||
|
|
||||||
_scaleChanged = false;
|
_scaleChanged = false;
|
||||||
|
|
Loading…
Reference in a new issue