Changeset 23740 in vbox for trunk/src/VBox/Main
- Timestamp:
- Oct 13, 2009 7:54:22 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Makefile.kmk
r23599 r23740 462 462 463 463 464 if def VBOX_WITH_CROGL464 if defined(VBOX_WITH_CROGL) || defined(VBOX_WITH_VIDEOHWACCEL) 465 465 ifneq ($(KBUILD_TARGET),darwin) 466 466 # … … 468 468 # 469 469 PROGRAMS += VBoxTestOGL 470 VBoxTestOGL_TEMPLATE = VBOXMAINEXE470 VBoxTestOGL_TEMPLATE = $(if $(VBOX_WITH_VIDEOHWACCEL),$(if $(VBOX_WITH_HARDENING),VBOXQT4GUI,VBOXQT4GUIEXE),VBOXMAINEXE) 471 471 VBoxTestOGL_SOURCES = generic/OpenGLTestApp.cpp 472 472 VBoxTestOGL_LIBS = \ 473 $(PATH_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \ 474 $(VBOX_LIB_OGL_HOSTCRUTIL) \ 473 $(if $(VBOX_WITH_CROGL), \ 474 $(PATH_LIB)/VBoxOGLhostspuload$(VBOX_SUFF_LIB) \ 475 $(VBOX_LIB_OGL_HOSTCRUTIL),) \ 476 $(if $(VBOX_WITH_VIDEOHWACCEL), $(PATH_LIB)/VBoxOGL2D$(VBOX_SUFF_LIB),) \ 475 477 $(LIB_RUNTIME) 478 VBoxTestOGL_DEFS += \ 479 $(if $(VBOX_WITH_CROGL), VBOX_WITH_CROGL,) \ 480 $(if $(VBOX_WITH_VIDEOHWACCEL), VBOX_WITH_VIDEOHWACCEL,) 481 ifdef VBOX_WITH_VIDEOHWACCEL 482 VBoxTestOGL_QT_MODULES += Core Gui OpenGL 483 VBoxTestOGL_LDFLAGS.darwin += -framework OpenGL 484 VBoxTestOGL_LIBS.win += $(PATH_SDK_WINPSDK_LIB)/Opengl32.lib 485 VBoxTestOGL_LIBS.solaris += GL 486 endif 487 VBoxTestOGL_LDFLAGS.win = /SUBSYSTEM:windows 476 488 endif 477 489 endif -
trunk/src/VBox/Main/generic/OpenGLTestApp.cpp
r20500 r23740 21 21 22 22 #include <iprt/initterm.h> 23 #include <iprt/getopt.h> 24 #include <iprt/err.h> 25 #include <iprt/assert.h> 23 26 #ifdef RT_OS_WINDOWS 24 27 #include <Windows.h> 25 28 #endif 29 30 #ifdef VBOX_WITH_CROGL 26 31 27 32 extern "C" { … … 30 35 } 31 36 32 #ifndef RT_OS_WINDOWS 37 38 static int vboxCheck3DAccelerationSupported() 39 { 40 void *spu = crSPULoad(NULL, 0, "render", NULL, NULL); 41 if (spu) 42 { 43 crSPUUnloadChain(spu); 44 return 0; 45 } 46 return 1; 47 } 48 #endif 49 50 #ifdef VBOX_WITH_VIDEOHWACCEL 51 #include <QGLWidget> 52 #include <QApplication> 53 #include <VBox/VBoxGL2D.h> 54 55 static int vboxCheck2DVideoAccelerationSupported() 56 { 57 static int dummyArgc = 1; 58 static char * dummyArgv = "GlTest"; 59 QApplication app (dummyArgc, &dummyArgv); 60 61 VBoxGLTmpContext ctx; 62 const QGLContext *pContext = ctx.makeCurrent(); 63 if(pContext) 64 { 65 VBoxVHWAInfo supportInfo; 66 supportInfo.init(pContext); 67 if(supportInfo.isVHWASupported()) 68 return 0; 69 } 70 return 1; 71 } 72 73 #endif 74 33 75 int main(int argc, char **argv) 34 #else35 extern "C" int WINAPI WinMain(HINSTANCE hInstance,36 HINSTANCE /*hPrevInstance*/, LPSTR lpCmdLine, int /*nShowCmd*/)37 #endif38 76 { 39 void *spu; 40 int rc=1; 77 int rc=0; 41 78 42 79 RTR3Init(); 43 80 44 spu = crSPULoad(NULL, 0, "render", NULL, NULL); 45 if (spu) 81 if(argc < 3) 46 82 { 47 crSPUUnloadChain(spu); 48 rc=0; 83 #ifdef VBOX_WITH_CROGL 84 /* backwards compatibility: check 3D */ 85 rc = vboxCheck3DAccelerationSupported(); 86 #endif 87 } 88 else 89 { 90 static const RTGETOPTDEF s_aOptionDefs[] = 91 { 92 { "--test", 't', RTGETOPT_REQ_STRING }, 93 { "-test", 't', RTGETOPT_REQ_STRING }, 94 }; 95 96 RTGETOPTSTATE State; 97 int rc = RTGetOptInit(&State, argc-1, argv+1, &s_aOptionDefs[0], RT_ELEMENTS(s_aOptionDefs), 0, 0); 98 AssertRCReturn(rc, 49); 99 100 for (;;) 101 { 102 RTGETOPTUNION Val; 103 rc = RTGetOpt(&State, &Val); 104 if (!rc) 105 break; 106 switch (rc) 107 { 108 case 't': 109 #ifdef VBOX_WITH_CROGL 110 if (!strcmp(Val.psz, "3D") || !strcmp(Val.psz, "3d")) 111 { 112 rc = vboxCheck3DAccelerationSupported(); 113 break; 114 } 115 #endif 116 #ifdef VBOX_WITH_VIDEOHWACCEL 117 if (!strcmp(Val.psz, "2D") || !strcmp(Val.psz, "2d")) 118 { 119 rc = vboxCheck2DVideoAccelerationSupported(); 120 break; 121 } 122 #endif 123 rc = 1; 124 break; 125 case VERR_GETOPT_UNKNOWN_OPTION: 126 case VINF_GETOPT_NOT_OPTION: 127 rc = 1; 128 default: 129 break; 130 } 131 132 if(rc) 133 break; 134 } 49 135 } 50 136 51 137 /*RTR3Term();*/ 52 138 return rc; 139 53 140 } 54 141 142 #ifdef RT_OS_WINDOWS 143 extern "C" int WINAPI WinMain(HINSTANCE hInstance, 144 HINSTANCE /*hPrevInstance*/, LPSTR lpCmdLine, int /*nShowCmd*/) 145 { 146 return main(__argc, __argv); 147 } 148 #endif 149
Note:
See TracChangeset
for help on using the changeset viewer.