From cf099946a1df81060b25f0717a04a4f9fefaad7e Mon Sep 17 00:00:00 2001 From: niki Date: Sun, 18 Sep 2022 00:18:32 +0200 Subject: [PATCH] vulkan: fix depth stencil textures --- src/modules/graphics/vulkan/Buffer.cpp | 26 +++++++- src/modules/graphics/vulkan/Buffer.h | 20 ++++++ src/modules/graphics/vulkan/Graphics.cpp | 36 ++++++++--- src/modules/graphics/vulkan/Graphics.h | 21 ++++++ .../graphics/vulkan/GraphicsReadback.cpp | 20 ++++++ .../graphics/vulkan/GraphicsReadback.h | 20 ++++++ src/modules/graphics/vulkan/Shader.cpp | 20 ++++++ src/modules/graphics/vulkan/Shader.h | 20 ++++++ src/modules/graphics/vulkan/ShaderStage.cpp | 20 ++++++ src/modules/graphics/vulkan/ShaderStage.h | 20 ++++++ src/modules/graphics/vulkan/StreamBuffer.cpp | 21 +++++- src/modules/graphics/vulkan/StreamBuffer.h | 22 ++++++- src/modules/graphics/vulkan/Texture.cpp | 64 +++++++++++++------ src/modules/graphics/vulkan/Texture.h | 21 ++++++ src/modules/graphics/vulkan/Vulkan.cpp | 20 ++++++ src/modules/graphics/vulkan/Vulkan.h | 20 ++++++ src/modules/graphics/vulkan/VulkanWrapper.h | 20 ++++++ 17 files changed, 377 insertions(+), 34 deletions(-) diff --git a/src/modules/graphics/vulkan/Buffer.cpp b/src/modules/graphics/vulkan/Buffer.cpp index c724e8f21..391a758d3 100644 --- a/src/modules/graphics/vulkan/Buffer.cpp +++ b/src/modules/graphics/vulkan/Buffer.cpp @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #include "Buffer.h" #include "Graphics.h" @@ -107,15 +127,15 @@ ptrdiff_t Buffer::getTexelBufferHandle() const return (ptrdiff_t) bufferView; } -void* Buffer::map(MapType map, size_t offset, size_t size) +void *Buffer::map(MapType map, size_t offset, size_t size) { - char* data = (char*)allocInfo.pMappedData; + char *data = (char*)allocInfo.pMappedData; return (void*) (data + offset); } bool Buffer::fill(size_t offset, size_t size, const void *data) { - void* dst = (void*)((char*)allocInfo.pMappedData + offset); + void *dst = (void*)((char*)allocInfo.pMappedData + offset); memcpy(dst, data, size); return true; } diff --git a/src/modules/graphics/vulkan/Buffer.h b/src/modules/graphics/vulkan/Buffer.h index 148b300b4..1a834a10e 100644 --- a/src/modules/graphics/vulkan/Buffer.h +++ b/src/modules/graphics/vulkan/Buffer.h @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #pragma once #include "graphics/Buffer.h" diff --git a/src/modules/graphics/vulkan/Graphics.cpp b/src/modules/graphics/vulkan/Graphics.cpp index f4a24694d..8edccc10f 100644 --- a/src/modules/graphics/vulkan/Graphics.cpp +++ b/src/modules/graphics/vulkan/Graphics.cpp @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #include "common/Exception.h" #include "common/pixelformat.h" #include "common/version.h" @@ -28,20 +48,14 @@ namespace graphics namespace vulkan { -const std::vector validationLayers = { +static const std::vector validationLayers = { "VK_LAYER_KHRONOS_validation" }; -const std::vector deviceExtensions = { +static const std::vector deviceExtensions = { VK_KHR_SWAPCHAIN_EXTENSION_NAME, }; -#ifdef NDEBUG -constexpr bool enableValidationLayers = false; -#else -constexpr bool enableValidationLayers = true; -#endif - constexpr int MAX_FRAMES_IN_FLIGHT = 2; const char *Graphics::getName() const @@ -67,6 +81,8 @@ Graphics::Graphics() volkInitializeCustom((PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr()); vulkanApiVersion = volkGetInstanceVersion(); + + enableValidationLayers = isDebugEnabled(); } Graphics::~Graphics() @@ -526,8 +542,8 @@ bool Graphics::setMode(void *context, int width, int height, int pixelwidth, int void Graphics::initCapabilities() { - // todo - capabilities.features[FEATURE_MULTI_RENDER_TARGET_FORMATS] = false; + // fixme: unsure what the first few features are for. + capabilities.features[FEATURE_MULTI_RENDER_TARGET_FORMATS] = true; capabilities.features[FEATURE_CLAMP_ZERO] = false; capabilities.features[FEATURE_CLAMP_ONE] = false; capabilities.features[FEATURE_BLEND_MINMAX] = false; diff --git a/src/modules/graphics/vulkan/Graphics.h b/src/modules/graphics/vulkan/Graphics.h index 936205a84..1042d31b0 100644 --- a/src/modules/graphics/vulkan/Graphics.h +++ b/src/modules/graphics/vulkan/Graphics.h @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #pragma once // löve @@ -371,6 +391,7 @@ private: VkSampler createSampler(const SamplerState &samplerState); uint32_t vulkanApiVersion = VK_VERSION_1_0; + bool enableValidationLayers = false; VkInstance instance = VK_NULL_HANDLE; VkPhysicalDevice physicalDevice = VK_NULL_HANDLE; int requestedMsaa = 0; diff --git a/src/modules/graphics/vulkan/GraphicsReadback.cpp b/src/modules/graphics/vulkan/GraphicsReadback.cpp index 30b567cb8..866352220 100644 --- a/src/modules/graphics/vulkan/GraphicsReadback.cpp +++ b/src/modules/graphics/vulkan/GraphicsReadback.cpp @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #include "GraphicsReadback.h" #include "Buffer.h" #include "Texture.h" diff --git a/src/modules/graphics/vulkan/GraphicsReadback.h b/src/modules/graphics/vulkan/GraphicsReadback.h index 702de7b78..4a933d4b7 100644 --- a/src/modules/graphics/vulkan/GraphicsReadback.h +++ b/src/modules/graphics/vulkan/GraphicsReadback.h @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #pragma once #include "graphics/GraphicsReadback.h" diff --git a/src/modules/graphics/vulkan/Shader.cpp b/src/modules/graphics/vulkan/Shader.cpp index b3299c8da..44c3243ea 100644 --- a/src/modules/graphics/vulkan/Shader.cpp +++ b/src/modules/graphics/vulkan/Shader.cpp @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #include "Shader.h" #include "Graphics.h" diff --git a/src/modules/graphics/vulkan/Shader.h b/src/modules/graphics/vulkan/Shader.h index b7de91b16..b9f17f62e 100644 --- a/src/modules/graphics/vulkan/Shader.h +++ b/src/modules/graphics/vulkan/Shader.h @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #pragma once // LÖVE diff --git a/src/modules/graphics/vulkan/ShaderStage.cpp b/src/modules/graphics/vulkan/ShaderStage.cpp index 650410412..a5725db78 100644 --- a/src/modules/graphics/vulkan/ShaderStage.cpp +++ b/src/modules/graphics/vulkan/ShaderStage.cpp @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #include "ShaderStage.h" #include "Graphics.h" diff --git a/src/modules/graphics/vulkan/ShaderStage.h b/src/modules/graphics/vulkan/ShaderStage.h index cf1b55a1e..1c1b58c00 100644 --- a/src/modules/graphics/vulkan/ShaderStage.h +++ b/src/modules/graphics/vulkan/ShaderStage.h @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #pragma once #include "graphics/ShaderStage.h" diff --git a/src/modules/graphics/vulkan/StreamBuffer.cpp b/src/modules/graphics/vulkan/StreamBuffer.cpp index 1e261b84a..d5dd2d528 100644 --- a/src/modules/graphics/vulkan/StreamBuffer.cpp +++ b/src/modules/graphics/vulkan/StreamBuffer.cpp @@ -1,5 +1,24 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #include "StreamBuffer.h" -#include "vulkan/vulkan.h" #include "Graphics.h" diff --git a/src/modules/graphics/vulkan/StreamBuffer.h b/src/modules/graphics/vulkan/StreamBuffer.h index 18e7b0202..821dce938 100644 --- a/src/modules/graphics/vulkan/StreamBuffer.h +++ b/src/modules/graphics/vulkan/StreamBuffer.h @@ -1,7 +1,27 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #pragma once #include "graphics/Volatile.h" -#include "modules/graphics/StreamBuffer.h" +#include "graphics/StreamBuffer.h" #include "graphics/Graphics.h" #include "VulkanWrapper.h" diff --git a/src/modules/graphics/vulkan/Texture.cpp b/src/modules/graphics/vulkan/Texture.cpp index 4a55a1646..41d9fa332 100644 --- a/src/modules/graphics/vulkan/Texture.cpp +++ b/src/modules/graphics/vulkan/Texture.cpp @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #include "Texture.h" #include "Graphics.h" #include "Vulkan.h" @@ -15,6 +35,7 @@ Texture::Texture(love::graphics::Graphics *gfx, const Settings &settings, const : love::graphics::Texture(gfx, settings, data) , vgfx(dynamic_cast(gfx)) , slices(settings.type) + , imageAspect(0) { if (data) slices = *data; @@ -27,6 +48,13 @@ bool Texture::loadVolatile() allocator = vgfx->getVmaAllocator(); device = vgfx->getDevice(); + if (isPixelFormatDepthStencil(format)) + imageAspect |= VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; + else if (isPixelFormatDepth(format)) + imageAspect |= VK_IMAGE_ASPECT_DEPTH_BIT; + else + imageAspect |= VK_IMAGE_ASPECT_COLOR_BIT; + auto vulkanFormat = Vulkan::getTextureFormat(format); VkImageUsageFlags usageFlags = @@ -35,17 +63,20 @@ bool Texture::loadVolatile() if (readable) { - usageFlags |= VK_IMAGE_USAGE_SAMPLED_BIT; + if (!isPixelFormatDepthStencil(format)) + usageFlags |= VK_IMAGE_USAGE_SAMPLED_BIT; - if (!isPixelFormatCompressed(format)) + if (!isPixelFormatCompressed(format) && !isPixelFormatDepthStencil(format)) usageFlags |= VK_IMAGE_USAGE_STORAGE_BIT; } - if (isPixelFormatDepthStencil(format) || isPixelFormatDepth(format)) - usageFlags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; - if (renderTarget) - usageFlags |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; + { + if (isPixelFormatDepthStencil(format)) + usageFlags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; + else + usageFlags |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; + } VkImageCreateFlags createFlags = 0; @@ -114,7 +145,7 @@ bool Texture::loadVolatile() for (int slice = 0; slice < sliceCount; slice++) { - auto* id = slices.get(slice, mip); + auto id = slices.get(slice, mip); if (id != nullptr) uploadImageData(id, mip, slice, 0, 0); } @@ -125,7 +156,7 @@ bool Texture::loadVolatile() createTextureImageView(); textureSampler = vgfx->getCachedSampler(samplerState); - if (mipmapCount > 1 && getMipmapsMode() != MIPMAPS_NONE) + if (!isPixelFormatDepthStencil(format) && mipmapCount > 1 && getMipmapsMode() != MIPMAPS_NONE) generateMipmaps(); if (renderTarget) @@ -142,7 +173,7 @@ bool Texture::loadVolatile() viewInfo.image = textureImage; viewInfo.viewType = Vulkan::getImageViewType(getTextureType()); viewInfo.format = vulkanFormat.internalFormat; - viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + viewInfo.subresourceRange.aspectMask = imageAspect; viewInfo.subresourceRange.baseMipLevel = mip; viewInfo.subresourceRange.levelCount = 1; viewInfo.subresourceRange.baseArrayLayer = slice; @@ -238,7 +269,7 @@ void Texture::createTextureImageView() viewInfo.image = textureImage; viewInfo.viewType = Vulkan::getImageViewType(getTextureType()); viewInfo.format = vulkanFormat.internalFormat; - viewInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + viewInfo.subresourceRange.aspectMask = imageAspect; viewInfo.subresourceRange.baseMipLevel = 0; viewInfo.subresourceRange.levelCount = getMipmapCount(); viewInfo.subresourceRange.baseArrayLayer = 0; @@ -257,12 +288,7 @@ void Texture::clear() auto commandBuffer = vgfx->getCommandBufferForDataTransfer(); VkImageSubresourceRange range{}; - if (isPixelFormatDepthStencil(format)) - range.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; - else if (isPixelFormatDepth(format)) - range.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT; - else - range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + range.aspectMask = imageAspect; range.baseMipLevel = 0; range.levelCount = VK_REMAINING_MIP_LEVELS; range.baseArrayLayer = 0; @@ -448,7 +474,7 @@ void Texture::uploadByteData(PixelFormat pixelformat, const void *data, size_t s else baseLayer = slice; - region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + region.imageSubresource.aspectMask = imageAspect; region.imageSubresource.mipLevel = level; region.imageSubresource.baseArrayLayer = baseLayer; region.imageSubresource.layerCount = 1; @@ -503,7 +529,7 @@ void Texture::copyFromBuffer(graphics::Buffer *source, size_t sourceoffset, int auto commandBuffer = vgfx->getCommandBufferForDataTransfer(); VkImageSubresourceLayers layers{}; - layers.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + layers.aspectMask = imageAspect; layers.mipLevel = mipmap; layers.baseArrayLayer = slice; layers.layerCount = 1; @@ -533,7 +559,7 @@ void Texture::copyToBuffer(graphics::Buffer *dest, int slice, int mipmap, const auto commandBuffer = vgfx->getCommandBufferForDataTransfer(); VkImageSubresourceLayers layers{}; - layers.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + layers.aspectMask = imageAspect; layers.mipLevel = mipmap; layers.baseArrayLayer = slice; layers.layerCount = 1; diff --git a/src/modules/graphics/vulkan/Texture.h b/src/modules/graphics/vulkan/Texture.h index 5c07dc727..95216cd8f 100644 --- a/src/modules/graphics/vulkan/Texture.h +++ b/src/modules/graphics/vulkan/Texture.h @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #pragma once #include "graphics/Texture.h" @@ -54,6 +74,7 @@ private: Graphics *vgfx = nullptr; VkDevice device = VK_NULL_HANDLE; + VkImageAspectFlags imageAspect; VmaAllocator allocator = VK_NULL_HANDLE; VkImage textureImage = VK_NULL_HANDLE; VkImageLayout imageLayout = VK_IMAGE_LAYOUT_UNDEFINED; diff --git a/src/modules/graphics/vulkan/Vulkan.cpp b/src/modules/graphics/vulkan/Vulkan.cpp index abc3f2312..bb726fa6f 100644 --- a/src/modules/graphics/vulkan/Vulkan.cpp +++ b/src/modules/graphics/vulkan/Vulkan.cpp @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #include "Vulkan.h" #include diff --git a/src/modules/graphics/vulkan/Vulkan.h b/src/modules/graphics/vulkan/Vulkan.h index 10e1d6c65..393faeb6d 100644 --- a/src/modules/graphics/vulkan/Vulkan.h +++ b/src/modules/graphics/vulkan/Vulkan.h @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #pragma once #include "graphics/Graphics.h" diff --git a/src/modules/graphics/vulkan/VulkanWrapper.h b/src/modules/graphics/vulkan/VulkanWrapper.h index 745a24697..8491435dc 100644 --- a/src/modules/graphics/vulkan/VulkanWrapper.h +++ b/src/modules/graphics/vulkan/VulkanWrapper.h @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2006-2022 LOVE Development Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + **/ + #pragma once #define VK_NO_PROTOTYPES