diff --git a/gfx/drivers/gl1.c b/gfx/drivers/gl1.c index e7acb7bf7a..afb1d69f73 100644 --- a/gfx/drivers/gl1.c +++ b/gfx/drivers/gl1.c @@ -278,6 +278,15 @@ static void *gl1_gfx_init(const video_info_t *video, gl1->ctx_driver->get_video_size(gl1->ctx_data, &mode_width, &mode_height); +#if defined(__APPLE__) && !defined(IOS) + /* This is a hack for now to work around a very annoying + * issue that currently eludes us. */ + if ( !gl1->ctx_driver->set_video_mode + || !gl1->ctx_driver->set_video_mode(gl1->ctx_data, + win_width, win_height, video->fullscreen)) + goto error; +#endif + full_x = mode_width; full_y = mode_height; mode_width = 0; @@ -560,8 +569,17 @@ static void draw_tex(gl1_t *gl1, int pot_width, int pot_height, int width, int h uint8_t *frame_rgba = NULL; /* FIXME: For now, everything is uploaded as BGRA8888, I could not get 444 or 555 to work, and there is no 565 support in GL 1.1 either. */ GLint internalFormat = GL_RGB8; - GLenum format = gl1->supports_bgra ? GL_BGRA_EXT : GL_RGBA; +#ifdef MSB_FIRST + bool supports_native = gl1->supports_bgra; + GLenum format = supports_native ? GL_BGRA_EXT : GL_RGBA; + GLenum type = supports_native ? GL_UNSIGNED_INT_8_8_8_8_REV : GL_UNSIGNED_BYTE; +#elif defined(LSB_FIRST) + bool supports_native = gl1->supports_bgra; + GLenum format = supports_native ? GL_BGRA_EXT : GL_RGBA; GLenum type = GL_UNSIGNED_BYTE; +#else +#error Broken endianness definition +#endif float vertices[] = { -1.0f, -1.0f, 0.0f, @@ -606,7 +624,8 @@ static void draw_tex(gl1_t *gl1, int pot_width, int pot_height, int width, int h glBindTexture(GL_TEXTURE_2D, tex); frame = (uint8_t*)frame_to_copy; - if (!gl1->supports_bgra) + + if (!supports_native) { frame_rgba = (uint8_t*)malloc(pot_width * pot_height * 4); if (frame_rgba) @@ -617,10 +636,17 @@ static void draw_tex(gl1_t *gl1, int pot_width, int pot_height, int width, int h for (x = 0; x < pot_width; x++) { int index = (y * pot_width + x) * 4; +#ifdef MSB_FIRST + frame_rgba[index + 2] = frame[index + 3]; + frame_rgba[index + 1] = frame[index + 2]; + frame_rgba[index + 0] = frame[index + 1]; + frame_rgba[index + 3] = frame[index + 0]; +#else frame_rgba[index + 2] = frame[index + 0]; frame_rgba[index + 1] = frame[index + 1]; frame_rgba[index + 0] = frame[index + 2]; frame_rgba[index + 3] = frame[index + 3]; +#endif } } frame = frame_rgba; @@ -924,7 +950,12 @@ static bool gl1_gfx_frame(void *data, const void *frame, /* Screenshots. */ if (gl1->readback_buffer_screenshot) gl1_readback(gl1, - 4, GL_RGBA, GL_UNSIGNED_BYTE, + 4, GL_RGBA, +#ifdef MSB_FIRST + GL_UNSIGNED_INT_8_8_8_8_REV, +#else + GL_UNSIGNED_BYTE, +#endif gl1->readback_buffer_screenshot); @@ -1312,7 +1343,12 @@ static void gl1_load_texture_data( (use_rgba || !rgb32) ? GL_RGBA : RARCH_GL1_INTERNAL_FORMAT32, width, height, 0, (use_rgba || !rgb32) ? GL_RGBA : RARCH_GL1_TEXTURE_TYPE32, - (rgb32) ? RARCH_GL1_FORMAT32 : GL_UNSIGNED_BYTE, frame); +#ifdef MSB_FIRST + GL_UNSIGNED_INT_8_8_8_8_REV, +#else + (rgb32) ? RARCH_GL1_FORMAT32 : GL_UNSIGNED_BYTE, +#endif + frame); } static void video_texture_load_gl1( diff --git a/gfx/drivers/gl2.c b/gfx/drivers/gl2.c index 295f18bc21..361ff1b4f5 100644 --- a/gfx/drivers/gl2.c +++ b/gfx/drivers/gl2.c @@ -3735,6 +3735,10 @@ static void *gl2_init(const video_info_t *video, #else video_driver_force_fallback("gdi"); #endif +#endif +#if defined(__APPLE__) && defined(__ppc__) + if (gl->version_major == 1) + video_driver_force_fallback("gl1"); #endif hwr = video_driver_get_hw_context(); diff --git a/pkg/apple/RetroArch_PPC.xcodeproj/project.pbxproj b/pkg/apple/RetroArch_PPC.xcodeproj/project.pbxproj index db57939481..10fa68d87c 100644 --- a/pkg/apple/RetroArch_PPC.xcodeproj/project.pbxproj +++ b/pkg/apple/RetroArch_PPC.xcodeproj/project.pbxproj @@ -321,6 +321,7 @@ "-DHAVE_GFX_WIDGETS", "-DOSX", "-DHAVE_OPENGL", + "-DHAVE_OPENGL1", "-DHAVE_CC_RESAMPLER", "-DHAVE_GLSL", "-DINLINE=inline", @@ -413,6 +414,7 @@ "-DHAVE_GFX_WIDGETS", "-DOSX", "-DHAVE_OPENGL", + "-DHAVE_OPENGL1", "-DHAVE_CC_RESAMPLER", "-DHAVE_GLSL", "-DINLINE=inline",