Stop identifying shader textures with handle and cbuf, use binding instead (#5266)
* Stop identifying shader textures with handle and cbuf, use binding instead * Remove now unused code * Consider image operations as having accurate type information too I don't know why that was not the case before * Fix missing unscale on InsertCoordNormalization, stop calling SetUsageFlagsForTextureQuery when not needed * Shader cache version bump * Change get texture methods to return descriptors created from ResourceManager state This is required to ensure that reserved textures and images will not be bound as a guest texture/image * Fix BindlessElimination.SetHandle inserting coords at the wrong place
This commit is contained in:
@@ -218,7 +218,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
return context.Copy(Register(srcB++, RegisterType.Gpr));
|
||||
}
|
||||
|
||||
Operand destOperand = dest != RegisterConsts.RegisterZeroIndex ? Register(dest, RegisterType.Gpr) : null;
|
||||
Operand d = dest != RegisterConsts.RegisterZeroIndex ? Register(dest, RegisterType.Gpr) : null;
|
||||
|
||||
List<Operand> sourcesList = new();
|
||||
|
||||
@@ -277,17 +277,17 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
flags |= TextureFlags.Bindless;
|
||||
}
|
||||
|
||||
TextureOperation operation = context.CreateTextureOperation(
|
||||
int binding = isBindless ? 0 : context.Config.ResourceManager.GetTextureOrImageBinding(
|
||||
Instruction.ImageAtomic,
|
||||
type,
|
||||
format,
|
||||
flags,
|
||||
imm,
|
||||
0,
|
||||
new[] { destOperand },
|
||||
sources);
|
||||
TextureOperation.DefaultCbufSlot,
|
||||
imm);
|
||||
|
||||
context.Add(operation);
|
||||
Operand res = context.ImageAtomic(type, format, flags, binding, sources);
|
||||
|
||||
context.Copy(d, res);
|
||||
}
|
||||
|
||||
private static void EmitSuld(
|
||||
@@ -383,21 +383,17 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
Array.Resize(ref dests, outputIndex);
|
||||
}
|
||||
|
||||
TextureOperation operation = context.CreateTextureOperation(
|
||||
TextureFormat format = isBindless ? TextureFormat.Unknown : context.Config.GetTextureFormat(handle);
|
||||
|
||||
int binding = isBindless ? 0 : context.Config.ResourceManager.GetTextureOrImageBinding(
|
||||
Instruction.ImageLoad,
|
||||
type,
|
||||
format,
|
||||
flags,
|
||||
handle,
|
||||
(int)componentMask,
|
||||
dests,
|
||||
sources);
|
||||
TextureOperation.DefaultCbufSlot,
|
||||
handle);
|
||||
|
||||
if (!isBindless)
|
||||
{
|
||||
operation.Format = context.Config.GetTextureFormat(handle);
|
||||
}
|
||||
|
||||
context.Add(operation);
|
||||
context.ImageLoad(type, format, flags, binding, (int)componentMask, dests, sources);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -430,17 +426,17 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
Array.Resize(ref dests, outputIndex);
|
||||
}
|
||||
|
||||
TextureOperation operation = context.CreateTextureOperation(
|
||||
TextureFormat format = GetTextureFormat(size);
|
||||
|
||||
int binding = isBindless ? 0 : context.Config.ResourceManager.GetTextureOrImageBinding(
|
||||
Instruction.ImageLoad,
|
||||
type,
|
||||
GetTextureFormat(size),
|
||||
format,
|
||||
flags,
|
||||
handle,
|
||||
compMask,
|
||||
dests,
|
||||
sources);
|
||||
TextureOperation.DefaultCbufSlot,
|
||||
handle);
|
||||
|
||||
context.Add(operation);
|
||||
context.ImageLoad(type, format, flags, binding, compMask, dests, sources);
|
||||
|
||||
switch (size)
|
||||
{
|
||||
@@ -552,17 +548,15 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
flags |= TextureFlags.Bindless;
|
||||
}
|
||||
|
||||
TextureOperation operation = context.CreateTextureOperation(
|
||||
int binding = isBindless ? 0 : context.Config.ResourceManager.GetTextureOrImageBinding(
|
||||
Instruction.ImageAtomic,
|
||||
type,
|
||||
format,
|
||||
flags,
|
||||
imm,
|
||||
0,
|
||||
null,
|
||||
sources);
|
||||
TextureOperation.DefaultCbufSlot,
|
||||
imm);
|
||||
|
||||
context.Add(operation);
|
||||
context.ImageAtomic(type, format, flags, binding, sources);
|
||||
}
|
||||
|
||||
private static void EmitSust(
|
||||
@@ -681,17 +675,15 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||
flags |= TextureFlags.Coherent;
|
||||
}
|
||||
|
||||
TextureOperation operation = context.CreateTextureOperation(
|
||||
int binding = isBindless ? 0 : context.Config.ResourceManager.GetTextureOrImageBinding(
|
||||
Instruction.ImageStore,
|
||||
type,
|
||||
format,
|
||||
flags,
|
||||
handle,
|
||||
0,
|
||||
null,
|
||||
sources);
|
||||
TextureOperation.DefaultCbufSlot,
|
||||
handle);
|
||||
|
||||
context.Add(operation);
|
||||
context.ImageStore(type, format, flags, binding, sources);
|
||||
}
|
||||
|
||||
private static int GetComponentSizeInBytesLog2(SuatomSize size)
|
||||
|
Reference in New Issue
Block a user