QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
authorMike Gorchak <lestat@i.com.ua>
Fri, 05 Jun 2009 07:30:51 +0000
changeset 3165 7168651d5706
parent 3164 c5b2884c26b4
child 3166 3a63a5824557
QNX quirk has been added, QNX OpenGL ES implementation is broken regarding support of textures with packed pixel formats.
src/video/SDL_renderer_gles.c
--- a/src/video/SDL_renderer_gles.c	Thu Jun 04 21:00:45 2009 +0000
+++ b/src/video/SDL_renderer_gles.c	Fri Jun 05 07:30:51 2009 +0000
@@ -30,25 +30,24 @@
 #include "SDL_rect_c.h"
 #include "SDL_yuv_sw_c.h"
 
-#if defined(SDL_VIDEO_DRIVER_QNXGF) || defined(SDL_VIDEO_DRIVER_PHOTON)
+#if defined(__QNXNTO__)
+/* Include QNX system header to check QNX version later */
+#include <sys/neutrino.h>
+#endif /* __QNXNTO__ */
 
-/* Empty function stub to get OpenGL ES 1.0 support without  */
-/* OpenGL ES extension GL_OES_draw_texture_supported         */
+#if defined(SDL_VIDEO_DRIVER_QNXGF)  ||  \
+    defined(SDL_VIDEO_DRIVER_PHOTON) ||  \
+    defined(SDL_VIDEO_DRIVER_PANDORA)
+
+/* Empty function stub to get OpenGL ES 1.x support without  */
+/* OpenGL ES extension GL_OES_draw_texture supported         */
 GL_API void GL_APIENTRY
 glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
 {
     return;
 }
 
-#endif /* __QNXNTO__ */
-
-#if SDL_VIDEO_DRIVER_PANDORA
-GL_API void GL_APIENTRY
-glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height)
-{
-    return;
-}
-#endif /* SDL_VIDEO_DRIVER_PANDORA */
+#endif /* QNXGF || PHOTON || PANDORA */
 
 /* OpenGL ES 1.1 renderer implementation, based on the OpenGL renderer */
 
@@ -262,10 +261,19 @@
     renderer->window = window->id;
     renderer->driverdata = data;
 
-
     renderer->info.flags =
         (SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED);
 
+#if defined(__QNXNTO__)
+#if _NTO_VERSION<=641
+    /* QNX's OpenGL ES implementation is broken regarding             */
+    /* packed textures support, affected versions 6.3.2, 6.4.0, 6.4.1 */
+    renderer->info.num_texture_formats=2;
+    renderer->info.texture_formats[0]=SDL_PIXELFORMAT_ABGR8888;
+    renderer->info.texture_formats[1]=SDL_PIXELFORMAT_BGR24;
+#endif /* _NTO_VERSION */
+#endif /* __QNXNTO__ */
+
     if (GLES_LoadFunctions(data) < 0) {
         GLES_DestroyRenderer(renderer);
         return NULL;
@@ -403,7 +411,7 @@
         type = GL_UNSIGNED_SHORT_4_4_4_4;
         break;
     default:
-        SDL_SetError("Unsupported texture format");
+        SDL_SetError("Unsupported by OpenGL ES texture format");
         return -1;
     }