mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-09 01:01:05 +00:00
Merge branch 'lightmaps2' of https://github.com/dpjudas/gzdoom into lightmaps2
This commit is contained in:
commit
2ed99c735d
5 changed files with 11 additions and 9 deletions
|
@ -449,7 +449,7 @@ inline std::unique_ptr<VulkanImage> ImageBuilder::create(VulkanDevice *device, V
|
|||
*allocatedBytes = allocatedInfo.size;
|
||||
}
|
||||
|
||||
return std::make_unique<VulkanImage>(device, image, allocation, imageInfo.extent.width, imageInfo.extent.height, imageInfo.mipLevels);
|
||||
return std::make_unique<VulkanImage>(device, image, allocation, imageInfo.extent.width, imageInfo.extent.height, imageInfo.mipLevels, imageInfo.arrayLayers);
|
||||
}
|
||||
|
||||
inline std::unique_ptr<VulkanImage> ImageBuilder::tryCreate(VulkanDevice *device)
|
||||
|
@ -461,7 +461,7 @@ inline std::unique_ptr<VulkanImage> ImageBuilder::tryCreate(VulkanDevice *device
|
|||
if (result != VK_SUCCESS)
|
||||
return nullptr;
|
||||
|
||||
return std::make_unique<VulkanImage>(device, image, allocation, imageInfo.extent.width, imageInfo.extent.height, imageInfo.mipLevels);
|
||||
return std::make_unique<VulkanImage>(device, image, allocation, imageInfo.extent.width, imageInfo.extent.height, imageInfo.mipLevels, imageInfo.arrayLayers);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -487,6 +487,7 @@ inline void ImageViewBuilder::setImage(VulkanImage *image, VkFormat format, VkIm
|
|||
viewInfo.format = format;
|
||||
viewInfo.subresourceRange.levelCount = image->mipLevels;
|
||||
viewInfo.subresourceRange.aspectMask = aspectMask;
|
||||
viewInfo.subresourceRange.layerCount = image->layerCount;
|
||||
}
|
||||
|
||||
inline std::unique_ptr<VulkanImageView> ImageViewBuilder::create(VulkanDevice *device)
|
||||
|
|
|
@ -635,7 +635,7 @@ void VulkanFrameBuffer::InitLightmap(FLevelLocals* Level)
|
|||
stagingBuffer->Unmap();
|
||||
|
||||
VkImageTransition imageTransition;
|
||||
imageTransition.addImage(&lightmap, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, true);
|
||||
imageTransition.addImage(&lightmap, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, true, 0, count);
|
||||
imageTransition.execute(cmdbuffer);
|
||||
|
||||
VkBufferImageCopy region = {};
|
||||
|
@ -647,7 +647,7 @@ void VulkanFrameBuffer::InitLightmap(FLevelLocals* Level)
|
|||
cmdbuffer->copyBufferToImage(stagingBuffer->buffer, lightmap.Image->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion);
|
||||
|
||||
VkImageTransition barrier;
|
||||
barrier.addImage(&lightmap, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, true);
|
||||
barrier.addImage(&lightmap, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, false, 0, count);
|
||||
barrier.execute(cmdbuffer);
|
||||
|
||||
FrameTextureUpload.Buffers.push_back(std::move(stagingBuffer));
|
||||
|
|
|
@ -79,7 +79,7 @@ private:
|
|||
class VulkanImage
|
||||
{
|
||||
public:
|
||||
VulkanImage(VulkanDevice *device, VkImage image, VmaAllocation allocation, int width, int height, int mipLevels);
|
||||
VulkanImage(VulkanDevice *device, VkImage image, VmaAllocation allocation, int width, int height, int mipLevels, int layerCount);
|
||||
~VulkanImage();
|
||||
|
||||
void SetDebugName(const char *name) { device->SetDebugObjectName(name, (uint64_t)image, VK_OBJECT_TYPE_IMAGE); }
|
||||
|
@ -88,6 +88,7 @@ public:
|
|||
int width = 0;
|
||||
int height = 0;
|
||||
int mipLevels = 1;
|
||||
int layerCount = 1;
|
||||
|
||||
void *Map(size_t offset, size_t size);
|
||||
void Unmap();
|
||||
|
@ -989,7 +990,7 @@ inline VulkanFramebuffer::~VulkanFramebuffer()
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
inline VulkanImage::VulkanImage(VulkanDevice *device, VkImage image, VmaAllocation allocation, int width, int height, int mipLevels) : image(image), width(width), height(height), mipLevels(mipLevels), device(device), allocation(allocation)
|
||||
inline VulkanImage::VulkanImage(VulkanDevice *device, VkImage image, VmaAllocation allocation, int width, int height, int mipLevels, int layerCount) : image(image), width(width), height(height), mipLevels(mipLevels), layerCount(layerCount), device(device), allocation(allocation)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "vk_imagetransition.h"
|
||||
|
||||
void VkImageTransition::addImage(VkTextureImage *image, VkImageLayout targetLayout, bool undefinedSrcLayout)
|
||||
void VkImageTransition::addImage(VkTextureImage *image, VkImageLayout targetLayout, bool undefinedSrcLayout, int baseMipLevel, int levelCount)
|
||||
{
|
||||
if (image->Layout == targetLayout)
|
||||
return;
|
||||
|
@ -91,7 +91,7 @@ void VkImageTransition::addImage(VkTextureImage *image, VkImageLayout targetLayo
|
|||
I_FatalError("Unimplemented dst image layout transition\n");
|
||||
}
|
||||
|
||||
barrier.addImage(image->Image.get(), undefinedSrcLayout ? VK_IMAGE_LAYOUT_UNDEFINED : image->Layout, targetLayout, srcAccess, dstAccess, aspectMask);
|
||||
barrier.addImage(image->Image.get(), undefinedSrcLayout ? VK_IMAGE_LAYOUT_UNDEFINED : image->Layout, targetLayout, srcAccess, dstAccess, aspectMask, baseMipLevel, levelCount);
|
||||
needbarrier = true;
|
||||
image->Layout = targetLayout;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
class VkImageTransition
|
||||
{
|
||||
public:
|
||||
void addImage(VkTextureImage *image, VkImageLayout targetLayout, bool undefinedSrcLayout);
|
||||
void addImage(VkTextureImage *image, VkImageLayout targetLayout, bool undefinedSrcLayout, int baseMipLevel = 0, int levelCount = 1);
|
||||
void execute(VulkanCommandBuffer *cmdbuffer);
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue