diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2014-03-31 05:35:02 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2015-12-08 06:25:12 +0300 |
commit | 964107fbce77fac3badf2de027e6096cc8efe7ca (patch) | |
tree | 0a46a17d7c07acfb9e4fb7f99a88ad1973297568 | |
parent | fe2f3a131d96e4b0d1c85e1379b30c73f6378ffd (diff) |
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
13 files changed, 80 insertions, 193 deletions
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index 0d04ab61919..c5fc55a8e68 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -54,7 +54,6 @@ #include "KX_PyConstraintBinding.h" #include "KX_PythonMain.h" -#include "RAS_GLExtensionManager.h" #include "RAS_OpenGLRasterizer.h" #include "RAS_ListRasterizer.h" @@ -250,8 +249,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c PyObject *pyGlobalDict = PyDict_New(); /* python utility storage, spans blend file loading */ #endif - - bgl::InitExtensions(true); // Globals to be carried on over blender files GlobalSettings gs; diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 2940e6d07ee..f0a7bd47ca3 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -78,7 +78,6 @@ extern "C" #include "RAS_MeshObject.h" #include "RAS_OpenGLRasterizer.h" #include "RAS_ListRasterizer.h" -#include "RAS_GLExtensionManager.h" #include "KX_PythonInit.h" #include "KX_PyConstraintBinding.h" #include "BL_Material.h" // MAXTEX @@ -563,7 +562,6 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) if (!m_engineInitialized) { GPU_init(); - bgl::InitExtensions(true); // get and set the preferences SYS_SystemHandle syshandle = SYS_GetSystem(); diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp index 4b229f53d77..6613780a0f8 100644 --- a/source/gameengine/Ketsji/BL_Shader.cpp +++ b/source/gameengine/Ketsji/BL_Shader.cpp @@ -34,7 +34,6 @@ #include "KX_PyMath.h" #include "MEM_guardedalloc.h" -#include "RAS_GLExtensionManager.h" #include "RAS_MeshObject.h" #include "RAS_IRasterizer.h" diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp index 8f717c05c0f..17bd8c31231 100644 --- a/source/gameengine/Ketsji/BL_Texture.cpp +++ b/source/gameengine/Ketsji/BL_Texture.cpp @@ -38,7 +38,6 @@ #include "BKE_image.h" #include "BLI_blenlib.h" -#include "RAS_OpenGLRasterizer/RAS_GLExtensionManager.h" #include "RAS_ICanvas.h" #include "RAS_Rect.h" diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index d85d33d9834..a10bdf4ac98 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -39,7 +39,6 @@ #include "RAS_BucketManager.h" #include "RAS_MeshObject.h" #include "RAS_IRasterizer.h" -#include "RAS_OpenGLRasterizer/RAS_GLExtensionManager.h" #include "GPU_draw.h" diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 26c6fcaa928..d35f09dd820 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -647,71 +647,10 @@ static PyObject *pyPrintStats(PyObject *,PyObject *,PyObject *) static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *) { -#define pprint(x) std::cout << x << std::endl; - bool count=0; - bool support=0; - pprint("Supported Extensions..."); - pprint(" GL_ARB_shader_objects supported? "<< (GLEW_ARB_shader_objects?"yes.":"no.")); - count = 1; - - support= GLEW_ARB_vertex_shader; - pprint(" GL_ARB_vertex_shader supported? "<< (support?"yes.":"no.")); - count = 1; - 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.")); - count = 1; - 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.")); - count = 1; - 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; - count = 1; - 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.")); - count = 1; - - if (!count) - pprint("No extenstions are used in this build"); + if (gp_Rasterizer) + gp_Rasterizer->PrintHardwareInfo(); + else + printf("Warning: no rasterizer detected for PrintGLInfo!\n"); Py_RETURN_NONE; } 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 <iostream> - -#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") diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp index 30a8107b558..a62ffee3137 100644 --- a/source/gameengine/VideoTexture/blendVideoTex.cpp +++ b/source/gameengine/VideoTexture/blendVideoTex.cpp @@ -32,8 +32,6 @@ #include "KX_PythonInit.h" -#include <RAS_GLExtensionManager.h> - #include <RAS_IPolygonMaterial.h> //Old API |