Merge pull request #128 from GPUCode/span-across

texture: Use spans
This commit is contained in:
wheremyfoodat
2023-07-20 16:10:00 +03:00
committed by GitHub
5 changed files with 44 additions and 61 deletions

View File

@@ -450,7 +450,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);
@@ -517,4 +517,4 @@ void RendererGL::screenshot(const std::string& name) {
}
stbi_write_png(name.c_str(), width, height, 4, flippedPixels.data(), 0);
}
}