Commit 5fca3f78 authored by Sam Lantinga's avatar Sam Lantinga

Advertise the most efficient format for the screen. Of course SDL code needs

to be fixed to handle framebuffers with alpha...

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402599
parent 438f7083
......@@ -457,15 +457,9 @@ 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;
......@@ -574,13 +568,14 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
renderdata->glTexParameteri(data->type, GL_TEXTURE_STORAGE_HINT_APPLE,
GL_STORAGE_CACHED_APPLE);
}
if (data->pixels && internalFormat == GL_RGBA && format == GL_BGRA
&& type == GL_UNSIGNED_INT_8_8_8_8_REV && data->pixels) {
if (texture->access == SDL_TEXTUREACCESS_STREAMING && texture->format == SDL_PIXELFORMAT_ARGB8888 ) {
/*
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);
......@@ -806,19 +801,6 @@ 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;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
p += 3;
#endif
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) {
......
......@@ -118,10 +118,10 @@ GetDisplayMode(CFDictionaryRef moderef, SDL_DisplayMode *mode)
mode->format = SDL_PIXELFORMAT_INDEX8;
break;
case 16:
mode->format = SDL_PIXELFORMAT_RGB555;
mode->format = SDL_PIXELFORMAT_ARGB1555;
break;
case 32:
mode->format = SDL_PIXELFORMAT_RGB888;
mode->format = SDL_PIXELFORMAT_ARGB8888;
break;
}
mode->w = width;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment