const struct anv_image_create_info *create_info,
VkImage *pImage)
{
- struct anv_device *device = (struct anv_device *) _device;
+ ANV_FROM_HANDLE(anv_device, device, _device);
const VkImageCreateInfo *pCreateInfo = create_info->vk_info;
const VkExtent3D *restrict extent = &pCreateInfo->extent;
struct anv_image *image = NULL;
goto fail;
}
- *pImage = (VkImage) image;
+ *pImage = anv_image_to_handle(image);
return VK_SUCCESS;
const VkImageViewCreateInfo* pCreateInfo,
struct anv_cmd_buffer *cmd_buffer)
{
+ ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
- struct anv_image *image = (struct anv_image *) pCreateInfo->image;
struct anv_surface *surface;
const struct anv_format *format_info =
const VkImageViewCreateInfo *pCreateInfo,
VkImageView *pView)
{
- const struct anv_image *image;
+ ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
const VkImageSubresourceRange *subresource;
const struct anv_image_view_info *view_info;
const struct anv_format *view_format_info;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO);
subresource = &pCreateInfo->subresourceRange;
- /* Validate image pointer before dereferencing it. */
- assert(pCreateInfo->image != 0);
- image = (struct anv_image *) pCreateInfo->image;
-
/* Validate viewType is in range before using it. */
assert(pCreateInfo->viewType >= VK_IMAGE_VIEW_TYPE_BEGIN_RANGE);
assert(pCreateInfo->viewType <= VK_IMAGE_VIEW_TYPE_END_RANGE);
const VkImageViewCreateInfo *pCreateInfo,
VkImageView *pView)
{
- struct anv_device *device = (struct anv_device *) _device;
+ ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_surface_view *view;
view = anv_device_alloc(device, sizeof(*view), 8,
const VkColorAttachmentViewCreateInfo* pCreateInfo,
struct anv_cmd_buffer *cmd_buffer)
{
- struct anv_image *image = (struct anv_image *) pCreateInfo->image;
+ ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
struct anv_surface *surface = &image->primary_surface;
const struct anv_format *format_info =
anv_format_for_vk_format(pCreateInfo->format);
const VkColorAttachmentViewCreateInfo *pCreateInfo,
VkColorAttachmentView *pView)
{
- struct anv_device *device = (struct anv_device *) _device;
+ ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_surface_view *view;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO);
const VkDepthStencilViewCreateInfo *pCreateInfo,
VkDepthStencilView *pView)
{
- struct anv_device *device = (struct anv_device *) _device;
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
struct anv_depth_stencil_view *view;
- struct anv_image *image = (struct anv_image *) pCreateInfo->image;
struct anv_surface *depth_surface = &image->primary_surface;
struct anv_surface *stencil_surface = &image->stencil_surface;
const struct anv_format *format =
view->stencil_offset = image->offset + stencil_surface->offset;
view->stencil_qpitch = 0; /* FINISHME: QPitch */
- *pView = (VkDepthStencilView) view;
+ *pView = anv_depth_stencil_view_to_handle(view);
return VK_SUCCESS;
}