mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 07:12:36 +00:00
- fall back to linear if tiling is not supported by the device
This commit is contained in:
parent
9861642fcc
commit
0a6d77a861
3 changed files with 26 additions and 3 deletions
|
@ -42,6 +42,14 @@ void VkRenderPassManager::BeginFrame()
|
||||||
|
|
||||||
builder.setFormat(VK_FORMAT_D24_UNORM_S8_UINT);
|
builder.setFormat(VK_FORMAT_D24_UNORM_S8_UINT);
|
||||||
builder.setUsage(VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT);
|
builder.setUsage(VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||||
|
if (!builder.isFormatSupported(fb->device))
|
||||||
|
{
|
||||||
|
builder.setLinearTiling();
|
||||||
|
if (!builder.isFormatSupported(fb->device))
|
||||||
|
{
|
||||||
|
I_FatalError("This device does not support VK_FORMAT_D24_UNORM_S8_UINT.");
|
||||||
|
}
|
||||||
|
}
|
||||||
SceneDepthStencil = builder.create(fb->device);
|
SceneDepthStencil = builder.create(fb->device);
|
||||||
|
|
||||||
ImageViewBuilder viewbuilder;
|
ImageViewBuilder viewbuilder;
|
||||||
|
|
|
@ -43,6 +43,8 @@ public:
|
||||||
void setUsage(VkImageUsageFlags imageUsage, VmaMemoryUsage memoryUsage = VMA_MEMORY_USAGE_GPU_ONLY, VmaAllocationCreateFlags allocFlags = 0);
|
void setUsage(VkImageUsageFlags imageUsage, VmaMemoryUsage memoryUsage = VMA_MEMORY_USAGE_GPU_ONLY, VmaAllocationCreateFlags allocFlags = 0);
|
||||||
void setLinearTiling();
|
void setLinearTiling();
|
||||||
|
|
||||||
|
bool isFormatSupported(VulkanDevice *device);
|
||||||
|
|
||||||
std::unique_ptr<VulkanImage> create(VulkanDevice *device);
|
std::unique_ptr<VulkanImage> create(VulkanDevice *device);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -356,6 +358,20 @@ inline void ImageBuilder::setUsage(VkImageUsageFlags usage, VmaMemoryUsage memor
|
||||||
allocInfo.flags = allocFlags;
|
allocInfo.flags = allocFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool ImageBuilder::isFormatSupported(VulkanDevice *device)
|
||||||
|
{
|
||||||
|
VkImageFormatProperties properties = { };
|
||||||
|
VkResult result = vkGetPhysicalDeviceImageFormatProperties(device->physicalDevice, imageInfo.format, imageInfo.imageType, imageInfo.tiling, imageInfo.usage, imageInfo.flags, &properties);
|
||||||
|
if (result != VK_SUCCESS) return false;
|
||||||
|
if (imageInfo.extent.width > properties.maxExtent.width) return false;
|
||||||
|
if (imageInfo.extent.height > properties.maxExtent.height) return false;
|
||||||
|
if (imageInfo.extent.depth > properties.maxExtent.depth) return false;
|
||||||
|
if (imageInfo.mipLevels > properties.maxMipLevels) return false;
|
||||||
|
if (imageInfo.arrayLayers > properties.maxArrayLayers) return false;
|
||||||
|
if ((imageInfo.samples & properties.sampleCounts) != imageInfo.samples) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
inline std::unique_ptr<VulkanImage> ImageBuilder::create(VulkanDevice *device)
|
inline std::unique_ptr<VulkanImage> ImageBuilder::create(VulkanDevice *device)
|
||||||
{
|
{
|
||||||
VkImage image;
|
VkImage image;
|
||||||
|
@ -715,7 +731,6 @@ inline GraphicsPipelineBuilder::GraphicsPipelineBuilder()
|
||||||
colorBlending.blendConstants[2] = 0.0f;
|
colorBlending.blendConstants[2] = 0.0f;
|
||||||
colorBlending.blendConstants[3] = 0.0f;
|
colorBlending.blendConstants[3] = 0.0f;
|
||||||
|
|
||||||
VkPipelineDynamicStateCreateInfo dynamicState = {};
|
|
||||||
dynamicState.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
|
dynamicState.sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,8 @@ public:
|
||||||
VkPhysicalDeviceProperties deviceProperties;
|
VkPhysicalDeviceProperties deviceProperties;
|
||||||
VkPhysicalDeviceFeatures deviceFeatures;
|
VkPhysicalDeviceFeatures deviceFeatures;
|
||||||
|
|
||||||
|
VkPhysicalDevice physicalDevice = {};
|
||||||
|
|
||||||
uint32_t findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties);
|
uint32_t findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -67,8 +69,6 @@ private:
|
||||||
VkInstance instance = nullptr;
|
VkInstance instance = nullptr;
|
||||||
VkSurfaceKHR surface = 0;
|
VkSurfaceKHR surface = 0;
|
||||||
|
|
||||||
VkPhysicalDevice physicalDevice = {};
|
|
||||||
|
|
||||||
VkQueue presentQueue = nullptr;
|
VkQueue presentQueue = nullptr;
|
||||||
|
|
||||||
VulkanDevice(const VulkanDevice &) = delete;
|
VulkanDevice(const VulkanDevice &) = delete;
|
||||||
|
|
Loading…
Reference in a new issue