From 1623ab524f54901e154c8b644e2315985d5bd0a0 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Mon, 8 Mar 2021 21:43:39 +0000 Subject: Improve Buffer Textures and flush Image Stores (#2088) * Improve Buffer Textures and flush Image Stores Fixes a number of issues with buffer textures: - Reworked Buffer Textures to create their buffers in the TextureManager, then bind them with the BufferManager later. - Fixes an issue where a buffer texture's buffer could be invalidated after it is bound, but before use. - Fixed width unpacking for large buffer textures. The width is now 32-bit rather than 16. - Force buffer textures to be rebound whenever any buffer is created, as using the handle id wasn't reliable, and the cost of binding isn't too high. Fixes vertex explosions and flickering animations in UE4 games. * Set ImageStore flag... for ImageStore. * Check the offset and size. --- .../Memory/BufferTextureBinding.cs | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Ryujinx.Graphics.Gpu/Memory/BufferTextureBinding.cs (limited to 'Ryujinx.Graphics.Gpu/Memory/BufferTextureBinding.cs') diff --git a/Ryujinx.Graphics.Gpu/Memory/BufferTextureBinding.cs b/Ryujinx.Graphics.Gpu/Memory/BufferTextureBinding.cs new file mode 100644 index 00000000..cf0d225e --- /dev/null +++ b/Ryujinx.Graphics.Gpu/Memory/BufferTextureBinding.cs @@ -0,0 +1,60 @@ +using Ryujinx.Graphics.GAL; +using Ryujinx.Graphics.Gpu.Image; + +namespace Ryujinx.Graphics.Gpu.Memory +{ + /// + /// A buffer binding to apply to a buffer texture. + /// + struct BufferTextureBinding + { + /// + /// The buffer texture. + /// + public ITexture Texture { get; } + + /// + /// The base address of the buffer binding. + /// + public ulong Address { get; } + + /// + /// The size of the buffer binding in bytes. + /// + public ulong Size { get; } + + /// + /// The image or sampler binding info for the buffer texture. + /// + public TextureBindingInfo BindingInfo { get; } + + /// + /// The image format for the binding. + /// + public Format Format { get; } + + /// + /// Whether the binding is for an image or a sampler. + /// + public bool IsImage { get; } + + /// + /// Create a new buffer texture binding. + /// + /// Buffer texture + /// Base address + /// Size in bytes + /// Binding info + /// Binding format + /// Whether the binding is for an image or a sampler + public BufferTextureBinding(ITexture texture, ulong address, ulong size, TextureBindingInfo bindingInfo, Format format, bool isImage) + { + Texture = texture; + Address = address; + Size = size; + BindingInfo = bindingInfo; + Format = format; + IsImage = isImage; + } + } +} -- cgit v1.2.3