Commit 5908561e authored by Sam Lantinga's avatar Sam Lantinga

Added official support for GL_APPLE_ycbcr_422 and GL_MESA_ycbcr_texture

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403306
parent 0fa8c80c
...@@ -146,6 +146,8 @@ typedef struct ...@@ -146,6 +146,8 @@ typedef struct
SDL_bool updateSize; SDL_bool updateSize;
SDL_bool GL_ARB_texture_rectangle_supported; SDL_bool GL_ARB_texture_rectangle_supported;
SDL_bool GL_EXT_paletted_texture_supported; SDL_bool GL_EXT_paletted_texture_supported;
SDL_bool GL_APPLE_ycbcr_422_supported;
SDL_bool GL_MESA_ycbcr_texture_supported;
SDL_bool GL_ARB_fragment_program_supported; SDL_bool GL_ARB_fragment_program_supported;
int blendMode; int blendMode;
int scaleMode; int scaleMode;
...@@ -378,6 +380,12 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -378,6 +380,12 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
} }
--info->num_texture_formats; --info->num_texture_formats;
} }
if (SDL_GL_ExtensionSupported("GL_APPLE_ycbcr_422")) {
data->GL_APPLE_ycbcr_422_supported = SDL_TRUE;
}
if (SDL_GL_ExtensionSupported("GL_MESA_ycbcr_texture")) {
data->GL_MESA_ycbcr_texture_supported = SDL_TRUE;
}
if (SDL_GL_ExtensionSupported("GL_APPLE_texture_range")) { if (SDL_GL_ExtensionSupported("GL_APPLE_texture_range")) {
data->glTextureRangeAPPLE = data->glTextureRangeAPPLE =
(void (*)(GLenum, GLsizei, const GLvoid *)) (void (*)(GLenum, GLsizei, const GLvoid *))
...@@ -660,13 +668,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -660,13 +668,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
format = GL_BGRA; format = GL_BGRA;
type = GL_UNSIGNED_INT_2_10_10_10_REV; type = GL_UNSIGNED_INT_2_10_10_10_REV;
break; break;
#if 0 /* Ryan's pixel shader code should be better, once it works. :) */
case SDL_PIXELFORMAT_UYVY: case SDL_PIXELFORMAT_UYVY:
// if (renderdata->GL_MESA_ycbcr_texture) { if (renderdata->GL_APPLE_ycbcr_422_supported) {
// internalFormat = 3;
// format = GL_YCBCR_MESA;
// type = GL_UNSIGNED_SHORT_8_8_MESA;
// } else if (renderdata->GL_APPLE_ycbcr_422) {
internalFormat = GL_RGB; internalFormat = GL_RGB;
format = GL_YCBCR_422_APPLE; format = GL_YCBCR_422_APPLE;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN #if SDL_BYTEORDER == SDL_LIL_ENDIAN
...@@ -674,14 +677,15 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -674,14 +677,15 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
#else #else
type = GL_UNSIGNED_SHORT_8_8_REV_APPLE; type = GL_UNSIGNED_SHORT_8_8_REV_APPLE;
#endif #endif
// } else { } else if (renderdata->GL_MESA_ycbcr_texture_supported) {
// SDL_SetError("Unsupported texture format"); internalFormat = GL_RGB;
// return -1; format = GL_YCBCR_MESA;
// } #if SDL_BYTEORDER == SDL_LIL_ENDIAN
break; type = GL_UNSIGNED_SHORT_8_8_MESA;
#else #else
case SDL_PIXELFORMAT_UYVY: type = GL_UNSIGNED_SHORT_8_8_REV_MESA;
if (renderdata->GL_ARB_fragment_program_supported) { #endif
} else if (renderdata->GL_ARB_fragment_program_supported) {
if (renderdata->fragment_program_UYVY == 0) { if (renderdata->fragment_program_UYVY == 0) {
renderdata->fragment_program_UYVY = renderdata->fragment_program_UYVY =
compile_shader(renderdata, GL_FRAGMENT_PROGRAM_ARB, compile_shader(renderdata, GL_FRAGMENT_PROGRAM_ARB,
...@@ -700,7 +704,28 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -700,7 +704,28 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return -1; return -1;
} }
break; break;
case SDL_PIXELFORMAT_YUY2:
if (renderdata->GL_APPLE_ycbcr_422_supported) {
internalFormat = GL_RGB;
format = GL_YCBCR_422_APPLE;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
type = GL_UNSIGNED_SHORT_8_8_REV_APPLE;
#else
type = GL_UNSIGNED_SHORT_8_8_APPLE;
#endif
} else if (renderdata->GL_MESA_ycbcr_texture_supported) {
internalFormat = GL_RGB;
format = GL_YCBCR_MESA;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
type = GL_UNSIGNED_SHORT_8_8_REV_MESA;
#else
type = GL_UNSIGNED_SHORT_8_8_MESA;
#endif #endif
} else {
SDL_SetError("Unsupported texture format");
return -1;
}
break;
default: default:
SDL_SetError("Unsupported texture format"); SDL_SetError("Unsupported texture format");
return -1; return -1;
......
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