Quellcode durchsuchen

Properly initialize a texture created with initial pixel data

BearishSun vor 9 Jahren
Ursprung
Commit
d2aa2bd074

+ 4 - 1
Source/BansheeCore/Source/BsTexture.cpp

@@ -561,7 +561,10 @@ namespace bs
 		desc.usage = usage;
 		desc.hwGamma = hwGammaCorrection;
 
-		return TextureManager::instance().createTextureInternal(desc, pixelData, deviceMask);
+		SPtr<Texture> newTex = TextureManager::instance().createTextureInternal(desc, pixelData, deviceMask);
+		newTex->initialize();
+
+		return newTex;
 	}
 	}
 }

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

@@ -141,10 +141,10 @@ namespace bs
 
 	SPtr<Texture> TextureManager::createTexture(const TEXTURE_DESC& desc, GpuDeviceFlags deviceMask)
 	{
-		SPtr<Texture> newRT = createTextureInternal(desc, nullptr, deviceMask);
-		newRT->initialize();
+		SPtr<Texture> newTex = createTextureInternal(desc, nullptr, deviceMask);
+		newTex->initialize();
 
-		return newRT;
+		return newTex;
 	}
 
 	SPtr<RenderTexture> TextureManager::createRenderTexture(const RENDER_TEXTURE_DESC& desc,