Browse Source

Fixing the GL

Panagiotis Christopoulos Charitos 13 years ago
parent
commit
89eca35d97

+ 11 - 1
CMakeLists.txt

@@ -98,7 +98,8 @@ FIND_PACKAGE(Doxygen)
 IF(DOXYGEN_FOUND)
 IF(DOXYGEN_FOUND)
 	CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/docs/doxyfile ${CMAKE_CURRENT_BINARY_DIR}/doxyfile @ONLY)
 	CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/docs/doxyfile ${CMAKE_CURRENT_BINARY_DIR}/doxyfile @ONLY)
 	
 	
-	ADD_CUSTOM_TARGET(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM)
+	ADD_CUSTOM_TARGET(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 
+		COMMENT "Generating API documentation with Doxygen" VERBATIM)
 ENDIF()
 ENDIF()
 
 
 #
 #
@@ -120,6 +121,12 @@ SET(ANKI_VERSION_MAJOR 0)
 SET(ANKI_VERSION_MINOR 1)
 SET(ANKI_VERSION_MINOR 1)
 MESSAGE("++ AnKi version: ${ANKI_VERSION_MAJOR}.${ANKI_VERSION_MINOR}")
 MESSAGE("++ AnKi version: ${ANKI_VERSION_MAJOR}.${ANKI_VERSION_MINOR}")
 
 
+IF(CMAKE_BUILD_TYPE STREQUAL Debug)
+	MESSAGE("++ AnKi debug: true")
+ELSE()
+	MESSAGE("++ AnKi debug: false")
+ENDIF()
+
 CONFIGURE_FILE("include/anki/Config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/anki/Config.h")
 CONFIGURE_FILE("include/anki/Config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/anki/Config.h")
 INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/anki/Config.h" DESTINATION "${INCLUDE_INSTALL_DIR}/anki")
 INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/anki/Config.h" DESTINATION "${INCLUDE_INSTALL_DIR}/anki")
 
 
@@ -147,6 +154,9 @@ ENDIF()
 SET(ANKI_EXTRA_INCLUDE_DIRS CACHE STRING "Some extra include paths (Needed for FBDEV)")
 SET(ANKI_EXTRA_INCLUDE_DIRS CACHE STRING "Some extra include paths (Needed for FBDEV)")
 SET(ANKI_EXTRA_LIB_DIRS CACHE STRING "Some extra lib paths (Needed for FBDEV)")
 SET(ANKI_EXTRA_LIB_DIRS CACHE STRING "Some extra lib paths (Needed for FBDEV)")
 
 
+INCLUDE_DIRECTORIES(${ANKI_EXTRA_INCLUDE_DIRS})
+LINK_DIRECTORIES(${ANKI_EXTRA_LIB_DIRS})
+
 INCLUDE_DIRECTORIES("extern/tinyxml2/include" "extern/lua" "extern/png" "extern/bullet" "include"
 INCLUDE_DIRECTORIES("extern/tinyxml2/include" "extern/lua" "extern/png" "extern/bullet" "include"
 	"${CMAKE_CURRENT_BINARY_DIR}")
 	"${CMAKE_CURRENT_BINARY_DIR}")
 
 

+ 2 - 0
build/genmakefilevithar

@@ -0,0 +1,2 @@
+#!/bin/sh
+cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -DANKI_ARCH=32 -DANKI_EXTRA_INCLUDE_DIRS="/work/halti/khronos/arm/winsys_fbdev;/work/halti;/work/halti/kernel/include" -DANKI_EXTRA_LIB_DIRS=/work/halti/progs -DANKI_WINDOW_BACKEND=EGLFBDEV ..

+ 6 - 0
include/anki/Config.h.cmake

@@ -23,4 +23,10 @@
 #	define ANKI_GL ANKI_GL_ES
 #	define ANKI_GL ANKI_GL_ES
 #endif
 #endif
 
 
+#if !NDEBUG
+#	define ANKI_DEBUG 1
+#else
+#	define ANKI_DEBUG 0
+#endif
+
 #endif
 #endif

+ 2 - 1
include/anki/core/NativeWindowEglFbdev.h

@@ -2,6 +2,7 @@
 #define ANKI_CORE_NATIVE_WINDOW_EGL_FBDEV_H
 #define ANKI_CORE_NATIVE_WINDOW_EGL_FBDEV_H
 
 
 #include "anki/core/NativeWindow.h"
 #include "anki/core/NativeWindow.h"
+#define EGL_FBDEV 1
 #include <EGL/egl.h>
 #include <EGL/egl.h>
 #include <GLES3/gl3.h>
 #include <GLES3/gl3.h>
 
 
@@ -13,7 +14,7 @@ struct NativeWindowImpl
 	EGLDisplay display = EGL_NO_DISPLAY;
 	EGLDisplay display = EGL_NO_DISPLAY;
 	EGLSurface surface = EGL_NO_SURFACE;
 	EGLSurface surface = EGL_NO_SURFACE;
 	EGLContext context = EGL_NO_CONTEXT;
 	EGLContext context = EGL_NO_CONTEXT;
-	EGLNativeWindowType fbwin = nullptr;
+	EGLNativeWindowType fbwin = 0;
 
 
 	~NativeWindowImpl()
 	~NativeWindowImpl()
 	{
 	{

+ 0 - 11
include/anki/renderer/MainRenderer.h

@@ -45,11 +45,6 @@ public:
 	{
 	{
 		return dbg;
 		return dbg;
 	}
 	}
-
-	double getDbgTime() const
-	{
-		return dbgTime;
-	}
 	/// @}
 	/// @}
 
 
 	/// The same as Renderer::init but with additional initialization.
 	/// The same as Renderer::init but with additional initialization.
@@ -72,12 +67,6 @@ private:
 	Dbg dbg; ///< Debugging rendering stage. Only the main renderer has it
 	Dbg dbg; ///< Debugging rendering stage. Only the main renderer has it
 	/// @}
 	/// @}
 
 
-	/// @name Profiling stuff
-	/// @{
-	double dbgTime;
-	std::unique_ptr<Query> dbgTq;
-	/// @}
-
 	ShaderProgramResourcePointer sProg; ///< Final pass' shader program
 	ShaderProgramResourcePointer sProg; ///< Final pass' shader program
 	int screenshotJpegQuality = 90; ///< The quality of the JPEG screenshots.
 	int screenshotJpegQuality = 90; ///< The quality of the JPEG screenshots.
 							        ///< From 0 to 100
 							        ///< From 0 to 100

+ 0 - 40
include/anki/renderer/Renderer.h

@@ -205,39 +205,6 @@ public:
 	{
 	{
 		return planesUpdateTimestamp;
 		return planesUpdateTimestamp;
 	}
 	}
-
-	F64 getMsTime() const
-	{
-		return msTime;
-	}
-
-	F64 getIsTime() const
-	{
-		return isTime;
-	}
-
-	F64 getPpsTime() const
-	{
-		return ppsTime;
-	}
-
-	F64 getBsTime() const
-	{
-		return bsTime;
-	}
-
-	Bool getStagesProfilingEnabled() const
-	{
-		return enableStagesProfilingFlag;
-	}
-	Bool& getStagesProfilingEnabled()
-	{
-		return enableStagesProfilingFlag;
-	}
-	void setStagesProfilingEnabled(const Bool x)
-	{
-		enableStagesProfilingFlag = x;
-	}
 	/// @}
 	/// @}
 
 
 	/// Init the renderer given an initialization class
 	/// Init the renderer given an initialization class
@@ -301,13 +268,6 @@ protected:
 	Bs bs; ///< Blending stage
 	Bs bs; ///< Blending stage
 	/// @}
 	/// @}
 
 
-	/// @name Profiling stuff
-	/// @{
-	F64 msTime, isTime, ppsTime, bsTime;
-	std::unique_ptr<Query> msTq, isTq, ppsTq, bsTq, pps2Tq;
-	Bool enableStagesProfilingFlag;
-	/// @}
-
 	/// Width of the rendering. Don't confuse with the window width
 	/// Width of the rendering. Don't confuse with the window width
 	U width;
 	U width;
 	/// Height of the rendering. Don't confuse with the window width
 	/// Height of the rendering. Don't confuse with the window width

+ 13 - 13
src/core/NativeWindowEglFbdev.cpp

@@ -51,7 +51,7 @@ void NativeWindowImpl::create(NativeWindowInitializer& init)
 
 
 	Vector<EGLConfig> configs(maxConfigs);
 	Vector<EGLConfig> configs(maxConfigs);
 
 
-	Array<int, 256> attribs;
+	Array<EGLint, 256> attribs;
 	U attr = 0;
 	U attr = 0;
 	attribs[attr++] = EGL_RENDERABLE_TYPE;
 	attribs[attr++] = EGL_RENDERABLE_TYPE;
 	attribs[attr++] = EGL_OPENGL_ES2_BIT;
 	attribs[attr++] = EGL_OPENGL_ES2_BIT;
@@ -78,8 +78,8 @@ void NativeWindowImpl::create(NativeWindowInitializer& init)
 
 
 	attribs[attr++] = EGL_NONE;
 	attribs[attr++] = EGL_NONE;
 
 
-	int configsCount;
-	if(eglChooseConfig(display, attribs, &configs[0], maxConfigs, 
+	EGLint configsCount;
+	if(eglChooseConfig(display, &attribs[0], &configs[0], maxConfigs, 
 		&configsCount) == EGL_FALSE)
 		&configsCount) == EGL_FALSE)
 	{
 	{
 		throw ANKI_EXCEPTION("Failed to query required EGL configs");
 		throw ANKI_EXCEPTION("Failed to query required EGL configs");
@@ -91,7 +91,7 @@ void NativeWindowImpl::create(NativeWindowInitializer& init)
 	}
 	}
 
 
 	EGLConfig config_ = nullptr;
 	EGLConfig config_ = nullptr;
-	for(U i = 0; i < configsCount; i++)
+	for(EGLint i = 0; i < configsCount; i++)
 	{
 	{
 		EGLint value;
 		EGLint value;
 		EGLConfig config = configs[i];
 		EGLConfig config = configs[i];
@@ -99,43 +99,43 @@ void NativeWindowImpl::create(NativeWindowInitializer& init)
 		// Use this to explicitly check that the EGL config has the 
 		// Use this to explicitly check that the EGL config has the 
 		// expected color depths
 		// expected color depths
 		eglGetConfigAttrib(display, config, EGL_RED_SIZE, &value);
 		eglGetConfigAttrib(display, config, EGL_RED_SIZE, &value);
-		if(value != init.rgbaBits[0]) 
+		if(value != (EGLint)init.rgbaBits[0]) 
 		{
 		{
 			continue;
 			continue;
 		}
 		}
 
 
 		eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &value);
 		eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &value);
-		if(value != init.rgbaBits[1]) 
+		if(value != (EGLint)init.rgbaBits[1]) 
 		{
 		{
 			continue;
 			continue;
 		}
 		}
 
 
 		eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &value);
 		eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &value);
-	    if(value != init.rgbaBits[2])
+	    if(value != (EGLint)init.rgbaBits[2])
 		{
 		{
 			continue;
 			continue;
 		}
 		}
 
 
 		eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &value);
 		eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &value);
-		if(value != init.rgbaBits[3])
+		if(value != (EGLint)init.rgbaBits[3])
 		{
 		{
 			continue;
 			continue;
 		}
 		}
 
 
 		eglGetConfigAttrib(display, config, EGL_SAMPLES, &value);
 		eglGetConfigAttrib(display, config, EGL_SAMPLES, &value);
-		if(value != init.samplesCount)
+		if(value != (EGLint)init.samplesCount)
 		{
 		{
 			continue;
 			continue;
 		}
 		}
 
 
 		eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &value);
 		eglGetConfigAttrib(display, config, EGL_DEPTH_SIZE, &value);
-		if(value != init.depthBits)
+		if(value != (EGLint)init.depthBits)
 		{
 		{
 			continue;
 			continue;
 		}
 		}
 
 
 		eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE, &value);
 		eglGetConfigAttrib(display, config, EGL_STENCIL_SIZE, &value);
-		if(value != init.stencilBits)
+		if(value != (EGLint)init.stencilBits)
 		{
 		{
 			continue;
 			continue;
 		}
 		}
@@ -210,9 +210,9 @@ void NativeWindow::destroy()
 void NativeWindow::swapBuffers()
 void NativeWindow::swapBuffers()
 {
 {
 	ANKI_ASSERT(isCreated());
 	ANKI_ASSERT(isCreated());
-	if(eglSwapBuffers(impl.display, impl.surface) == EGL_FALSE)
+	if(eglSwapBuffers(impl->display, impl->surface) == EGL_FALSE)
 	{
 	{
-		throw FUZZY_EXCEPTION("eglSwapBuffers() failed");
+		throw ANKI_EXCEPTION("eglSwapBuffers() failed");
 	}
 	}
 }
 }
 
 

+ 13 - 0
src/gl/Query.cpp

@@ -35,8 +35,13 @@ void Query::end()
 //==============================================================================
 //==============================================================================
 GLuint64 Query::getResult()
 GLuint64 Query::getResult()
 {
 {
+#if ANKI_GL == ANKI_GL_DESKTOP
 	GLuint64 result;
 	GLuint64 result;
 	glGetQueryObjectui64v(glId, GL_QUERY_RESULT, &result);
 	glGetQueryObjectui64v(glId, GL_QUERY_RESULT, &result);
+#else
+	GLuint result;
+	glGetQueryObjectuiv(glId, GL_QUERY_RESULT, &result);
+#endif
 	return result;
 	return result;
 }
 }
 
 
@@ -46,10 +51,18 @@ GLuint64 Query::getResultNoWait(Bool& finished)
 	GLuint resi;
 	GLuint resi;
 	glGetQueryObjectuiv(glId, GL_QUERY_RESULT_AVAILABLE, &resi);
 	glGetQueryObjectuiv(glId, GL_QUERY_RESULT_AVAILABLE, &resi);
 
 
+#if ANKI_GL == ANKI_GL_DESKTOP
 	GLuint64 result;
 	GLuint64 result;
+#else
+	GLuint result;
+#endif
 	if(resi)
 	if(resi)
 	{
 	{
+#if ANKI_GL == ANKI_GL_DESKTOP
 		glGetQueryObjectui64v(glId, GL_QUERY_RESULT, &result);
 		glGetQueryObjectui64v(glId, GL_QUERY_RESULT, &result);
+#else
+		glGetQueryObjectuiv(glId, GL_QUERY_RESULT, &result);
+#endif
 		finished = true;
 		finished = true;
 	}
 	}
 	else
 	else

+ 12 - 0
src/gl/ShaderProgram.cpp

@@ -310,20 +310,32 @@ void ShaderProgram::create(const char* vertSource, const char* tcSource,
 
 
 	if(tcSource != nullptr)
 	if(tcSource != nullptr)
 	{
 	{
+#if ANKI_GL == ANKI_GL_DESKTOP
 		tcShaderGlId = createAndCompileShader(tcSource, preprocSource.c_str(), 
 		tcShaderGlId = createAndCompileShader(tcSource, preprocSource.c_str(), 
 			GL_TESS_CONTROL_SHADER);
 			GL_TESS_CONTROL_SHADER);
+#else
+		ANKI_ASSERT(0 && "Not allowed");
+#endif
 	}
 	}
 
 
 	if(teSource != nullptr)
 	if(teSource != nullptr)
 	{
 	{
+#if ANKI_GL == ANKI_GL_DESKTOP
 		teShaderGlId = createAndCompileShader(teSource, preprocSource.c_str(), 
 		teShaderGlId = createAndCompileShader(teSource, preprocSource.c_str(), 
 			GL_TESS_EVALUATION_SHADER);
 			GL_TESS_EVALUATION_SHADER);
+#else
+		ANKI_ASSERT(0 && "Not allowed");
+#endif
 	}
 	}
 
 
 	if(geomSource != nullptr)
 	if(geomSource != nullptr)
 	{
 	{
+#if ANKI_GL == ANKI_GL_DESKTOP
 		geomShaderGlId = createAndCompileShader(geomSource, 
 		geomShaderGlId = createAndCompileShader(geomSource, 
 			preprocSource.c_str(), GL_GEOMETRY_SHADER);
 			preprocSource.c_str(), GL_GEOMETRY_SHADER);
+#else
+		ANKI_ASSERT(0 && "Not allowed");
+#endif
 	}
 	}
 
 
 	ANKI_ASSERT(fragSource != nullptr);
 	ANKI_ASSERT(fragSource != nullptr);

+ 2 - 0
src/gl/Texture.cpp

@@ -227,11 +227,13 @@ void Texture::create(const Initializer& init)
 		setFilteringNoBind(init.filteringType);
 		setFilteringNoBind(init.filteringType);
 	}
 	}
 
 
+#if ANKI_GL == ANKI_GL_DESKTOP
 	if(init.anisotropyLevel > 1)
 	if(init.anisotropyLevel > 1)
 	{
 	{
 		glTexParameteri(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, 
 		glTexParameteri(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, 
 			GLint(init.anisotropyLevel));
 			GLint(init.anisotropyLevel));
 	}
 	}
+#endif
 
 
 	ANKI_CHECK_GL_ERROR();
 	ANKI_CHECK_GL_ERROR();
 }
 }

+ 20 - 27
src/renderer/MainRenderer.cpp

@@ -22,8 +22,6 @@ void MainRenderer::init(const Renderer::Initializer& initializer_)
 
 
 	sProg.load("shaders/Final.glsl");
 	sProg.load("shaders/Final.glsl");
 
 
-	dbgTq.reset(new Query(GL_TIME_ELAPSED));
-
 	windowWidth = initializer_.width;
 	windowWidth = initializer_.width;
 	windowHeight = initializer_.height;
 	windowHeight = initializer_.height;
 
 
@@ -59,7 +57,7 @@ void MainRenderer::initGl()
 
 
 	// get max texture units
 	// get max texture units
 	glClearColor(1.0, 0.0, 1.0, 1.0);
 	glClearColor(1.0, 0.0, 1.0, 1.0);
-	glClearDepth(1.0);
+	glClearDepthf(1.0);
 	glClearStencil(0);
 	glClearStencil(0);
 	glDepthFunc(GL_LEQUAL);
 	glDepthFunc(GL_LEQUAL);
 	// CullFace is always on
 	// CullFace is always on
@@ -67,11 +65,9 @@ void MainRenderer::initGl()
 	GlStateSingleton::get().enable(GL_CULL_FACE);
 	GlStateSingleton::get().enable(GL_CULL_FACE);
 
 
 	// defaults
 	// defaults
-	//glDisable(GL_LIGHTING);
-	//glDisable(GL_TEXTURE_2D);
 	GlStateSingleton::get().disable(GL_BLEND);
 	GlStateSingleton::get().disable(GL_BLEND);
 	GlStateSingleton::get().disable(GL_STENCIL_TEST);
 	GlStateSingleton::get().disable(GL_STENCIL_TEST);
-	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+	//glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 	glDepthMask(GL_TRUE);
 	glDepthMask(GL_TRUE);
 	glDepthFunc(GL_LESS);
 	glDepthFunc(GL_LESS);
 
 
@@ -89,17 +85,7 @@ void MainRenderer::initGl()
 void MainRenderer::render(Scene& scene)
 void MainRenderer::render(Scene& scene)
 {
 {
 	Renderer::render(scene);
 	Renderer::render(scene);
-
-	if(getStagesProfilingEnabled())
-	{
-		dbgTq->begin();
-		dbg.run();
-		dbgTq->end();
-	}
-	else
-	{
-		dbg.run();
-	}
+	dbg.run();
 
 
 	// Render the PPS FAI to the framebuffer
 	// Render the PPS FAI to the framebuffer
 	//
 	//
@@ -127,9 +113,9 @@ void MainRenderer::takeScreenshotTga(const char* filename)
 	}
 	}
 
 
 	// write headers
 	// write headers
-	unsigned char tgaHeaderUncompressed[12] = {0, 0, 2, 0, 0, 0, 0, 0,
-		0, 0, 0, 0};
-	unsigned char header[6];
+	static const U8 tgaHeaderUncompressed[12] = {
+		0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+	Array<U8, 6> header;
 
 
 	header[1] = getWidth() / 256;
 	header[1] = getWidth() / 256;
 	header[0] = getWidth() % 256;
 	header[0] = getWidth() % 256;
@@ -138,19 +124,26 @@ void MainRenderer::takeScreenshotTga(const char* filename)
 	header[4] = 24;
 	header[4] = 24;
 	header[5] = 0;
 	header[5] = 0;
 
 
-	fs.write((char*)tgaHeaderUncompressed, 12);
-	fs.write((char*)header, 6);
+	fs.write((char*)tgaHeaderUncompressed, sizeof(tgaHeaderUncompressed));
+	fs.write((char*)&header[0], sizeof(header));
+
+	// get the buffer
+	U8* buffer = new U8[getWidth() * getHeight() * 3];
 
 
-	// write the buffer
-	char* buffer = (char*)calloc(getWidth()*getHeight()*3, sizeof(char));
+	for(U i = 0; i < getWidth() * getHeight(); i += 3)
+	{
+		U8 temp = buffer[i];
+		buffer[i] = buffer[i + 2];
+		buffer[i + 2] = temp;
+	}
 
 
-	glReadPixels(0, 0, getWidth(), getHeight(), GL_BGR, GL_UNSIGNED_BYTE,
+	glReadPixels(0, 0, getWidth(), getHeight(), GL_RGB, GL_UNSIGNED_BYTE,
 		buffer);
 		buffer);
-	fs.write(buffer, getWidth()*getHeight()*3);
+	fs.write((char*)buffer, getWidth() * getHeight() * 3);
 
 
 	// end
 	// end
 	fs.close();
 	fs.close();
-	free(buffer);
+	delete[] buffer;
 }
 }
 
 
 //==============================================================================
 //==============================================================================

+ 6 - 45
src/renderer/Renderer.cpp

@@ -9,9 +9,7 @@ namespace anki {
 Renderer::Renderer()
 Renderer::Renderer()
 	: ms(this), is(this), pps(this), bs(this), width(640), height(480),
 	: ms(this), is(this), pps(this), bs(this), width(640), height(480),
 		sceneDrawer(this)
 		sceneDrawer(this)
-{
-	enableStagesProfilingFlag = false;
-}
+{}
 
 
 //==============================================================================
 //==============================================================================
 Renderer::~Renderer()
 Renderer::~Renderer()
@@ -52,12 +50,6 @@ void Renderer::init(const RendererInitializer& initializer)
 	quadVao.attachArrayBufferVbo(quadPositionsVbo, 0, 2, GL_FLOAT, false, 0,
 	quadVao.attachArrayBufferVbo(quadPositionsVbo, 0, 2, GL_FLOAT, false, 0,
 		NULL);
 		NULL);
 	quadVao.attachElementArrayBufferVbo(quadVertIndecesVbo);
 	quadVao.attachElementArrayBufferVbo(quadVertIndecesVbo);
-
-	// Other
-	msTq.reset(new Query(GL_TIME_ELAPSED));
-	isTq.reset(new Query(GL_TIME_ELAPSED));
-	ppsTq.reset(new Query(GL_TIME_ELAPSED));
-	bsTq.reset(new Query(GL_TIME_ELAPSED));
 }
 }
 
 
 //==============================================================================
 //==============================================================================
@@ -87,42 +79,11 @@ void Renderer::render(Scene& scene_)
 
 
 	viewProjectionMat = cam.getViewProjectionMatrix();
 	viewProjectionMat = cam.getViewProjectionMatrix();
 
 
-	if(enableStagesProfilingFlag)
-	{
-		msTq->begin();
-		ms.run();
-		msTq->end();
-
-		isTq->begin();
-		is.run();
-		isTq->end();
-
-		ppsTq->begin();
-		pps.runPrePass();
-		ppsTq->end();
-
-		bsTq->begin();
-		bs.run();
-		bsTq->end();
-
-		pps2Tq->begin();
-		pps.runPostPass();
-		pps2Tq->end();
-
-		// Now wait
-		msTime = msTq->getResult();
-		isTime = isTq->getResult();
-		bsTime = bsTq->getResult();
-		ppsTime = ppsTq->getResult() + ppsTq->getResult();
-	}
-	else
-	{
-		ms.run();
-		is.run();
-		/*pps.runPrePass();
-		bs.run();
-		pps.runPostPass();*/
-	}
+	ms.run();
+	is.run();
+	/*pps.runPrePass();
+	bs.run();
+	pps.runPostPass();*/
 
 
 	++framesNum;
 	++framesNum;
 }
 }

+ 20 - 0
src/resource/TextureResource.cpp

@@ -2,6 +2,12 @@
 #include "anki/resource/Image.h"
 #include "anki/resource/Image.h"
 #include "anki/util/Exception.h"
 #include "anki/util/Exception.h"
 
 
+#if ANKI_GL == ANKI_GL_DESKTOP
+#	define DRIVER_CAN_COMPRESS 1
+#else
+#	define DRIVER_CAN_COMPRESS 0
+#endif
+
 namespace anki {
 namespace anki {
 
 
 //==============================================================================
 //==============================================================================
@@ -31,22 +37,34 @@ void TextureResource::load(const Image& img)
 	switch(img.getColorType())
 	switch(img.getColorType())
 	{
 	{
 	case Image::CT_R:
 	case Image::CT_R:
+#if DRIVER_CAN_COMPRESS
 		init.internalFormat = (compressionEnabled) 
 		init.internalFormat = (compressionEnabled) 
 			? GL_COMPRESSED_RED : GL_RED;
 			? GL_COMPRESSED_RED : GL_RED;
+#else
+		init.internalFormat = GL_RED;
+#endif
 		init.format = GL_RED;
 		init.format = GL_RED;
 		init.type = GL_UNSIGNED_BYTE;
 		init.type = GL_UNSIGNED_BYTE;
 		break;
 		break;
 
 
 	case Image::CT_RGB:
 	case Image::CT_RGB:
+#if DRIVER_CAN_COMPRESS
 		init.internalFormat = (compressionEnabled) 
 		init.internalFormat = (compressionEnabled) 
 			? GL_COMPRESSED_RGB : GL_RGB;
 			? GL_COMPRESSED_RGB : GL_RGB;
+#else
+		init.internalFormat = GL_RGB;
+#endif
 		init.format = GL_RGB;
 		init.format = GL_RGB;
 		init.type = GL_UNSIGNED_BYTE;
 		init.type = GL_UNSIGNED_BYTE;
 		break;
 		break;
 
 
 	case Image::CT_RGBA:
 	case Image::CT_RGBA:
+#if DRIVER_CAN_COMPRESS
 		init.internalFormat = (compressionEnabled) 
 		init.internalFormat = (compressionEnabled) 
 			? GL_COMPRESSED_RGBA : GL_RGBA;
 			? GL_COMPRESSED_RGBA : GL_RGBA;
+#else
+		init.internalFormat = GL_RGBA;
+#endif
 		init.format = GL_RGBA;
 		init.format = GL_RGBA;
 		init.type = GL_UNSIGNED_BYTE;
 		init.type = GL_UNSIGNED_BYTE;
 		break;
 		break;
@@ -60,6 +78,7 @@ void TextureResource::load(const Image& img)
 	case Image::DC_NONE:
 	case Image::DC_NONE:
 		break;
 		break;
 
 
+#if !DRIVER_CAN_COMPRESS
 	case Image::DC_DXT1:
 	case Image::DC_DXT1:
 		init.internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
 		init.internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
 		break;
 		break;
@@ -71,6 +90,7 @@ void TextureResource::load(const Image& img)
 	case Image::DC_DXT5:
 	case Image::DC_DXT5:
 		init.internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
 		init.internalFormat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
 		break;
 		break;
+#endif
 	}
 	}
 
 
 	init.data = img.getData();
 	init.data = img.getData();