Experimental shared memory texture handling
This commit is contained in:
@@ -35,14 +35,22 @@ namespace OpenVulkano::Vulkan
|
||||
cmdBuffer.pipelineBarrier(/*VulkanUtils::GetPipelineStageForLayout(oldLayout)*/vk::PipelineStageFlagBits::eTopOfPipe, /*VulkanUtils::GetPipelineStageForLayout(newLayout)*/ vk::PipelineStageFlagBits::eTransfer, {}, nullptr, nullptr, imgMemBarrier);
|
||||
}
|
||||
|
||||
void Image::Init(const Device* device, const DataFormat& format, const vk::Extent3D& resolution)
|
||||
void Image::Init(const Device* device, const DataFormat& format, const vk::Extent3D& resolution, const vk::MemoryPropertyFlags& memoryPropertyFlags)
|
||||
{
|
||||
vk::ImageCreateInfo imgCreateInfo { {}, vk::ImageType::e2D, format, resolution, 1, 1 };
|
||||
|
||||
imgCreateInfo.usage = vk::ImageUsageFlagBits::eTransferDst | vk::ImageUsageFlagBits::eSampled;
|
||||
imgCreateInfo.tiling = vk::ImageTiling::eOptimal;
|
||||
if (memoryPropertyFlags & vk::MemoryPropertyFlagBits::eHostVisible)
|
||||
{
|
||||
imgCreateInfo.tiling = vk::ImageTiling::eLinear;
|
||||
imgCreateInfo.initialLayout = vk::ImageLayout::ePreinitialized;
|
||||
}
|
||||
else
|
||||
{
|
||||
imgCreateInfo.tiling = vk::ImageTiling::eOptimal;
|
||||
imgCreateInfo.initialLayout = vk::ImageLayout::eUndefined;
|
||||
}
|
||||
imgCreateInfo.sharingMode = vk::SharingMode::eExclusive;
|
||||
imgCreateInfo.initialLayout = vk::ImageLayout::eUndefined;
|
||||
|
||||
vk::ImageViewCreateInfo imgViewCreateInfo { {}, image, vk::ImageViewType::e2D, imgCreateInfo.format };
|
||||
imgViewCreateInfo.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor;
|
||||
@@ -51,7 +59,7 @@ namespace OpenVulkano::Vulkan
|
||||
imgViewCreateInfo.subresourceRange.baseArrayLayer = 0;
|
||||
imgViewCreateInfo.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS;
|
||||
|
||||
Init(device, imgCreateInfo, imgViewCreateInfo);
|
||||
Init(device, imgCreateInfo, imgViewCreateInfo, true, memoryPropertyFlags);
|
||||
}
|
||||
|
||||
void Image::Close()
|
||||
|
||||
Reference in New Issue
Block a user