- Timestamp:
- Apr 22, 2019 5:43:30 PM (6 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/render
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu.h
r78190 r78251 104 104 int nvSwapGroup; 105 105 106 #ifdef USE_OSMESA107 GLubyte *buffer; /**< for rendering to off screen buffer. */108 int in_buffer_width;109 int in_buffer_height;110 #endif111 112 106 } WindowInfo; 113 107 … … 253 247 254 248 PFNVCRSERVER_CLIENT_CALLOUT pfnClientCallout; 255 256 #ifdef USE_OSMESA257 /** Off screen rendering hooks. */258 int use_osmesa;259 260 OSMesaContext (*OSMesaCreateContext)( GLenum format, OSMesaContext sharelist );261 GLboolean (* OSMesaMakeCurrent)( OSMesaContext ctx,262 GLubyte *buffer,263 GLenum type,264 GLsizei width,265 GLsizei height );266 void (*OSMesaDestroyContext)( OSMesaContext ctx );267 #endif268 249 269 250 #if defined(GLX) -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_glx.c
r78190 r78251 669 669 670 670 CRASSERT(visual); 671 672 #ifdef USE_OSMESA673 if (render_spu.use_osmesa) {674 /* A dummy visual - being non null is enough. */675 visual->visual =(XVisualInfo *) "os";676 return GL_TRUE;677 }678 #endif679 671 680 672 dpyName = renderspuGetDisplayName(); … … 862 854 window->nativeWindow = 0; 863 855 864 #ifdef USE_OSMESA865 if (render_spu.use_osmesa)866 return GL_TRUE;867 #endif868 869 856 dpy = visual->dpy; 870 857 … … 1162 1149 CRASSERT(window->visual); 1163 1150 1164 #ifdef USE_OSMESA 1165 if (render_spu.use_osmesa) 1166 { 1167 crFree(window->buffer); 1168 window->buffer = NULL; 1169 } 1170 else 1151 if (window->visual->visAttribs & CR_PBUFFER_BIT) { 1152 #ifdef GLX_VERSION_1_3 1153 render_spu.ws.glXDestroyPbuffer(window->visual->dpy, window->window); 1171 1154 #endif 1172 { 1173 if (window->visual->visAttribs & CR_PBUFFER_BIT) { 1174 #ifdef GLX_VERSION_1_3 1175 render_spu.ws.glXDestroyPbuffer(window->visual->dpy, window->window); 1176 #endif 1177 } 1178 else { 1179 /* The value window->nativeWindow will only be non-NULL if the 1180 * render_to_app_window option is set to true. In this case, we 1181 * don't want to do anything, since we're not responsible for this 1182 * window. I know...personal responsibility and all... 1183 */ 1184 if (!window->nativeWindow) { 1185 if (window->BltInfo.Base.id != CR_RENDER_WINCMD_ID) 1186 { 1187 int rc = renderspuWinCmdSubmit(CR_RENDER_WINCMD_TYPE_WIN_ON_DESTROY, window); 1188 AssertRC(rc); 1189 } 1190 XDestroyWindow(window->visual->dpy, window->window); 1191 XSync(window->visual->dpy, 0); 1192 } 1155 } 1156 else { 1157 /* The value window->nativeWindow will only be non-NULL if the 1158 * render_to_app_window option is set to true. In this case, we 1159 * don't want to do anything, since we're not responsible for this 1160 * window. I know...personal responsibility and all... 1161 */ 1162 if (!window->nativeWindow) { 1163 if (window->BltInfo.Base.id != CR_RENDER_WINCMD_ID) 1164 { 1165 int rc = renderspuWinCmdSubmit(CR_RENDER_WINCMD_TYPE_WIN_ON_DESTROY, window); 1166 AssertRC(rc); 1167 } 1168 XDestroyWindow(window->visual->dpy, window->window); 1169 XSync(window->visual->dpy, 0); 1193 1170 } 1194 1171 } … … 1212 1189 sharedSystemContext = sharedContext->context; 1213 1190 } 1214 1215 1216 1217 #ifdef USE_OSMESA1218 if (render_spu.use_osmesa) {1219 context->context = (GLXContext) render_spu.OSMesaCreateContext(OSMESA_RGB, 0);1220 if (context->context)1221 return GL_TRUE;1222 else1223 return GL_FALSE;1224 }1225 #endif1226 1191 1227 1192 #ifdef GLX_VERSION_1_3 … … 1380 1345 renderspu_SystemDestroyContext( ContextInfo *context ) 1381 1346 { 1382 #ifdef USE_OSMESA 1383 if (render_spu.use_osmesa) 1384 { 1385 render_spu.OSMesaDestroyContext( (OSMesaContext) context->context ); 1386 } 1387 else 1347 #if 0 1348 /* XXX disable for now - causes segfaults w/ NVIDIA's driver */ 1349 render_spu.ws.glXDestroyContext( context->visual->dpy, context->context ); 1388 1350 #endif 1389 {1390 #if 01391 /* XXX disable for now - causes segfaults w/ NVIDIA's driver */1392 render_spu.ws.glXDestroyContext( context->visual->dpy, context->context );1393 #endif1394 }1395 1351 context->visual = NULL; 1396 1352 context->context = 0; 1397 1353 } 1398 1399 1400 #ifdef USE_OSMESA1401 static void1402 check_buffer_size( WindowInfo *window )1403 {1404 if (window->BltInfo.width != window->in_buffer_width1405 || window->BltInfo.height != window->in_buffer_height1406 || ! window->buffer) {1407 crFree(window->buffer);1408 1409 window->buffer = crCalloc(window->BltInfo.width * window->BltInfo.height1410 * 4 * sizeof (GLubyte));1411 1412 window->in_buffer_width = window->BltInfo.width;1413 window->in_buffer_height = window->BltInfo.height;1414 1415 crDebug("Render SPU: dimensions changed to %d x %d", window->BltInfo.width, window->BltInfo.height);1416 }1417 }1418 #endif1419 1354 1420 1355 … … 1428 1363 1429 1364 /*crDebug("%s nativeWindow=0x%x", __FUNCTION__, (int) nativeWindow);*/ 1430 1431 #ifdef USE_OSMESA1432 if (render_spu.use_osmesa) {1433 check_buffer_size(window);1434 render_spu.OSMesaMakeCurrent( (OSMesaContext) context->context,1435 window->buffer, GL_UNSIGNED_BYTE,1436 window->BltInfo.width, window->BltInfo.height);1437 return;1438 }1439 #endif1440 1365 1441 1366 nativeWindow = 0; … … 1618 1543 renderspu_SystemWindowSize( WindowInfo *window, GLint w, GLint h ) 1619 1544 { 1620 #ifdef USE_OSMESA1621 if (render_spu.use_osmesa) {1622 window->BltInfo.width = w;1623 window->BltInfo.height = h;1624 check_buffer_size(window);1625 return;1626 }1627 #endif1628 1629 1545 CRASSERT(window); 1630 1546 CRASSERT(window->visual); … … 1730 1646 GLint *x, GLint *y, GLint *w, GLint *h ) 1731 1647 { 1732 #ifdef USE_OSMESA1733 if (render_spu.use_osmesa) {1734 *w = window->BltInfo.width;1735 *h = window->BltInfo.height;1736 return;1737 }1738 #endif1739 1740 1648 CRASSERT(window); 1741 1649 CRASSERT(window->visual); … … 1781 1689 renderspu_SystemGetMaxWindowSize( WindowInfo *window, GLint *w, GLint *h ) 1782 1690 { 1783 int scrn; 1784 #ifdef USE_OSMESA 1785 if (render_spu.use_osmesa) { 1786 *w = 2048; 1787 *h = 2048; 1788 return; 1789 } 1790 #endif 1691 int scrn; 1791 1692 1792 1693 CRASSERT(window); … … 1803 1704 renderspu_SystemWindowPosition( WindowInfo *window, GLint x, GLint y ) 1804 1705 { 1805 #ifdef USE_OSMESA1806 if (render_spu.use_osmesa)1807 return;1808 #endif1809 1810 1706 CRASSERT(window); 1811 1707 CRASSERT(window->visual); … … 1826 1722 renderspu_SystemWindowVisibleRegion( WindowInfo *window, GLint cRects, const GLint *pRects ) 1827 1723 { 1828 #ifdef USE_OSMESA1829 if (render_spu.use_osmesa)1830 return;1831 #endif1832 1833 1724 CRASSERT(window); 1834 1725 CRASSERT(window->visual); … … 1879 1770 renderspu_SystemShowWindow( WindowInfo *window, GLboolean showIt ) 1880 1771 { 1881 #ifdef USE_OSMESA1882 if (render_spu.use_osmesa)1883 return;1884 #endif1885 1886 1772 if (window->visual->dpy && window->window && 1887 1773 (window->visual->visAttribs & CR_PBUFFER_BIT) == 0) -
trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_init.c
r78190 r78251 224 224 return NULL; 225 225 } 226 #ifdef USE_OSMESA227 if (render_spu.use_osmesa) {228 if (!crLoadOSMesa(&render_spu.OSMesaCreateContext,229 &render_spu.OSMesaMakeCurrent,230 &render_spu.OSMesaDestroyContext)) {231 crError("Unable to load OSMesa library");232 }233 }234 #endif235 226 236 227 rc = renderspuDefaultCtxInit();
Note:
See TracChangeset
for help on using the changeset viewer.