From 86503aaba48070162fa01ec4bb01ee859e037f5b Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Tue, 27 Sep 2022 13:13:01 +0200 Subject: [PATCH] v3dv: use enabled features from vk_device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Eric Engestrom Reviewed-by: Alejandro PiƱeiro Part-of: --- src/broadcom/vulkan/v3dv_device.c | 24 ++------------- src/broadcom/vulkan/v3dv_pipeline.c | 45 ++++++++++++++++++----------- src/broadcom/vulkan/v3dv_private.h | 5 ---- 3 files changed, 30 insertions(+), 44 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c index ba5df92f630..bdc5d88ad01 100644 --- a/src/broadcom/vulkan/v3dv_device.c +++ b/src/broadcom/vulkan/v3dv_device.c @@ -2059,30 +2059,10 @@ v3dv_CreateDevice(VkPhysicalDevice physicalDevice, device->devinfo = physical_device->devinfo; - /* Vulkan 1.1 and VK_KHR_get_physical_device_properties2 added - * VkPhysicalDeviceFeatures2 which can be used in the pNext chain of - * vkDeviceCreateInfo, in which case it should be used instead of - * pEnabledFeatures. - */ - const VkPhysicalDeviceFeatures2 *features2 = - vk_find_struct_const(pCreateInfo->pNext, PHYSICAL_DEVICE_FEATURES_2); - if (features2) { - memcpy(&device->features, &features2->features, - sizeof(device->features)); - - const VkPhysicalDeviceImageRobustnessFeatures *irf = - vk_find_struct_const(pCreateInfo->pNext, - PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES); - device->ext_features.robustImageAccess = irf && irf->robustImageAccess; - } else if (pCreateInfo->pEnabledFeatures) { - memcpy(&device->features, pCreateInfo->pEnabledFeatures, - sizeof(device->features)); - } - - if (device->features.robustBufferAccess) + if (device->vk.enabled_features.robustBufferAccess) perf_debug("Device created with Robust Buffer Access enabled.\n"); - if (device->ext_features.robustImageAccess) + if (device->vk.enabled_features.robustImageAccess) perf_debug("Device created with Robust Image Access enabled.\n"); diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index 4299650c6a8..7ea8306e85d 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -1038,8 +1038,11 @@ pipeline_populate_v3d_fs_key(struct v3d_fs_key *key, memset(key, 0, sizeof(*key)); - const bool rba = p_stage->pipeline->device->features.robustBufferAccess; - const bool ria = p_stage->pipeline->device->ext_features.robustImageAccess; + struct v3dv_device *device = p_stage->pipeline->device; + assert(device); + + const bool rba = device->vk.enabled_features.robustBufferAccess; + const bool ria = device->vk.enabled_features.robustImageAccess; pipeline_populate_v3d_key(&key->base, p_stage, ucp_enables, rba, ria); const VkPipelineInputAssemblyStateCreateInfo *ia_info = @@ -1155,10 +1158,13 @@ pipeline_populate_v3d_gs_key(struct v3d_gs_key *key, assert(p_stage->stage == BROADCOM_SHADER_GEOMETRY || p_stage->stage == BROADCOM_SHADER_GEOMETRY_BIN); + struct v3dv_device *device = p_stage->pipeline->device; + assert(device); + memset(key, 0, sizeof(*key)); - const bool rba = p_stage->pipeline->device->features.robustBufferAccess; - const bool ria = p_stage->pipeline->device->ext_features.robustImageAccess; + const bool rba = device->vk.enabled_features.robustBufferAccess; + const bool ria = device->vk.enabled_features.robustImageAccess; pipeline_populate_v3d_key(&key->base, p_stage, 0, rba, ria); struct v3dv_pipeline *pipeline = p_stage->pipeline; @@ -1198,10 +1204,13 @@ pipeline_populate_v3d_vs_key(struct v3d_vs_key *key, assert(p_stage->stage == BROADCOM_SHADER_VERTEX || p_stage->stage == BROADCOM_SHADER_VERTEX_BIN); + struct v3dv_device *device = p_stage->pipeline->device; + assert(device); + memset(key, 0, sizeof(*key)); - const bool rba = p_stage->pipeline->device->features.robustBufferAccess; - const bool ria = p_stage->pipeline->device->ext_features.robustImageAccess; + const bool rba = device->vk.enabled_features.robustBufferAccess; + const bool ria = device->vk.enabled_features.robustImageAccess; pipeline_populate_v3d_key(&key->base, p_stage, 0, rba, ria); struct v3dv_pipeline *pipeline = p_stage->pipeline; @@ -1859,12 +1868,13 @@ pipeline_populate_graphics_key(struct v3dv_pipeline *pipeline, struct v3dv_pipeline_key *key, const VkGraphicsPipelineCreateInfo *pCreateInfo) { - memset(key, 0, sizeof(*key)); - key->robust_buffer_access = - pipeline->device->features.robustBufferAccess; + struct v3dv_device *device = pipeline->device; + assert(device); - key->robust_image_access = - pipeline->device->ext_features.robustImageAccess; + memset(key, 0, sizeof(*key)); + + key->robust_buffer_access = device->vk.enabled_features.robustBufferAccess; + key->robust_image_access = device->vk.enabled_features.robustImageAccess; const bool raster_enabled = !pCreateInfo->pRasterizationState->rasterizerDiscardEnable; @@ -1949,16 +1959,17 @@ pipeline_populate_compute_key(struct v3dv_pipeline *pipeline, struct v3dv_pipeline_key *key, const VkComputePipelineCreateInfo *pCreateInfo) { + struct v3dv_device *device = pipeline->device; + assert(device); + /* We use the same pipeline key for graphics and compute, but we don't need * to add a field to flag compute keys because this key is not used alone * to search in the cache, we also use the SPIR-V or the serialized NIR for * example, which already flags compute shaders. */ memset(key, 0, sizeof(*key)); - key->robust_buffer_access = - pipeline->device->features.robustBufferAccess; - key->robust_image_access = - pipeline->device->ext_features.robustImageAccess; + key->robust_buffer_access = device->vk.enabled_features.robustBufferAccess; + key->robust_image_access = device->vk.enabled_features.robustImageAccess; } static struct v3dv_pipeline_shared_data * @@ -3126,8 +3137,8 @@ pipeline_compile_compute(struct v3dv_pipeline *pipeline, struct v3d_key key; memset(&key, 0, sizeof(key)); - const bool rba = pipeline->device->features.robustBufferAccess; - const bool ria = pipeline->device->ext_features.robustImageAccess; + const bool rba = pipeline->device->vk.enabled_features.robustBufferAccess; + const bool ria = pipeline->device->vk.enabled_features.robustImageAccess; pipeline_populate_v3d_key(&key, p_stage, 0, rba, ria); pipeline->shared_data->variants[BROADCOM_SHADER_COMPUTE] = pipeline_compile_shader_variant(p_stage, &key, sizeof(key), diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h index d94eeef260e..4d87ad73a15 100644 --- a/src/broadcom/vulkan/v3dv_private.h +++ b/src/broadcom/vulkan/v3dv_private.h @@ -520,11 +520,6 @@ struct v3dv_device { */ struct v3dv_bo *default_attribute_float; - VkPhysicalDeviceFeatures features; - struct { - bool robustImageAccess; - } ext_features; - void *device_address_mem_ctx; struct util_dynarray device_address_bo_list; /* Array of struct v3dv_bo * */