mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
vulkan: determine correct supported api version
This commit is contained in:
@@ -82,7 +82,7 @@ Graphics::Graphics()
|
||||
|
||||
volkInitializeCustom((PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr());
|
||||
|
||||
vulkanApiVersion = volkGetInstanceVersion();
|
||||
vulkanApiVersion = Vulkan::getSupportedVulkanApiVersion(volkGetInstanceVersion());
|
||||
}
|
||||
|
||||
Graphics::~Graphics()
|
||||
|
||||
@@ -275,20 +275,6 @@ VkPipeline Shader::getComputePipeline() const
|
||||
return computePipeline;
|
||||
}
|
||||
|
||||
static VkDescriptorImageInfo *createDescriptorImageInfo(graphics::Texture *texture, bool sampler)
|
||||
{
|
||||
auto vkTexture = (Texture*)texture;
|
||||
|
||||
auto imageInfo = new VkDescriptorImageInfo();
|
||||
|
||||
imageInfo->imageLayout = vkTexture->getImageLayout();
|
||||
imageInfo->imageView = (VkImageView)vkTexture->getRenderTargetHandle();
|
||||
if (sampler)
|
||||
imageInfo->sampler = (VkSampler)vkTexture->getSamplerHandle();
|
||||
|
||||
return imageInfo;
|
||||
}
|
||||
|
||||
void Shader::newFrame(uint32_t frameIndex)
|
||||
{
|
||||
currentFrame = frameIndex;
|
||||
|
||||
@@ -58,6 +58,24 @@ int Vulkan::getVsync()
|
||||
return vsync;
|
||||
}
|
||||
|
||||
uint32_t Vulkan::getSupportedVulkanApiVersion(uint32_t suggested)
|
||||
{
|
||||
#ifdef VK_VERSION_1_3
|
||||
if (suggested >= VK_API_VERSION_1_3)
|
||||
return VK_API_VERSION_1_3;
|
||||
#endif
|
||||
#ifdef VK_VERSION_1_2
|
||||
if (suggested >= VK_API_VERSION_1_2)
|
||||
return VK_API_VERSION_1_2;
|
||||
#endif
|
||||
#ifdef VK_VERSION_1_1
|
||||
if (suggested >= VK_API_VERSION_1_1)
|
||||
return VK_API_VERSION_1_1;
|
||||
#endif
|
||||
|
||||
return VK_API_VERSION_1_0;
|
||||
}
|
||||
|
||||
VkFormat Vulkan::getVulkanVertexFormat(DataFormat format)
|
||||
{
|
||||
switch (format)
|
||||
|
||||
@@ -59,6 +59,7 @@ public:
|
||||
static void setVsync(int vsync);
|
||||
static int getVsync();
|
||||
|
||||
static uint32_t getSupportedVulkanApiVersion(uint32_t suggested);
|
||||
static VkFormat getVulkanVertexFormat(DataFormat format);
|
||||
static TextureFormat getTextureFormat(PixelFormat);
|
||||
static std::string getVendorName(uint32_t vendorId);
|
||||
|
||||
Reference in New Issue
Block a user