Merge pull request #11501 from iwubcode/abstract_texture_load_specify_layer

VideoBackends: add a way to load data into a specific level AND layer
This commit is contained in:
Scott Mansell
2023-02-01 00:03:59 +13:00
committed by GitHub
15 changed files with 43 additions and 42 deletions

View File

@ -25,8 +25,8 @@ public:
u32 dst_layer, u32 dst_level) override;
void ResolveFromTexture(const AbstractTexture* src, const MathUtil::Rectangle<int>& rect,
u32 layer, u32 level) override;
void Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer,
size_t buffer_size) override;
void Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer, size_t buffer_size,
u32 layer) override;
id<MTLTexture> GetMTLTexture() const { return m_tex; }
void SetMTLTexture(MRCOwned<id<MTLTexture>> tex) { m_tex = std::move(tex); }

View File

@ -56,7 +56,7 @@ void Metal::Texture::ResolveFromTexture(const AbstractTexture* src,
static constexpr u32 STAGING_TEXTURE_UPLOAD_THRESHOLD = 1024 * 1024 * 4;
void Metal::Texture::Load(u32 level, u32 width, u32 height, u32 row_length, //
const u8* buffer, size_t buffer_size)
const u8* buffer, size_t buffer_size, u32 layer)
{
@autoreleasepool
{
@ -89,7 +89,7 @@ void Metal::Texture::Load(u32 level, u32 width, u32 height, u32 row_length, //
sourceBytesPerImage:upload_size
sourceSize:MTLSizeMake(width, height, 1)
toTexture:m_tex
destinationSlice:0
destinationSlice:layer
destinationLevel:level
destinationOrigin:MTLOriginMake(0, 0, 0)];
}