Changeset 54638 in vbox for trunk/src/VBox
- Timestamp:
- Mar 5, 2015 12:33:47 AM (10 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-cocoa.m
r54167 r54638 735 735 DEBUG_MSG(("cocoaViewMakeCurrentContext(%p, %p)\n", (void*)pView, (void*)pCtx)); 736 736 737 /* Always flush before flush. glXMakeCurrent and wglMakeCurrent does this 738 implicitly, seemingly NSOpenGLContext::makeCurrentContext doesn't. */ 739 if ([NSOpenGLContext currentContext] != 0) 740 glFlush(); 741 737 742 if (pView) 738 743 { -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_cocoa_helper.m
r54632 r54638 193 193 } while (0) 194 194 195 #ifdef DEBUG_poetzsch 196 # define DEBUG_CHECK_GL_ERROR() do { checkGLError(__FILE__, __LINE__); } while (0); 197 static void checkGLError(char *pszFile, int iLine) 198 { 199 GLenum uGlErr = glGetError(); 200 if (uGlErr != GL_NO_ERROR) 201 { 202 const char *errStr; 203 switch (uGlErr) 204 { 205 case GL_INVALID_ENUM: errStr = "GL_INVALID_ENUM"; break; 206 case GL_INVALID_VALUE: errStr = "GL_INVALID_VALUE"; break; 207 case GL_INVALID_OPERATION: errStr = "GL_INVALID_OPERATION"; break; 208 case GL_STACK_OVERFLOW: errStr = "GL_STACK_OVERFLOW"; break; 209 case GL_STACK_UNDERFLOW: errStr = "GL_STACK_UNDERFLOW"; break; 210 case GL_OUT_OF_MEMORY: errStr = "GL_OUT_OF_MEMORY"; break; 211 case GL_TABLE_TOO_LARGE: errStr = "GL_TABLE_TOO_LARGE"; break; 212 default: errStr = "UNKNOWN"; break; 213 } 214 DEBUG_MSG(("%s:%d: glError %d (%s)\n", pszFile, iLine, uGlErr, errStr)); 215 } 216 } 195 #ifdef VBOX_STRICT 196 # define DEBUG_CLEAR_GL_ERRORS() \ 197 do { \ 198 while (glGetError() != GL_NO_ERROR) \ 199 { /* nothing */ } \ 200 } while (0) 201 # define DEBUG_CHECK_GL_ERROR(a_szOp) \ 202 do { \ 203 GLenum iGlCheckErr = glGetError(); \ 204 if (RT_UNLIKELY(iGlCheckErr != GL_NO_ERROR)) \ 205 AssertMsgFailed((a_szOp ": iGlCheckErr=%#x\n", iGlCheckErr)); \ 206 } while (0) 217 207 #else 218 # define DEBUG_CHECK_GL_ERROR() do {} while (0) 208 # define DEBUG_CLEAR_GL_ERRORS() do {} while (0) 209 # define DEBUG_CHECK_GL_ERROR(a_szOp) do {} while (0) 219 210 #endif 220 211 … … 389 380 glFlush(); 390 381 382 DEBUG_CLEAR_GL_ERRORS(); 391 383 [pNewCtx makeCurrentContext]; 384 DEBUG_CHECK_GL_ERROR("makeCurrentContext"); 392 385 393 386 pCtxInfo->fIsValid = true; … … 420 413 if ([pOldCtx view] != pOldView) 421 414 { 415 DEBUG_CLEAR_GL_ERRORS(); 422 416 [pOldCtx setView: pOldView]; 417 DEBUG_CHECK_GL_ERROR("setView"); 423 418 } 424 419 420 DEBUG_CLEAR_GL_ERRORS(); 425 421 [pOldCtx makeCurrentContext]; 422 DEBUG_CHECK_GL_ERROR("makeCurrentContext"); 426 423 427 424 #ifdef VBOX_STRICT … … 1497 1494 if (m_pGLCtx) 1498 1495 { 1496 #ifdef IN_VMSVGA3D 1497 Assert(!pCtx); 1498 #endif 1499 1499 [m_pGLCtx clearDrawable]; 1500 1500 [m_pGLCtx release]; … … 2000 2000 - (void)makeCurrentFBO 2001 2001 { 2002 COCOA_LOG_FLOW(("%s: self=%p\n", __PRETTY_FUNCTION__, (void *)self)); 2002 COCOA_LOG_FLOW(("%s: self=%p - m_pGLCtx=%p m_fNeedCtxUpdate=%d\n", __PRETTY_FUNCTION__, (void *)self, 2003 (void *)m_pGLCtx, m_fNeedCtxUpdate)); 2003 2004 2004 2005 if (m_pGLCtx) 2005 2006 { 2007 NSOpenGLContext *pPrevCtx = [NSOpenGLContext currentContext]; 2008 2009 #ifdef IN_VMSVGA3D 2010 /* Always flush before flush. glXMakeCurrent and wglMakeCurrent does this 2011 implicitly, seemingly NSOpenGLContext::makeCurrentContext doesn't. */ 2012 if (pPrevCtx != nil) 2013 { 2014 DEBUG_CLEAR_GL_ERRORS(); 2015 glFlush(); 2016 DEBUG_CHECK_GL_ERROR("glFlush"); 2017 } 2018 #endif 2019 2006 2020 if ([m_pGLCtx view] != self) 2007 2021 { 2022 #ifndef IN_VMSVGA3D 2008 2023 /* We change the active view, so flush first */ 2009 if ( [NSOpenGLContext currentContext] != 0)2024 if (pPrevCtx != nil) 2010 2025 glFlush(); 2026 #endif 2027 DEBUG_CLEAR_GL_ERRORS(); 2011 2028 [m_pGLCtx setView: self]; 2012 DEBUG_CHECK_GL_ERROR( );2029 DEBUG_CHECK_GL_ERROR("setView"); 2013 2030 } 2014 2031 2015 /* 2016 if ( [NSOpenGLContext currentContext]!= m_pGLCtx)2017 */ 2032 #if 0 2033 if (pPrevCtx != m_pGLCtx) 2034 #endif 2018 2035 { 2036 DEBUG_CLEAR_GL_ERRORS(); 2019 2037 [m_pGLCtx makeCurrentContext]; 2020 DEBUG_CHECK_GL_ERROR(); 2021 if (m_fNeedCtxUpdate == true) 2022 { 2023 [m_pGLCtx update]; 2024 m_fNeedCtxUpdate = false; 2025 } 2038 DEBUG_CHECK_GL_ERROR("makeCurrentContext"); 2039 Assert([NSOpenGLContext currentContext] == m_pGLCtx); 2040 Assert([m_pGLCtx view] == self); 2041 } 2042 2043 if (m_fNeedCtxUpdate == true) 2044 { 2045 [m_pGLCtx update]; 2046 m_fNeedCtxUpdate = false; 2026 2047 } 2027 2048 … … 2851 2872 2852 2873 [pPool release]; 2853 COCOA_LOG_FLOW(("cocoaGLCtx Destroy: returns *ppCtx=%p\n", (void *)*ppCtx));2874 COCOA_LOG_FLOW(("cocoaGLCtxCreate: returns *ppCtx=%p\n", (void *)*ppCtx)); 2854 2875 } 2855 2876 … … 3131 3152 else 3132 3153 { 3154 #ifdef IN_VMSVGA3D 3155 /* Always flush before flush. glXMakeCurrent and wglMakeCurrent does this 3156 implicitly, seemingly NSOpenGLContext::makeCurrentContext doesn't. */ 3157 if ([NSOpenGLContext currentContext] != nil) 3158 { 3159 DEBUG_CLEAR_GL_ERRORS(); 3160 glFlush(); 3161 DEBUG_CHECK_GL_ERROR("glFlush"); 3162 } 3163 #endif 3133 3164 [NSOpenGLContext clearCurrentContext]; 3134 3165 } … … 3207 3238 VMSVGA3D_DECL(void) vmsvga3dCocoaViewMakeCurrentContext(NativeNSViewRef pView, NativeNSOpenGLContextRef pCtx) 3208 3239 { 3240 Assert(!pView || [(OverlayView *)pView glCtx] == pCtx || [(OverlayView *)pView glCtx] == nil); 3209 3241 cocoaViewMakeCurrentContext(pView, pCtx); 3210 3242 }
Note:
See TracChangeset
for help on using the changeset viewer.