aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2024-09-17 15:52:30 -0300
committerGitHub <noreply@github.com>2024-09-17 15:52:30 -0300
commiteb8132b627d3c0285dd199f4e40c6f3800bdb22d (patch)
tree970a119909a0dd901bbd8cb5454b725a08e329b3 /src/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
parentccf96bf5e673456ec80f72725e4c9afa4e4c5a85 (diff)
Change image format view handling to allow view incompatible formats (#7311)
* Allow creating texture aliases on texture pool * Delete old image format override code * New format incompatible alias * Missing bounds check * GetForBinding now takes FormatInfo * Make FormatInfo struct more compact
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs')
-rw-r--r--src/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs35
1 files changed, 8 insertions, 27 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
index 9f1f60d9..ad018f15 100644
--- a/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
+++ b/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs
@@ -522,7 +522,7 @@ namespace Ryujinx.Graphics.Gpu.Image
// Ensure that the buffer texture is using the correct buffer as storage.
// Buffers are frequently re-created to accommodate larger data, so we need to re-bind
// to ensure we're not using a old buffer that was already deleted.
- _channel.BufferManager.SetBufferTextureStorage(stage, hostTexture, texture.Range, bindingInfo, bindingInfo.Format, false);
+ _channel.BufferManager.SetBufferTextureStorage(stage, hostTexture, texture.Range, bindingInfo, false);
// Cache is not used for buffer texture, it must always rebind.
state.CachedTexture = null;
@@ -616,6 +616,7 @@ namespace Ryujinx.Graphics.Gpu.Image
if (!poolModified &&
state.TextureHandle == textureId &&
+ state.ImageFormat == bindingInfo.FormatInfo.Format &&
state.CachedTexture != null &&
state.CachedTexture.InvalidatedSequence == state.InvalidatedSequence)
{
@@ -629,26 +630,22 @@ namespace Ryujinx.Graphics.Gpu.Image
cachedTexture.SignalModified();
}
- Format format = bindingInfo.Format == 0 ? cachedTexture.Format : bindingInfo.Format;
-
- if (state.ImageFormat != format ||
- ((usageFlags & TextureUsageFlags.NeedsScaleValue) != 0 &&
- UpdateScale(state.CachedTexture, usageFlags, scaleIndex, stage)))
+ if ((usageFlags & TextureUsageFlags.NeedsScaleValue) != 0 && UpdateScale(state.CachedTexture, usageFlags, scaleIndex, stage))
{
ITexture hostTextureRebind = state.CachedTexture.GetTargetTexture(bindingInfo.Target);
state.Texture = hostTextureRebind;
- state.ImageFormat = format;
- _context.Renderer.Pipeline.SetImage(stage, bindingInfo.Binding, hostTextureRebind, format);
+ _context.Renderer.Pipeline.SetImage(stage, bindingInfo.Binding, hostTextureRebind);
}
continue;
}
state.TextureHandle = textureId;
+ state.ImageFormat = bindingInfo.FormatInfo.Format;
- ref readonly TextureDescriptor descriptor = ref pool.GetForBinding(textureId, out Texture texture);
+ ref readonly TextureDescriptor descriptor = ref pool.GetForBinding(textureId, bindingInfo.FormatInfo, out Texture texture);
specStateMatches &= specState.MatchesImage(stage, index, descriptor);
@@ -660,14 +657,7 @@ namespace Ryujinx.Graphics.Gpu.Image
// Buffers are frequently re-created to accommodate larger data, so we need to re-bind
// to ensure we're not using a old buffer that was already deleted.
- Format format = bindingInfo.Format;
-
- if (format == 0 && texture != null)
- {
- format = texture.Format;
- }
-
- _channel.BufferManager.SetBufferTextureStorage(stage, hostTexture, texture.Range, bindingInfo, format, true);
+ _channel.BufferManager.SetBufferTextureStorage(stage, hostTexture, texture.Range, bindingInfo, true);
// Cache is not used for buffer texture, it must always rebind.
state.CachedTexture = null;
@@ -689,16 +679,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{
state.Texture = hostTexture;
- Format format = bindingInfo.Format;
-
- if (format == 0 && texture != null)
- {
- format = texture.Format;
- }
-
- state.ImageFormat = format;
-
- _context.Renderer.Pipeline.SetImage(stage, bindingInfo.Binding, hostTexture, format);
+ _context.Renderer.Pipeline.SetImage(stage, bindingInfo.Binding, hostTexture);
}
state.CachedTexture = texture;