Skip to content

Commit 68f46ad

Browse files
authored
textures: fix texture size on uninitialized textures (#103)
GX_TexObjGetAll() returns a size of 1024x1024 if called on a 0-initialized object, due to how texture size is internally stored. Workaround this issue by explicitly setting width and height to 0 if we see that the texel pointer is NULL.
1 parent 71f2799 commit 68f46ad

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/texture.c

+3
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ static void texture_get_info(const GXTexObj *obj, TextureInfo *info)
142142
&info->mipmap);
143143
if (info->texels) {
144144
info->texels = MEM_PHYSICAL_TO_K0(info->texels);
145+
} else {
146+
/* Ensure size is 0 if there's no texture */
147+
info->width = info->height = 0;
145148
}
146149

147150
float minlevel, maxlevel;

0 commit comments

Comments
 (0)