diff options
author | gdkchan <gab.dark.100@gmail.com> | 2021-07-07 20:56:06 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-07 20:56:06 -0300 |
commit | 8b44eb1c981d7106be37107755c7c71c3c3c0ce4 (patch) | |
tree | 70c3a8d7286d827941c41dee2ec3cb3273c1e6d7 /Ryujinx.Graphics.Gpu/Image/TextureCache.cs | |
parent | 31cbd09a75a9d5f4814c3907a060e0961eb2bb15 (diff) |
Separate GPU engines and make state follow official docs (part 1/2) (#2422)
* Use DeviceState for compute and i2m
* Migrate 2D class, more comments
* Migrate DMA copy engine
* Remove now unused code
* Replace GpuState by GpuAccessorState on GpuAcessor, since compute no longer has a GpuState
* More comments
* Add logging (disabled)
* Add back i2m on 3D engine
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureCache.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Image/TextureCache.cs | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs index 37a2219f..106dc8e8 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureCache.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureCache.cs @@ -753,21 +753,30 @@ namespace Ryujinx.Graphics.Gpu.Image /// </summary> /// <param name="memoryManager">GPU memory manager where the texture is mapped</param> /// <param name="tex">The texture information</param> - /// <param name="cbp">The copy buffer parameters</param> - /// <param name="swizzle">The copy buffer swizzle</param> + /// <param name="gpuVa">GPU virtual address of the texture</param> + /// <param name="bpp">Bytes per pixel</param> + /// <param name="stride">If <paramref name="linear"/> is true, should have the texture stride, otherwise ignored</param> + /// <param name="xCount">Number of pixels to be copied per line</param> + /// <param name="yCount">Number of lines to be copied</param> /// <param name="linear">True if the texture has a linear layout, false otherwise</param> /// <returns>A matching texture, or null if there is no match</returns> - public Texture FindTexture(MemoryManager memoryManager, CopyBufferTexture tex, CopyBufferParams cbp, CopyBufferSwizzle swizzle, bool linear) + public Texture FindTexture( + MemoryManager memoryManager, + CopyBufferTexture tex, + ulong gpuVa, + int bpp, + int stride, + int xCount, + int yCount, + bool linear) { - ulong address = memoryManager.Translate(cbp.DstAddress.Pack()); + ulong address = memoryManager.Translate(gpuVa); if (address == MemoryManager.PteUnmapped) { return null; } - int bpp = swizzle.UnpackDstComponentsCount() * swizzle.UnpackComponentSize(); - int addressMatches = _textures.FindOverlaps(address, ref _textureOverlaps); for (int i = 0; i < addressMatches; i++) @@ -786,7 +795,7 @@ namespace Ryujinx.Graphics.Gpu.Image { // Size is not available for linear textures. Use the stride and end of the copy region instead. - match = texture.Info.IsLinear && texture.Info.Stride == cbp.DstStride && tex.RegionY + cbp.YCount <= texture.Info.Height; + match = texture.Info.IsLinear && texture.Info.Stride == stride && tex.RegionY + yCount <= texture.Info.Height; } else { @@ -794,7 +803,7 @@ namespace Ryujinx.Graphics.Gpu.Image // Due to the way linear strided and block layouts work, widths can be multiplied by Bpp for comparison. // Note: tex.Width is the aligned texture size. Prefer param.XCount, as the destination should be a texture with that exact size. - bool sizeMatch = cbp.XCount * bpp == texture.Info.Width * format.BytesPerPixel && tex.Height == texture.Info.Height; + bool sizeMatch = xCount * bpp == texture.Info.Width * format.BytesPerPixel && tex.Height == texture.Info.Height; bool formatMatch = !texture.Info.IsLinear && texture.Info.GobBlocksInY == tex.MemoryLayout.UnpackGobBlocksInY() && texture.Info.GobBlocksInZ == tex.MemoryLayout.UnpackGobBlocksInZ(); |