Test using glTextureRangeAPPLE
This actually ends up being quite a bit slower on my MacBook, but I'm checking it in to test on a PPC iMac. Maybe someone knows why it's slower? --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402595
This commit is contained in:
parent
1d36dcc958
commit
cbc3f4b4c4
1 changed files with 30 additions and 1 deletions
|
@ -117,8 +117,8 @@ typedef struct
|
|||
{
|
||||
SDL_GLContext context;
|
||||
SDL_bool updateSize;
|
||||
SDL_bool GL_EXT_paletted_texture_supported;
|
||||
SDL_bool GL_ARB_texture_rectangle_supported;
|
||||
SDL_bool GL_EXT_paletted_texture_supported;
|
||||
int blendMode;
|
||||
int scaleMode;
|
||||
|
||||
|
@ -128,6 +128,8 @@ typedef struct
|
|||
#undef SDL_PROC
|
||||
|
||||
PFNGLCOLORTABLEEXTPROC glColorTableEXT;
|
||||
void (*glTextureRangeAPPLE) (GLenum target, GLsizei length,
|
||||
const GLvoid * pointer);
|
||||
} GL_RenderData;
|
||||
|
||||
typedef struct
|
||||
|
@ -329,6 +331,11 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||
}
|
||||
--info->num_texture_formats;
|
||||
}
|
||||
if (SDL_GL_ExtensionSupported("GL_APPLE_texture_range")) {
|
||||
data->glTextureRangeAPPLE =
|
||||
(void (*)(GLenum, GLsizei, const GLvoid *))
|
||||
SDL_GL_GetProcAddress("glTextureRangeAPPLE");
|
||||
}
|
||||
|
||||
/* Set up parameters for rendering */
|
||||
data->blendMode = -1;
|
||||
|
@ -450,9 +457,15 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
type = GL_UNSIGNED_BYTE;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_RGB888:
|
||||
#ifdef __MACOSX__
|
||||
internalFormat = GL_RGBA;
|
||||
format = GL_BGRA;
|
||||
type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
#else
|
||||
internalFormat = GL_RGB8;
|
||||
format = GL_BGRA;
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
#endif
|
||||
break;
|
||||
case SDL_PIXELFORMAT_BGR24:
|
||||
internalFormat = GL_RGB8;
|
||||
|
@ -563,6 +576,11 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
}
|
||||
if (data->pixels && internalFormat == GL_RGBA && format == GL_BGRA
|
||||
&& type == GL_UNSIGNED_INT_8_8_8_8_REV && data->pixels) {
|
||||
if (renderdata->glTextureRangeAPPLE) {
|
||||
renderdata->glTextureRangeAPPLE(data->type,
|
||||
texture->h * data->pitch,
|
||||
data->pixels);
|
||||
}
|
||||
renderdata->glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
|
||||
renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
|
||||
texture_h, 0, format, type, data->pixels);
|
||||
|
@ -788,6 +806,17 @@ GL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
int bpp = SDL_BYTESPERPIXEL(texture->format);
|
||||
int pitch = texturedata->pitch;
|
||||
|
||||
#ifdef __MACOSX__
|
||||
if (texture->format == SDL_PIXELFORMAT_RGB888) {
|
||||
int i;
|
||||
Uint8 *p = (Uint8 *) texturedata->pixels;
|
||||
p += 3;
|
||||
for (i = texture->h * pitch / 4; i--;) {
|
||||
*p = 0xff;
|
||||
p += 4;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
SetupTextureUpdate(data, texture, pitch);
|
||||
data->glBindTexture(texturedata->type, texturedata->texture);
|
||||
for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue