Changeset 80365 in vbox for trunk/src/VBox/Main/src-helper-apps
- Timestamp:
- Aug 21, 2019 11:28:40 AM (5 years ago)
- Location:
- trunk/src/VBox/Main/src-helper-apps/OpenGLTest
- Files:
-
- 3 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-helper-apps/OpenGLTest/Makefile.kmk
r80364 r80365 1 1 # $Id$ 2 2 ## @file 3 # Sub-Makefile for the Shared OpenGL Host Service.3 # Sub-Makefile for the OpenGLTest helper app. 4 4 # 5 5 … … 23 23 # Target lists. 24 24 # 25 ifdef VBOX_WITH_MAIN26 LIBRARIES += VBoxOGLrenderspu27 BLDDIRS += \28 $(VBOX_PATH_CROGL_GENFILES)/29 endif30 31 ifeq ($(KBUILD_TARGET),darwin)32 #33 # We have to symlink the system headers of OpenGl cause they have some34 # different directory hierarchy on Mac OS X (no /GL sub directory).35 #36 # See Config.kmk for the global variables.37 #38 INSTALLS += DarwinOpenGLHdrs39 DarwinOpenGLHdrs_INST = $(VBOX_DARWIN_OPENGL_INST)40 DarwinOpenGLHdrs_SYMLINKS = \41 $(foreach hdr, $(VBOX_DARWIN_OPENGL_HEADERS),\42 $(hdr)=>$(VBOX_PATH_MACOSX_SDK)/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/$(hdr))43 endif # darwin44 45 #46 # VBoxOGLrenderspu47 #48 VBoxOGLrenderspu_TEMPLATE = VBOXCROGLR3HOSTLIB49 VBoxOGLrenderspu_INTERMEDIATES = \50 $(VBOX_PATH_CROGL_GENFILES)/state/cr_currentpointers.h \51 $(VBOX_PATH_CROGL_GENFILES)/state/cr_statefuncs.h52 VBoxOGLrenderspu_INCS = $(VBOX_GRAPHICS_INCS)53 VBoxOGLrenderspu_SOURCES = \54 render/renderspu.c \55 render/renderspu_config.c \56 render/renderspu_init.c57 VBoxOGLrenderspu_SOURCES.win = \58 render/renderspu_wgl.c59 VBoxOGLrenderspu_SOURCES.linux = render/renderspu_glx.c60 VBoxOGLrenderspu_SOURCES.solaris = render/renderspu_glx.c61 VBoxOGLrenderspu_SOURCES.freebsd = render/renderspu_glx.c62 VBoxOGLrenderspu_OBJCFLAGS.darwin = -Wno-shadow63 VBoxOGLrenderspu_SOURCES.darwin = \64 OpenGLTest/OpenGLTestDarwin.cpp \65 render/renderspu_cocoa.c \66 render/renderspu_cocoa_helper.m67 ifdef VBOX_WITH_CRHGSMI68 VBoxOGLrenderspu_DEFS += VBOX_WITH_CRHGSMI69 endif70 ifdef VBOX_WITH_VDMA71 VBoxOGLrenderspu_DEFS += VBOX_WITH_VDMA72 endif73 74 25 LIBRARIES += VBoxOGLTest 75 26 VBoxOGLTest_TEMPLATE = VBOXR3NP 76 27 ifneq ($(KBUILD_TARGET),darwin) 77 VBoxOGLTest_SOURCES = OpenGLTest /OpenGLTest.cpp28 VBoxOGLTest_SOURCES = OpenGLTest.cpp 78 29 endif 79 VBoxOGLTest_SOURCES.darwin = OpenGLTest /OpenGLTestDarwin.cpp30 VBoxOGLTest_SOURCES.darwin = OpenGLTestDarwin.cpp 80 31 81 32 # … … 84 35 # 85 36 if ( defined(VBOX_WITH_QTGUI) \ 86 && (defined(VBOX_WITH_CROGL) || defined(VBOX_WITH_VIDEOHWACCEL)) \37 && defined(VBOX_WITH_VIDEOHWACCEL) \ 87 38 && !defined(VBOX_WITH_DEBUG_VCC_CRT)) 88 39 ifneq ($(KBUILD_TARGET),darwin) … … 92 43 PROGRAMS += VBoxTestOGL 93 44 VBoxTestOGL_TEMPLATE = $(if $(VBOX_WITH_VIDEOHWACCEL),$(if $(VBOX_WITH_HARDENING),VBOXQTGUI,VBOXQTGUIEXE),VBOXMAINEXE) 94 VBoxTestOGL_INCS += $(VBOX_PATH_CROGL_INCLUDE) $(VBOX_PATH_CROGL_GENFILES)95 45 VBoxTestOGL_DEFS.win = _WIN32_WINNT=0x0500 WINDOWS=1 96 46 VBoxTestOGL_DEFS.linux = Linux=1 _GNU_SOURCE … … 98 48 VBoxTestOGL_DEFS.darwin = DARWIN=1 GL_GLEXT_LEGACY _GNU_SOURCE 99 49 VBoxTestOGL_DEFS.freebsd = FreeBSD=1 _GNU_SOURCE 100 VBoxTestOGL_SOURCES = OpenGLTest /OpenGLTestApp.cpp101 VBoxTestOGL_SOURCES.win = OpenGLTest/VBoxTestOGL.rc50 VBoxTestOGL_SOURCES = OpenGLTestApp.cpp 51 VBoxTestOGL_SOURCES.win = VBoxTestOGL.rc 102 52 VBoxTestOGL_LIBS = \ 103 $(if $(VBOX_WITH_CROGL), \104 $(PATH_STAGE_LIB)/VBoxOGLhosterrorspu$(VBOX_SUFF_LIB) \105 $(PATH_STAGE_LIB)/VBoxOGLrenderspu$(VBOX_SUFF_LIB) \106 $(PATH_STAGE_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \107 $(PATH_STAGE_LIB)/VBoxOGLhostcrutil$(VBOX_SUFF_LIB),) \108 53 $(if $(VBOX_WITH_VIDEOHWACCEL), $(PATH_STAGE_LIB)/VBoxOGL2D$(VBOX_SUFF_LIB),) \ 109 54 $(LIB_RUNTIME) 110 55 VBoxTestOGL_DEFS += \ 111 56 VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\" \ 112 $(if $(VBOX_WITH_CROGL), VBOX_WITH_CROGL,) \113 57 $(if $(VBOX_WITH_VIDEOHWACCEL), VBOX_WITH_VIDEOHWACCEL,) 114 58 ifdef VBOX_WITH_VIDEOHWACCEL -
trunk/src/VBox/Main/src-helper-apps/OpenGLTest/OpenGLTest.cpp
r76553 r80365 32 32 bool RTCALL VBoxOglIs3DAccelerationSupported(void) 33 33 { 34 if (RTEnvExist("VBOX_ CROGL_FORCE_SUPPORTED"))34 if (RTEnvExist("VBOX_3D_FORCE_SUPPORTED")) 35 35 { 36 LogRel(("VBOX_ CROGL_FORCE_SUPPORTED is specified, skipping 3D test, and treating as supported\n"));36 LogRel(("VBOX_3D_FORCE_SUPPORTED is specified, skipping 3D test, and treating as supported\n")); 37 37 return true; 38 38 } -
trunk/src/VBox/Main/src-helper-apps/OpenGLTest/OpenGLTestApp.cpp
r78410 r80365 21 21 #include <iprt/getopt.h> 22 22 #include <iprt/initterm.h> 23 #include <iprt/ldr.h> 23 24 #include <iprt/stream.h> 24 25 #ifdef RT_OS_WINDOWS … … 55 56 #endif 56 57 57 #ifdef VBOX_WITH_CROGL 58 #include <cr_spu.h> 58 /** 59 * The OpenGL methods to look for when checking 3D presence. 60 */ 61 static const char * const g_apszOglMethods[] = 62 { 63 #ifdef RT_OS_WINDOWS 64 "wglCreateContext", 65 "wglDeleteContext", 66 "wglMakeCurrent", 67 "wglShareLists", 68 #elif defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD) || defined(RT_OS_SOLARIS) 69 "glXQueryVersion", 70 "glXChooseVisual", 71 "glXCreateContext", 72 "glXMakeCurrent", 73 "glXDestroyContext", 74 #endif 75 "glAlphaFunc", 76 "glBindTexture", 77 "glBlendFunc", 78 "glClear", 79 "glClearColor", 80 "glClearDepth", 81 "glClearStencil", 82 "glClipPlane", 83 "glColorMask", 84 "glColorPointer", 85 "glCullFace", 86 "glDeleteTextures", 87 "glDepthFunc", 88 "glDepthMask", 89 "glDepthRange", 90 "glDisable", 91 "glDisableClientState", 92 "glDrawArrays", 93 "glDrawElements", 94 "glEnable", 95 "glEnableClientState", 96 "glFogf", 97 "glFogfv", 98 "glFogi", 99 "glFrontFace", 100 "glGenTextures", 101 "glGetBooleanv", 102 "glGetError", 103 "glGetFloatv", 104 "glGetIntegerv", 105 "glGetString", 106 "glGetTexImage", 107 "glLightModelfv", 108 "glLightf", 109 "glLightfv", 110 "glLineWidth", 111 "glLoadIdentity", 112 "glLoadMatrixf", 113 "glMaterialfv", 114 "glMatrixMode", 115 "glMultMatrixf", 116 "glNormalPointer", 117 "glPixelStorei", 118 "glPointSize", 119 "glPolygonMode", 120 "glPolygonOffset", 121 "glPopAttrib", 122 "glPopMatrix", 123 "glPushAttrib", 124 "glPushMatrix", 125 "glScissor", 126 "glShadeModel", 127 "glStencilFunc", 128 "glStencilMask", 129 "glStencilOp", 130 "glTexCoordPointer", 131 "glTexImage2D", 132 "glTexParameterf", 133 "glTexParameterfv", 134 "glTexParameteri", 135 "glTexSubImage2D", 136 "glVertexPointer", 137 "glViewport" 138 }; 139 140 141 /** 142 * Tries to resolve the given OpenGL symbol. 143 * 144 * @returns Pointer to the symbol or nULL on error. 145 * @param pszSymbol The symbol to resolve. 146 */ 147 DECLINLINE(PFNRT) vboxTestOglGetProc(const char *pszSymbol) 148 { 149 int rc; 150 151 #ifdef RT_OS_WINDOWS 152 static RTLDRMOD s_hOpenGL32 = NULL; 153 if (s_hOpenGL32 == NULL) 154 { 155 rc = RTLdrLoadSystem("opengl32", /* fNoUnload = */ true, &s_hOpenGL32); 156 if (RT_FAILURE(rc)) 157 s_hOpenGL32 = NULL; 158 } 159 160 typedef PROC (WINAPI *PFNWGLGETPROCADDRESS)(LPCSTR); 161 static PFNWGLGETPROCADDRESS s_wglGetProcAddress = NULL; 162 if (s_wglGetProcAddress == NULL) 163 { 164 if (s_hOpenGL32 != NULL) 165 { 166 rc = RTLdrGetSymbol(s_hOpenGL32, "wglGetProcAddress", (void **)&s_wglGetProcAddress); 167 if (RT_FAILURE(rc)) 168 s_wglGetProcAddress = NULL; 169 } 170 } 171 172 if (s_wglGetProcAddress) 173 { 174 /* Khronos: [on failure] "some implementations will return other values. 1, 2, and 3 are used, as well as -1". */ 175 PFNRT p = (PFNRT)s_wglGetProcAddress(pszSymbol); 176 if (RT_VALID_PTR(p)) 177 return p; 178 179 /* Might be an exported symbol. */ 180 rc = RTLdrGetSymbol(s_hOpenGL32, pszSymbol, (void **)&p); 181 if (RT_SUCCESS(rc)) 182 return p; 183 } 184 #else /* The X11 gang */ 185 static RTLDRMOD s_hGL = NULL; 186 if (s_hGL == NULL) 187 { 188 static const char s_szLibGL[] = "libGL.so.1"; 189 rc = RTLdrLoadEx(s_szLibGL, &s_hGL, RTLDRLOAD_FLAGS_GLOBAL | RTLDRLOAD_FLAGS_NO_UNLOAD, NULL); 190 if (RT_FAILURE(rc)) 191 { 192 s_hGL = NULL; 193 return NULL; 194 } 195 } 196 197 typedef PFNRT (* PFNGLXGETPROCADDRESS)(const GLubyte * procName); 198 static PFNGLXGETPROCADDRESS s_glXGetProcAddress = NULL; 199 if (s_glXGetProcAddress == NULL) 200 { 201 rc = RTLdrGetSymbol(s_hGL, "glXGetProcAddress", (void **)&s_glXGetProcAddress); 202 if (RT_FAILURE(rc)) 203 { 204 s_glXGetProcAddress = NULL; 205 return NULL; 206 } 207 } 208 209 PFNRT p = s_glXGetProcAddress((const GLubyte *)pszSymbol); 210 if (RT_VALID_PTR(p)) 211 return p; 212 213 /* Might be an exported symbol. */ 214 rc = RTLdrGetSymbol(s_hGL, pszSymbol, (void **)&p); 215 if (RT_SUCCESS(rc)) 216 return p; 217 #endif 218 219 return NULL; 220 } 59 221 60 222 static int vboxCheck3DAccelerationSupported() 61 223 { 62 224 LogRel(("Testing 3D Support:\n")); 63 PCSPUREG aSpuRegs[] = { &g_RenderSpuReg, &g_ErrorSpuReg, NULL}; 64 SPU *spu = crSPUInitFromReg(NULL, 0, "render", NULL, &aSpuRegs[0]); 65 if (spu) 66 { 67 crSPUUnloadChain(spu); 68 LogRel(("Testing 3D Succeeded!\n")); 69 return 0; 70 } 71 LogRel(("Testing 3D Failed\n")); 72 return 1; 73 } 74 #endif 225 226 for (uint32_t i = 0; i < RT_ELEMENTS(g_apszOglMethods); i++) 227 { 228 PFNRT pfn = vboxTestOglGetProc(g_apszOglMethods[i]); 229 if (!pfn) 230 { 231 LogRel(("Testing 3D Failed\n")); 232 return 1; 233 } 234 } 235 236 LogRel(("Testing 3D Succeeded!\n")); 237 return 0; 238 } 75 239 76 240 #ifdef VBOX_WITH_VIDEOHWACCEL … … 211 375 if(argc < 2) 212 376 { 213 #ifdef VBOX_WITH_CROGL214 377 /* backwards compatibility: check 3D */ 215 378 rc = vboxCheck3DAccelerationSupported(); 216 #endif217 379 } 218 380 else … … 234 396 bool bTest2D = false; 235 397 #endif 236 #ifdef VBOX_WITH_CROGL237 398 bool bTest3D = false; 238 #endif239 399 #ifdef VBOXGLTEST_WITH_LOGGING 240 400 bool bLog = false; … … 252 412 { 253 413 case 't': 254 #ifdef VBOX_WITH_CROGL255 414 if (!strcmp(Val.psz, "3D") || !strcmp(Val.psz, "3d")) 256 415 { … … 259 418 break; 260 419 } 261 #endif262 420 #ifdef VBOX_WITH_VIDEOHWACCEL 263 421 if (!strcmp(Val.psz, "2D") || !strcmp(Val.psz, "2d")) … … 286 444 " --test 2D test for 2D (video) OpenGL capabilities\n" 287 445 #endif 288 #ifdef VBOX_WITH_CROGL289 446 " --test 3D test for 3D OpenGL capabilities\n" 290 #endif291 447 #ifdef VBOXGLTEST_WITH_LOGGING 292 448 " --log <log_file_name> log the GL test result to the given file\n" … … 333 489 rc = vboxInitQuietMode(); 334 490 335 #ifdef VBOX_WITH_CROGL336 491 if(!rc && bTest3D) 337 492 rc = vboxCheck3DAccelerationSupported(); 338 #endif339 493 340 494 #ifdef VBOX_WITH_VIDEOHWACCEL -
trunk/src/VBox/Main/src-helper-apps/OpenGLTest/OpenGLTestDarwin.cpp
r78190 r80365 100 100 bool RTCALL VBoxOglIs3DAccelerationSupported(void) 101 101 { 102 if (RTEnvExist("VBOX_ CROGL_FORCE_SUPPORTED"))102 if (RTEnvExist("VBOX_3D_FORCE_SUPPORTED")) 103 103 { 104 LogRel(("VBOX_ CROGL_FORCE_SUPPORTED is specified, skipping 3D test, and treating as supported\n"));104 LogRel(("VBOX_3D_FORCE_SUPPORTED is specified, skipping 3D test, and treating as supported\n")); 105 105 return true; 106 106 }
Note:
See TracChangeset
for help on using the changeset viewer.