texture: Use spans

This commit is contained in:
GPUCode 2023-07-20 15:28:52 +03:00
parent 50bf9bf7da
commit a019d98af9
5 changed files with 44 additions and 61 deletions

View file

@ -448,7 +448,7 @@ OpenGL::Texture RendererGL::getTexture(Texture& tex) {
if (buffer.has_value()) {
return buffer.value().get().texture;
} else {
const void* textureData = gpu.getPointerPhys<void*>(tex.location); // Get pointer to the texture data in 3DS memory
const auto textureData = std::span{gpu.getPointerPhys<u8>(tex.location), tex.sizeInBytes()}; // Get pointer to the texture data in 3DS memory
Texture& newTex = textureCache.add(tex);
newTex.decodeTexture(textureData);
@ -515,4 +515,4 @@ void RendererGL::screenshot(const std::string& name) {
}
stbi_write_png(name.c_str(), width, height, 4, flippedPixels.data(), 0);
}
}