mirror of https://github.com/encounter/SDL.git
Fixed GLES2 back-end on Big Endian Platform (see #5093)
This commit is contained in:
parent
61107494a1
commit
3a69828e87
|
@ -1486,6 +1486,9 @@ static int
|
||||||
GLES2_TexSubImage2D(GLES2_RenderData *data, GLenum target, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, GLint pitch, GLint bpp)
|
GLES2_TexSubImage2D(GLES2_RenderData *data, GLenum target, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, GLint pitch, GLint bpp)
|
||||||
{
|
{
|
||||||
Uint8 *blob = NULL;
|
Uint8 *blob = NULL;
|
||||||
|
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||||
|
Uint32 *blob2 = NULL;
|
||||||
|
#endif
|
||||||
Uint8 *src;
|
Uint8 *src;
|
||||||
int src_pitch;
|
int src_pitch;
|
||||||
int y;
|
int y;
|
||||||
|
@ -1512,10 +1515,33 @@ GLES2_TexSubImage2D(GLES2_RenderData *data, GLenum target, GLint xoffset, GLint
|
||||||
src = blob;
|
src = blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
Uint32 *src32 = (Uint32 *)src;
|
||||||
|
blob2 = (Uint32 *)SDL_malloc(src_pitch * height);
|
||||||
|
if (!blob2) {
|
||||||
|
if (blob) {
|
||||||
|
SDL_free(blob);
|
||||||
|
}
|
||||||
|
return SDL_OutOfMemory();
|
||||||
|
}
|
||||||
|
for (i = 0; i < (src_pitch * height) / 4; i++) {
|
||||||
|
blob2[i] = SDL_Swap32(src32[i]);
|
||||||
|
}
|
||||||
|
src = (Uint8 *) blob2;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
data->glTexSubImage2D(target, 0, xoffset, yoffset, width, height, format, type, src);
|
data->glTexSubImage2D(target, 0, xoffset, yoffset, width, height, format, type, src);
|
||||||
if (blob) {
|
if (blob) {
|
||||||
SDL_free(blob);
|
SDL_free(blob);
|
||||||
}
|
}
|
||||||
|
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||||
|
if (blob2) {
|
||||||
|
SDL_free(blob2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue