Răsfoiți Sursa

Merge pull request #27 from almightykiwi/linux

Linux fixes
Marko Pintera 9 ani în urmă
părinte
comite
1eb23d478c

+ 4 - 1
Source/BansheeCore/Include/BsBlendState.h

@@ -243,15 +243,18 @@ namespace BansheeEngine
  *  @{
  */
 
+namespace std
+{
 /**	Hash value generator for BLEND_STATE_DESC. */
 template<>
-struct std::hash<BansheeEngine::BLEND_STATE_DESC>
+struct hash<BansheeEngine::BLEND_STATE_DESC>
 {
 	size_t operator()(const BansheeEngine::BLEND_STATE_DESC& value) const
 	{
 		return (size_t)BansheeEngine::BlendState::generateHash(value);
 	}
 };
+}
 
 /** @} */
 /** @endcond */

+ 5 - 2
Source/BansheeCore/Include/BsDepthStencilState.h

@@ -235,15 +235,18 @@ namespace BansheeEngine
  *  @{
  */
 
+namespace std
+{
 /**	Hash value generator for DEPTH_STENCIL_STATE_DESC. */
 template<>
-struct std::hash<BansheeEngine::DEPTH_STENCIL_STATE_DESC>
+struct hash<BansheeEngine::DEPTH_STENCIL_STATE_DESC>
 {
 	size_t operator()(const BansheeEngine::DEPTH_STENCIL_STATE_DESC& value) const
 	{
 		return (size_t)BansheeEngine::DepthStencilState::generateHash(value);
 	}
 };
+}
 
 /** @} */
-/** @endcond */
+/** @endcond */

+ 2 - 2
Source/BansheeCore/Include/BsGameObjectHandle.h

@@ -133,7 +133,7 @@ namespace BansheeEngine
 		GameObjectHandleBase(std::nullptr_t ptr);
 
 		/**	Throws an exception if the referenced GameObject has been destroyed. */
-		inline void throwIfDestroyed() const;
+		void throwIfDestroyed() const;
 		
 		/**	Invalidates the handle signifying the referenced object was destroyed. */
 		void destroy()
@@ -288,4 +288,4 @@ namespace BansheeEngine
 	}
 
 	/** @} */
-}
+}

+ 2 - 2
Source/BansheeCore/Include/BsMaterialParams.h

@@ -113,7 +113,7 @@ namespace BansheeEngine
 			if (result != GetParamResult::Success)
 				return;
 
-			const GpuParamDataTypeInfo& typeInfo = GpuParams::PARAM_SIZES[dataType];
+			const GpuParamDataTypeInfo& typeInfo = GpuParams::PARAM_SIZES.lookup[dataType];
 			UINT32 paramTypeSize = typeInfo.numColumns * typeInfo.numRows * typeInfo.baseTypeSize;
 			output = *(T*)(mDataParamsBuffer[param->index + arrayIdx * paramTypeSize]);
 
@@ -140,7 +140,7 @@ namespace BansheeEngine
 			if (result != GetParamResult::Success)
 				return;
 
-			const GpuParamDataTypeInfo& typeInfo = GpuParams::PARAM_SIZES[dataType];
+			const GpuParamDataTypeInfo& typeInfo = GpuParams::PARAM_SIZES.lookup[dataType];
 			UINT32 paramTypeSize = typeInfo.numColumns * typeInfo.numRows * typeInfo.baseTypeSize;
 
 			memcpy(&mDataParamsBuffer[param->index + arrayIdx * paramTypeSize], input, sizeof(paramTypeSize));

+ 5 - 2
Source/BansheeCore/Include/BsRasterizerState.h

@@ -216,15 +216,18 @@ namespace BansheeEngine
  *  @{
  */
 
+namespace std
+{
 /**	Hash value generator for RASTERIZER_STATE_DESC. */
 template<>
-struct std::hash<BansheeEngine::RASTERIZER_STATE_DESC>
+struct hash<BansheeEngine::RASTERIZER_STATE_DESC>
 {
 	size_t operator()(const BansheeEngine::RASTERIZER_STATE_DESC& value) const
 	{
 		return (size_t)BansheeEngine::RasterizerState::generateHash(value);
 	}
 };
+}
 
 /** @} */
-/** @endcond */
+/** @endcond */

+ 6 - 5
Source/BansheeCore/Include/BsRenderAPICapabilities.h

@@ -5,10 +5,11 @@
 #include "BsCorePrerequisites.h"
 #include "BsGpuProgram.h"
 
-#define CAPS_CATEGORY_SIZE 8i64
-#define BS_CAPS_BITSHIFT (64i64 - CAPS_CATEGORY_SIZE)
-#define CAPS_CATEGORY_MASK (((1i64 << CAPS_CATEGORY_SIZE) - 1i64) << BS_CAPS_BITSHIFT)
-#define BS_CAPS_VALUE(cat, val) ((cat << BS_CAPS_BITSHIFT) | (1i64 << val))
+#include <cstdint>
+#define CAPS_CATEGORY_SIZE INT64_C(8)
+#define BS_CAPS_BITSHIFT (INT64_C(64) - CAPS_CATEGORY_SIZE)
+#define CAPS_CATEGORY_MASK (((INT64_C(1) << CAPS_CATEGORY_SIZE) - INT64_C(1)) << BS_CAPS_BITSHIFT)
+#define BS_CAPS_VALUE(cat, val) ((cat << BS_CAPS_BITSHIFT) | (INT64_C(1) << val))
 
 #define MAX_BOUND_VERTEX_BUFFERS 32
 
@@ -532,4 +533,4 @@ namespace BansheeEngine
 	};
 
 	/** @} */
-}
+}

+ 3 - 3
Source/BansheeCore/Include/BsResourceHandle.h

@@ -106,7 +106,7 @@ namespace BansheeEngine
 		static Mutex mResourceCreatedMutex;
 
 	protected:
-		inline void throwIfNotLoaded() const;
+		void throwIfNotLoaded() const;
 	};
 
 	/**
@@ -290,7 +290,7 @@ namespace BansheeEngine
 		 * @note	Handle will take ownership of the provided resource pointer, so make sure you don't delete it elsewhere.
 		 */
 		explicit TResourceHandle(T* ptr, const String& uuid)
-			:TResourceHandleBase()
+			:TResourceHandleBase<WeakHandle>()
 		{
 			this->mData = bs_shared_ptr_new<ResourceHandleData>();
 			this->addRef();
@@ -391,4 +391,4 @@ namespace BansheeEngine
 	}
 
 	/** @} */
-}
+}

+ 7 - 2
Source/BansheeCore/Include/BsSamplerState.h

@@ -7,6 +7,8 @@
 #include "BsIReflectable.h"
 #include "BsCoreObject.h"
 
+#include <cfloat>
+
 namespace BansheeEngine 
 {
 	/** @addtogroup RenderAPI
@@ -194,15 +196,18 @@ namespace BansheeEngine
  *  @{
  */
 
+namespace std
+{
 /**	Hash value generator for SAMPLER_STATE_DESC. */
 template<>
-struct std::hash<BansheeEngine::SAMPLER_STATE_DESC>
+struct hash<BansheeEngine::SAMPLER_STATE_DESC>
 {
 	size_t operator()(const BansheeEngine::SAMPLER_STATE_DESC& value) const
 	{
 		return (size_t)BansheeEngine::SamplerState::generateHash(value);
 	}
 };
+}
 
 /** @} */
-/** @endcond */
+/** @endcond */

+ 2 - 2
Source/BansheeCore/Source/BsIconUtility.cpp

@@ -201,7 +201,7 @@ namespace BansheeEngine
 		//    - icon/cursor/etc data
 
 		std::fstream stream;
-		stream.open(path.toWString().c_str(), std::ios::in | std::ios::out | std::ios::binary);
+		stream.open(path.toPlatformString().c_str(), std::ios::in | std::ios::out | std::ios::binary);
 
 		// First check magic number to ensure file is even an executable
 		UINT16 magicNum;
@@ -379,4 +379,4 @@ namespace BansheeEngine
 			}
 		}
 	}
-}
+}

+ 1 - 1
Source/BansheeCore/Source/BsPixelUtil.cpp

@@ -5,7 +5,7 @@
 #include "BsColor.h"
 #include "BsMath.h"
 #include "BsException.h"
-#include <nvtt.h>
+#include <nvtt/nvtt.h>
 
 namespace BansheeEngine 
 {

+ 3 - 3
Source/BansheeCore/Source/BsProfilerCPU.cpp

@@ -69,8 +69,8 @@ namespace BansheeEngine
 	inline UINT64 ProfilerCPU::TimerPrecise::getNumCycles() 
 	{
 #if BS_COMPILER == BS_COMPILER_GNUC
-		int a = 0;
-		int b[4];
+		unsigned int a = 0;
+		unsigned int b[4];
 		__get_cpuid(a, &b[0], &b[1], &b[2], &b[3]);
 
 #if BS_ARCH_TYPE == BS_ARCHITECTURE_x86_64
@@ -1016,4 +1016,4 @@ namespace BansheeEngine
 	{
 		return ProfilerCPU::instance();
 	}
-}
+}

+ 11 - 0
Source/BansheeUtility/Include/BsPath.h

@@ -172,6 +172,17 @@ namespace BansheeEngine
 		 */
 		String toString(PathType type = PathType::Default) const;
 
+		/**
+		 * Converts the path to either a string or a wstring, doing The Right Thing for the current platform.
+         *
+         * This method is equivalent to toWString() on Windows, and to toString() elsewhere.
+		 */
+#if BS_PLATFORM == BS_PLATFORM_WIN32
+		WString toPlatformString() const { return toWString(); }
+#else
+		String toPlatformString() const { return toString(); }
+#endif
+
 		/** Checks is the path a directory (contains no file-name). */
 		bool isDirectory() const { return mFilename.empty(); }
 

+ 2 - 1
Source/BansheeUtility/Include/BsVectorNI.h

@@ -3,6 +3,7 @@
 #pragma once
 
 #include "BsPrerequisitesUtil.h"
+#include "BsVector2I.h"
 
 namespace BansheeEngine
 {
@@ -68,4 +69,4 @@ namespace BansheeEngine
 
 	typedef VectorNI<3> Vector3I;
 	typedef VectorNI<4> Vector4I;
-}
+}

+ 2 - 2
Source/BansheeUtility/Source/BsFileSerializer.cpp

@@ -23,7 +23,7 @@ namespace BansheeEngine
 		if (!FileSystem::exists(parentDir))
 			FileSystem::createDir(parentDir);
 
-		mOutputStream.open(fileLocation.toWString().c_str(), std::ios::out | std::ios::binary);
+		mOutputStream.open(fileLocation.toPlatformString().c_str(), std::ios::out | std::ios::binary);
 		if (mOutputStream.fail())
 		{
 			LOGWRN("Failed to save file: \"" + fileLocation.toString() + "\". Error: " + strerror(errno) + ".");
@@ -100,4 +100,4 @@ namespace BansheeEngine
 		mInputStream->read(&objectSize, sizeof(objectSize));
 		mInputStream->skip(objectSize);
 	}
-}
+}