mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-28 10:02:31 -06:00
GetTextureSurface: return on invalid physical address early
Previously this check is in GetSurface (if (addr == 0)). This worked fine because GetTextureSurface directly forwarded the address value to GetSurface. However, now with mipmap support, GetTextureSurface would call GetSurface several times with different address offset, resulting some >0 but still invalid address in case the input is 0. We should error out early on invalid address instead of sending it furthor down which would cause invalid memory access
This commit is contained in:
parent
ebdef4fd69
commit
88a011ec8e
1 changed files with 4 additions and 0 deletions
|
@ -1332,6 +1332,10 @@ Surface RasterizerCacheOpenGL::GetTextureSurface(
|
|||
|
||||
Surface RasterizerCacheOpenGL::GetTextureSurface(const Pica::Texture::TextureInfo& info,
|
||||
u32 max_level) {
|
||||
if (info.physical_address == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SurfaceParams params;
|
||||
params.addr = info.physical_address;
|
||||
params.width = info.width;
|
||||
|
|
Loading…
Reference in a new issue