anv/image: Fix initialization of the ISL tiling
If an internal user creates an image with Vulkan tiling VK_IMAGE_TILING_OPTIMAL and an ISL tiling that isn't set, ISL will fail to create the image as anv_image_create_info::isl_tiling_flags will be an invalid value. Correct this by making anv_image_create_info::isl_tiling_flags an opt-in, filtering bitmask, that allows the caller to specify which ISL tilings are acceptable, but not contradictory to the Vulkan tiling. Opt-out of filtering for vkCreateImage. Signed-off-by: Nanley Chery <nanley.g.chery@intel.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
@@ -120,9 +120,17 @@ make_surface(const struct anv_device *dev,
|
|||||||
[VK_IMAGE_TYPE_3D] = ISL_SURF_DIM_3D,
|
[VK_IMAGE_TYPE_3D] = ISL_SURF_DIM_3D,
|
||||||
};
|
};
|
||||||
|
|
||||||
isl_tiling_flags_t tiling_flags = anv_info->isl_tiling_flags;
|
/* Translate the Vulkan tiling to an equivalent ISL tiling, then filter the
|
||||||
if (vk_info->tiling == VK_IMAGE_TILING_LINEAR)
|
* result with an optionally provided ISL tiling argument.
|
||||||
tiling_flags = ISL_TILING_LINEAR_BIT;
|
*/
|
||||||
|
isl_tiling_flags_t tiling_flags =
|
||||||
|
(vk_info->tiling == VK_IMAGE_TILING_LINEAR) ?
|
||||||
|
ISL_TILING_LINEAR_BIT : ISL_TILING_ANY_MASK;
|
||||||
|
|
||||||
|
if (anv_info->isl_tiling_flags)
|
||||||
|
tiling_flags &= anv_info->isl_tiling_flags;
|
||||||
|
|
||||||
|
assert(tiling_flags);
|
||||||
|
|
||||||
struct anv_surface *anv_surf = get_surface(image, aspect);
|
struct anv_surface *anv_surf = get_surface(image, aspect);
|
||||||
|
|
||||||
@@ -260,7 +268,6 @@ anv_CreateImage(VkDevice device,
|
|||||||
return anv_image_create(device,
|
return anv_image_create(device,
|
||||||
&(struct anv_image_create_info) {
|
&(struct anv_image_create_info) {
|
||||||
.vk_info = pCreateInfo,
|
.vk_info = pCreateInfo,
|
||||||
.isl_tiling_flags = ISL_TILING_ANY_MASK,
|
|
||||||
},
|
},
|
||||||
pAllocator,
|
pAllocator,
|
||||||
pImage);
|
pImage);
|
||||||
|
@@ -1698,7 +1698,10 @@ struct anv_image_view {
|
|||||||
|
|
||||||
struct anv_image_create_info {
|
struct anv_image_create_info {
|
||||||
const VkImageCreateInfo *vk_info;
|
const VkImageCreateInfo *vk_info;
|
||||||
|
|
||||||
|
/** An opt-in bitmask which filters an ISL-mapping of the Vulkan tiling. */
|
||||||
isl_tiling_flags_t isl_tiling_flags;
|
isl_tiling_flags_t isl_tiling_flags;
|
||||||
|
|
||||||
uint32_t stride;
|
uint32_t stride;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user