Fix crash when generating mipmaps on 4bpp textures
This commit is contained in:
parent
3d1f447af9
commit
fe7f9cbed0
|
@ -274,6 +274,12 @@ void APIENTRY glGenerateMipmapEXT(GLenum target) {
|
|||
return;
|
||||
}
|
||||
|
||||
if((tex->color & GPU_TXRFMT_PAL4BPP) == GPU_TXRFMT_PAL4BPP) {
|
||||
fprintf(stderr, "[GL ERROR] Mipmap generation not supported for 4BPP paletted textures\n");
|
||||
_glKosThrowError(GL_INVALID_OPERATION, __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if((tex->color & GPU_TXRFMT_NONTWIDDLED) == GPU_TXRFMT_NONTWIDDLED) {
|
||||
/* glTexImage2D should twiddle internally textures in nearly all cases
|
||||
* so this error is unlikely */
|
||||
|
@ -321,7 +327,7 @@ void APIENTRY glGenerateMipmapEXT(GLenum target) {
|
|||
}
|
||||
|
||||
/* generate mipmaps for any image provided by the user and then pass them to OpenGL */
|
||||
GLAPI GLint APIENTRY gluBuild2DMipmaps(GLenum target, GLint internalFormat,
|
||||
GLAPI GLvoid APIENTRY gluBuild2DMipmaps(GLenum target, GLint internalFormat,
|
||||
GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, const void *data){
|
||||
/* 2d texture, level of detail 0 (normal), 3 components (red, green, blue),
|
||||
|
|
|
@ -775,6 +775,7 @@ void APIENTRY glCompressedTexImage2DARB(GLenum target,
|
|||
return;
|
||||
|
||||
default: {
|
||||
fprintf(stderr, "Unsupported internalFormat: %d\n", internalFormat);
|
||||
_glKosThrowError(GL_INVALID_OPERATION, __func__);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user