this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Cleanup for SetFullscreen and SetWindowResolution in preparation for a fix.

+91 -53
+1
src/groups.dox
··· 8 8 * 9 9 * Other functions in the Initialization module control how initialization is performed. 10 10 * 11 + * 11 12 * \defgroup Logging Debugging, Logging, and Error Handling 12 13 * Use GPU_Log() for normal logging output (e.g. to replace printf). Other logging priorities are handled by GPU_LogWarning() and GPU_LogError(). 13 14 *
+1
src/renderer_GLES_1.c
··· 18 18 #define SDL_GPU_USE_ARRAY_PIPELINE 19 19 #define SDL_GPU_DISABLE_TEXTURE_GETS 20 20 #define SDL_GPU_DISABLE_SHADERS 21 + #define SDL_GPU_DISABLE_RENDER_TO_TEXTURE 21 22 #define SDL_GPU_APPLY_TRANSFORMS_TO_GL_STACK 22 23 #define SDL_GPU_NO_VAO 23 24
+88 -53
src/renderer_GL_common.inl
··· 1074 1074 && get_GLSL_version(&renderer->max_shader_version)); 1075 1075 } 1076 1076 1077 + static void update_stored_dimensions(GPU_Target* target) 1078 + { 1079 + Uint8 is_fullscreen; 1080 + 1081 + if(target->context == NULL) 1082 + return; 1083 + 1084 + #ifdef SDL_GPU_USE_SDL2 1085 + { 1086 + SDL_Window* window = SDL_GetWindowFromID(target->context->windowID); 1087 + SDL_GetWindowSize(window, &target->context->window_w, &target->context->window_h); 1088 + is_fullscreen = (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN); 1089 + } 1090 + #else 1091 + { 1092 + SDL_Surface* screen = SDL_GetVideoSurface(); 1093 + target->context->window_w = screen->w; 1094 + target->context->window_h = screen->h; 1095 + is_fullscreen = (screen->flags & SDL_FULLSCREEN); 1096 + } 1097 + #endif 1098 + 1099 + if(!is_fullscreen) 1100 + { 1101 + target->context->stored_window_w = target->context->window_w; 1102 + target->context->stored_window_h = target->context->window_h; 1103 + } 1104 + } 1105 + 1077 1106 static GPU_Target* CreateTargetFromWindow(GPU_Renderer* renderer, Uint32 windowID, GPU_Target* target) 1078 1107 { 1079 1108 Uint8 created = 0; // Make a new one or repurpose an existing target? ··· 1156 1185 target->context->context = SDL_GL_CreateContext(window); 1157 1186 GPU_AddWindowMapping(target); 1158 1187 } 1159 - 1160 - // Get window dimensions 1161 - SDL_GetWindowSize(window, &target->context->window_w, &target->context->window_h); 1162 - target->context->stored_window_w = target->context->window_w; 1163 - target->context->stored_window_h = target->context->window_h; 1188 + 1164 1189 // We need a GL context before we can get the drawable size. 1165 1190 SDL_GL_GetDrawableSize(window, &target->context->drawable_w, &target->context->drawable_h); 1166 1191 ··· 1183 1208 } 1184 1209 1185 1210 target->context->windowID = 1; 1186 - target->context->window_w = target->context->drawable_w = screen->w; 1187 - target->context->window_h = target->context->drawable_h = screen->h; 1188 - target->context->stored_window_w = target->context->window_w; 1189 - target->context->stored_window_h = target->context->window_h; 1211 + target->context->drawable_w = screen->w; 1212 + target->context->drawable_h = screen->h; 1190 1213 1191 1214 #endif 1215 + 1216 + update_stored_dimensions(target); 1217 + 1192 1218 1193 1219 ((GPU_TARGET_DATA*)target->data)->handle = 0; 1194 1220 ((GPU_TARGET_DATA*)target->data)->format = GL_RGBA; ··· 1604 1630 extBindFramebuffer(renderer, ((GPU_TARGET_DATA*)target->data)->handle); 1605 1631 } 1606 1632 1633 + static void get_window_dimensions(GPU_Target* target, int* w, int* h) 1634 + { 1635 + #ifdef SDL_GPU_USE_SDL2 1636 + SDL_GetWindowSize(SDL_GetWindowFromID(target->context->windowID), w, h); 1637 + #else 1638 + SDL_Surface* screen = SDL_GetVideoSurface(); 1639 + *w = screen->w; 1640 + *h = screen->h; 1641 + #endif 1642 + } 1643 + 1644 + static void get_drawable_dimensions(GPU_Target* target, int* w, int* h) 1645 + { 1646 + #ifdef SDL_GPU_USE_SDL2 1647 + SDL_GL_GetDrawableSize(SDL_GetWindowFromID(target->context->windowID), w, h); 1648 + #else 1649 + get_window_dimensions(target, w, h); 1650 + #endif 1651 + } 1652 + 1653 + static void resize_window(GPU_Target* target, int w, int h) 1654 + { 1655 + #ifdef SDL_GPU_USE_SDL2 1656 + SDL_SetWindowSize(SDL_GetWindowFromID(target->context->windowID), w, h); 1657 + #else 1658 + SDL_Surface* screen = SDL_GetVideoSurface(); 1659 + Uint32 flags = screen->flags; 1660 + 1661 + screen = SDL_SetVideoMode(w, h, 0, flags); 1662 + // NOTE: There's a bug in SDL 1.2. This is a workaround. Let's resize again: 1663 + screen = SDL_SetVideoMode(w, h, 0, flags); 1664 + #endif 1665 + } 1666 + 1607 1667 static Uint8 SetWindowResolution(GPU_Renderer* renderer, Uint16 w, Uint16 h) 1608 1668 { 1609 1669 GPU_Target* target = renderer->current_context_target; ··· 1612 1672 if(isCurrent) 1613 1673 renderer->impl->FlushBlitBuffer(renderer); 1614 1674 1615 - #ifdef SDL_GPU_USE_SDL2 1616 - 1675 + // Don't need to resize (only update internals) when resolution isn't changing. 1676 + get_window_dimensions(target, &target->context->window_w, &target->context->window_h); 1677 + get_drawable_dimensions(target, &target->context->drawable_w, &target->context->drawable_h); 1678 + if(target->context->window_w != w || target->context->window_h != h) 1617 1679 { 1618 - SDL_Window* window = SDL_GetWindowFromID(target->context->windowID); 1619 - 1620 - // Don't need to resize (only update internals) when resolution isn't changing. 1621 - SDL_GetWindowSize(window, &target->context->window_w, &target->context->window_h); 1622 - SDL_GL_GetDrawableSize(window, &target->context->drawable_w, &target->context->drawable_h); 1623 - if(target->context->window_w != w || target->context->window_h != h) 1624 - { 1625 - SDL_SetWindowSize(window, w, h); 1626 - SDL_GetWindowSize(window, &target->context->window_w, &target->context->window_h); 1627 - SDL_GL_GetDrawableSize(window, &target->context->drawable_w, &target->context->drawable_h); 1628 - } 1680 + resize_window(target, w, h); 1681 + get_window_dimensions(target, &target->context->window_w, &target->context->window_h); 1682 + get_drawable_dimensions(target, &target->context->drawable_w, &target->context->drawable_h); 1629 1683 } 1630 1684 1631 - #else 1632 - SDL_Surface* screen = SDL_GetVideoSurface(); 1633 - Uint32 flags = screen->flags; 1634 - GPU_Context* context; 1685 + #ifdef SDL_GPU_USE_SDL1 1635 1686 1636 - // Don't need to resize (only update internals) when resolution isn't changing. 1637 - if(screen->w != w || screen->h != h) 1687 + // FIXME: Does the entire GL state need to be reset because the screen was recreated? 1638 1688 { 1639 - screen = SDL_SetVideoMode(w, h, 0, flags); 1640 - // There's a bug in SDL. This is a workaround. Let's resize again: 1641 - screen = SDL_SetVideoMode(w, h, 0, flags); 1689 + GPU_Context* context; 1642 1690 1643 - if(screen == NULL) 1644 - return 0; 1691 + // Reset texturing state 1692 + context = renderer->current_context_target->context; 1693 + context->use_texturing = 1; 1694 + ((GPU_CONTEXT_DATA*)context->data)->last_use_texturing = 0; 1645 1695 } 1646 1696 1647 - target->context->window_w = target->context->drawable_w = screen->w; 1648 - target->context->window_h = target->context->drawable_h = screen->h; 1649 - 1650 - // FIXME: Does the entire GL state need to be reset because the screen was recreated? 1651 - 1652 - // Reset texturing state 1653 - context = renderer->current_context_target->context; 1654 - context->use_texturing = 1; 1655 - ((GPU_CONTEXT_DATA*)context->data)->last_use_texturing = 0; 1656 - 1657 1697 // Clear target (no state change) 1658 1698 glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); 1659 1699 glClear( GL_COLOR_BUFFER_BIT ); 1660 1700 #endif 1661 1701 1662 1702 // Store the resolution for fullscreen_desktop changes 1663 - target->context->stored_window_w = target->context->window_w; 1664 - target->context->stored_window_h = target->context->window_h; 1703 + update_stored_dimensions(target); 1665 1704 1666 1705 // Update base dimensions 1667 1706 target->base_w = target->context->drawable_w; ··· 1768 1807 // If we're in windowed mode now and a resolution was stored, restore the original window resolution 1769 1808 if(was_fullscreen && !is_fullscreen && (target->context->stored_window_w != 0 && target->context->stored_window_h != 0)) 1770 1809 SDL_SetWindowSize(window, target->context->stored_window_w, target->context->stored_window_h); 1771 - 1772 - // Update window dims 1773 - SDL_GetWindowSize(window, &target->context->window_w, &target->context->window_h); 1774 - SDL_GL_GetDrawableSize(window, &target->context->drawable_w, &target->context->drawable_h); 1775 1810 } 1776 1811 1777 1812 #else ··· 1783 1818 { 1784 1819 SDL_WM_ToggleFullScreen(surf); 1785 1820 is_fullscreen = (surf->flags & SDL_FULLSCREEN); 1786 - 1787 - // Update window dims 1788 - target->context->window_w = target->context->drawable_w = surf->w; 1789 - target->context->window_h = target->context->drawable_h = surf->h; 1790 1821 } 1791 1822 1792 1823 #endif 1793 1824 1794 1825 if(is_fullscreen != was_fullscreen) 1795 1826 { 1827 + // Update window dims 1828 + get_window_dimensions(target, &target->context->window_w, &target->context->window_h); 1829 + get_drawable_dimensions(target, &target->context->drawable_w, &target->context->drawable_h); 1830 + 1796 1831 // If virtual res is not set, we need to update the target dims and reset stuff that no longer is right 1797 1832 if(!target->using_virtual_resolution) 1798 1833 {
+1
src/renderer_OpenGL_1_BASE.c
··· 13 13 // Most of the code pulled in from here... 14 14 #define SDL_GPU_USE_OPENGL 15 15 #define SDL_GPU_DISABLE_SHADERS 16 + #define SDL_GPU_DISABLE_RENDER_TO_TEXTURE 16 17 #define SDL_GPU_USE_FIXED_FUNCTION_PIPELINE 17 18 #define SDL_GPU_GL_TIER 1 18 19 #define SDL_GPU_GL_MAJOR_VERSION 1