using System.Collections.Generic; namespace Ryujinx.Graphics.Shader.StructuredIr { class ShaderProperties { private readonly Dictionary _constantBuffers; private readonly Dictionary _storageBuffers; private readonly Dictionary _textures; private readonly Dictionary _images; private readonly Dictionary _localMemories; private readonly Dictionary _sharedMemories; public IReadOnlyDictionary ConstantBuffers => _constantBuffers; public IReadOnlyDictionary StorageBuffers => _storageBuffers; public IReadOnlyDictionary Textures => _textures; public IReadOnlyDictionary Images => _images; public IReadOnlyDictionary LocalMemories => _localMemories; public IReadOnlyDictionary SharedMemories => _sharedMemories; public readonly bool OriginUpperLeft; public ShaderProperties() { _constantBuffers = new Dictionary(); _storageBuffers = new Dictionary(); _textures = new Dictionary(); _images = new Dictionary(); _localMemories = new Dictionary(); _sharedMemories = new Dictionary(); } public ShaderProperties(bool originUpperLeft) : this() { OriginUpperLeft = originUpperLeft; } public void AddOrUpdateConstantBuffer(int binding, BufferDefinition definition) { _constantBuffers[binding] = 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; _localMemories.Add(id, definition); return id; } public int AddSharedMemory(MemoryDefinition definition) { int id = _sharedMemories.Count; _sharedMemories.Add(id, definition); return id; } } }