mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
nvk: Plumb a physical device into descriptor_stride_align_for_type
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26617>
This commit is contained in:
parent
c7de8afbe0
commit
bc236acff5
3 changed files with 25 additions and 13 deletions
|
|
@ -395,7 +395,8 @@ nvk_CreateDescriptorPool(VkDevice _device,
|
||||||
type_list = &mutable_info->pMutableDescriptorTypeLists[i];
|
type_list = &mutable_info->pMutableDescriptorTypeLists[i];
|
||||||
|
|
||||||
uint32_t stride, align;
|
uint32_t stride, align;
|
||||||
nvk_descriptor_stride_align_for_type(pCreateInfo->pPoolSizes[i].type,
|
nvk_descriptor_stride_align_for_type(pdev,
|
||||||
|
pCreateInfo->pPoolSizes[i].type,
|
||||||
type_list, &stride, &align);
|
type_list, &stride, &align);
|
||||||
max_align = MAX2(max_align, align);
|
max_align = MAX2(max_align, align);
|
||||||
}
|
}
|
||||||
|
|
@ -407,7 +408,8 @@ nvk_CreateDescriptorPool(VkDevice _device,
|
||||||
type_list = &mutable_info->pMutableDescriptorTypeLists[i];
|
type_list = &mutable_info->pMutableDescriptorTypeLists[i];
|
||||||
|
|
||||||
uint32_t stride, align;
|
uint32_t stride, align;
|
||||||
nvk_descriptor_stride_align_for_type(pCreateInfo->pPoolSizes[i].type,
|
nvk_descriptor_stride_align_for_type(pdev,
|
||||||
|
pCreateInfo->pPoolSizes[i].type,
|
||||||
type_list, &stride, &align);
|
type_list, &stride, &align);
|
||||||
bo_size += MAX2(stride, max_align) *
|
bo_size += MAX2(stride, max_align) *
|
||||||
pCreateInfo->pPoolSizes[i].descriptorCount;
|
pCreateInfo->pPoolSizes[i].descriptorCount;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include "nvk_descriptor_set.h"
|
#include "nvk_descriptor_set.h"
|
||||||
#include "nvk_device.h"
|
#include "nvk_device.h"
|
||||||
#include "nvk_entrypoints.h"
|
#include "nvk_entrypoints.h"
|
||||||
|
#include "nvk_physical_device.h"
|
||||||
#include "nvk_sampler.h"
|
#include "nvk_sampler.h"
|
||||||
|
|
||||||
#include "vk_pipeline_layout.h"
|
#include "vk_pipeline_layout.h"
|
||||||
|
|
@ -27,7 +28,8 @@ binding_has_immutable_samplers(const VkDescriptorSetLayoutBinding *binding)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nvk_descriptor_stride_align_for_type(VkDescriptorType type,
|
nvk_descriptor_stride_align_for_type(const struct nvk_physical_device *pdev,
|
||||||
|
VkDescriptorType type,
|
||||||
const VkMutableDescriptorTypeListEXT *type_list,
|
const VkMutableDescriptorTypeListEXT *type_list,
|
||||||
uint32_t *stride, uint32_t *align)
|
uint32_t *stride, uint32_t *align)
|
||||||
{
|
{
|
||||||
|
|
@ -67,7 +69,8 @@ nvk_descriptor_stride_align_for_type(VkDescriptorType type,
|
||||||
assert(type_list->pDescriptorTypes[i] !=
|
assert(type_list->pDescriptorTypes[i] !=
|
||||||
VK_DESCRIPTOR_TYPE_MUTABLE_EXT);
|
VK_DESCRIPTOR_TYPE_MUTABLE_EXT);
|
||||||
uint32_t desc_stride, desc_align;
|
uint32_t desc_stride, desc_align;
|
||||||
nvk_descriptor_stride_align_for_type(type_list->pDescriptorTypes[i],
|
nvk_descriptor_stride_align_for_type(pdev,
|
||||||
|
type_list->pDescriptorTypes[i],
|
||||||
NULL, &desc_stride, &desc_align);
|
NULL, &desc_stride, &desc_align);
|
||||||
*stride = MAX2(*stride, desc_stride);
|
*stride = MAX2(*stride, desc_stride);
|
||||||
*align = MAX2(*align, desc_align);
|
*align = MAX2(*align, desc_align);
|
||||||
|
|
@ -103,6 +106,7 @@ nvk_CreateDescriptorSetLayout(VkDevice device,
|
||||||
VkDescriptorSetLayout *pSetLayout)
|
VkDescriptorSetLayout *pSetLayout)
|
||||||
{
|
{
|
||||||
VK_FROM_HANDLE(nvk_device, dev, device);
|
VK_FROM_HANDLE(nvk_device, dev, device);
|
||||||
|
struct nvk_physical_device *pdev = nvk_device_physical(dev);
|
||||||
|
|
||||||
uint32_t num_bindings = 0;
|
uint32_t num_bindings = 0;
|
||||||
uint32_t immutable_sampler_count = 0;
|
uint32_t immutable_sampler_count = 0;
|
||||||
|
|
@ -197,8 +201,8 @@ nvk_CreateDescriptorSetLayout(VkDevice device,
|
||||||
mutable_info, info_idx);
|
mutable_info, info_idx);
|
||||||
|
|
||||||
uint32_t stride, align;
|
uint32_t stride, align;
|
||||||
nvk_descriptor_stride_align_for_type(binding->descriptorType, type_list,
|
nvk_descriptor_stride_align_for_type(pdev, binding->descriptorType,
|
||||||
&stride, &align);
|
type_list, &stride, &align);
|
||||||
|
|
||||||
uint8_t max_plane_count = 1;
|
uint8_t max_plane_count = 1;
|
||||||
|
|
||||||
|
|
@ -284,6 +288,9 @@ nvk_GetDescriptorSetLayoutSupport(VkDevice device,
|
||||||
const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
|
const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
|
||||||
VkDescriptorSetLayoutSupport *pSupport)
|
VkDescriptorSetLayoutSupport *pSupport)
|
||||||
{
|
{
|
||||||
|
VK_FROM_HANDLE(nvk_device, dev, device);
|
||||||
|
struct nvk_physical_device *pdev = nvk_device_physical(dev);
|
||||||
|
|
||||||
const VkMutableDescriptorTypeCreateInfoEXT *mutable_info =
|
const VkMutableDescriptorTypeCreateInfoEXT *mutable_info =
|
||||||
vk_find_struct_const(pCreateInfo->pNext,
|
vk_find_struct_const(pCreateInfo->pNext,
|
||||||
MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT);
|
MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT);
|
||||||
|
|
@ -303,8 +310,8 @@ nvk_GetDescriptorSetLayoutSupport(VkDevice device,
|
||||||
mutable_info, i);
|
mutable_info, i);
|
||||||
|
|
||||||
uint32_t stride, align;
|
uint32_t stride, align;
|
||||||
nvk_descriptor_stride_align_for_type(binding->descriptorType, type_list,
|
nvk_descriptor_stride_align_for_type(pdev, binding->descriptorType,
|
||||||
&stride, &align);
|
type_list, &stride, &align);
|
||||||
max_align = MAX2(max_align, align);
|
max_align = MAX2(max_align, align);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -334,8 +341,8 @@ nvk_GetDescriptorSetLayoutSupport(VkDevice device,
|
||||||
mutable_info, i);
|
mutable_info, i);
|
||||||
|
|
||||||
uint32_t stride, align;
|
uint32_t stride, align;
|
||||||
nvk_descriptor_stride_align_for_type(binding->descriptorType, type_list,
|
nvk_descriptor_stride_align_for_type(pdev, binding->descriptorType,
|
||||||
&stride, &align);
|
type_list, &stride, &align);
|
||||||
|
|
||||||
if (stride > 0) {
|
if (stride > 0) {
|
||||||
assert(stride <= UINT8_MAX);
|
assert(stride <= UINT8_MAX);
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include "vk_object.h"
|
#include "vk_object.h"
|
||||||
|
|
||||||
struct nvk_device;
|
struct nvk_device;
|
||||||
|
struct nvk_physical_device;
|
||||||
struct nvk_sampler;
|
struct nvk_sampler;
|
||||||
struct vk_pipeline_layout;
|
struct vk_pipeline_layout;
|
||||||
|
|
||||||
|
|
@ -62,9 +63,11 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(nvk_descriptor_set_layout, vk.base,
|
||||||
VkDescriptorSetLayout,
|
VkDescriptorSetLayout,
|
||||||
VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT)
|
VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT)
|
||||||
|
|
||||||
void nvk_descriptor_stride_align_for_type(VkDescriptorType type,
|
void
|
||||||
const VkMutableDescriptorTypeListEXT *type_list,
|
nvk_descriptor_stride_align_for_type(const struct nvk_physical_device *pdev,
|
||||||
uint32_t *stride, uint32_t *align);
|
VkDescriptorType type,
|
||||||
|
const VkMutableDescriptorTypeListEXT *type_list,
|
||||||
|
uint32_t *stride, uint32_t *align);
|
||||||
|
|
||||||
static inline struct nvk_descriptor_set_layout *
|
static inline struct nvk_descriptor_set_layout *
|
||||||
vk_to_nvk_descriptor_set_layout(struct vk_descriptor_set_layout *layout)
|
vk_to_nvk_descriptor_set_layout(struct vk_descriptor_set_layout *layout)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue