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
This commit is contained in:
Mitchell Stokes 2014-03-30 18:35:02 -07:00
parent fe2f3a131d
commit 964107fbce
13 changed files with 80 additions and 193 deletions

View File

@ -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;

View File

@ -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();

View File

@ -34,7 +34,6 @@
#include "KX_PyMath.h"
#include "MEM_guardedalloc.h"
#include "RAS_GLExtensionManager.h"
#include "RAS_MeshObject.h"
#include "RAS_IRasterizer.h"

View File

@ -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"

View File

@ -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"

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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__ */

View File

@ -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."));
}

View File

@ -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")

View File

@ -32,8 +32,6 @@
#include "KX_PythonInit.h"
#include <RAS_GLExtensionManager.h>
#include <RAS_IPolygonMaterial.h>
//Old API