this repo has no description
0
fork

Configure Feed

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

Added null check for SetActiveTarget.

+27 -25
+2
src/CMakeLists.txt
··· 99 99 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) 100 100 endif() 101 101 102 + add_definitions(-DDLL_EXPORT) 103 + 102 104 103 105 # Copy includes to output ${OUTPUT_DIR}/include 104 106 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${OUTPUT_DIR})
+25 -25
src/renderer_GL_common.inl
··· 659 659 ((GPU_CONTEXT_DATA*)renderer->current_context_target->context->data)->last_image = NULL; 660 660 } 661 661 662 - // Binds the target's framebuffer. Returns false if it can't be bound. 662 + 663 + 664 + // Only for window targets, which have their own contexts. 665 + static void makeContextCurrent(GPU_Renderer* renderer, GPU_Target* target) 666 + { 667 + if (target == NULL || target->context == NULL || renderer->current_context_target == target) 668 + return; 669 + 670 + renderer->impl->FlushBlitBuffer(renderer); 671 + 672 + #ifdef SDL_GPU_USE_SDL2 673 + SDL_GL_MakeCurrent(SDL_GetWindowFromID(target->context->windowID), target->context->context); 674 + #endif 675 + renderer->current_context_target = target; 676 + } 677 + 678 + // Binds the target's framebuffer. Returns false if it can't be bound, true if it is bound or already bound. 663 679 static GPU_bool SetActiveTarget(GPU_Renderer* renderer, GPU_Target* target) 664 680 { 681 + makeContextCurrent(renderer, target); 682 + 683 + if (target == NULL || renderer->current_context_target == NULL) 684 + return GPU_FALSE; 685 + 665 686 if(renderer->enabled_features & GPU_FEATURE_RENDER_TARGETS) 666 687 { 667 688 // Bind the FBO 668 689 if(target != renderer->current_context_target->context->active_target) 669 690 { 670 - GLuint handle = 0; 671 - if(target != NULL) 672 - handle = ((GPU_TARGET_DATA*)target->data)->handle; 691 + GLuint handle = ((GPU_TARGET_DATA*)target->data)->handle; 673 692 renderer->impl->FlushBlitBuffer(renderer); 674 693 675 694 extBindFramebuffer(renderer, handle); 676 695 renderer->current_context_target->context->active_target = target; 677 696 } 678 - return GPU_TRUE; 679 697 } 680 698 else 681 699 { 682 700 // There's only one possible render target, the default framebuffer. 683 701 // Note: Could check against the default framebuffer value (((GPU_TARGET_DATA*)target->data)->handle versus result of GL_FRAMEBUFFER_BINDING)... 684 - if(target != NULL) 685 - { 686 - renderer->current_context_target->context->active_target = target; 687 - return GPU_TRUE; 688 - } 689 - return GPU_FALSE; 702 + renderer->current_context_target->context->active_target = target; 690 703 } 704 + return GPU_TRUE; 691 705 } 692 706 693 707 static_inline void flushAndBindFramebuffer(GPU_Renderer* renderer, GLuint handle) ··· 820 834 return GPU_TRUE; 821 835 } 822 836 823 - 824 - // Only for window targets, which have their own contexts. 825 - static void makeContextCurrent(GPU_Renderer* renderer, GPU_Target* target) 826 - { 827 - if(target == NULL || target->context == NULL || renderer->current_context_target == target) 828 - return; 829 - 830 - renderer->impl->FlushBlitBuffer(renderer); 831 - 832 - #ifdef SDL_GPU_USE_SDL2 833 - SDL_GL_MakeCurrent(SDL_GetWindowFromID(target->context->windowID), target->context->context); 834 - #endif 835 - renderer->current_context_target = target; 836 - } 837 837 838 838 static void setClipRect(GPU_Renderer* renderer, GPU_Target* target) 839 839 {