From 964107fbce77fac3badf2de027e6096cc8efe7ca Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sun, 30 Mar 2014 18:35:02 -0700 Subject: BGE code cleanup: Removing RAS_GLExtensionManager. This class did nothing but print out extensions if they were found. Instead, the code from bge.logic.PrintGLInfo() is now printed as the Rasterizer is initialized. This gives better information, and it removes some GL code from KX_PythonInit.cpp (the PrintGLInfo method now calls the Rasterizer to print the information). Differential Revision: https://developer.blender.org/D438 --- source/gameengine/Rasterizer/RAS_IRasterizer.h | 5 ++ .../Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt | 2 - .../RAS_GLExtensionManager.cpp | 73 ---------------------- .../RAS_OpenGLRasterizer/RAS_GLExtensionManager.h | 43 ------------- .../RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp | 67 ++++++++++++++++++++ .../RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h | 4 ++ 6 files changed, 76 insertions(+), 118 deletions(-) delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp delete mode 100644 source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h (limited to 'source/gameengine/Rasterizer') diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index 618bcbf578c..e960131c1fb 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -479,6 +479,11 @@ public: virtual void SetAuxilaryClientInfo(void *inf) = 0; + /** + * Prints information about what the hardware supports. + */ + virtual void PrintHardwareInfo() = 0; + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_IRasterizer") #endif diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt index 168e3fa45a1..9f95e2c82af 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt @@ -49,14 +49,12 @@ set(INC_SYS ) set(SRC - RAS_GLExtensionManager.cpp RAS_ListRasterizer.cpp RAS_OpenGLLight.cpp RAS_OpenGLRasterizer.cpp RAS_StorageVA.cpp RAS_StorageVBO.cpp - RAS_GLExtensionManager.h RAS_IStorage.h RAS_ListRasterizer.h RAS_OpenGLLight.h diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp deleted file mode 100644 index bc22d68e218..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp - * \ingroup bgerastogl - */ - - -#include - -#include "glew-mx.h" - -#include "RAS_GLExtensionManager.h" - -namespace bgl -{ - void InitExtensions(bool debug) - { - static bool firsttime = true; - - if (firsttime) { - firsttime = false; - - if (debug) { - if (GLEW_ATI_pn_triangles) - std::cout << "Enabled GL_ATI_pn_triangles" << std::endl; - if (GLEW_ARB_texture_env_combine) - std::cout << "Detected GL_ARB_texture_env_combine" << std::endl; - if (GLEW_ARB_texture_cube_map) - std::cout << "Detected GL_ARB_texture_cube_map" << std::endl; - if (GLEW_ARB_multitexture) - std::cout << "Detected GL_ARB_multitexture" << std::endl; - if (GLEW_ARB_shader_objects) - std::cout << "Detected GL_ARB_shader_objects" << std::endl; - if (GLEW_ARB_vertex_shader) - std::cout << "Detected GL_ARB_vertex_shader" << std::endl; - if (GLEW_ARB_fragment_shader) - std::cout << "Detected GL_ARB_fragment_shader" << std::endl; - if (GLEW_ARB_vertex_program) - std::cout << "Detected GL_ARB_vertex_program" << std::endl; - if (GLEW_ARB_depth_texture) - std::cout << "Detected GL_ARB_depth_texture" << std::endl; - if (GLEW_EXT_separate_specular_color) - std::cout << "Detected GL_EXT_separate_specular_color" << std::endl; - } - } - } -} // namespace bgl - diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h deleted file mode 100644 index 9f2039b4c6f..00000000000 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file RAS_GLExtensionManager.h - * \ingroup bgerastogl - */ - -#ifndef __RAS_GLEXTENSIONMANAGER_H__ -#define __RAS_GLEXTENSIONMANAGER_H__ - -/** Note: this used to have a lot more code, but now extension handling - * is done by GLEW, so it does mostly debug stuff */ - -namespace bgl -{ - void InitExtensions(bool debug); -} /* namespace bgl */ - -#endif /* __RAS_GLEXTENSIONMANAGER_H__ */ diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index 8ba4ab715e2..4d8cfb56bd1 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -137,6 +137,8 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas, RAS_STORAGE_TYPE glGetIntegerv(GL_MAX_LIGHTS, (GLint *) &m_numgllights); if (m_numgllights < 8) m_numgllights = 8; + + PrintHardwareInfo(); } @@ -1616,3 +1618,68 @@ void RAS_OpenGLRasterizer::SetAuxilaryClientInfo(void* inf) m_auxilaryClientInfo = inf; } +void RAS_OpenGLRasterizer::PrintHardwareInfo() +{ + #define pprint(x) std::cout << x << std::endl; + + pprint("GL_VENDOR: " << glGetString(GL_VENDOR)); + pprint("GL_RENDERER: " << glGetString(GL_RENDERER)); + pprint("GL_VERSION: " << glGetString(GL_VERSION)); + bool support=0; + pprint("Supported Extensions..."); + pprint(" GL_ARB_shader_objects supported? "<< (GLEW_ARB_shader_objects?"yes.":"no.")); + + support= GLEW_ARB_vertex_shader; + pprint(" GL_ARB_vertex_shader supported? "<< (support?"yes.":"no.")); + if (support) { + pprint(" ----------Details----------"); + int max=0; + glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, (GLint*)&max); + pprint(" Max uniform components." << max); + + glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB, (GLint*)&max); + pprint(" Max varying floats." << max); + + glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, (GLint*)&max); + pprint(" Max vertex texture units." << max); + + glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, (GLint*)&max); + pprint(" Max combined texture units." << max); + pprint(""); + } + + support=GLEW_ARB_fragment_shader; + pprint(" GL_ARB_fragment_shader supported? "<< (support?"yes.":"no.")); + if (support) { + pprint(" ----------Details----------"); + int max=0; + glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, (GLint*)&max); + pprint(" Max uniform components." << max); + pprint(""); + } + + support = GLEW_ARB_texture_cube_map; + pprint(" GL_ARB_texture_cube_map supported? "<< (support?"yes.":"no.")); + if (support) { + pprint(" ----------Details----------"); + int size=0; + glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, (GLint*)&size); + pprint(" Max cubemap size." << size); + pprint(""); + } + + support = GLEW_ARB_multitexture; + pprint(" GL_ARB_multitexture supported? "<< (support?"yes.":"no.")); + if (support) { + pprint(" ----------Details----------"); + int units=0; + glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, (GLint*)&units); + pprint(" Max texture units available. " << units); + pprint(""); + } + + pprint(" GL_ARB_texture_env_combine supported? "<< (GLEW_ARB_texture_env_combine?"yes.":"no.")); + + pprint(" GL_ARB_texture_non_power_of_two supported " << (GPU_non_power_of_two_support()?"yes.":"no.")); +} + diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index 39708b382aa..1b012a61355 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -323,6 +323,10 @@ public: void SetAuxilaryClientInfo(void *inf); + /** + * Prints information about what the hardware supports. + */ + virtual void PrintHardwareInfo(); #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("GE:RAS_OpenGLRasterizer") -- cgit v1.2.3