mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-25 21:27:14 +02:00
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:
parent
3b46bb73f7
commit
1c7a90ef35
25 changed files with 656 additions and 659 deletions
|
@ -8,24 +8,21 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
|||
public TextureFormat Format { get; }
|
||||
public TextureFlags Flags { get; }
|
||||
|
||||
public int CbufSlot { get; }
|
||||
public int Handle { get; }
|
||||
public int Binding { get; }
|
||||
|
||||
public AstTextureOperation(
|
||||
Instruction inst,
|
||||
SamplerType type,
|
||||
TextureFormat format,
|
||||
TextureFlags flags,
|
||||
int cbufSlot,
|
||||
int handle,
|
||||
int binding,
|
||||
int index,
|
||||
params IAstNode[] sources) : base(inst, StorageKind.None, false, index, sources, sources.Length)
|
||||
{
|
||||
Type = type;
|
||||
Format = format;
|
||||
Flags = flags;
|
||||
CbufSlot = cbufSlot;
|
||||
Handle = handle;
|
||||
Binding = binding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,11 +6,15 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
|||
{
|
||||
private readonly Dictionary<int, BufferDefinition> _constantBuffers;
|
||||
private readonly Dictionary<int, BufferDefinition> _storageBuffers;
|
||||
private readonly Dictionary<int, TextureDefinition> _textures;
|
||||
private readonly Dictionary<int, TextureDefinition> _images;
|
||||
private readonly Dictionary<int, MemoryDefinition> _localMemories;
|
||||
private readonly Dictionary<int, MemoryDefinition> _sharedMemories;
|
||||
|
||||
public IReadOnlyDictionary<int, BufferDefinition> ConstantBuffers => _constantBuffers;
|
||||
public IReadOnlyDictionary<int, BufferDefinition> StorageBuffers => _storageBuffers;
|
||||
public IReadOnlyDictionary<int, TextureDefinition> Textures => _textures;
|
||||
public IReadOnlyDictionary<int, TextureDefinition> Images => _images;
|
||||
public IReadOnlyDictionary<int, MemoryDefinition> LocalMemories => _localMemories;
|
||||
public IReadOnlyDictionary<int, MemoryDefinition> SharedMemories => _sharedMemories;
|
||||
|
||||
|
@ -18,20 +22,32 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
|||
{
|
||||
_constantBuffers = new Dictionary<int, BufferDefinition>();
|
||||
_storageBuffers = new Dictionary<int, BufferDefinition>();
|
||||
_textures = new Dictionary<int, TextureDefinition>();
|
||||
_images = new Dictionary<int, TextureDefinition>();
|
||||
_localMemories = new Dictionary<int, MemoryDefinition>();
|
||||
_sharedMemories = new Dictionary<int, MemoryDefinition>();
|
||||
}
|
||||
|
||||
public void AddConstantBuffer(int binding, BufferDefinition definition)
|
||||
public void AddOrUpdateConstantBuffer(int binding, BufferDefinition definition)
|
||||
{
|
||||
_constantBuffers[binding] = definition;
|
||||
}
|
||||
|
||||
public void AddStorageBuffer(int binding, BufferDefinition definition)
|
||||
public void AddOrUpdateStorageBuffer(int binding, BufferDefinition definition)
|
||||
{
|
||||
_storageBuffers[binding] = definition;
|
||||
}
|
||||
|
||||
public void AddOrUpdateTexture(int binding, TextureDefinition descriptor)
|
||||
{
|
||||
_textures[binding] = descriptor;
|
||||
}
|
||||
|
||||
public void AddOrUpdateImage(int binding, TextureDefinition descriptor)
|
||||
{
|
||||
_images[binding] = descriptor;
|
||||
}
|
||||
|
||||
public int AddLocalMemory(MemoryDefinition definition)
|
||||
{
|
||||
int id = _localMemories.Count;
|
||||
|
|
|
@ -125,15 +125,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
|
|||
|
||||
AstTextureOperation GetAstTextureOperation(TextureOperation texOp)
|
||||
{
|
||||
return new AstTextureOperation(
|
||||
inst,
|
||||
texOp.Type,
|
||||
texOp.Format,
|
||||
texOp.Flags,
|
||||
texOp.CbufSlot,
|
||||
texOp.Handle,
|
||||
texOp.Index,
|
||||
sources);
|
||||
return new AstTextureOperation(inst, texOp.Type, texOp.Format, texOp.Flags, texOp.Binding, texOp.Index, sources);
|
||||
}
|
||||
|
||||
int componentsCount = BitOperations.PopCount((uint)operation.Index);
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
namespace Ryujinx.Graphics.Shader
|
||||
{
|
||||
readonly struct TextureDefinition
|
||||
{
|
||||
public int Set { get; }
|
||||
public int Binding { get; }
|
||||
public string Name { get; }
|
||||
public SamplerType Type { get; }
|
||||
public TextureFormat Format { get; }
|
||||
public TextureUsageFlags Flags { get; }
|
||||
|
||||
public TextureDefinition(int set, int binding, string name, SamplerType type, TextureFormat format, TextureUsageFlags flags)
|
||||
{
|
||||
Set = set;
|
||||
Binding = binding;
|
||||
Name = name;
|
||||
Type = type;
|
||||
Format = format;
|
||||
Flags = flags;
|
||||
}
|
||||
|
||||
public TextureDefinition SetFlag(TextureUsageFlags flag)
|
||||
{
|
||||
return new TextureDefinition(Set, Binding, Name, Type, Format, Flags | flag);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue