瀏覽代碼

Prepearing for first demo release. Adding fullscreen native rez, cleaning up

Panagiotis Christopoulos Charitos 12 年之前
父節點
當前提交
5a7ed7e113

+ 0 - 163
.cproject

@@ -1,163 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
-	<storageModule moduleId="org.eclipse.cdt.core.settings">
-		<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1191103617">
-			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1191103617" moduleId="org.eclipse.cdt.core.settings" name="Debug">
-				<externalSettings/>
-				<extensions>
-					<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-					<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-					<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-					<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
-				</extensions>
-			</storageModule>
-			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
-				<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1191103617" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
-					<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1191103617." name="/" resourcePath="">
-						<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.265738319" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
-							<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1307654940" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
-							<builder buildPath="${workspace_loc:/anki/build}" id="cdt.managedbuild.target.gnu.builder.exe.debug.887785930" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="8" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
-							<tool id="cdt.managedbuild.tool.gnu.archiver.base.1037353125" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
-							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.733325444" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
-								<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.678362421" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
-								<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.527125870" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
-								<option id="gnu.cpp.compiler.option.include.paths.2128411428" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
-									<listOptionValue builtIn="false" value="/usr/include"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/anki}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/extern}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/build/anki}&quot;"/>
-								</option>
-								<option id="gnu.cpp.compiler.option.preprocessor.def.703966797" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
-									<listOptionValue builtIn="false" value="__GXX_EXPERIMENTAL_CXX0X__"/>
-								</option>
-								<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1705857210" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
-							</tool>
-							<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.509716139" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
-								<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.857210792" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/>
-								<option id="gnu.c.compiler.exe.debug.option.debugging.level.236164295" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
-								<option id="gnu.c.compiler.option.include.paths.2141416219" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
-									<listOptionValue builtIn="false" value="/usr/include"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/anki}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/extern}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/build/anki}&quot;"/>
-								</option>
-								<option id="gnu.c.compiler.option.preprocessor.def.symbols.1930194539" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
-									<listOptionValue builtIn="false" value="__GXX_EXPERIMENTAL_CXX0X__"/>
-								</option>
-								<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1888715461" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
-							</tool>
-							<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1831689831" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
-							<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1936286391" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
-								<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1344251973" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
-									<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
-									<additionalInput kind="additionalinput" paths="$(LIBS)"/>
-								</inputType>
-							</tool>
-							<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1152709085" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
-								<option id="gnu.both.asm.option.include.paths.1360594794" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/include}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/extern}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/build/anki}&quot;"/>
-									<listOptionValue builtIn="false" value="/usr/include"/>
-								</option>
-								<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1588784404" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
-							</tool>
-						</toolChain>
-					</folderInfo>
-				</configuration>
-			</storageModule>
-			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
-			<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
-			<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
-		</cconfiguration>
-		<cconfiguration id="cdt.managedbuild.config.gnu.exe.release.571635259">
-			<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.571635259" moduleId="org.eclipse.cdt.core.settings" name="Release">
-				<externalSettings/>
-				<extensions>
-					<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-					<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-					<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-					<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-					<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-					<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
-				</extensions>
-			</storageModule>
-			<storageModule moduleId="cdtBuildSystem" version="4.0.0">
-				<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.571635259" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
-					<folderInfo id="cdt.managedbuild.config.gnu.exe.release.571635259." name="/" resourcePath="">
-						<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1798558317" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
-							<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.1852283584" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
-							<builder buildPath="${workspace_loc:/anki/Release}" id="cdt.managedbuild.target.gnu.builder.exe.release.154092247" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
-							<tool id="cdt.managedbuild.tool.gnu.archiver.base.1469196148" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
-							<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1634217479" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
-								<option id="gnu.cpp.compiler.exe.release.option.optimization.level.467488783" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
-								<option id="gnu.cpp.compiler.exe.release.option.debugging.level.1206763877" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
-								<option id="gnu.cpp.compiler.option.preprocessor.def.1535300050" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
-									<listOptionValue builtIn="false" value="__GXX_EXPERIMENTAL_CXX0X__"/>
-								</option>
-								<option id="gnu.cpp.compiler.option.include.paths.1144441363" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/extern}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/build/anki}&quot;"/>
-								</option>
-								<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1897753799" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
-							</tool>
-							<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1453949923" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
-								<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.204107120" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/>
-								<option id="gnu.c.compiler.exe.release.option.debugging.level.1402099681" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
-								<option id="gnu.c.compiler.option.preprocessor.def.symbols.1483582268" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
-									<listOptionValue builtIn="false" value="__GXX_EXPERIMENTAL_CXX0X__"/>
-								</option>
-								<option id="gnu.c.compiler.option.include.paths.1839935228" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/extern}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/build/anki}&quot;"/>
-								</option>
-								<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.813305505" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
-							</tool>
-							<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1557937760" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
-							<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1899812877" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
-								<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.443040260" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
-									<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
-									<additionalInput kind="additionalinput" paths="$(LIBS)"/>
-								</inputType>
-							</tool>
-							<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1828291711" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
-								<option id="gnu.both.asm.option.include.paths.22345717" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/extern}&quot;"/>
-									<listOptionValue builtIn="false" value="&quot;${workspace_loc:/anki/build/anki}&quot;"/>
-								</option>
-								<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1528209394" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
-							</tool>
-						</toolChain>
-					</folderInfo>
-				</configuration>
-			</storageModule>
-			<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
-			<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>
-			<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
-		</cconfiguration>
-	</storageModule>
-	<storageModule moduleId="cdtBuildSystem" version="4.0.0">
-		<project id="anki.cdt.managedbuild.target.gnu.exe.1185865252" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
-	</storageModule>
-	<storageModule moduleId="refreshScope" versionNumber="1">
-		<resource resourceType="PROJECT" workspacePath="/anki"/>
-	</storageModule>
-	<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
-	<storageModule moduleId="scannerConfiguration">
-		<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1191103617;cdt.managedbuild.config.gnu.exe.debug.1191103617.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.733325444;cdt.managedbuild.tool.gnu.cpp.compiler.input.1705857210">
-			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
-		</scannerConfigBuildInfo>
-		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.571635259;cdt.managedbuild.config.gnu.exe.release.571635259.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1634217479;cdt.managedbuild.tool.gnu.cpp.compiler.input.1897753799">
-			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
-		</scannerConfigBuildInfo>
-		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1191103617;cdt.managedbuild.config.gnu.exe.debug.1191103617.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.509716139;cdt.managedbuild.tool.gnu.c.compiler.input.1888715461">
-			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
-		</scannerConfigBuildInfo>
-		<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.571635259;cdt.managedbuild.config.gnu.exe.release.571635259.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1453949923;cdt.managedbuild.tool.gnu.c.compiler.input.813305505">
-			<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
-		</scannerConfigBuildInfo>
-	</storageModule>
-</cproject>

+ 0 - 89
.project

@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>anki</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.python.pydev.PyDevBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
-			<triggers>clean,full,incremental,</triggers>
-			<arguments>
-				<dictionary>
-					<key>?name?</key>
-					<value></value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.append_environment</key>
-					<value>true</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.autoBuildTarget</key>
-					<value>all</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.buildArguments</key>
-					<value>-j8</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.buildCommand</key>
-					<value>make</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.buildLocation</key>
-					<value>${workspace_loc:/anki/build}</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
-					<value>clean</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.contents</key>
-					<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
-					<value>false</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
-					<value>true</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.enableFullBuild</key>
-					<value>true</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.fullBuildTarget</key>
-					<value>all</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.stopOnError</key>
-					<value>true</value>
-				</dictionary>
-				<dictionary>
-					<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
-					<value>true</value>
-				</dictionary>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
-			<triggers>full,incremental,</triggers>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.cdt.core.cnature</nature>
-		<nature>org.eclipse.cdt.core.ccnature</nature>
-		<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
-		<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
-		<nature>org.python.pydev.pythonNature</nature>
-	</natures>
-</projectDescription>

+ 10 - 0
CMakeLists.txt

@@ -14,6 +14,13 @@ OPTION(ANKI_WITH_GPERFTOOLS_PROF "Link with gperftools profiler" OFF)
 
 
 OPTION(ANKI_STRIP "Srip the symbols from the executables" OFF)
 OPTION(ANKI_STRIP "Srip the symbols from the executables" OFF)
 
 
+OPTION(ANKI_ENABLE_COUNTERS "Enable performance counters. Small overhead" OFF)
+IF(ANKI_ENABLE_COUNTERS)
+	SET(_ANKI_ENABLE_COUNTERS 1)
+ELSE()
+	SET(_ANKI_ENABLE_COUNTERS 0)
+ENDIF()
+
 # Because we want different compiler flags for each platform
 # Because we want different compiler flags for each platform
 SET(ANKI_CPU "X86" CACHE STRING "The CPU arch (X86 or ARM)")
 SET(ANKI_CPU "X86" CACHE STRING "The CPU arch (X86 or ARM)")
 
 
@@ -106,6 +113,9 @@ ELSE()
 	MESSAGE("++ Building with AnKi provided libpng")
 	MESSAGE("++ Building with AnKi provided libpng")
 ENDIF()
 ENDIF()
 
 
+# Disable GLU in GLEW
+ADD_DEFINITIONS(-DGLEW_NO_GLU)
+
 # Window backend
 # Window backend
 MESSAGE("++ Window backend: ${ANKI_WINDOW_BACKEND}")
 MESSAGE("++ Window backend: ${ANKI_WINDOW_BACKEND}")
 
 

+ 0 - 0
build/genmakefiledbg → build/genmakefiledbg.sh


+ 0 - 0
build/genmakefilemalimodel → build/genmakefilemalimodel.sh


+ 2 - 0
build/genmakefilerelease.sh

@@ -0,0 +1,2 @@
+#!/bin/sh
+cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DANKI_STRIP=ON ..

+ 31 - 21
include/anki/Config.h.cmake

@@ -1,6 +1,9 @@
 #ifndef ANKI_CONFIG_H
 #ifndef ANKI_CONFIG_H
 #define ANKI_CONFIG_H
 #define ANKI_CONFIG_H
 
 
+/// @addtogroup config
+/// @{
+
 #define ANKI_VERSION_MINOR ${ANKI_VERSION_MINOR}
 #define ANKI_VERSION_MINOR ${ANKI_VERSION_MINOR}
 #define ANKI_VERSION_MAJOR ${ANKI_VERSION_MAJOR}
 #define ANKI_VERSION_MAJOR ${ANKI_VERSION_MAJOR}
 #define ANKI_REVISION ${ANKI_REVISION}
 #define ANKI_REVISION ${ANKI_REVISION}
@@ -62,17 +65,20 @@
 #	error "Unsupported compiler"
 #	error "Unsupported compiler"
 #endif
 #endif
 
 
+// SIMD
 #define ANKI_MATH_SIMD_NONE 1
 #define ANKI_MATH_SIMD_NONE 1
 #define ANKI_MATH_SIMD_SSE 2
 #define ANKI_MATH_SIMD_SSE 2
 #define ANKI_MATH_SIMD_NEON 3
 #define ANKI_MATH_SIMD_NEON 3
 #define ANKI_MATH_SIMD ANKI_MATH_SIMD_${ANKI_MATH_SIMD}
 #define ANKI_MATH_SIMD ANKI_MATH_SIMD_${ANKI_MATH_SIMD}
 
 
+// Window backend
 #define ANKI_WINDOW_BACKEND_GLXX11 1
 #define ANKI_WINDOW_BACKEND_GLXX11 1
 #define ANKI_WINDOW_BACKEND_EGLX11 2
 #define ANKI_WINDOW_BACKEND_EGLX11 2
 #define ANKI_WINDOW_BACKEND_EGLFBDEV 3
 #define ANKI_WINDOW_BACKEND_EGLFBDEV 3
 #define ANKI_WINDOW_BACKEND ANKI_WINDOW_BACKEND_${ANKI_WINDOW_BACKEND}
 #define ANKI_WINDOW_BACKEND ANKI_WINDOW_BACKEND_${ANKI_WINDOW_BACKEND}
 #define ANKI_WINDOW_BACKEND_STR "ANKI_WINDOW_BACKEND_${ANKI_WINDOW_BACKEND}"
 #define ANKI_WINDOW_BACKEND_STR "ANKI_WINDOW_BACKEND_${ANKI_WINDOW_BACKEND}"
 
 
+// OpenGL version
 #define ANKI_GL_DESKTOP 1
 #define ANKI_GL_DESKTOP 1
 #define ANKI_GL_ES 2
 #define ANKI_GL_ES 2
 #if ANKI_WINDOW_BACKEND == ANKI_WINDOW_BACKEND_GLXX11
 #if ANKI_WINDOW_BACKEND == ANKI_WINDOW_BACKEND_GLXX11
@@ -83,6 +89,29 @@
 #	define ANKI_GL_STR "ANKI_GL_ES"
 #	define ANKI_GL_STR "ANKI_GL_ES"
 #endif
 #endif
 
 
+// Enable performance counters
+#define ANKI_ENABLE_COUNTERS ${_ANKI_ENABLE_COUNTERS}
+
+// General config
+#define ANKI_MAX_MULTIDRAW_PRIMITIVES 64
+#define ANKI_MAX_INSTANCES 16
+
+// Renderer config
+#define ANKI_RENDERER_MAX_POINT_LIGHTS (512 - 16)
+#define ANKI_RENDERER_MAX_SPOT_LIGHTS 8
+#define ANKI_RENDERER_MAX_SPOT_TEX_LIGHTS 8
+
+#define ANKI_RENDERER_MAX_POINT_LIGHTS_PER_TILE 48
+#define ANKI_RENDERER_MAX_SPOT_LIGHTS_PER_TILE 4
+#define ANKI_RENDERER_MAX_SPOT_TEX_LIGHTS_PER_TILE 4
+
+#define ANKI_RENDERER_TILES_X_COUNT 16
+#define ANKI_RENDERER_TILES_Y_COUNT 16
+
+// Scene config
+#define ANKI_SCENE_OPTIMAL_SCENE_NODES_COUNT 1024
+
+// Some compiler struff
 #if defined(__GNUC__)
 #if defined(__GNUC__)
 #	define ANKI_LIKELY(x) __builtin_expect((x), 1)
 #	define ANKI_LIKELY(x) __builtin_expect((x), 1)
 #	define ANKI_UNLIKELY(x) __builtin_expect((x), 0)
 #	define ANKI_UNLIKELY(x) __builtin_expect((x), 0)
@@ -93,6 +122,8 @@
 #	define ANKI_RESTRICT
 #	define ANKI_RESTRICT
 #endif
 #endif
 
 
+/// @}
+
 // Workaround some GCC C++11 problems
 // Workaround some GCC C++11 problems
 #if ${ANKI_GCC_TO_STRING_WORKAROUND}
 #if ${ANKI_GCC_TO_STRING_WORKAROUND}
 #	include <sstream>
 #	include <sstream>
@@ -126,25 +157,4 @@ inline int stoi(const string& str)
 } // end namespace std
 } // end namespace std
 #endif
 #endif
 
 
-/// @addtogroup config
-/// @{
-
-#define ANKI_RENDERER_MAX_POINT_LIGHTS (512 - 16)
-#define ANKI_RENDERER_MAX_SPOT_LIGHTS 8
-#define ANKI_RENDERER_MAX_SPOT_TEX_LIGHTS 8
-
-#define ANKI_RENDERER_MAX_POINT_LIGHTS_PER_TILE 48
-#define ANKI_RENDERER_MAX_SPOT_LIGHTS_PER_TILE 4
-#define ANKI_RENDERER_MAX_SPOT_TEX_LIGHTS_PER_TILE 4
-
-#define ANKI_RENDERER_TILES_X_COUNT 16
-#define ANKI_RENDERER_TILES_Y_COUNT 16
-
-#define ANKI_MAX_MULTIDRAW_PRIMITIVES 64
-#define ANKI_MAX_INSTANCES 16
-
-#define ANKI_SCENE_OPTIMAL_SCENE_NODES_COUNT 1024
-
-/// @}
-
 #endif
 #endif

+ 35 - 8
include/anki/core/Counters.h

@@ -1,12 +1,15 @@
 #include "anki/util/StdTypes.h"
 #include "anki/util/StdTypes.h"
 #include "anki/util/Singleton.h"
 #include "anki/util/Singleton.h"
 #include "anki/util/Filesystem.h"
 #include "anki/util/Filesystem.h"
+#include "anki/util/HighRezTimer.h"
 
 
 namespace anki {
 namespace anki {
 
 
 /// Enumeration of counters
 /// Enumeration of counters
 enum Counter
 enum Counter
 {
 {
+	C_FPS,
+	C_MAIN_RENDERER_TIME,
 	C_RENDERER_MS_TIME,
 	C_RENDERER_MS_TIME,
 	C_RENDERER_IS_TIME,
 	C_RENDERER_IS_TIME,
 	C_RENDERER_PPS_TIME,
 	C_RENDERER_PPS_TIME,
@@ -35,22 +38,46 @@ public:
 	/// terminates
 	/// terminates
 	void flush();
 	void flush();
 
 
+	/// Start a timer of a specific counter
+	void startTimer(Counter counter);
+
+	/// Stop the timer and increase the counter
+	void stopTimerIncreaseCounter(Counter counter);
+
 private:
 private:
 	File perframeFile;
 	File perframeFile;
-	File globalFile;
-	Vector<U64> counters;
+	File perrunFile;
+	Vector<U64> perframeValues;
+	Vector<U64> perrunValues;
+	Vector<HighRezTimer::Scalar> counterTimes;
 };
 };
 
 
 /// The singleton of the counters manager
 /// The singleton of the counters manager
 typedef Singleton<CountersManager> CountersManagerSingleton;
 typedef Singleton<CountersManager> CountersManagerSingleton;
 
 
-#define ANKI_COUNTER_INC(counter_, val_) \
-	CountersManagerSingleton::get().increaseCounter(counter_, val_)
+// Macros that encapsulate the functionaly
+
+#if ANKI_ENABLE_COUNTERS
+#	define ANKI_COUNTER_INC(counter_, val_) \
+		CountersManagerSingleton::get().increaseCounter(counter_, val_)
+
+#	define ANKI_COUNTER_START_TIMER(counter_) \
+		CountersManagerSingleton::get().startTimer(counter_)
+
+#	define ANKI_COUNTER_STOP_TIMER_INC(counter_) \
+		CountersManagerSingleton::get().stopTimerIncreaseCounter(counter_)
 
 
-#define ANKI_COUNTERS_RESOLVE_FRAME() \
-	CountersManagerSingleton::get().resolveFrame()
+#	define ANKI_COUNTERS_RESOLVE_FRAME() \
+		CountersManagerSingleton::get().resolveFrame()
 
 
-#define ANKI_COUNTERS_FLUSH() \
-	CountersManagerSingleton::get().flush()
+#	define ANKI_COUNTERS_FLUSH() \
+		CountersManagerSingleton::get().flush()
+#else // !ANKI_ENABLE_COUNTERS
+#	define ANKI_COUNTER_INC(counter_, val_) ((void)0)
+#	define ANKI_COUNTER_START_TIMER(counter_) ((void)0)
+#	define ANKI_COUNTER_STOP_TIMER_INC(counter_) ((void)0)
+#	define ANKI_COUNTERS_RESOLVE_FRAME() ((void)0)
+#	define ANKI_COUNTERS_FLUSH() ((void)0)
+#endif // ANKI_ENABLE_COUNTERS
 
 
 } // end namespace anki
 } // end namespace anki

+ 0 - 1
include/anki/core/NativeWindowGlxX11.h

@@ -5,7 +5,6 @@
 #include <X11/Xlib.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/Xutil.h>
 #include <GL/glew.h>
 #include <GL/glew.h>
-#include <GL/gl.h>
 #include <GL/glx.h>
 #include <GL/glx.h>
 
 
 namespace anki {
 namespace anki {

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

@@ -283,8 +283,6 @@ public:
 	/// skipped
 	/// skipped
 	void clearAfterBindingFbo(const GLenum cap);
 	void clearAfterBindingFbo(const GLenum cap);
 
 
-	void printProfileInfo() const;
-
 protected:
 protected:
 	/// @name Rendering stages
 	/// @name Rendering stages
 	/// @{
 	/// @{
@@ -330,10 +328,6 @@ private:
 	Vbo quadVertIndecesVbo; ///< The VBO for quad array buffer elements
 	Vbo quadVertIndecesVbo; ///< The VBO for quad array buffer elements
 	Vao quadVao; ///< This VAO is used everywhere except material stage
 	Vao quadVao; ///< This VAO is used everywhere except material stage
 	/// @}
 	/// @}
-
-#if ANKI_CFG_RENDERER_PROFILE
-	HighRezTimer::Scalar tilerTime = 0, msTime = 0, isTime = 0, ppsTime = 0;
-#endif
 };
 };
 
 
 
 

+ 0 - 6
include/anki/scene/SceneGraph.h

@@ -148,8 +148,6 @@ public:
 	SceneNode& findSceneNode(const char* name);
 	SceneNode& findSceneNode(const char* name);
 	SceneNode* tryFindSceneNode(const char* name);
 	SceneNode* tryFindSceneNode(const char* name);
 
 
-	void printProfileInfo() const;
-
 private:
 private:
 	SceneAllocator<U8> alloc;
 	SceneAllocator<U8> alloc;
 	SceneAllocator<U8> frameAlloc;
 	SceneAllocator<U8> frameAlloc;
@@ -168,10 +166,6 @@ private:
 
 
 	EventManager events;
 	EventManager events;
 
 
-#if ANKI_CFG_SCENE_PROFILE
-	HighRezTimer::Scalar timeForUpdates = 0.0;
-#endif
-
 	/// Put a node in the appropriate containers
 	/// Put a node in the appropriate containers
 	void registerNode(SceneNode* node);
 	void registerNode(SceneNode* node);
 	void unregisterNode(SceneNode* node);
 	void unregisterNode(SceneNode* node);

+ 0 - 1
readme

@@ -1 +0,0 @@
-for build info and more see docs/manual.html

+ 47 - 0
readme.txt

@@ -0,0 +1,47 @@
+
+AnKi 3D engine is a Linux opensource game engine buld using OpenGL.
+
+=============
+Building AnKi
+=============
+
+AnKi's build system is using CMake. A great effort was made to keep the number 
+of external dependencies to minimum so the only prerequisites are the following:
+
+- X11 development files (Package name under Ubuntu: libx11-dev)
+- Mesa GL development files (Package name under Ubuntu: mesa-common-dev)
+
+AnKi is using the C++11 standard so the supported compilers are:
+
+- GCC 4.7 or greater 
+- clang 3.2 or greater 
+
+To build the release version:
+
+- cd <path_to_anki>/build
+- cmake -DCMAKE_BUILD_TYPE=Release ..
+- make
+
+To view and configure the build options you can use ccmake tool:
+
+- cd <path_to_anki>/build
+- cmake -DCMAKE_BUILD_TYPE=Release ..
+- ccmake .
+
+This will open an interface with all the available options.
+
+===============================
+Supported hardware and software
+===============================
+
+AnKi has 3 codepaths: 
+
+- OpenGL 3.x core
+- OpenGL 4.4
+- OpenGL ES 3.0
+
+It's been tested on nVidia HW with some less than a year old nVidia 
+proprietary drivers. Different HW and drivers have not been tested yet and they
+are supported only in theory.
+
+It's been known to build and run on Ubuntu 12.04 64bit.

+ 1 - 2
shaders/IsLp.glsl

@@ -319,9 +319,8 @@ void main()
 #endif
 #endif
 
 
 #if 0
 #if 0
-	if(tiles[vInstanceId].lightsCount[3] == 666U)
 	{
 	{
-		fColor += vec3(0.5, 0.0, 0.0);
+		fColor += fColor * 0.1 + normal * 0.9;
 	}
 	}
 #endif
 #endif
 
 

+ 136 - 18
src/core/Counters.cpp

@@ -6,14 +6,17 @@
 
 
 namespace anki {
 namespace anki {
 
 
+#if ANKI_ENABLE_COUNTERS
+
 //==============================================================================
 //==============================================================================
 
 
 enum CounterFlag
 enum CounterFlag
 {
 {
 	CF_PER_FRAME = 1 << 0,
 	CF_PER_FRAME = 1 << 0,
-	CF_GLOBAL = 1 << 1,
-	CF_F64 = 1 << 2,
-	CF_U64 = 1 << 3
+	CF_PER_RUN = 1 << 1,
+	CF_FPS = 1 << 2, ///< Only with CF_PER_RUN
+	CF_F64 = 1 << 3,
+	CF_U64 = 1 << 4
 };
 };
 
 
 struct CounterInfo
 struct CounterInfo
@@ -23,19 +26,23 @@ struct CounterInfo
 };
 };
 
 
 static const Array<CounterInfo, C_COUNT> cinfo = {{
 static const Array<CounterInfo, C_COUNT> cinfo = {{
-	{"C_RENDERER_MS_TIME", CF_PER_FRAME | CF_F64},
-	{"C_RENDERER_IS_TIME", CF_PER_FRAME | CF_F64},
-	{"C_RENDERER_PPS_TIME", CF_PER_FRAME | CF_F64},
-	{"C_RENDERER_DRAWCALLS_COUNT", CF_GLOBAL | CF_U64},
-	{"C_RENDERER_VERTICES_COUNT", CF_GLOBAL | CF_U64},
-	{"C_SCENE_UPDATE_TIME", CF_PER_FRAME | CF_F64},
-	{"C_SWAP_BUFFERS_TIME", CF_PER_FRAME | CF_F64}
+	{"FPS", CF_PER_RUN | CF_FPS | CF_F64},
+	{"MAIN_RENDERER_TIME", CF_PER_FRAME | CF_PER_RUN | CF_F64},
+	{"RENDERER_MS_TIME", CF_PER_FRAME | CF_PER_RUN | CF_F64},
+	{"RENDERER_IS_TIME", CF_PER_FRAME | CF_PER_RUN | CF_F64},
+	{"RENDERER_PPS_TIME", CF_PER_FRAME | CF_PER_RUN | CF_F64},
+	{"RENDERER_DRAWCALLS_COUNT", CF_PER_RUN | CF_U64},
+	{"RENDERER_VERTICES_COUNT", CF_PER_RUN | CF_U64},
+	{"SCENE_UPDATE_TIME", CF_PER_RUN | CF_F64},
+	{"SWAP_BUFFERS_TIME", CF_PER_RUN | CF_F64}
 }};
 }};
 
 
 //==============================================================================
 //==============================================================================
 CountersManager::CountersManager()
 CountersManager::CountersManager()
 {
 {
-	counters.resize(C_COUNT, 0);
+	perframeValues.resize(C_COUNT, 0);
+	perrunValues.resize(C_COUNT, 0);
+	counterTimes.resize(C_COUNT, 0.0);
 
 
 	// Open and write the headers to the files
 	// Open and write the headers to the files
 	perframeFile.open("./perframe_counters.csv", File::OF_WRITE);
 	perframeFile.open("./perframe_counters.csv", File::OF_WRITE);
@@ -49,6 +56,27 @@ CountersManager::CountersManager()
 			perframeFile.writeString(", %s", inf.name);
 			perframeFile.writeString(", %s", inf.name);
 		}
 		}
 	}
 	}
+
+	// Open and write the headers to the other file
+	perrunFile.open("./perrun_counters.csv", File::OF_WRITE);
+
+	U i = 0;
+	for(const CounterInfo& inf : cinfo)
+	{
+		if(inf.flags & CF_PER_RUN)
+		{
+			if(i != 0)
+			{
+				perrunFile.writeString(", %s", inf.name);
+			}
+			else
+			{
+				perrunFile.writeString("%s", inf.name);
+			}
+
+			++i;
+		}
+	}
 }
 }
 
 
 //==============================================================================
 //==============================================================================
@@ -56,17 +84,62 @@ CountersManager::~CountersManager()
 {}
 {}
 
 
 //==============================================================================
 //==============================================================================
-void CountersManager::increaseCounter(Counter counter, F64 val)
+void CountersManager::increaseCounter(Counter counter, U64 val)
 {
 {
-	counters[counter] += val;
+	ANKI_ASSERT(cinfo[counter].flags & CF_U64);
+
+	if(cinfo[counter].flags & CF_PER_FRAME)
+	{
+		perframeValues[counter] += val;
+	}
+
+	if(cinfo[counter].flags & CF_PER_RUN)
+	{
+		perrunValues[counter] += val;
+	}
 }
 }
 
 
 //==============================================================================
 //==============================================================================
-void CountersManager::increaseCounter(Counter counter, U64 val)
+void CountersManager::increaseCounter(Counter counter, F64 val)
 {
 {
+	ANKI_ASSERT(cinfo[counter].flags & CF_F64);
 	F64 f;
 	F64 f;
 	memcpy(&f, &val, sizeof(F64));
 	memcpy(&f, &val, sizeof(F64));
-	*(F64*)(&counters[counter]) += f;
+
+	if(cinfo[counter].flags & CF_PER_FRAME)
+	{
+		*(F64*)(&perframeValues[counter]) += f;
+	}
+
+	if(cinfo[counter].flags & CF_PER_RUN)
+	{
+		*(F64*)(&perrunValues[counter]) += f;
+	}
+}
+
+//==============================================================================
+void CountersManager::startTimer(Counter counter)
+{
+	// The counter should be F64
+	ANKI_ASSERT(cinfo[counter].flags & CF_F64);
+	// The timer should have beeb reseted
+	ANKI_ASSERT(counterTimes[counter] == 0.0);
+
+	counterTimes[counter] = HighRezTimer::getCurrentTime();
+}
+
+//==============================================================================
+void CountersManager::stopTimerIncreaseCounter(Counter counter)
+{
+	// The counter should be F64
+	ANKI_ASSERT(cinfo[counter].flags & CF_F64);
+	// The timer should have started
+	ANKI_ASSERT(counterTimes[counter] > 0.0);
+
+	F32 prevTime = counterTimes[counter];
+	counterTimes[counter] = 0.0;
+
+	increaseCounter(counter, HighRezTimer::getCurrentTime() - prevTime);
 }
 }
 
 
 //==============================================================================
 //==============================================================================
@@ -82,18 +155,18 @@ void CountersManager::resolveFrame()
 		{
 		{
 			if(inf.flags & CF_U64)
 			if(inf.flags & CF_U64)
 			{
 			{
-				perframeFile.writeString(", %llu", counters[i]);
+				perframeFile.writeString(", %llu", perframeValues[i]);
 			}
 			}
 			else if(inf.flags & CF_F64)
 			else if(inf.flags & CF_F64)
 			{
 			{
-				perframeFile.writeString(", %f", *((F64*)&counters[i]));
+				perframeFile.writeString(", %f", *((F64*)&perframeValues[i]));
 			}
 			}
 			else
 			else
 			{
 			{
 				ANKI_ASSERT(0);
 				ANKI_ASSERT(0);
 			}
 			}
 
 
-			counters[i] = 0;
+			perframeValues[i] = 0;
 		}
 		}
 
 
 		i++;
 		i++;
@@ -103,7 +176,52 @@ void CountersManager::resolveFrame()
 //==============================================================================
 //==============================================================================
 void CountersManager::flush()
 void CountersManager::flush()
 {
 {
+	// Resolve per run counters
+	perrunFile.writeString("\n");
+	U i = 0;
+	U j = 0;
+	for(const CounterInfo& inf : cinfo)
+	{
+		if(inf.flags & CF_PER_RUN)
+		{
+			if(j != 0)
+			{
+				perrunFile.writeString(", ");
+			}
+
+			if(inf.flags & CF_U64)
+			{
+				perrunFile.writeString("%llu", perrunValues[i]);
+			}
+			else if(inf.flags & CF_F64)
+			{
+				if(inf.flags & CF_FPS)
+				{
+					perrunFile.writeString("%f", 
+						(F64)getGlobTimestamp() / *((F64*)&perrunValues[i]));
+				}
+				else
+				{
+					perrunFile.writeString("%f", *((F64*)&perrunValues[i]));
+				}
+			}
+			else
+			{
+				ANKI_ASSERT(0);
+			}
+
+			perrunValues[i] = 0;
+			++j;
+		}
+
+		++i;
+	}
+
+	// Close and flush files
 	perframeFile.close();
 	perframeFile.close();
+	perrunFile.close();
 }
 }
 
 
+#endif // ANKI_ENABLE_COUNTERS
+
 } // end namespace anki
 } // end namespace anki

+ 16 - 0
src/core/NativeWindowGlxX11.cpp

@@ -1,4 +1,5 @@
 #include "anki/core/NativeWindowGlxX11.h"
 #include "anki/core/NativeWindowGlxX11.h"
+#include "anki/core/Counters.h"
 #include "anki/util/Exception.h"
 #include "anki/util/Exception.h"
 #include <cstring>
 #include <cstring>
 
 
@@ -89,6 +90,16 @@ void NativeWindowImpl::createNativeWindow(NativeWindowInitializer& init)
 	XSetWindowAttributes swa;
 	XSetWindowAttributes swa;
 	Window root;
 	Window root;
 
 
+	// If it's fullscreen override the resolution with the desktop one
+	if(init.fullscreenDesktopRez)
+	{
+		Screen* pscr = nullptr;
+		pscr = DefaultScreenOfDisplay(xDisplay);
+
+		init.width = pscr->width;
+		init.height = pscr->height;
+	}
+
 	vi = glXGetVisualFromFBConfig(xDisplay, glxConfig[0]);
 	vi = glXGetVisualFromFBConfig(xDisplay, glxConfig[0]);
 
 
 	if(!vi)
 	if(!vi)
@@ -282,6 +293,9 @@ void NativeWindow::create(NativeWindowInitializer& initializer)
 {
 {
 	impl.reset(new NativeWindowImpl);
 	impl.reset(new NativeWindowImpl);
 	impl->create(initializer);
 	impl->create(initializer);
+
+	// Set the size after because the create may have changed it to something
+	// more nice
 	width = initializer.width;
 	width = initializer.width;
 	height = initializer.height;
 	height = initializer.height;
 }
 }
@@ -295,8 +309,10 @@ void NativeWindow::destroy()
 //==============================================================================
 //==============================================================================
 void NativeWindow::swapBuffers()
 void NativeWindow::swapBuffers()
 {
 {
+	ANKI_COUNTER_START_TIMER(C_SWAP_BUFFERS_TIME);
 	ANKI_ASSERT(isCreated());
 	ANKI_ASSERT(isCreated());
 	glXSwapBuffers(impl->xDisplay, impl->xWindow);
 	glXSwapBuffers(impl->xDisplay, impl->xWindow);
+	ANKI_COUNTER_STOP_TIMER_INC(C_SWAP_BUFFERS_TIME);
 }
 }
 
 
 } // end namespace anki
 } // end namespace anki

+ 15 - 0
src/renderer/Drawer.cpp

@@ -7,9 +7,21 @@
 #include "anki/scene/ModelNode.h"
 #include "anki/scene/ModelNode.h"
 #include "anki/resource/TextureResource.h"
 #include "anki/resource/TextureResource.h"
 #include "anki/renderer/Renderer.h"
 #include "anki/renderer/Renderer.h"
+#include "anki/core/Counters.h"
 
 
 namespace anki {
 namespace anki {
 
 
+//==============================================================================
+static U64 countVerts(U32* indicesCount, I primCount)
+{
+	U64 sum = 0;
+	while(--primCount >= 0)
+	{
+		sum += indicesCount[primCount];
+	}
+	return sum;
+}
+
 //==============================================================================
 //==============================================================================
 /// Visitor that sets a uniform
 /// Visitor that sets a uniform
 struct SetupRenderableVariableVisitor
 struct SetupRenderableVariableVisitor
@@ -318,6 +330,9 @@ void RenderableDrawer::render(SceneNode& frsn, RenderingStage stage,
 	dc.primCount = primCount;
 	dc.primCount = primCount;
 
 
 	dc.enque();
 	dc.enque();
+	ANKI_COUNTER_INC(C_RENDERER_DRAWCALLS_COUNT, (U64)1);
+	ANKI_COUNTER_INC(C_RENDERER_VERTICES_COUNT, 
+		countVerts(indicesCountArray, (I)primCount));
 }
 }
 
 
 }  // end namespace anki
 }  // end namespace anki

+ 5 - 0
src/renderer/MainRenderer.cpp

@@ -2,6 +2,7 @@
 #include "anki/core/Logger.h"
 #include "anki/core/Logger.h"
 #include "anki/renderer/Deformer.h"
 #include "anki/renderer/Deformer.h"
 #include "anki/util/Filesystem.h"
 #include "anki/util/Filesystem.h"
+#include "anki/core/Counters.h"
 #include <cstdlib>
 #include <cstdlib>
 #include <cstdio>
 #include <cstdio>
 #include <fstream>
 #include <fstream>
@@ -74,6 +75,8 @@ void MainRenderer::initGl()
 //==============================================================================
 //==============================================================================
 void MainRenderer::render(SceneGraph& scene)
 void MainRenderer::render(SceneGraph& scene)
 {
 {
+	ANKI_COUNTER_START_TIMER(C_MAIN_RENDERER_TIME);
+
 	Bool drawToDefaultFbo = renderingQuality > 0.9 && !dbg.getEnabled();
 	Bool drawToDefaultFbo = renderingQuality > 0.9 && !dbg.getEnabled();
 
 
 	pps.setDrawToDefaultFbo(drawToDefaultFbo);
 	pps.setDrawToDefaultFbo(drawToDefaultFbo);
@@ -106,6 +109,8 @@ void MainRenderer::render(SceneGraph& scene)
 
 
 	// Check for error
 	// Check for error
 	ANKI_CHECK_GL_ERROR();
 	ANKI_CHECK_GL_ERROR();
+
+	ANKI_COUNTER_STOP_TIMER_INC(C_MAIN_RENDERER_TIME);
 }
 }
 
 
 //==============================================================================
 //==============================================================================

+ 7 - 30
src/renderer/Renderer.cpp

@@ -2,6 +2,7 @@
 #include "anki/util/Exception.h"
 #include "anki/util/Exception.h"
 #include "anki/scene/Camera.h"
 #include "anki/scene/Camera.h"
 #include "anki/scene/SceneGraph.h"
 #include "anki/scene/SceneGraph.h"
+#include "anki/core/Counters.h"
 
 
 namespace anki {
 namespace anki {
 
 
@@ -82,36 +83,21 @@ void Renderer::render(SceneGraph& scene_)
 
 
 	viewProjectionMat = cam.getViewProjectionMatrix();
 	viewProjectionMat = cam.getViewProjectionMatrix();
 
 
-#if ANKI_CFG_RENDERER_PROFILE
-	HighRezTimer::Scalar timea, timeb;
-
-	timeb = HighRezTimer::getCurrentTime();
-
+	ANKI_COUNTER_START_TIMER(C_RENDERER_MS_TIME);
 	ms.run();
 	ms.run();
-	timea = HighRezTimer::getCurrentTime();
-	msTime += timea - timeb;
+	ANKI_COUNTER_STOP_TIMER_INC(C_RENDERER_MS_TIME);
 
 
 	tiler.runMinMax(ms.getDepthFai());
 	tiler.runMinMax(ms.getDepthFai());
-	timeb = HighRezTimer::getCurrentTime();
-	tilerTime += timeb - timea;
 
 
+	ANKI_COUNTER_START_TIMER(C_RENDERER_IS_TIME);
 	is.run();
 	is.run();
-	timea = HighRezTimer::getCurrentTime();
-	isTime += timea - timeb;
+	ANKI_COUNTER_STOP_TIMER_INC(C_RENDERER_IS_TIME);
 
 
 	bs.run();
 	bs.run();
-	timeb = HighRezTimer::getCurrentTime();
 
 
+	ANKI_COUNTER_START_TIMER(C_RENDERER_PPS_TIME);
 	pps.run();
 	pps.run();
-	timea = HighRezTimer::getCurrentTime();
-	ppsTime += timea - timeb;
-#else
-	ms.run();
-	tiler.runMinMax(ms.getDepthFai());
-	is.run();
-	bs.run();
-	pps.run();
-#endif
+	ANKI_COUNTER_STOP_TIMER_INC(C_RENDERER_PPS_TIME);
 
 
 	ANKI_CHECK_GL_ERROR();
 	ANKI_CHECK_GL_ERROR();
 	++framesNum;
 	++framesNum;
@@ -224,13 +210,4 @@ void Renderer::clearAfterBindingFbo(const GLenum cap)
 	}
 	}
 }
 }
 
 
-//==============================================================================
-void Renderer::printProfileInfo() const
-{
-#if ANKI_CFG_RENDERER_PROFILE
-	ANKI_LOGI("Renderer times: MS " << msTime << " IS " << isTime
-		<< " PPS " << ppsTime << " Tiler " << tilerTime);
-#endif
-}
-
 } // end namespace anki
 } // end namespace anki

+ 2 - 2
src/resource/MeshLoader.cpp

@@ -267,7 +267,6 @@ void MeshLoader::createVertTangents()
 			(uvedge01.x() * uvedge02.y());
 			(uvedge01.x() * uvedge02.y());
 		if(isZero(det))
 		if(isZero(det))
 		{
 		{
-			//ANKI_LOGW(getRsrcName() << ": det == " << fixed << det);
 			det = 0.0001;
 			det = 0.0001;
 		}
 		}
 		else
 		else
@@ -276,7 +275,8 @@ void MeshLoader::createVertTangents()
 			det = 1.0 / det;
 			det = 1.0 / det;
 
 
 			// Add a noise to the det to avoid zero tangents on mirrored cases
 			// Add a noise to the det to avoid zero tangents on mirrored cases
-			det *= ((rand() % 10) * getEpsilon<F32>());
+			// Add 1 to the rand so that it's not zero
+			det *= ((rand() % 10 + 1) * getEpsilon<F32>());
 		}
 		}
 
 
 		Vec3 t = (edge02 * uvedge01.y() - edge01 * uvedge02.y()) * det;
 		Vec3 t = (edge02 * uvedge01.y() - edge01 * uvedge02.y()) * det;

+ 7 - 43
src/scene/SceneGraph.cpp

@@ -3,6 +3,7 @@
 #include "anki/scene/ModelNode.h"
 #include "anki/scene/ModelNode.h"
 #include "anki/util/Exception.h"
 #include "anki/util/Exception.h"
 #include "anki/core/ThreadPool.h"
 #include "anki/core/ThreadPool.h"
+#include "anki/core/Counters.h"
 #include "anki/renderer/Renderer.h"
 #include "anki/renderer/Renderer.h"
 #include "anki/misc/Xml.h"
 #include "anki/misc/Xml.h"
 
 
@@ -128,10 +129,10 @@ void SceneGraph::unregisterNode(SceneNode* node)
 //==============================================================================
 //==============================================================================
 void SceneGraph::update(F32 prevUpdateTime, F32 crntTime, Renderer& renderer)
 void SceneGraph::update(F32 prevUpdateTime, F32 crntTime, Renderer& renderer)
 {
 {
-#if ANKI_CFG_SCENE_PROFILE
-	HighRezTimer::Scalar startTime = HighRezTimer::getCurrentTime();
-#endif
+	ANKI_COUNTER_START_TIMER(C_SCENE_UPDATE_TIME);
 
 
+	ThreadPool& threadPool = ThreadPoolSingleton::get();
+	(void)threadPool;
 	frameAlloc.reset();
 	frameAlloc.reset();
 
 
 	// XXX Do that in parallel
 	// XXX Do that in parallel
@@ -139,7 +140,7 @@ void SceneGraph::update(F32 prevUpdateTime, F32 crntTime, Renderer& renderer)
 	renderer.getTiler().updateTiles(*mainCam);
 	renderer.getTiler().updateTiles(*mainCam);
 	events.updateAllEvents(prevUpdateTime, crntTime);
 	events.updateAllEvents(prevUpdateTime, crntTime);
 
 
-#if 0
+#if 1
 	// First do the movable updates
 	// First do the movable updates
 	for(SceneNode* n : nodes)
 	for(SceneNode* n : nodes)
 	{
 	{
@@ -151,7 +152,6 @@ void SceneGraph::update(F32 prevUpdateTime, F32 crntTime, Renderer& renderer)
 		}
 		}
 	}
 	}
 #else
 #else
-	ThreadPool& threadPool = ThreadPoolSingleton::get();
 	UpdateMovablesJob jobs[ThreadPool::MAX_THREADS];
 	UpdateMovablesJob jobs[ThreadPool::MAX_THREADS];
 
 
 	for(U i = 0; i < threadPool.getThreadsCount(); i++)
 	for(U i = 0; i < threadPool.getThreadsCount(); i++)
@@ -166,7 +166,7 @@ void SceneGraph::update(F32 prevUpdateTime, F32 crntTime, Renderer& renderer)
 #endif
 #endif
 
 
 	// Then the rest
 	// Then the rest
-#if 0
+#if 1
 	for(SceneNode* n : nodes)
 	for(SceneNode* n : nodes)
 	{
 	{
 		updateSceneNode(*n, prevUpdateTime, crntTime, sectorGroup);
 		updateSceneNode(*n, prevUpdateTime, crntTime, sectorGroup);
@@ -195,35 +195,7 @@ void SceneGraph::update(F32 prevUpdateTime, F32 crntTime, Renderer& renderer)
 	/*sectorGroup.doVisibilityTests(*mainCam,
 	/*sectorGroup.doVisibilityTests(*mainCam,
 		VisibilityTest(VT_RENDERABLES | VT_LIGHTS), &r);*/
 		VisibilityTest(VT_RENDERABLES | VT_LIGHTS), &r);*/
 
 
-#if 0
-	for(SceneNode* n : nodes)
-	{
-		if(n->getSpatial()
-			&& n->getSpatial()->getSpatialLastUpdateFrame() == frame)
-		{
-			std::cout << "Spatial updated on: " << n->getName()
-				<< std::endl;
-		}
-
-		if(n->getMovable()
-			&& n->getMovable()->getMovableLastUpdateFrame() == frame)
-		{
-			std::cout << "Movable updated on: " << n->getName()
-				<< std::endl;
-		}
-
-		if(n->getFrustumable()
-			&& n->getFrustumable()->getFrustumableLastUpdateFrame() == frame)
-		{
-			std::cout << "Frustumable updated on: " << n->getName()
-				<< std::endl;
-		}
-	}
-#endif
-
-#if ANKI_CFG_SCENE_PROFILE
-	timeForUpdates += HighRezTimer::getCurrentTime() - startTime;
-#endif
+	ANKI_COUNTER_STOP_TIMER_INC(C_SCENE_UPDATE_TIME);
 }
 }
 
 
 //==============================================================================
 //==============================================================================
@@ -240,14 +212,6 @@ SceneNode* SceneGraph::tryFindSceneNode(const char* name)
 	return (it == nameToNode.end()) ? nullptr : it->second;
 	return (it == nameToNode.end()) ? nullptr : it->second;
 }
 }
 
 
-//==============================================================================
-void SceneGraph::printProfileInfo() const
-{
-#if ANKI_CFG_SCENE_PROFILE
-	ANKI_LOGI("Scene times: " << timeForUpdates);
-#endif
-}
-
 //==============================================================================
 //==============================================================================
 void SceneGraph::load(const char* filename)
 void SceneGraph::load(const char* filename)
 {
 {

+ 14 - 21
testapp/Main.cpp

@@ -134,7 +134,7 @@ void init()
 	cam->setAll(
 	cam->setAll(
 		MainRendererSingleton::get().getAspectRatio() * toRad(ang),
 		MainRendererSingleton::get().getAspectRatio() * toRad(ang),
 		toRad(ang), 0.5, 500.0);
 		toRad(ang), 0.5, 500.0);
-	cam->setLocalTransform(Transform(Vec3(20.0, 5.0, 0.0),
+	cam->setLocalTransform(Transform(Vec3(18.0, 5.2, 0.0),
 		Mat3(Euler(toRad(-10.0), toRad(90.0), toRad(0.0))),
 		Mat3(Euler(toRad(-10.0), toRad(90.0), toRad(0.0))),
 		1.0));
 		1.0));
 	scene.setActiveCamera(cam);
 	scene.setActiveCamera(cam);
@@ -169,8 +169,8 @@ void init()
 	SpotLight* spot = new SpotLight("spot0", &scene, Movable::MF_NONE, nullptr);
 	SpotLight* spot = new SpotLight("spot0", &scene, Movable::MF_NONE, nullptr);
 	spot->setOuterAngle(toRad(45.0));
 	spot->setOuterAngle(toRad(45.0));
 	spot->setInnerAngle(toRad(15.0));
 	spot->setInnerAngle(toRad(15.0));
-	spot->setLocalTransform(Transform(Vec3(1.3, 4.3, 3.0),
-		Mat3::getIdentity(), 1.0));
+	spot->setLocalTransform(Transform(Vec3(8.27936, 5.86285, 1.85526),
+		Mat3(Quat(-0.125117, 0.620465, 0.154831, 0.758544)), 1.0));
 	spot->setDiffuseColor(Vec4(2.0));
 	spot->setDiffuseColor(Vec4(2.0));
 	spot->setSpecularColor(Vec4(-1.0));
 	spot->setSpecularColor(Vec4(-1.0));
 	spot->loadTexture("gfx/lights/flashlight.tga");
 	spot->loadTexture("gfx/lights/flashlight.tga");
@@ -437,11 +437,11 @@ void mainLoop()
 {
 {
 	ANKI_LOGI("Entering main loop");
 	ANKI_LOGI("Entering main loop");
 
 
-	HighRezTimer mainLoopTimer;
-	mainLoopTimer.start();
 	HighRezTimer::Scalar prevUpdateTime = HighRezTimer::getCurrentTime();
 	HighRezTimer::Scalar prevUpdateTime = HighRezTimer::getCurrentTime();
 	HighRezTimer::Scalar crntTime = prevUpdateTime;
 	HighRezTimer::Scalar crntTime = prevUpdateTime;
 
 
+	ANKI_COUNTER_START_TIMER(C_FPS);
+
 	while(1)
 	while(1)
 	{
 	{
 		HighRezTimer timer;
 		HighRezTimer timer;
@@ -478,7 +478,7 @@ void mainLoop()
 				- timer.getElapsedTime());
 				- timer.getElapsedTime());
 		}
 		}
 #else
 #else
-		if(MainRendererSingleton::get().getFramesCount() == 1000)
+		if(MainRendererSingleton::get().getFramesCount() == 2000)
 		{
 		{
 			break;
 			break;
 		}
 		}
@@ -490,13 +490,9 @@ void mainLoop()
 	MainRendererSingleton::get().takeScreenshot("screenshot.tga");
 	MainRendererSingleton::get().takeScreenshot("screenshot.tga");
 #endif
 #endif
 
 
-	ANKI_COUNTERS_FLUSH();
+	ANKI_COUNTER_STOP_TIMER_INC(C_FPS);
 
 
-	HighRezTimer::Scalar timePassed = mainLoopTimer.getElapsedTime();
-	ANKI_LOGI("Exiting main loop (" << timePassed
-		<< " sec) FPS: " << 1000.0 / timePassed);
-	MainRendererSingleton::get().printProfileInfo();
-	SceneGraphSingleton::get().printProfileInfo();
+	ANKI_COUNTERS_FLUSH();
 }
 }
 
 
 //==============================================================================
 //==============================================================================
@@ -517,8 +513,8 @@ void initSubsystems(int argc, char* argv[])
 
 
 	// Window
 	// Window
 	NativeWindowInitializer nwinit;
 	NativeWindowInitializer nwinit;
-	nwinit.width = 1920;
-	nwinit.height = 1080;
+	nwinit.width = 1280;
+	nwinit.height = 720;
 	nwinit.majorVersion = glmajor;
 	nwinit.majorVersion = glmajor;
 	nwinit.minorVersion = glminor;
 	nwinit.minorVersion = glminor;
 	nwinit.depthBits = 0;
 	nwinit.depthBits = 0;
@@ -548,17 +544,17 @@ void initSubsystems(int argc, char* argv[])
 	initializer.pps.hdr.blurringDist = 1.0;
 	initializer.pps.hdr.blurringDist = 1.0;
 	initializer.pps.hdr.blurringIterationsCount = 2;
 	initializer.pps.hdr.blurringIterationsCount = 2;
 	initializer.pps.hdr.exposure = 8.0;
 	initializer.pps.hdr.exposure = 8.0;
-	initializer.pps.ssao.blurringIterationsNum = 4;
+	initializer.pps.ssao.blurringIterationsNum = 2;
 	initializer.pps.ssao.enabled = true;
 	initializer.pps.ssao.enabled = true;
 	initializer.pps.ssao.mainPassRenderingQuality = 0.5;
 	initializer.pps.ssao.mainPassRenderingQuality = 0.5;
-	initializer.pps.ssao.blurringRenderingQuality = 0.7;
+	initializer.pps.ssao.blurringRenderingQuality = 0.5;
 	initializer.pps.enabled = true;
 	initializer.pps.enabled = true;
 	initializer.pps.bl.enabled = true;
 	initializer.pps.bl.enabled = true;
 	initializer.pps.bl.blurringIterationsNum = 2;
 	initializer.pps.bl.blurringIterationsNum = 2;
 	initializer.pps.bl.sideBlurFactor = 1.0;
 	initializer.pps.bl.sideBlurFactor = 1.0;
 	initializer.renderingQuality = 1.0;
 	initializer.renderingQuality = 1.0;
-	initializer.width = nwinit.width;
-	initializer.height = nwinit.height;
+	initializer.width = win->getWidth();
+	initializer.height = win->getHeight();
 	initializer.lodDistance = 20.0;
 	initializer.lodDistance = 20.0;
 
 
 	MainRendererSingleton::get().init(initializer);
 	MainRendererSingleton::get().init(initializer);
@@ -568,9 +564,6 @@ void initSubsystems(int argc, char* argv[])
 
 
 	// Parallel jobs
 	// Parallel jobs
 	ThreadPoolSingleton::get().init(getCpuCoresCount());
 	ThreadPoolSingleton::get().init(getCpuCoresCount());
-
-	// Init counters
-	CountersManagerSingleton::get();
 }
 }
 
 
 //==============================================================================
 //==============================================================================