Browse Source

[BUGFIX] Fix a bug in copy buffer to texture method

Panagiotis Christopoulos Charitos 8 years ago
parent
commit
5aea3ae2d6

+ 1 - 1
src/anki/core/NativeWindowSdl.cpp

@@ -28,7 +28,7 @@ Error NativeWindow::init(NativeWindowInitInfo& init, HeapAllocator<U8>& alloc)
 #if ANKI_GR_BACKEND == ANKI_GR_BACKEND_VULKAN
 #if ANKI_GR_BACKEND == ANKI_GR_BACKEND_VULKAN
 	if(SDL_Vulkan_LoadLibrary(nullptr))
 	if(SDL_Vulkan_LoadLibrary(nullptr))
 	{
 	{
-		ANKI_CORE_LOGE("SDL_Vulkan_LoadLibrary() failed");
+		ANKI_CORE_LOGE("SDL_Vulkan_LoadLibrary() failed: %s", SDL_GetError());
 		return Error::FUNCTION_FAILED;
 		return Error::FUNCTION_FAILED;
 	}
 	}
 #endif
 #endif

+ 1 - 1
src/anki/gr/vulkan/CommandBufferImpl.cpp

@@ -695,7 +695,7 @@ void CommandBufferImpl::copyBufferToTextureViewInternal(
 		// Copy
 		// Copy
 		VkBufferImageCopy region;
 		VkBufferImageCopy region;
 		region.imageSubresource.aspectMask = aspect;
 		region.imageSubresource.aspectMask = aspect;
-		region.imageSubresource.baseArrayLayer = (is3D) ? tex.computeVkArrayLayer(surf) : tex.computeVkArrayLayer(vol);
+		region.imageSubresource.baseArrayLayer = (is3D) ? tex.computeVkArrayLayer(vol) : tex.computeVkArrayLayer(surf);
 		region.imageSubresource.layerCount = 1;
 		region.imageSubresource.layerCount = 1;
 		region.imageSubresource.mipLevel = surf.m_level;
 		region.imageSubresource.mipLevel = surf.m_level;
 		region.imageOffset = {0, 0, 0};
 		region.imageOffset = {0, 0, 0};

+ 1 - 3
src/anki/gr/vulkan/TextureImpl.h

@@ -69,9 +69,6 @@ public:
 		case TextureType::_2D:
 		case TextureType::_2D:
 			layer = 0;
 			layer = 0;
 			break;
 			break;
-		case TextureType::_3D:
-			layer = 0;
-			break;
 		case TextureType::CUBE:
 		case TextureType::CUBE:
 			layer = surf.m_face;
 			layer = surf.m_face;
 			break;
 			break;
@@ -90,6 +87,7 @@ public:
 
 
 	U computeVkArrayLayer(const TextureVolumeInfo& vol) const
 	U computeVkArrayLayer(const TextureVolumeInfo& vol) const
 	{
 	{
+		ANKI_ASSERT(m_texType == TextureType::_3D);
 		return 0;
 		return 0;
 	}
 	}