diff options
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Image')
| -rw-r--r-- | src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs index b6fa842e..5a3319b0 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs @@ -351,6 +351,53 @@ namespace Ryujinx.Graphics.Gpu.Image /// Tries to find an existing texture, or create a new one if not found. /// </summary> /// <param name="memoryManager">GPU memory manager where the texture is mapped</param> + /// <param name="formatInfo">Format of the texture</param> + /// <param name="gpuAddress">GPU virtual address of the texture</param> + /// <param name="xCount">Texture width in bytes</param> + /// <param name="yCount">Texture height</param> + /// <param name="stride">Texture stride if linear, otherwise ignored</param> + /// <param name="isLinear">Indicates if the texture is linear or block linear</param> + /// <param name="gobBlocksInY">GOB blocks in Y for block linear textures</param> + /// <param name="gobBlocksInZ">GOB blocks in Z for 3D block linear textures</param> + /// <returns>The texture</returns> + public Texture FindOrCreateTexture( + MemoryManager memoryManager, + FormatInfo formatInfo, + ulong gpuAddress, + int xCount, + int yCount, + int stride, + bool isLinear, + int gobBlocksInY, + int gobBlocksInZ) + { + TextureInfo info = new( + gpuAddress, + xCount / formatInfo.BytesPerPixel, + yCount, + 1, + 1, + 1, + 1, + stride, + isLinear, + gobBlocksInY, + gobBlocksInZ, + 1, + Target.Texture2D, + formatInfo); + + Texture texture = FindOrCreateTexture(memoryManager, TextureSearchFlags.ForCopy, info, 0, sizeHint: new Size(xCount, yCount, 1)); + + texture?.SynchronizeMemory(); + + return texture; + } + + /// <summary> + /// Tries to find an existing texture, or create a new one if not found. + /// </summary> + /// <param name="memoryManager">GPU memory manager where the texture is mapped</param> /// <param name="colorState">Color buffer texture to find or create</param> /// <param name="layered">Indicates if the texture might be accessed with a non-zero layer index</param> /// <param name="discard">Indicates that the sizeHint region's data will be overwritten</param> |
