From b090ec48ce12e2b1f5e5cda5114fe08d7f1c116a Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Wed, 9 Nov 2011 13:10:34 +0000 Subject: [PATCH] Add query counter bits to hwdetect This was SVN commit r10493. --- source/ps/GameSetup/HWDetect.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/source/ps/GameSetup/HWDetect.cpp b/source/ps/GameSetup/HWDetect.cpp index 9abe28f8f3..e08f930b5a 100644 --- a/source/ps/GameSetup/HWDetect.cpp +++ b/source/ps/GameSetup/HWDetect.cpp @@ -263,7 +263,7 @@ void RunHardwareDetection() #endif // Send the same data to the reporting system - g_UserReporter.SubmitReport("hwdetect", 8, scriptInterface.StringifyJSON(settings.get(), false)); + g_UserReporter.SubmitReport("hwdetect", 9, scriptInterface.StringifyJSON(settings.get(), false)); // Run the detection script: @@ -348,6 +348,15 @@ static void ReportGLLimits(ScriptInterface& scriptInterface, CScriptValRooted se scriptInterface.SetProperty(settings.get(), "GL_" #id, std::string(c)); \ } while (false) +#define QUERY(target, pname) do { \ + GLint i = -1; \ + pglGetQueryivARB(GL_##target, GL_##pname, &i); \ + if (ogl_SquelchError(GL_INVALID_ENUM)) \ + scriptInterface.SetProperty(settings.get(), "GL_" #target ".GL_" #pname, errstr); \ + else \ + scriptInterface.SetProperty(settings.get(), "GL_" #target ".GL_" #pname, i); \ + } while (false) + #define VERTEXPROGRAM(id) do { \ GLint i = -1; \ pglGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_##id, &i); \ @@ -427,12 +436,19 @@ static void ReportGLLimits(ScriptInterface& scriptInterface, CScriptValRooted se // Core OpenGL 2.0 (treated as extensions): if (ogl_HaveExtension("GL_EXT_texture_lod_bias")) + { FLOAT(MAX_TEXTURE_LOD_BIAS_EXT); + } - // Skip GL_ARB_occlusion_query's QUERY_COUNTER_BITS_ARB since it'd need GetQueryiv + if (ogl_HaveExtension("GL_ARB_occlusion_query")) + { + QUERY(SAMPLES_PASSED, QUERY_COUNTER_BITS); + } if (ogl_HaveExtension("GL_ARB_shading_language_100")) + { STRING(SHADING_LANGUAGE_VERSION_ARB); + } if (ogl_HaveExtension("GL_ARB_vertex_shader")) { @@ -454,7 +470,9 @@ static void ReportGLLimits(ScriptInterface& scriptInterface, CScriptValRooted se } if (ogl_HaveExtension("GL_ARB_draw_buffers")) + { INTEGER(MAX_DRAW_BUFFERS_ARB); + } // Core OpenGL 3.0: @@ -490,6 +508,16 @@ static void ReportGLLimits(ScriptInterface& scriptInterface, CScriptValRooted se // Other interesting extensions: + if (ogl_HaveExtension("GL_EXT_timer_query") || ogl_HaveExtension("GL_ARB_timer_query")) + { + QUERY(TIME_ELAPSED_EXT, QUERY_COUNTER_BITS); + } + + if (ogl_HaveExtension("GL_ARB_timer_query")) + { + QUERY(TIMESTAMP, QUERY_COUNTER_BITS); + } + if (ogl_HaveExtension("GL_EXT_texture_filter_anisotropic")) { FLOAT(MAX_TEXTURE_MAX_ANISOTROPY_EXT);