Ver código fonte

Fixed GpuResourceData assignment so ownership is not incorrectly transfered
Fixed Mono unloading so it doesn't crash

Marko Pintera 11 anos atrás
pai
commit
644f28f7db

+ 1 - 0
BansheeEngine/Include/BsBuiltinResources.h

@@ -14,6 +14,7 @@ namespace BansheeEngine
 	{
 	public:
 		BuiltinResources();
+		~BuiltinResources();
 
 		const GUISkin& getSkin() const { return mSkin; }
 

+ 14 - 0
BansheeEngine/Source/BsBuiltinResources.cpp

@@ -110,6 +110,20 @@ namespace BansheeEngine
 	const Vector2I BuiltinResources::CursorSizeNWSEHotspot = Vector2I(15, 15);
 	const Vector2I BuiltinResources::CursorSizeWEHotspot = Vector2I(15, 15);
 
+	BuiltinResources::~BuiltinResources()
+	{
+		mCursorArrow = nullptr;
+		mCursorArrowDrag = nullptr;
+		mCursorArrowLeftRight = nullptr;
+		mCursorIBeam = nullptr;
+		mCursorDeny = nullptr;
+		mCursorWait = nullptr;
+		mCursorSizeNESW = nullptr;
+		mCursorSizeNS = nullptr;
+		mCursorSizeNWSE = nullptr;
+		mCursorSizeWE = nullptr;
+	}
+
 	BuiltinResources::BuiltinResources()
 	{
 		// TODO - Normally I want to load this from some file

+ 5 - 3
BansheeMono/Source/BsMonoManager.cpp

@@ -23,7 +23,7 @@ namespace BansheeEngine
 	{
 		for(auto& entry : mAssemblies)
 		{
-			unloadAssembly(*entry.second);
+			unloadAssembly(*entry.second); 
 			cm_delete(entry.second);
 		}
 
@@ -105,8 +105,10 @@ namespace BansheeEngine
 		::MonoAssembly* monoAssembly = assembly.mMonoAssembly;
 		assembly.unload();
 
-		if(monoAssembly)
-			mono_assembly_close(monoAssembly);
+		// TODO: Not calling this because it crashed if called before domain was unloaded. Try calling
+		// it after. I'm not sure if its even necessary to call it.
+		//if(monoAssembly)
+			//mono_assembly_close(monoAssembly);
 	}
 
 	MonoAssembly* MonoManager::getAssembly(const String& name) const

+ 0 - 5
BoostPort.txt

@@ -1,10 +1,5 @@
  - Ability to construct Module using startUp without having to do allocation outside of it
 
- REFACTOR GpuProgram
-  - Get rid of HighLevelGpuProgram and merge everything into GpuProgram if possible
-  - 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.
-
 DEBUG CODE in GLRenderSystem::beginDraw()
 
 		GLuint VAOID[1];

+ 2 - 0
CamelotCore/Include/CmGpuResourceData.h

@@ -26,6 +26,8 @@ namespace BansheeEngine
 		GpuResourceData(const GpuResourceData& copy);
 		virtual ~GpuResourceData();
 
+		GpuResourceData& operator=(const GpuResourceData& rhs);
+
 		/**
 		 * @brief	Returns pointer to the internal buffer.
 		 */

+ 1 - 0
CamelotCore/Include/CmPixelData.h

@@ -156,6 +156,7 @@ namespace BansheeEngine
     	}
 
 		PixelData(const PixelData& copy);
+		PixelData& operator=(const PixelData& rhs);
 
 		UINT32 getRowPitch() const { return mRowPitch; }
 		UINT32 getSlicePitch() const { return mSlicePitch; }

+ 9 - 0
CamelotCore/Source/CmGpuResourceData.cpp

@@ -23,6 +23,15 @@ namespace BansheeEngine
 		freeInternalBuffer();
 	}
 
+	GpuResourceData& GpuResourceData::operator=(const GpuResourceData& rhs)
+	{
+		mData = rhs.mData;
+		mLocked = rhs.mLocked; // TODO - This should be shared by all copies pointing to the same data?
+		mOwnsData = false;
+
+		return *this;
+	}
+
 	UINT8* GpuResourceData::getData() const
 	{
 #if !CM_FORCE_SINGLETHREADED_RENDERING

+ 12 - 0
CamelotCore/Source/CmPixelData.cpp

@@ -13,6 +13,18 @@ namespace BansheeEngine
 		mExtents = copy.mExtents;
 	}
 
+	PixelData& PixelData::operator=(const PixelData& rhs)
+	{
+		GpuResourceData::operator= (rhs);
+
+		mFormat = rhs.mFormat;
+		mRowPitch = rhs.mRowPitch;
+		mSlicePitch = rhs.mSlicePitch;
+		mExtents = rhs.mExtents;
+
+		return *this;
+	}
+
 	UINT32 PixelData::getInternalBufferSize()
 	{
 		return PixelUtil::getMemorySize(getWidth(), getHeight(), getDepth(), getFormat());

+ 1 - 0
SBansheeEngine/Source/BsScriptObject.cpp

@@ -18,6 +18,7 @@ namespace BansheeEngine
 
 	void ScriptObjectBase::_onManagedInstanceDeleted()
 	{
+		mManagedInstance = nullptr;
 		cm_delete(this);
 	}
 }