diff options
author | gdkchan <gab.dark.100@gmail.com> | 2023-10-31 19:00:39 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-31 19:00:39 -0300 |
commit | 841dd56f4ce850693aee5980cd750791624e47be (patch) | |
tree | 585a5a581e78c5c6d64244e148097b57788cb9c6 /src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs | |
parent | a16d582a105a6f9218e5f50fafd2670c64c1244c (diff) |
Implement copy dependency for depth and color textures (#4365)1.1.1068
* Implement copy dependency for depth and color textures
* Revert changes added because R32 <-> D32 copies were illegal
* Restore depth alias matches
Diffstat (limited to 'src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs')
-rw-r--r-- | src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs b/src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs index 0f5fe46a..7f1b1c38 100644 --- a/src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs +++ b/src/Ryujinx.Graphics.OpenGL/Image/TextureView.cs @@ -140,6 +140,28 @@ namespace Ryujinx.Graphics.OpenGL.Image int levels = Math.Min(Info.Levels, destinationView.Info.Levels - firstLevel); _renderer.TextureCopyIncompatible.CopyIncompatibleFormats(this, destinationView, 0, firstLayer, 0, firstLevel, layers, levels); } + else if (destinationView.Format.IsDepthOrStencil() != Format.IsDepthOrStencil()) + { + int layers = Math.Min(Info.GetLayers(), destinationView.Info.GetLayers() - firstLayer); + int levels = Math.Min(Info.Levels, destinationView.Info.Levels - firstLevel); + + for (int level = 0; level < levels; level++) + { + int srcWidth = Math.Max(1, Width >> level); + int srcHeight = Math.Max(1, Height >> level); + + int dstWidth = Math.Max(1, destinationView.Width >> (firstLevel + level)); + int dstHeight = Math.Max(1, destinationView.Height >> (firstLevel + level)); + + int minWidth = Math.Min(srcWidth, dstWidth); + int minHeight = Math.Min(srcHeight, dstHeight); + + for (int layer = 0; layer < layers; layer++) + { + _renderer.TextureCopy.PboCopy(this, destinationView, 0, firstLayer + layer, 0, firstLevel + level, minWidth, minHeight); + } + } + } else { _renderer.TextureCopy.CopyUnscaled(this, destinationView, 0, firstLayer, 0, firstLevel); @@ -169,6 +191,13 @@ namespace Ryujinx.Graphics.OpenGL.Image { _renderer.TextureCopyIncompatible.CopyIncompatibleFormats(this, destinationView, srcLayer, dstLayer, srcLevel, dstLevel, 1, 1); } + else if (destinationView.Format.IsDepthOrStencil() != Format.IsDepthOrStencil()) + { + int minWidth = Math.Min(Width, destinationView.Width); + int minHeight = Math.Min(Height, destinationView.Height); + + _renderer.TextureCopy.PboCopy(this, destinationView, srcLayer, dstLayer, srcLevel, dstLevel, minWidth, minHeight); + } else { _renderer.TextureCopy.CopyUnscaled(this, destinationView, srcLayer, dstLayer, srcLevel, dstLevel, 1, 1); |