mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 16:18:06 +02:00
zink: use VkFormatProperties3
but wrap it in a smaller type to save some space Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24775>
This commit is contained in:
parent
e02441b000
commit
87fa46c10d
3 changed files with 21 additions and 8 deletions
|
|
@ -371,7 +371,7 @@ check_ici(struct zink_screen *screen, VkImageCreateInfo *ici, uint64_t modifier)
|
|||
}
|
||||
|
||||
static VkImageUsageFlags
|
||||
get_image_usage_for_feats(struct zink_screen *screen, VkFormatFeatureFlags feats, const struct pipe_resource *templ, unsigned bind, bool *need_extended)
|
||||
get_image_usage_for_feats(struct zink_screen *screen, VkFormatFeatureFlags2 feats, const struct pipe_resource *templ, unsigned bind, bool *need_extended)
|
||||
{
|
||||
VkImageUsageFlags usage = 0;
|
||||
bool is_planar = util_format_get_num_planes(templ->format) > 1;
|
||||
|
|
@ -537,8 +537,8 @@ get_image_usage(struct zink_screen *screen, VkImageCreateInfo *ici, const struct
|
|||
}
|
||||
}
|
||||
} else {
|
||||
VkFormatProperties props = screen->format_props[templ->format];
|
||||
VkFormatFeatureFlags feats = tiling == VK_IMAGE_TILING_LINEAR ? props.linearTilingFeatures : props.optimalTilingFeatures;
|
||||
struct zink_format_props props = screen->format_props[templ->format];
|
||||
VkFormatFeatureFlags2 feats = tiling == VK_IMAGE_TILING_LINEAR ? props.linearTilingFeatures : props.optimalTilingFeatures;
|
||||
if (ici->flags & VK_IMAGE_CREATE_EXTENDED_USAGE_BIT)
|
||||
feats = UINT32_MAX;
|
||||
VkImageUsageFlags usage = get_image_usage_for_feats(screen, feats, templ, bind, &need_extended);
|
||||
|
|
|
|||
|
|
@ -1394,7 +1394,7 @@ zink_is_format_supported(struct pipe_screen *pscreen,
|
|||
}
|
||||
}
|
||||
|
||||
VkFormatProperties props = screen->format_props[format];
|
||||
struct zink_format_props props = screen->format_props[format];
|
||||
|
||||
if (target == PIPE_BUFFER) {
|
||||
if (bind & PIPE_BIND_VERTEX_BUFFER) {
|
||||
|
|
@ -2078,7 +2078,9 @@ retry:
|
|||
props3.pNext = props.pNext;
|
||||
props.pNext = &props3;
|
||||
VKSCR(GetPhysicalDeviceFormatProperties2)(screen->pdev, format, &props);
|
||||
screen->format_props[i] = props.formatProperties;
|
||||
screen->format_props[i].linearTilingFeatures = props3.linearTilingFeatures;
|
||||
screen->format_props[i].optimalTilingFeatures = props3.optimalTilingFeatures;
|
||||
screen->format_props[i].bufferFeatures = props3.bufferFeatures;
|
||||
if (props3.linearTilingFeatures & VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV)
|
||||
screen->format_props[i].linearTilingFeatures |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT;
|
||||
if (screen->info.have_EXT_image_drm_format_modifier && mod_props.drmFormatModifierCount) {
|
||||
|
|
@ -2089,8 +2091,13 @@ retry:
|
|||
screen->modifier_props[i].pDrmFormatModifierProperties[j] = mod_props.pDrmFormatModifierProperties[j];
|
||||
}
|
||||
}
|
||||
} else
|
||||
VKSCR(GetPhysicalDeviceFormatProperties)(screen->pdev, format, &screen->format_props[i]);
|
||||
} else {
|
||||
VkFormatProperties props = {0};
|
||||
VKSCR(GetPhysicalDeviceFormatProperties)(screen->pdev, format, &props);
|
||||
screen->format_props[i].linearTilingFeatures = props.linearTilingFeatures;
|
||||
screen->format_props[i].optimalTilingFeatures = props.optimalTilingFeatures;
|
||||
screen->format_props[i].bufferFeatures = props.bufferFeatures;
|
||||
}
|
||||
if (i == PIPE_FORMAT_A8_UNORM && !screen->driver_workarounds.missing_a8_unorm) {
|
||||
if (!screen->format_props[i].linearTilingFeatures &&
|
||||
!screen->format_props[i].optimalTilingFeatures &&
|
||||
|
|
|
|||
|
|
@ -1369,6 +1369,12 @@ struct zink_modifier_prop {
|
|||
VkDrmFormatModifierPropertiesEXT* pDrmFormatModifierProperties;
|
||||
};
|
||||
|
||||
struct zink_format_props {
|
||||
VkFormatFeatureFlags2 linearTilingFeatures;
|
||||
VkFormatFeatureFlags2 optimalTilingFeatures;
|
||||
VkFormatFeatureFlags2 bufferFeatures;
|
||||
};
|
||||
|
||||
struct zink_screen {
|
||||
struct pipe_screen base;
|
||||
|
||||
|
|
@ -1503,7 +1509,7 @@ struct zink_screen {
|
|||
bool zink_shader_object_enable;
|
||||
} driconf;
|
||||
|
||||
VkFormatProperties format_props[PIPE_FORMAT_COUNT];
|
||||
struct zink_format_props format_props[PIPE_FORMAT_COUNT];
|
||||
struct zink_modifier_prop modifier_props[PIPE_FORMAT_COUNT];
|
||||
|
||||
VkExtent2D maxSampleLocationGridSize[5];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue