Mercurial > sdl-ios-xcode
comparison src/video/SDL_renderer_gl.c @ 2844:70b63882d2ef
The YCbCr texture extension works now that bytes_per_pixel() returns the
correct value for YUV textures. Yay!
I'm still cheering for Ryan's pixel shader instead, since once it works
different shaders can handle all the YUV formats.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 06 Dec 2008 18:37:06 +0000 |
parents | e919f2e3700d |
children | 1cc5d5b164e2 |
comparison
equal
deleted
inserted
replaced
2843:e919f2e3700d | 2844:70b63882d2ef |
---|---|
658 case SDL_PIXELFORMAT_ARGB2101010: | 658 case SDL_PIXELFORMAT_ARGB2101010: |
659 internalFormat = GL_RGB10_A2; | 659 internalFormat = GL_RGB10_A2; |
660 format = GL_BGRA; | 660 format = GL_BGRA; |
661 type = GL_UNSIGNED_INT_2_10_10_10_REV; | 661 type = GL_UNSIGNED_INT_2_10_10_10_REV; |
662 break; | 662 break; |
663 #if 0 /* Ryan's pixel shader code should be better, once it works. :) */ | |
664 case SDL_PIXELFORMAT_UYVY: | |
665 // if (renderdata->GL_MESA_ycbcr_texture) { | |
666 // internalFormat = 3; | |
667 // format = GL_YCBCR_MESA; | |
668 // type = GL_UNSIGNED_SHORT_8_8_MESA; | |
669 // } else if (renderdata->GL_APPLE_ycbcr_422) { | |
670 internalFormat = GL_RGB; | |
671 format = GL_YCBCR_422_APPLE; | |
672 #if SDL_BYTEORDER == SDL_LIL_ENDIAN | |
673 type = GL_UNSIGNED_SHORT_8_8_APPLE; | |
674 #else | |
675 type = GL_UNSIGNED_SHORT_8_8_REV_APPLE; | |
676 #endif | |
677 // } else { | |
678 // SDL_SetError("Unsupported texture format"); | |
679 // return -1; | |
680 // } | |
681 break; | |
682 #else | |
663 case SDL_PIXELFORMAT_UYVY: | 683 case SDL_PIXELFORMAT_UYVY: |
664 if (renderdata->GL_ARB_fragment_program_supported) { | 684 if (renderdata->GL_ARB_fragment_program_supported) { |
665 if (renderdata->fragment_program_UYVY == 0) { | 685 if (renderdata->fragment_program_UYVY == 0) { |
666 renderdata->fragment_program_UYVY = | 686 renderdata->fragment_program_UYVY = |
667 compile_shader(renderdata, GL_FRAGMENT_PROGRAM_ARB, | 687 compile_shader(renderdata, GL_FRAGMENT_PROGRAM_ARB, |
678 } else { | 698 } else { |
679 SDL_SetError("Unsupported texture format"); | 699 SDL_SetError("Unsupported texture format"); |
680 return -1; | 700 return -1; |
681 } | 701 } |
682 break; | 702 break; |
703 #endif | |
683 default: | 704 default: |
684 SDL_SetError("Unsupported texture format"); | 705 SDL_SetError("Unsupported texture format"); |
685 return -1; | 706 return -1; |
686 } | 707 } |
687 | 708 |
865 } else if (texture->format == SDL_PIXELFORMAT_INDEX1MSB) { | 886 } else if (texture->format == SDL_PIXELFORMAT_INDEX1MSB) { |
866 renderdata->glPixelStorei(GL_UNPACK_LSB_FIRST, 0); | 887 renderdata->glPixelStorei(GL_UNPACK_LSB_FIRST, 0); |
867 } | 888 } |
868 renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); | 889 renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
869 renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, | 890 renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, |
870 (pitch / bytes_per_pixel(texture->format) / ((GL_TextureData *)texture->driverdata)->HACK_RYAN_FIXME)); | 891 (pitch / bytes_per_pixel(texture->format)) / ((GL_TextureData *)texture->driverdata)->HACK_RYAN_FIXME); |
871 } | 892 } |
872 | 893 |
873 static int | 894 static int |
874 GL_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture) | 895 GL_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture) |
875 { | 896 { |