Forráskód Böngészése

Shared ptr construction now forwards arguments directly

Marko Pintera 11 éve
szülő
commit
7689bd6785

+ 6 - 5
BoostPort.txt

@@ -1,4 +1,3 @@
- - std::function allocates memory yet I'm not using a custom allocator for it. Replace std::function with custom Function method.
  - Ability to construct Module using startUp without having to do allocation outside of it
  - Ability to construct Module using startUp without having to do allocation outside of it
 
 
  REFACTOR GpuProgram
  REFACTOR GpuProgram
@@ -6,11 +5,13 @@
   - Right now HighLevelGpuProgram always creates just one instance of GpuProgram internally, and I don't see why they should be separate
   - Right now HighLevelGpuProgram always creates just one instance of GpuProgram internally, and I don't see why they should be separate
   - Possibly also determine how to neatly handle compilation faliure. Error should be reported and dummy shader should be returned.
   - Possibly also determine how to neatly handle compilation faliure. Error should be reported and dummy shader should be returned.
 
 
-cm_shared_ptr should use && for parameter forwarding?
-cm_core_ptr too
+DEBUG CODE in GLRenderSystem::beginDraw()
 
 
-Update GLRenderSystem docs
+		GLuint VAOID[1];
+		glGenVertexArrays(1, &VAOID[0]);
+		glBindVertexArray(VAOID[0]);
 
 
-Perform refactor mentioned in the documentation e-mail
+I'll probably want a system like PipelineManager where it saves all VS and VB combinations and retuns vertex array for it.
+ - Those vertex arrays should probably be saved in the vertex shader
 
 
 Create a proper git repo of dependencies folder
 Create a proper git repo of dependencies folder

+ 6 - 6
CamelotCore/Include/CmCoreObject.h

@@ -208,9 +208,9 @@ namespace BansheeEngine
 	 * 			and you should not create them manually.
 	 * 			and you should not create them manually.
 	 */
 	 */
 	template<class Type, class MainAlloc, class PtrDataAlloc, class... Args>
 	template<class Type, class MainAlloc, class PtrDataAlloc, class... Args>
-	std::shared_ptr<Type> cm_core_ptr(Args ...args)
+	std::shared_ptr<Type> cm_core_ptr(Args &&...args)
 	{
 	{
-		return std::shared_ptr<Type>(cm_new<Type, MainAlloc>(args...),
+		return std::shared_ptr<Type>(cm_new<Type, MainAlloc>(std::forward<Args>(args)...),
 			&CoreObject::_deleteDelayed<Type, MainAlloc>, StdAlloc<PtrDataAlloc>());
 			&CoreObject::_deleteDelayed<Type, MainAlloc>, StdAlloc<PtrDataAlloc>());
 	}
 	}
 
 
@@ -221,9 +221,9 @@ namespace BansheeEngine
 	 * 			and you should not create them manually.
 	 * 			and you should not create them manually.
 	 */
 	 */
 	template<class Type, class MainAlloc, class... Args>
 	template<class Type, class MainAlloc, class... Args>
-	std::shared_ptr<Type> cm_core_ptr(Args ...args)
+	std::shared_ptr<Type> cm_core_ptr(Args &&...args)
 	{
 	{
-		return std::shared_ptr<Type>(cm_new<Type, MainAlloc>(args...),
+		return std::shared_ptr<Type>(cm_new<Type, MainAlloc>(std::forward<Args>(args)...),
 			&CoreObject::_deleteDelayed<Type, MainAlloc>, StdAlloc<GenAlloc>());
 			&CoreObject::_deleteDelayed<Type, MainAlloc>, StdAlloc<GenAlloc>());
 	}
 	}
 
 
@@ -234,9 +234,9 @@ namespace BansheeEngine
 	 * 			and you should not create them manually.
 	 * 			and you should not create them manually.
 	 */
 	 */
 	template<class Type, class... Args>
 	template<class Type, class... Args>
-	std::shared_ptr<Type> cm_core_ptr(Args ...args)
+	std::shared_ptr<Type> cm_core_ptr(Args &&...args)
 	{
 	{
-		return std::shared_ptr<Type>(cm_new<Type, GenAlloc>(args...),
+		return std::shared_ptr<Type>(cm_new<Type, GenAlloc>(std::forward<Args>(args)...),
 			&CoreObject::_deleteDelayed<Type, GenAlloc>, StdAlloc<GenAlloc>());
 			&CoreObject::_deleteDelayed<Type, GenAlloc>, StdAlloc<GenAlloc>());
 	}
 	}
 
 

+ 1 - 1
CamelotGLRenderer/Source/CmGLRenderSystem.cpp

@@ -1319,7 +1319,7 @@ namespace BansheeEngine
 
 
 		GLuint VAOID[1];
 		GLuint VAOID[1];
 		glGenVertexArrays(1, &VAOID[0]);
 		glGenVertexArrays(1, &VAOID[0]);
-		glBindVertexArray(VAOID[0]);
+		glBindVertexArray(VAOID[0]); // DEBUG ONLY!!! - Store these somewhere and just rebind them when needed
 
 
 		for (elem = decl.begin(); elem != elemEnd; ++elem)
 		for (elem = decl.begin(); elem != elemEnd; ++elem)
 		{
 		{

+ 4 - 4
CamelotUtility/Include/CmStdHeaders.h

@@ -138,18 +138,18 @@ namespace BansheeEngine
 	 * @brief	Create a new shared pointer using a custom allocator category.
 	 * @brief	Create a new shared pointer using a custom allocator category.
 	 */
 	 */
 	template<class Type, class AllocCategory, class... Args> 
 	template<class Type, class AllocCategory, class... Args> 
-	std::shared_ptr<Type> cm_shared_ptr(Args... args) 
+	std::shared_ptr<Type> cm_shared_ptr(Args &&... args) 
 	{
 	{
-		return std::allocate_shared<Type>(StdAlloc<AllocCategory>(), args...); 
+		return std::allocate_shared<Type>(StdAlloc<AllocCategory>(), std::forward<Args>(args)...); 
 	}
 	}
 
 
 	/**
 	/**
 	* @brief	Create a new shared pointer using the default allocator category.
 	* @brief	Create a new shared pointer using the default allocator category.
 	*/
 	*/
 	template<class Type, class... Args>
 	template<class Type, class... Args>
-	std::shared_ptr<Type> cm_shared_ptr(Args... args)
+	std::shared_ptr<Type> cm_shared_ptr(Args &&... args)
 	{
 	{
-		return std::allocate_shared<Type>(StdAlloc<GenAlloc>(), args...);
+		return std::allocate_shared<Type>(StdAlloc<GenAlloc>(), std::forward<Args>(args)...);
 	}
 	}
 
 
 	/**
 	/**

+ 1 - 1
Notes.txt

@@ -60,7 +60,7 @@ Reminders:
 	- When showing a debug message, also provide a (clickable?) reference to Component it was triggered on (if applicable)
 	- When showing a debug message, also provide a (clickable?) reference to Component it was triggered on (if applicable)
 	  - It really helps when you get an error on a Component that hundreds of SceneObjects use
 	  - It really helps when you get an error on a Component that hundreds of SceneObjects use
 	- When displaying an error with a callstack, make each line of the callstack clickable where it opens the external editor
 	- When displaying an error with a callstack, make each line of the callstack clickable where it opens the external editor
-
+  - std::function allocates memory but I have no got way of using custom allocators as I'd have to wrap std::bind and that seems non-trivial
 
 
 Potential optimizations:
 Potential optimizations:
  - bulkPixelConversion is EXTREMELY poorly unoptimized. Each pixel it calls a separate method that does redudant operations every pixel.
  - bulkPixelConversion is EXTREMELY poorly unoptimized. Each pixel it calls a separate method that does redudant operations every pixel.