diff options
| author | Tilka <tilkax@gmail.com> | 2024-04-20 21:16:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-20 21:16:54 +0100 |
| commit | f1e40f73bd2a9da298d9aceafa7f956041bac142 (patch) | |
| tree | 16727f3ab7552bc6d668df2c0b3482ba3a23284b /Source/Core/VideoCommon/TextureDecoder.h | |
| parent | 6443084e8c355001ad298b03423b8e4f1a6cf042 (diff) | |
| parent | c204b33314802d5e5719990d76bccc87a1907c9d (diff) | |
Merge pull request #12705 from JosJuice/get-span-for-address
Memmap: Replace GetPointer with GetSpanForAddress
Diffstat (limited to 'Source/Core/VideoCommon/TextureDecoder.h')
| -rw-r--r-- | Source/Core/VideoCommon/TextureDecoder.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/TextureDecoder.h b/Source/Core/VideoCommon/TextureDecoder.h index dcc7513d43..2296c1bfed 100644 --- a/Source/Core/VideoCommon/TextureDecoder.h +++ b/Source/Core/VideoCommon/TextureDecoder.h @@ -3,16 +3,20 @@ #pragma once +#include <array> +#include <span> #include <tuple> + #include "Common/CommonTypes.h" #include "Common/EnumFormatter.h" +#include "Common/SpanUtils.h" enum { TMEM_SIZE = 1024 * 1024, TMEM_LINE_SIZE = 32, }; -alignas(16) extern u8 texMem[TMEM_SIZE]; +alignas(16) extern std::array<u8, TMEM_SIZE> s_tex_mem; enum class TextureFormat { @@ -171,6 +175,11 @@ static inline bool CanReinterpretTextureOnGPU(TextureFormat from_format, Texture } } +inline std::span<u8> TexDecoder_GetTmemSpan(size_t offset = 0) +{ + return Common::SafeSubspan(std::span<u8>(s_tex_mem), offset); +} + int TexDecoder_GetTexelSizeInNibbles(TextureFormat format); int TexDecoder_GetTextureSizeInBytes(int width, int height, TextureFormat format); int TexDecoder_GetBlockWidthInTexels(TextureFormat format); @@ -184,8 +193,10 @@ void TexDecoder_Decode(u8* dst, const u8* src, int width, int height, TextureFor const u8* tlut, TLUTFormat tlutfmt); void TexDecoder_DecodeRGBA8FromTmem(u8* dst, const u8* src_ar, const u8* src_gb, int width, int height); -void TexDecoder_DecodeTexel(u8* dst, const u8* src, int s, int t, int imageWidth, - TextureFormat texformat, const u8* tlut, TLUTFormat tlutfmt); +void TexDecoder_DecodeTexel(u8* dst, std::span<const u8> src, int s, int t, int imageWidth, + TextureFormat texformat, std::span<const u8> tlut, TLUTFormat tlutfmt); +void TexDecoder_DecodeTexelRGBA8FromTmem(u8* dst, std::span<const u8> src_ar, + std::span<const u8> src_gb, int s, int t, int imageWidth); void TexDecoder_DecodeTexelRGBA8FromTmem(u8* dst, const u8* src_ar, const u8* src_gb, int s, int t, int imageWidth); void TexDecoder_DecodeXFB(u8* dst, const u8* src, u32 width, u32 height, u32 stride); |
