mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +00:00
[vulkan] Switch to using vkGetPhysicalDeviceProperties2
Necessary for getting VkPhysicalDeviceMultiviewProperties (and others, but not at this time).
This commit is contained in:
parent
e5932d1f92
commit
f04108ae3e
8 changed files with 23 additions and 12 deletions
|
@ -22,7 +22,7 @@ GLOBAL_LEVEL_VULKAN_FUNCTION (vkCreateInstance)
|
|||
#endif
|
||||
|
||||
INSTANCE_LEVEL_VULKAN_FUNCTION (vkEnumeratePhysicalDevices)
|
||||
INSTANCE_LEVEL_VULKAN_FUNCTION (vkGetPhysicalDeviceProperties)
|
||||
INSTANCE_LEVEL_VULKAN_FUNCTION (vkGetPhysicalDeviceProperties2)
|
||||
INSTANCE_LEVEL_VULKAN_FUNCTION (vkGetPhysicalDeviceFeatures)
|
||||
INSTANCE_LEVEL_VULKAN_FUNCTION (vkGetPhysicalDeviceQueueFamilyProperties)
|
||||
INSTANCE_LEVEL_VULKAN_FUNCTION (vkCreateDevice)
|
||||
|
|
|
@ -42,7 +42,9 @@ typedef struct DARRAY_TYPE(const char *) qfv_debugstack_t;
|
|||
typedef struct qfv_physdev_s {
|
||||
struct qfv_instance_s *instance;
|
||||
VkPhysicalDevice dev;
|
||||
VkPhysicalDeviceProperties properties;
|
||||
VkPhysicalDeviceProperties2 properties2;
|
||||
VkPhysicalDeviceProperties *properties;
|
||||
VkPhysicalDeviceMultiviewProperties multiViewProperties;
|
||||
VkPhysicalDeviceMemoryProperties memory_properties;
|
||||
} qfv_physdev_t;
|
||||
|
||||
|
|
|
@ -151,6 +151,7 @@ QFV_CreateDevice (vulkan_ctx_t *ctx, const char **extensions)
|
|||
};
|
||||
VkPhysicalDeviceFeatures features = {
|
||||
.geometryShader = 1,
|
||||
.multiViewport = 1,
|
||||
};
|
||||
VkDeviceCreateInfo dCreateInfo = {
|
||||
VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, 0, 0,
|
||||
|
|
|
@ -279,7 +279,15 @@ QFV_CreateInstance (vulkan_ctx_t *ctx,
|
|||
qfv_physdev_t *dev = &inst->devices[i];
|
||||
dev->instance = inst;
|
||||
dev->dev = physDev;
|
||||
ifunc->vkGetPhysicalDeviceProperties (physDev, &dev->properties);
|
||||
dev->properties2 = (VkPhysicalDeviceProperties2) {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2,
|
||||
.pNext = &dev->multiViewProperties,
|
||||
};
|
||||
dev->multiViewProperties = (VkPhysicalDeviceMultiviewProperties) {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES,
|
||||
};
|
||||
ifunc->vkGetPhysicalDeviceProperties2 (physDev, &dev->properties2);
|
||||
dev->properties = &dev->properties2.properties;
|
||||
ifunc->vkGetPhysicalDeviceMemoryProperties (physDev,
|
||||
&dev->memory_properties);
|
||||
}
|
||||
|
@ -306,8 +314,8 @@ QFV_GetMaxSampleCount (qfv_physdev_t *physdev)
|
|||
{
|
||||
VkSampleCountFlagBits maxSamples = VK_SAMPLE_COUNT_64_BIT;
|
||||
VkSampleCountFlagBits counts;
|
||||
counts = min (physdev->properties.limits.framebufferColorSampleCounts,
|
||||
physdev->properties.limits.framebufferDepthSampleCounts);
|
||||
counts = min (physdev->properties->limits.framebufferColorSampleCounts,
|
||||
physdev->properties->limits.framebufferDepthSampleCounts);
|
||||
while (maxSamples && maxSamples > counts) {
|
||||
maxSamples >>= 1;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ qfv_stagebuf_t *
|
|||
QFV_CreateStagingBuffer (qfv_device_t *device, const char *name, size_t size,
|
||||
VkCommandPool cmdPool)
|
||||
{
|
||||
size_t atom = device->physDev->properties.limits.nonCoherentAtomSize;
|
||||
size_t atom = device->physDev->properties->limits.nonCoherentAtomSize;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
dstring_t *str = dstring_new ();
|
||||
|
||||
|
|
|
@ -1092,7 +1092,7 @@ parse_object (vulkan_ctx_t *ctx, memsuper_t *memsuper, plitem_t *plist,
|
|||
{"frames", &vulkan_frameset_t_type, &ctx->frames},
|
||||
{"msaaSamples", &VkSampleCountFlagBits_type, &ctx->msaaSamples},
|
||||
{"physDevLimits", &VkPhysicalDeviceLimits_type,
|
||||
&ctx->device->physDev->properties.limits },
|
||||
&ctx->device->physDev->properties->limits },
|
||||
{QFV_PROPERTIES, &cexpr_plitem, &parsectx.properties},
|
||||
{}
|
||||
};
|
||||
|
|
|
@ -436,7 +436,7 @@ Vulkan_BuildDisplayLists (model_t **models, int num_models, vulkan_ctx_t *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
size_t atom = device->physDev->properties.limits.nonCoherentAtomSize;
|
||||
size_t atom = device->physDev->properties->limits.nonCoherentAtomSize;
|
||||
size_t atom_mask = atom - 1;
|
||||
size_t frames = bctx->frames.size;
|
||||
size_t index_buffer_size = index_count * frames * sizeof (uint32_t);
|
||||
|
@ -1118,7 +1118,7 @@ Vulkan_Bsp_Flush (vulkan_ctx_t *ctx)
|
|||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
bspctx_t *bctx = ctx->bsp_context;
|
||||
bspframe_t *bframe = &bctx->frames.a[ctx->curFrame];
|
||||
size_t atom = device->physDev->properties.limits.nonCoherentAtomSize;
|
||||
size_t atom = device->physDev->properties->limits.nonCoherentAtomSize;
|
||||
size_t atom_mask = atom - 1;
|
||||
size_t index_offset = bframe->index_offset;
|
||||
size_t index_size = bframe->index_count * sizeof (uint32_t);
|
||||
|
@ -1424,7 +1424,7 @@ Vulkan_Bsp_Init (vulkan_ctx_t *ctx)
|
|||
|
||||
size_t entid_count = Vulkan_Scene_MaxEntities (ctx);
|
||||
size_t entid_size = entid_count * sizeof (uint32_t);
|
||||
size_t atom = device->physDev->properties.limits.nonCoherentAtomSize;
|
||||
size_t atom = device->physDev->properties->limits.nonCoherentAtomSize;
|
||||
size_t atom_mask = atom - 1;
|
||||
entid_size = (entid_size + atom_mask) & ~atom_mask;
|
||||
bctx->entid_buffer
|
||||
|
|
|
@ -362,7 +362,7 @@ Vulkan_Lighting_Init (vulkan_ctx_t *ctx)
|
|||
lframe->shadowWrite.dstBinding = 0;
|
||||
lframe->shadowWrite.descriptorCount
|
||||
= min (MaxLights,
|
||||
device->physDev->properties.limits.maxPerStageDescriptorSamplers);
|
||||
device->physDev->properties->limits.maxPerStageDescriptorSamplers);
|
||||
lframe->shadowWrite.pImageInfo = lframe->shadowInfo;
|
||||
}
|
||||
free (shadow_set);
|
||||
|
@ -578,7 +578,7 @@ build_shadow_maps (lightingctx_t *lctx, vulkan_ctx_t *ctx)
|
|||
qfv_device_t *device = ctx->device;
|
||||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
qfv_physdev_t *physDev = device->physDev;
|
||||
int maxLayers = physDev->properties.limits.maxImageArrayLayers;
|
||||
int maxLayers = physDev->properties->limits.maxImageArrayLayers;
|
||||
lightingdata_t *ldata = lctx->ldata;
|
||||
light_t *lights = ldata->lights.a;
|
||||
int numLights = ldata->lights.size;
|
||||
|
|
Loading…
Reference in a new issue