diff options
| author | riperiperi <rhy3756547@hotmail.com> | 2020-11-20 16:30:59 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-20 13:30:59 -0300 |
| commit | cf7044e37bc628f25525941d25b830594b833428 (patch) | |
| tree | 3da120676707d1ee7f4c2fcc2273ce036d6fd821 /Ryujinx.Graphics.OpenGL/Image/TextureCopyUnscaled.cs | |
| parent | 9852cb9c9ea3793eaef405ebb671052bb4b6643a (diff) | |
Perform Compressed<->Uncompressed copies using Pixel Buffer Objects (#1732)
* PBO single layer copy, part 1
Still needs ability to take and set width/height slices. (using pack paramaters)
* PBO Copies pt 2
* Some fixes and cleanup.
* Misc Cleanup
* Move handle into the TextureInfo interface.
This interface is shared between texture storages and views.
* Move unscaled copy to the TextureCopy class.
* Address feedback.
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Image/TextureCopyUnscaled.cs')
| -rw-r--r-- | Ryujinx.Graphics.OpenGL/Image/TextureCopyUnscaled.cs | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Image/TextureCopyUnscaled.cs b/Ryujinx.Graphics.OpenGL/Image/TextureCopyUnscaled.cs deleted file mode 100644 index 8fc8f85f..00000000 --- a/Ryujinx.Graphics.OpenGL/Image/TextureCopyUnscaled.cs +++ /dev/null @@ -1,93 +0,0 @@ -using OpenTK.Graphics.OpenGL; -using Ryujinx.Common; -using Ryujinx.Graphics.GAL; -using System; - -namespace Ryujinx.Graphics.OpenGL.Image -{ - static class TextureCopyUnscaled - { - public static void Copy( - TextureCreateInfo srcInfo, - TextureCreateInfo dstInfo, - int srcHandle, - int dstHandle, - int srcLayer, - int dstLayer, - int srcLevel, - int dstLevel) - { - int srcWidth = srcInfo.Width; - int srcHeight = srcInfo.Height; - int srcDepth = srcInfo.GetDepthOrLayers(); - int srcLevels = srcInfo.Levels; - - int dstWidth = dstInfo.Width; - int dstHeight = dstInfo.Height; - int dstDepth = dstInfo.GetDepthOrLayers(); - int dstLevels = dstInfo.Levels; - - dstWidth = Math.Max(1, dstWidth >> dstLevel); - dstHeight = Math.Max(1, dstHeight >> dstLevel); - - if (dstInfo.Target == Target.Texture3D) - { - dstDepth = Math.Max(1, dstDepth >> dstLevel); - } - - // When copying from a compressed to a non-compressed format, - // the non-compressed texture will have the size of the texture - // in blocks (not in texels), so we must adjust that size to - // match the size in texels of the compressed texture. - if (!srcInfo.IsCompressed && dstInfo.IsCompressed) - { - dstWidth = BitUtils.DivRoundUp(dstWidth, dstInfo.BlockWidth); - dstHeight = BitUtils.DivRoundUp(dstHeight, dstInfo.BlockHeight); - } - else if (srcInfo.IsCompressed && !dstInfo.IsCompressed) - { - dstWidth *= srcInfo.BlockWidth; - dstHeight *= srcInfo.BlockHeight; - } - - int width = Math.Min(srcWidth, dstWidth); - int height = Math.Min(srcHeight, dstHeight); - int depth = Math.Min(srcDepth, dstDepth); - int levels = Math.Min(srcLevels, dstLevels); - - for (int level = 0; level < levels; level++) - { - // Stop copy if we are already out of the levels range. - if (level >= srcInfo.Levels || dstLevel + level >= dstInfo.Levels) - { - break; - } - - GL.CopyImageSubData( - srcHandle, - srcInfo.Target.ConvertToImageTarget(), - srcLevel + level, - 0, - 0, - srcLayer, - dstHandle, - dstInfo.Target.ConvertToImageTarget(), - dstLevel + level, - 0, - 0, - dstLayer, - width, - height, - depth); - - width = Math.Max(1, width >> 1); - height = Math.Max(1, height >> 1); - - if (srcInfo.Target == Target.Texture3D) - { - depth = Math.Max(1, depth >> 1); - } - } - } - } -} |
