mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
vk/image: Embed VkImageCreateInfo* into anv_image_create_info
All function signatures that matched this pattern, old: f(const VkImageCreateInfo *, const struct anv_image_create_info *) were rewritten as new: f(const struct anv_image_create_info *)
This commit is contained in:
parent
ca6cef3302
commit
fdcd71f71d
3 changed files with 37 additions and 33 deletions
|
|
@ -91,13 +91,12 @@ static const struct anv_tile_info {
|
|||
};
|
||||
|
||||
static uint32_t
|
||||
anv_image_choose_tile_mode(const VkImageCreateInfo *vk_info,
|
||||
const struct anv_image_create_info *anv_info)
|
||||
anv_image_choose_tile_mode(const struct anv_image_create_info *anv_info)
|
||||
{
|
||||
if (anv_info)
|
||||
if (anv_info->force_tile_mode)
|
||||
return anv_info->tile_mode;
|
||||
|
||||
switch (vk_info->tiling) {
|
||||
switch (anv_info->vk_info->tiling) {
|
||||
case VK_IMAGE_TILING_LINEAR:
|
||||
return LINEAR;
|
||||
case VK_IMAGE_TILING_OPTIMAL:
|
||||
|
|
@ -110,11 +109,11 @@ anv_image_choose_tile_mode(const VkImageCreateInfo *vk_info,
|
|||
|
||||
VkResult anv_image_create(
|
||||
VkDevice _device,
|
||||
const VkImageCreateInfo* pCreateInfo,
|
||||
const struct anv_image_create_info * extra,
|
||||
const struct anv_image_create_info * create_info,
|
||||
VkImage* pImage)
|
||||
{
|
||||
struct anv_device *device = (struct anv_device *) _device;
|
||||
const VkImageCreateInfo *pCreateInfo = create_info->vk_info;
|
||||
const VkExtent3D *restrict extent = &pCreateInfo->extent;
|
||||
|
||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO);
|
||||
|
|
@ -128,8 +127,7 @@ VkResult anv_image_create(
|
|||
anv_assert(pCreateInfo->extent.height > 0);
|
||||
anv_assert(pCreateInfo->extent.depth == 1);
|
||||
|
||||
const uint32_t tile_mode =
|
||||
anv_image_choose_tile_mode(pCreateInfo, extra);
|
||||
const uint32_t tile_mode = anv_image_choose_tile_mode(create_info);
|
||||
|
||||
/* TODO(chadv): How should we validate inputs? */
|
||||
const uint8_t surf_type =
|
||||
|
|
@ -228,7 +226,11 @@ VkResult anv_CreateImage(
|
|||
const VkImageCreateInfo* pCreateInfo,
|
||||
VkImage* pImage)
|
||||
{
|
||||
return anv_image_create(device, pCreateInfo, NULL, pImage);
|
||||
return anv_image_create(device,
|
||||
&(struct anv_image_create_info) {
|
||||
.vk_info = pCreateInfo,
|
||||
},
|
||||
pImage);
|
||||
}
|
||||
|
||||
VkResult anv_GetImageSubresourceInfo(
|
||||
|
|
|
|||
|
|
@ -833,12 +833,13 @@ struct anv_surface_view {
|
|||
};
|
||||
|
||||
struct anv_image_create_info {
|
||||
uint32_t tile_mode;
|
||||
const VkImageCreateInfo *vk_info;
|
||||
bool force_tile_mode;
|
||||
uint8_t tile_mode;
|
||||
};
|
||||
|
||||
VkResult anv_image_create(VkDevice _device,
|
||||
const VkImageCreateInfo *pCreateInfo,
|
||||
const struct anv_image_create_info *extra,
|
||||
const struct anv_image_create_info *info,
|
||||
VkImage *pImage);
|
||||
|
||||
void anv_image_view_init(struct anv_surface_view *view,
|
||||
|
|
|
|||
|
|
@ -107,27 +107,28 @@ VkResult anv_CreateSwapChainWSI(
|
|||
struct anv_device_memory *memory;
|
||||
|
||||
anv_image_create((VkDevice) device,
|
||||
&(VkImageCreateInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
|
||||
.imageType = VK_IMAGE_TYPE_2D,
|
||||
.format = pCreateInfo->imageFormat,
|
||||
.extent = {
|
||||
.width = pCreateInfo->imageExtent.width,
|
||||
.height = pCreateInfo->imageExtent.height,
|
||||
.depth = 1
|
||||
},
|
||||
.mipLevels = 1,
|
||||
.arraySize = 1,
|
||||
.samples = 1,
|
||||
/* FIXME: Need a way to use X tiling to allow scanout */
|
||||
.tiling = VK_IMAGE_TILING_OPTIMAL,
|
||||
.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
|
||||
.flags = 0,
|
||||
},
|
||||
&(struct anv_image_create_info) {
|
||||
.tile_mode = XMAJOR
|
||||
},
|
||||
(VkImage *) &image);
|
||||
&(struct anv_image_create_info) {
|
||||
.force_tile_mode = true,
|
||||
.tile_mode = XMAJOR,
|
||||
.vk_info =
|
||||
&(VkImageCreateInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
|
||||
.imageType = VK_IMAGE_TYPE_2D,
|
||||
.format = pCreateInfo->imageFormat,
|
||||
.extent = {
|
||||
.width = pCreateInfo->imageExtent.width,
|
||||
.height = pCreateInfo->imageExtent.height,
|
||||
.depth = 1
|
||||
},
|
||||
.mipLevels = 1,
|
||||
.arraySize = 1,
|
||||
.samples = 1,
|
||||
/* FIXME: Need a way to use X tiling to allow scanout */
|
||||
.tiling = VK_IMAGE_TILING_OPTIMAL,
|
||||
.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
|
||||
.flags = 0,
|
||||
}},
|
||||
(VkImage *) &image);
|
||||
|
||||
anv_AllocMemory((VkDevice) device,
|
||||
&(VkMemoryAllocInfo) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue