Ver Fonte

Nothing important

Panagiotis Christopoulos Charitos há 13 anos atrás
pai
commit
23aaa7c068

+ 1 - 1
CMakeLists.txt

@@ -138,7 +138,7 @@ ADD_DEFINITIONS("-Dthread_local=__thread")
 #
 # Compiler flags
 #
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors -pedantic -ansi -Wall -W -Wextra -Wwrite-strings -Wno-unused -Wundef -Wunused-variable -Werror -msse4 -std=c++11 ")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors -pedantic -ansi -Wall -W -Wextra -Wwrite-strings -Wno-unused -Wundef -Wunused-variable -Wstrict-aliasing=1 -Wstrict-overflow=5 -Werror -msse4 -std=c++11")
 
 IF(CMAKE_BUILD_TYPE STREQUAL Debug)
 	# Removed because they do not work with boost::regexpr and who knows what

+ 1 - 1
include/anki/gl/Query.h

@@ -17,7 +17,7 @@ public:
 	/// @{
 
 	/// @param q One of GL_SAMPLES_PASSED, GL_ANY_SAMPLES_PASSED, 
-	///        GL_TIME_ELAPSED
+	///          GL_TIME_ELAPSED
 	Query(GLenum q);
 
 	~Query();

+ 5 - 1
include/anki/resource/Material.h

@@ -19,6 +19,10 @@ class ShaderProgramUniformVariable;
 class XmlElement;
 class MaterialShaderProgramCreator;
 
+// A few consts
+const U32 MATERIAL_MAX_PASSES = 4;
+const U32 MATERIAL_MAX_LODS = 4;
+
 /// Material variable base. Its a visitable
 typedef Visitable<F32, Vec2, Vec3, Vec4, Mat3, Mat4, TextureResourcePointer> 
 	MateriaVariableVisitable;
@@ -122,7 +126,7 @@ public:
 	/// @{
 	const Data& get() const
 	{
-		ANKI_ASSERT(data.get() != nullptr);
+		ANKI_ASSERT(dataSet == true);
 		return data;
 	}
 

+ 8 - 8
include/anki/resource/PassLevelKey.h

@@ -1,17 +1,17 @@
 #ifndef ANKI_RESOURCE_PASS_LEVEL_KEY_H
 #define ANKI_RESOURCE_PASS_LEVEL_KEY_H
 
+#include "anki/util/StdTypes.h"
 #include <unordered_map>
-#include <cstdint>
 #include <cstdlib>
 
 namespace anki {
 
-/// XXX
+/// A key that consistst of the rendering pass and the level of detail
 struct PassLevelKey
 {
-	uint32_t pass = 0;
-	uint32_t level = 0;
+	U8 pass = 0;
+	U8 level = 0;
 
 	PassLevelKey()
 	{}
@@ -20,7 +20,7 @@ struct PassLevelKey
 		: pass(b.pass), level(b.level)
 	{}
 
-	PassLevelKey(uint32_t pass_, uint32_t level_)
+	explicit PassLevelKey(const U8 pass_, const U8 level_)
 		: pass(pass_), level(level_)
 	{}
 };
@@ -30,14 +30,14 @@ struct PassLevelKeyCreateHash
 {
 	size_t operator()(const PassLevelKey& b) const
 	{
-		return b.pass * 1000 + b.level;
+		return ((U32)b.pass << 16) | (U32)b.level;
 	}
 };
 
 /// Values comparisons functor
 struct PassLevelKeyComparision
 {
-	bool operator()(const PassLevelKey& a,
+	Bool operator()(const PassLevelKey& a,
 		const PassLevelKey& b) const
 	{
 		return a.pass == b.pass && a.level == b.level;
@@ -50,6 +50,6 @@ template<typename T>
 using PassLevelHashMap = std::unordered_map<
 	PassLevelKey, T, PassLevelKeyCreateHash, PassLevelKeyComparision>;
 
-} // end namespace
+} // end namespace anki
 
 #endif

+ 1 - 0
src/resource/Material.cpp

@@ -381,6 +381,7 @@ void Material::populateVariables(const MaterialShaderProgramCreator& mspc)
 			ANKI_ASSERT(0);
 		}
 
+		// Set value
 		if(inpvar->value.size() != 0)
 		{
 			const StringList& value = inpvar->value;