mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
VideoCommon: Use GetSpanForAddress safely in texture decoding
Now only VertexLoader remains... But that one might be tricky.
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
@ -17,9 +18,9 @@ class TextureInfo
|
||||
{
|
||||
public:
|
||||
static TextureInfo FromStage(u32 stage);
|
||||
TextureInfo(u32 stage, const u8* ptr, const u8* tlut_ptr, u32 address,
|
||||
TextureInfo(u32 stage, std::span<const u8> data, std::span<const u8> tlut_data, u32 address,
|
||||
TextureFormat texture_format, TLUTFormat tlut_format, u32 width, u32 height,
|
||||
bool from_tmem, const u8* tmem_odd, const u8* tmem_even,
|
||||
bool from_tmem, std::span<const u8> tmem_odd, std::span<const u8> tmem_even,
|
||||
std::optional<u32> mip_count);
|
||||
|
||||
struct NameDetails
|
||||
@ -33,6 +34,8 @@ public:
|
||||
};
|
||||
NameDetails CalculateTextureName() const;
|
||||
|
||||
bool IsDataValid() const;
|
||||
|
||||
const u8* GetData() const;
|
||||
const u8* GetTlutAddress() const;
|
||||
|
||||
@ -61,11 +64,12 @@ public:
|
||||
class MipLevel
|
||||
{
|
||||
public:
|
||||
MipLevel(u32 level, const TextureInfo& parent, bool from_tmem, const u8*& src_data,
|
||||
const u8*& ptr_even, const u8*& ptr_odd);
|
||||
MipLevel(u32 level, const TextureInfo& parent, bool from_tmem, std::span<const u8>* src_data,
|
||||
std::span<const u8>* tmem_even, std::span<const u8>* tmem_odd);
|
||||
|
||||
bool IsDataValid() const;
|
||||
|
||||
const u8* GetData() const;
|
||||
|
||||
u32 GetTextureSize() const;
|
||||
|
||||
u32 GetExpandedWidth() const;
|
||||
@ -75,6 +79,8 @@ public:
|
||||
u32 GetRawHeight() const;
|
||||
|
||||
private:
|
||||
bool m_data_valid;
|
||||
|
||||
const u8* m_ptr;
|
||||
|
||||
u32 m_texture_size = 0;
|
||||
@ -99,6 +105,8 @@ private:
|
||||
|
||||
u32 m_address;
|
||||
|
||||
bool m_data_valid;
|
||||
|
||||
bool m_from_tmem;
|
||||
const u8* m_tmem_odd;
|
||||
|
||||
|
Reference in New Issue
Block a user