Skip to content

Commit 96152bf

Browse files
authored
Merge branch 'grimfang4:master' into tcc
2 parents b3bd638 + e8ee352 commit 96152bf

File tree

3 files changed

+28
-26
lines changed

3 files changed

+28
-26
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ if (BUILD_DOCS)
342342
set(DOXYGEN_INPUT ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src)
343343
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
344344
add_custom_target(doc
345-
` ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
345+
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
346346
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
347347
COMMENT "Generating API documentation with Doxygen" VERBATIM
348348
)

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ if(APPLE)
9999
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
100100
endif()
101101

102+
add_definitions(-DDLL_EXPORT)
103+
102104

103105
# Copy includes to output ${OUTPUT_DIR}/include
104106
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${OUTPUT_DIR})

src/renderer_GL_common.inl

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -659,35 +659,49 @@ static_inline void flushAndBindTexture(GPU_Renderer* renderer, GLuint handle)
659659
((GPU_CONTEXT_DATA*)renderer->current_context_target->context->data)->last_image = NULL;
660660
}
661661

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.
663679
static GPU_bool SetActiveTarget(GPU_Renderer* renderer, GPU_Target* target)
664680
{
681+
makeContextCurrent(renderer, target);
682+
683+
if (target == NULL || renderer->current_context_target == NULL)
684+
return GPU_FALSE;
685+
665686
if(renderer->enabled_features & GPU_FEATURE_RENDER_TARGETS)
666687
{
667688
// Bind the FBO
668689
if(target != renderer->current_context_target->context->active_target)
669690
{
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;
673692
renderer->impl->FlushBlitBuffer(renderer);
674693

675694
extBindFramebuffer(renderer, handle);
676695
renderer->current_context_target->context->active_target = target;
677696
}
678-
return GPU_TRUE;
679697
}
680698
else
681699
{
682700
// There's only one possible render target, the default framebuffer.
683701
// 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;
690703
}
704+
return GPU_TRUE;
691705
}
692706

693707
static_inline void flushAndBindFramebuffer(GPU_Renderer* renderer, GLuint handle)
@@ -821,20 +835,6 @@ static GPU_bool growIndexBuffer(GPU_CONTEXT_DATA* cdata, unsigned int minimum_ve
821835
}
822836

823837

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-
838838
static void setClipRect(GPU_Renderer* renderer, GPU_Target* target)
839839
{
840840
if(target->use_clip_rect)

0 commit comments

Comments
 (0)