aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2019-12-06 20:19:12 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit17fb11ddb98e94aaf494eaf6002ab149c5d54000 (patch)
treeefd9b4853181d1f5b0b7b56e186206ee49d692c1
parentcb171f6ebfa7e1aa5721503d1c1115719957932d (diff)
Fix wrong maximum id on sampler pool in some cases
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/Methods.cs9
-rw-r--r--Ryujinx.Graphics.Gpu/Image/Pool.cs5
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs2
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs3
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/DefaultNames.cs3
-rw-r--r--Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs2
6 files changed, 14 insertions, 10 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Methods.cs b/Ryujinx.Graphics.Gpu/Engine/Methods.cs
index 5388c86d..29360cf9 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Methods.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Methods.cs
@@ -123,7 +123,7 @@ namespace Ryujinx.Graphics.Gpu.Engine
}
// Pools.
- if (state.QueryModified(MethodOffset.SamplerPoolState))
+ if (state.QueryModified(MethodOffset.SamplerPoolState, MethodOffset.SamplerIndex))
{
UpdateSamplerPoolState(state);
}
@@ -422,11 +422,16 @@ namespace Ryujinx.Graphics.Gpu.Engine
private void UpdateSamplerPoolState(GpuState state)
{
+ var texturePool = state.Get<PoolState>(MethodOffset.TexturePoolState);
var samplerPool = state.Get<PoolState>(MethodOffset.SamplerPoolState);
var samplerIndex = state.Get<SamplerIndex>(MethodOffset.SamplerIndex);
- _textureManager.SetGraphicsSamplerPool(samplerPool.Address.Pack(), samplerPool.MaximumId, samplerIndex);
+ int maximumId = samplerIndex == SamplerIndex.ViaHeaderIndex
+ ? texturePool.MaximumId
+ : samplerPool.MaximumId;
+
+ _textureManager.SetGraphicsSamplerPool(samplerPool.Address.Pack(), maximumId, samplerIndex);
}
private void UpdateTexturePoolState(GpuState state)
diff --git a/Ryujinx.Graphics.Gpu/Image/Pool.cs b/Ryujinx.Graphics.Gpu/Image/Pool.cs
index 7457de19..5ce8d7f6 100644
--- a/Ryujinx.Graphics.Gpu/Image/Pool.cs
+++ b/Ryujinx.Graphics.Gpu/Image/Pool.cs
@@ -11,12 +11,15 @@ namespace Ryujinx.Graphics.Gpu.Image
protected T[] Items;
+ public int MaximumId { get; }
+
public ulong Address { get; }
public ulong Size { get; }
public Pool(GpuContext context, ulong address, int maximumId)
{
- Context = context;
+ Context = context;
+ MaximumId = maximumId;
int count = maximumId + 1;
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
index 290bb665..63a42709 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
@@ -76,7 +76,7 @@ namespace Ryujinx.Graphics.Gpu.Image
if (_samplerPool != null)
{
- if (_samplerPool.Address == address)
+ if (_samplerPool.Address == address && _samplerPool.MaximumId >= maximumId)
{
return;
}
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
index 85a0001b..32c90c2d 100644
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
+++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Declarations.cs
@@ -180,9 +180,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
public static void DeclareLocals(CodeGenContext context, StructuredProgramInfo info)
{
- context.AppendLine(GetVarTypeName(VariableType.S32) + " " + DefaultNames.DummyIntName + ";");
- context.AppendLine(GetVarTypeName(VariableType.U32) + " " + DefaultNames.DummyUintName + ";");
-
foreach (AstOperand decl in info.Locals)
{
string name = context.OperandManager.DeclareLocal(decl);
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/DefaultNames.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/DefaultNames.cs
index 90853b9f..4da38b2d 100644
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/DefaultNames.cs
+++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/DefaultNames.cs
@@ -22,9 +22,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
public const string LocalMemoryName = "local_mem";
public const string SharedMemoryName = "shared_mem";
- public const string DummyIntName = "dummyInt";
- public const string DummyUintName = "dummyUint";
-
public const string UndefinedName = "undef";
}
} \ No newline at end of file
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs
index 2a8f00cc..0cb854e9 100644
--- a/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs
+++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs
@@ -241,6 +241,8 @@ namespace Ryujinx.Graphics.Shader.Instructions
res = context.IAdd(res, srcC);
+ // TODO: CC, X, SAT, and more?
+
context.Copy(GetDest(context), res);
}