add support for multisample count
This commit is contained in:
@@ -22,8 +22,6 @@ gnReturnCode createOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHan
|
||||
.samplerAnisotropy = VK_TRUE
|
||||
};
|
||||
|
||||
|
||||
|
||||
VkDeviceCreateInfo deviceCreateInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
|
||||
.queueCreateInfoCount = deviceInfo.queueInfoCount,
|
||||
|
@@ -3,6 +3,23 @@
|
||||
#include <output_device/vulkan_device_extensions.h>
|
||||
#include <vulkan_surface/vulkan_surface.h>
|
||||
|
||||
gnMultisampleCountFlags getVulkanSampleCount(VkPhysicalDevice device) {
|
||||
VkPhysicalDeviceProperties physicalDeviceProperties;
|
||||
vkGetPhysicalDeviceProperties(device, &physicalDeviceProperties);
|
||||
VkSampleCountFlags counts = physicalDeviceProperties.limits.framebufferColorSampleCounts & physicalDeviceProperties.limits.framebufferDepthSampleCounts;
|
||||
|
||||
gnMultisampleCountFlags sampleCount = GN_SAMPLES_NONE;
|
||||
if (counts & VK_SAMPLE_COUNT_64_BIT) { sampleCount |= GN_SAMPLE_BIT_64; }
|
||||
if (counts & VK_SAMPLE_COUNT_32_BIT) { sampleCount |= GN_SAMPLE_BIT_32; }
|
||||
if (counts & VK_SAMPLE_COUNT_16_BIT) { sampleCount |= GN_SAMPLE_BIT_16; }
|
||||
if (counts & VK_SAMPLE_COUNT_8_BIT) { sampleCount |= GN_SAMPLE_BIT_8; }
|
||||
if (counts & VK_SAMPLE_COUNT_4_BIT) { sampleCount |= GN_SAMPLE_BIT_4; }
|
||||
if (counts & VK_SAMPLE_COUNT_2_BIT) { sampleCount |= GN_SAMPLE_BIT_2; }
|
||||
if (counts & VK_SAMPLE_COUNT_1_BIT) { sampleCount |= GN_SAMPLE_BIT_1; }
|
||||
|
||||
return sampleCount;
|
||||
}
|
||||
|
||||
gnPhysicalDevice* getPhysicalDevices(gnInstanceHandle instance, uint32_t* deviceCount) {
|
||||
vkEnumeratePhysicalDevices(instance->instance->vk_instance, deviceCount, NULL);
|
||||
if (deviceCount == 0)
|
||||
@@ -43,6 +60,8 @@ gnPhysicalDevice* getPhysicalDevices(gnInstanceHandle instance, uint32_t* device
|
||||
if (queueFamilies[i].queueFlags & VK_QUEUE_SPARSE_BINDING_BIT) finalQueueType |= GN_QUEUE_SPARSE_BINDING;
|
||||
outputDevices[i].queueProperties.queueProperties[i].queueType = finalQueueType;
|
||||
}
|
||||
|
||||
outputDevices[i].features.avaliableSamples = getVulkanSampleCount(physicalDevices[i]);
|
||||
}
|
||||
free(physicalDevices);
|
||||
|
||||
|
@@ -7,13 +7,24 @@ typedef enum gnDeviceType {
|
||||
GN_DEDICATED_DEVICE, GN_INTEGRATED_DEVICE, GN_EXTERNAL_DEVICE
|
||||
} gnDeviceType;
|
||||
|
||||
typedef enum gnMultisampleCountFlags {
|
||||
GN_SAMPLES_NONE = 0,
|
||||
GN_SAMPLE_BIT_1 = 1 << 0, // 0x01
|
||||
GN_SAMPLE_BIT_2 = 1 << 1, // 0x02
|
||||
GN_SAMPLE_BIT_4 = 1 << 2, // 0x04
|
||||
GN_SAMPLE_BIT_8 = 1 << 3, // 0x08
|
||||
GN_SAMPLE_BIT_16 = 1 << 4, // 0x10
|
||||
GN_SAMPLE_BIT_32 = 1 << 5, // 0x20
|
||||
GN_SAMPLE_BIT_64 = 1 << 6, // 0x40
|
||||
} gnMultisampleCountFlags;
|
||||
|
||||
typedef struct gnPhysicalDeviceProperties {
|
||||
gnString name;
|
||||
gnDeviceType deviceType;
|
||||
} gnPhysicalDeviceProperties;
|
||||
|
||||
typedef struct gnPhysicalDeviceFeatures {
|
||||
gnBool supportsGeometryShader;
|
||||
gnMultisampleCountFlags avaliableSamples;
|
||||
} gnPhysicalDeviceFeatures;
|
||||
|
||||
typedef enum gnQueueTypeFlags {
|
||||
|
Reference in New Issue
Block a user