Add assertions
This commit is contained in:
parent
5f7fef2cf9
commit
44ca14bcbd
11
GL/texture.c
11
GL/texture.c
|
@ -29,7 +29,6 @@ void _glApplyColorTable() {
|
||||||
* FIXME:
|
* FIXME:
|
||||||
*
|
*
|
||||||
* - Different palette formats (GL_RGB -> PVR_PAL_RGB565)
|
* - Different palette formats (GL_RGB -> PVR_PAL_RGB565)
|
||||||
* - Store the active palette, don't resubmit eah time
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static TexturePalette* last_bound = NULL;
|
static TexturePalette* last_bound = NULL;
|
||||||
|
@ -776,6 +775,8 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
|
||||||
|
|
||||||
TextureObject* active = TEXTURE_UNITS[ACTIVE_TEXTURE];
|
TextureObject* active = TEXTURE_UNITS[ACTIVE_TEXTURE];
|
||||||
|
|
||||||
|
assert(active);
|
||||||
|
|
||||||
if(active->data) {
|
if(active->data) {
|
||||||
/* pre-existing texture - check if changed */
|
/* pre-existing texture - check if changed */
|
||||||
if(active->width != width ||
|
if(active->width != width ||
|
||||||
|
@ -854,6 +855,10 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
|
||||||
/* No data? Do nothing! */
|
/* No data? Do nothing! */
|
||||||
return;
|
return;
|
||||||
} else if(!needsConversion) {
|
} else if(!needsConversion) {
|
||||||
|
assert(targetData);
|
||||||
|
assert(data);
|
||||||
|
assert(bytes);
|
||||||
|
|
||||||
/* No conversion? Just copy the data, and the pvr_format is correct */
|
/* No conversion? Just copy the data, and the pvr_format is correct */
|
||||||
sq_cpy(targetData, data, bytes);
|
sq_cpy(targetData, data, bytes);
|
||||||
return;
|
return;
|
||||||
|
@ -872,7 +877,11 @@ void APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalFormat,
|
||||||
GLubyte* dest = (GLubyte*) targetData;
|
GLubyte* dest = (GLubyte*) targetData;
|
||||||
const GLubyte* source = data;
|
const GLubyte* source = data;
|
||||||
|
|
||||||
|
assert(dest);
|
||||||
|
assert(source);
|
||||||
|
|
||||||
GLint stride = _determineStride(format, type);
|
GLint stride = _determineStride(format, type);
|
||||||
|
assert(stride > -1);
|
||||||
|
|
||||||
if(stride == -1) {
|
if(stride == -1) {
|
||||||
_glKosThrowError(GL_INVALID_OPERATION, __func__);
|
_glKosThrowError(GL_INVALID_OPERATION, __func__);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user