OpenGLTestApp.cpp revision 7012c4fe33d74bb65f08a9eae37a49467efcec56
248c89033c87fed7229aa29bbbc4f4698fb13687vboxsync * VBox host opengl support test application.
248c89033c87fed7229aa29bbbc4f4698fb13687vboxsync * Copyright (C) 2009 Sun Microsystems, Inc.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * available from http://www.virtualbox.org. This file is free software;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * you can redistribute it and/or modify it under the terms of the GNU
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * General Public License (GPL) as published by the Free Software
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync * additional information or have any questions.
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync extern void * crSPULoad(void *, int, char *, char *, void *);
c89333d3e41e439ed9e74768000edc399d3e72e6vboxsync extern void crSPUUnloadChain(void *);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync void *spu = crSPULoad(NULL, 0, (char*)"render", NULL, NULL);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync static const char * const s_apszGroups[] = VBOX_LOGGROUP_NAMES;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync int vrc = RTLogCreateEx(&loggerRelease, fFlags, "all",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "VBOX_RELEASE_LOG", RT_ELEMENTS(s_apszGroups), s_apszGroups,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync RTLOGDEST_FILE, szError, sizeof(szError), pszFilenameFmt, pszFilename);
248c89033c87fed7229aa29bbbc4f4698fb13687vboxsync /* some introductory information */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync RTTimeSpecToString(RTTimeNow(&timeSpec), szTmp, sizeof(szTmp));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "VBoxTestGL %s r%u %s (%s %s) release log\n"
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "Log opened %s\n",
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync VBOX_VERSION_STRING, RTBldCfgRevision(), VBOX_BUILD_TARGET,
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync vrc = RTSystemQueryOSInfo(RTSYSOSINFO_PRODUCT, szTmp, sizeof(szTmp));
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync if (RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW)
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync RTLogRelLogger(loggerRelease, 0, ~0U, "OS Product: %s\n", szTmp);
b4d7b4dbcc45b8bde7502aa129440d92d7ffd038vboxsync vrc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szTmp, sizeof(szTmp));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync RTLogRelLogger(loggerRelease, 0, ~0U, "OS Release: %s\n", szTmp);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync vrc = RTSystemQueryOSInfo(RTSYSOSINFO_VERSION, szTmp, sizeof(szTmp));
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW)
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync RTLogRelLogger(loggerRelease, 0, ~0U, "OS Version: %s\n", szTmp);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync vrc = RTSystemQueryOSInfo(RTSYSOSINFO_SERVICE_PACK, szTmp, sizeof(szTmp));
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync if (RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW)
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync RTLogRelLogger(loggerRelease, 0, ~0U, "OS Service Pack: %s\n", szTmp);
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync// RTLogRelLogger(loggerRelease, 0, ~0U, "Host RAM: %uMB RAM, available: %uMB\n",
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync// uHostRamMb, uHostRamAvailMb);
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync /* the package type is interesting for Linux distributions */
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync char *pszExecName = RTProcGetExecutableName(szExecName, sizeof(szExecName));
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync "Executable: %s\n"
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync "Process ID: %u\n"
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync "Package type: %s"
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync /* register this logger as the release logger */
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync /* This small test application might crash on some hosts. Do never
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync * generate a core dump as most likely some OpenGL library is
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync * responsible. */
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync /* Redirect stderr to /dev/null */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync /* backwards compatibility: check 3D */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync rc = RTGetOptInit(&State, argc-1, argv+1, &s_aOptionDefs[0], RT_ELEMENTS(s_aOptionDefs), 0, 0);
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync bool bTest2D = false;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync bool bTest3D = false;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync bool bLog = false;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync const char * pLog;
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (!strcmp(Val.psz, "3D") || !strcmp(Val.psz, "3d"))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync if (!strcmp(Val.psz, "2D") || !strcmp(Val.psz, "2d"))
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync RTPrintf("VirtualBox Helper for testing 2D/3D OpenGL capabilities %u.%u.%u\n"
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "(C) 2009 Sun Microsystems, Inc.\n"
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "All rights reserved.\n"
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "Parameters:\n"
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync " --test 2D test for 2D (video) OpenGL capabilities\n"
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync " --test 3D test for 3D OpenGL capabilities\n"
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync " --log <log_file_name> log the GL test result to the given file\n"
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync "Logging can alternatively be enabled by specifying the VBOXGLTEST_LOG=<log_file_name> env variable\n"
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync RTBldCfgVersionMajor(), RTBldCfgVersionMinor(), RTBldCfgVersionBuild());
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /* check the VBOXGLTEST_LOG env var */
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync /*RTR3Term();*/
553a2f0d8ef91a6dad8de4eef206ff093af53a5dvboxsync HINSTANCE /*hPrevInstance*/, LPSTR lpCmdLine, int /*nShowCmd*/)