jwzgles: Add glCompressedTexImage2D and glCompressedTexSubImage2D as cheap copies of their non-compressed variants.

git-svn-id: https://svn.eduke32.com/eduke32@5676 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2016-03-28 05:15:20 +00:00
parent 1c3ed04bcd
commit 7e12cf2a83
2 changed files with 71 additions and 0 deletions

View file

@ -280,6 +280,19 @@ extern void jwzgles_glTexSubImage2D (GLenum target, GLint level,
GLsizei width, GLsizei height, GLsizei width, GLsizei height,
GLenum format, GLenum type, GLenum format, GLenum type,
const GLvoid *pixels); const GLvoid *pixels);
extern void jwzgles_glCompressedTexImage2D (GLenum target,
GLint level,
GLint internalFormat,
GLsizei width,
GLsizei height,
GLint border,
GLsizei imageSize,
const GLvoid *data);
extern void jwzgles_glCompressedTexSubImage2D (GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLsizei imageSize,
const GLvoid *pixels);
extern void jwzgles_glCopyTexImage2D (GLenum target, GLint level, extern void jwzgles_glCopyTexImage2D (GLenum target, GLint level,
GLenum internalformat, GLenum internalformat,
GLint x, GLint y, GLint x, GLint y,

View file

@ -3019,6 +3019,64 @@ jwzgles_glTexSubImage2D (GLenum target, GLint level,
CHECK("glTexSubImage2D"); CHECK("glTexSubImage2D");
} }
void
jwzgles_glCompressedTexImage2D (GLenum target,
GLint level,
GLint internalFormat,
GLsizei width,
GLsizei height,
GLint border,
GLsizei imageSize,
const GLvoid *data)
{
GLvoid *d2 = NULL;
Assert (!state->compiling_verts, "glCompressedTexImage2D not allowed inside glBegin");
Assert (!state->compiling_list, /* technically legal, but stupid! */
"glCompressedTexImage2D not allowed inside glNewList");
// Assert (width == to_pow2(width), "width must be a power of 2");
// Assert (height == to_pow2(height), "height must be a power of 2");
/* GLES does not let us omit the data pointer to create a blank texture. */
if (! data)
{
data = d2 = (GLvoid *) calloc (1, width * height * sizeof(GLfloat) * 4);
Assert (d2, "out of memory");
}
if (! state->replaying_list)
LOG9 ("direct %-12s %s %d %s %d %d %d %d 0x%lX", "glCompressedTexImage2D",
mode_desc(target), level, mode_desc(internalFormat),
width, height, border, imageSize,
(unsigned long) data);
glCompressedTexImage2D (target, level, internalFormat, width, height, border,
imageSize, data); /* the real one */
CHECK("glCompressedTexImage2D");
free (d2);
}
void
jwzgles_glCompressedTexSubImage2D (GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLsizei imageSize,
const GLvoid *pixels)
{
Assert (!state->compiling_verts,
"glCompressedTexSubImage2D not allowed inside glBegin");
Assert (!state->compiling_list, /* technically legal, but stupid! */
"glCompressedTexSubImage2D not allowed inside glNewList");
if (! state->replaying_list)
LOG10 ("direct %-12s %s %d %d %d %d %d %s %d 0x%lX", "glCompressedTexSubImage2D",
mode_desc(target), level, xoffset, yoffset, width, height,
mode_desc (format), imageSize, (unsigned long) pixels);
glCompressedTexSubImage2D (target, level, xoffset, yoffset, width, height,
format, imageSize, pixels); /* the real one */
CHECK("glCompressedTexSubImage2D");
}
void void
jwzgles_glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, jwzgles_glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat,
GLint x, GLint y, GLsizei width, GLsizei height, GLint x, GLint y, GLsizei width, GLsizei height,