浏览代码

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

Panagiotis Christopoulos Charitos 8 年之前
父节点
当前提交
5aea3ae2d6
共有 3 个文件被更改,包括 3 次插入5 次删除
  1. 1 1
      src/anki/core/NativeWindowSdl.cpp
  2. 1 1
      src/anki/gr/vulkan/CommandBufferImpl.cpp
  3. 1 3
      src/anki/gr/vulkan/TextureImpl.h

+ 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(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;
 	}
 #endif

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

@@ -695,7 +695,7 @@ void CommandBufferImpl::copyBufferToTextureViewInternal(
 		// Copy
 		VkBufferImageCopy region;
 		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.mipLevel = surf.m_level;
 		region.imageOffset = {0, 0, 0};

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

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