2015-05-08 22:32:37 -07:00
|
|
|
/*
|
|
|
|
* Copyright © 2015 Intel Corporation
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
* IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
#include "private.h"
|
|
|
|
|
2015-07-06 16:25:59 -07:00
|
|
|
struct anv_image_view_info {
|
|
|
|
uint8_t surface_type; /**< RENDER_SURFACE_STATE.SurfaceType */
|
|
|
|
bool is_array:1; /**< RENDER_SURFACE_STATE.SurfaceArray */
|
|
|
|
bool is_cube:1; /**< RENDER_SURFACE_STATE.CubeFaceEnable* */
|
|
|
|
};
|
|
|
|
|
2015-06-09 12:11:46 -07:00
|
|
|
static const uint8_t anv_halign[] = {
|
|
|
|
[4] = HALIGN4,
|
|
|
|
[8] = HALIGN8,
|
|
|
|
[16] = HALIGN16,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const uint8_t anv_valign[] = {
|
|
|
|
[4] = VALIGN4,
|
|
|
|
[8] = VALIGN8,
|
|
|
|
[16] = VALIGN16,
|
|
|
|
};
|
|
|
|
|
2015-05-28 07:37:59 -07:00
|
|
|
static const uint8_t anv_surf_type_from_image_type[] = {
|
|
|
|
[VK_IMAGE_TYPE_1D] = SURFTYPE_1D,
|
|
|
|
[VK_IMAGE_TYPE_2D] = SURFTYPE_2D,
|
|
|
|
[VK_IMAGE_TYPE_3D] = SURFTYPE_3D,
|
2015-07-06 16:25:59 -07:00
|
|
|
|
2015-05-28 07:37:59 -07:00
|
|
|
};
|
|
|
|
|
2015-07-06 16:25:59 -07:00
|
|
|
static const struct anv_image_view_info
|
|
|
|
anv_image_view_info_table[] = {
|
|
|
|
#define INFO(s, ...) { .surface_type = s, __VA_ARGS__ }
|
|
|
|
[VK_IMAGE_VIEW_TYPE_1D] = INFO(SURFTYPE_1D),
|
|
|
|
[VK_IMAGE_VIEW_TYPE_2D] = INFO(SURFTYPE_2D),
|
|
|
|
[VK_IMAGE_VIEW_TYPE_3D] = INFO(SURFTYPE_3D),
|
|
|
|
[VK_IMAGE_VIEW_TYPE_CUBE] = INFO(SURFTYPE_CUBE, .is_cube = 1),
|
|
|
|
[VK_IMAGE_VIEW_TYPE_1D_ARRAY] = INFO(SURFTYPE_1D, .is_array = 1),
|
|
|
|
[VK_IMAGE_VIEW_TYPE_2D_ARRAY] = INFO(SURFTYPE_2D, .is_array = 1),
|
|
|
|
[VK_IMAGE_VIEW_TYPE_CUBE_ARRAY] = INFO(SURFTYPE_CUBE, .is_array = 1, .is_cube = 1),
|
|
|
|
#undef INFO
|
2015-05-28 07:37:59 -07:00
|
|
|
};
|
|
|
|
|
2015-05-28 07:40:22 -07:00
|
|
|
static const struct anv_surf_type_limits {
|
|
|
|
int32_t width;
|
|
|
|
int32_t height;
|
|
|
|
int32_t depth;
|
|
|
|
} anv_surf_type_limits[] = {
|
|
|
|
[SURFTYPE_1D] = {16384, 0, 2048},
|
|
|
|
[SURFTYPE_2D] = {16384, 16384, 2048},
|
|
|
|
[SURFTYPE_3D] = {2048, 2048, 2048},
|
|
|
|
[SURFTYPE_CUBE] = {16384, 16384, 340},
|
|
|
|
[SURFTYPE_BUFFER] = {128, 16384, 64},
|
|
|
|
[SURFTYPE_STRBUF] = {128, 16384, 64},
|
|
|
|
};
|
|
|
|
|
2015-06-09 13:29:08 -07:00
|
|
|
static const struct anv_tile_info {
|
|
|
|
uint32_t width;
|
|
|
|
uint32_t height;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Alignment for RENDER_SURFACE_STATE.SurfaceBaseAddress.
|
|
|
|
*
|
|
|
|
* To simplify calculations, the alignments defined in the table are
|
|
|
|
* sometimes larger than required. For example, Skylake requires that X and
|
|
|
|
* Y tiled buffers be aligned to 4K, but Broadwell permits smaller
|
|
|
|
* alignment. We choose 4K to accomodate both chipsets. The alignment of
|
|
|
|
* a linear buffer depends on its element type and usage. Linear depth
|
|
|
|
* buffers have the largest alignment, 64B, so we choose that for all linear
|
|
|
|
* buffers.
|
|
|
|
*/
|
|
|
|
uint32_t surface_alignment;
|
|
|
|
} anv_tile_info_table[] = {
|
|
|
|
[LINEAR] = { 1, 1, 64 },
|
|
|
|
[XMAJOR] = { 512, 8, 4096 },
|
|
|
|
[YMAJOR] = { 128, 32, 4096 },
|
|
|
|
[WMAJOR] = { 128, 32, 4096 },
|
2015-05-08 22:32:37 -07:00
|
|
|
};
|
|
|
|
|
2015-06-09 14:33:05 -07:00
|
|
|
static uint32_t
|
2015-06-26 20:06:08 -07:00
|
|
|
anv_image_choose_tile_mode(const struct anv_image_create_info *anv_info)
|
2015-06-09 14:33:05 -07:00
|
|
|
{
|
2015-06-26 20:06:08 -07:00
|
|
|
if (anv_info->force_tile_mode)
|
2015-06-09 14:33:05 -07:00
|
|
|
return anv_info->tile_mode;
|
|
|
|
|
2015-06-26 18:48:34 -07:00
|
|
|
if (anv_info->vk_info->format == VK_FORMAT_S8_UINT)
|
|
|
|
return WMAJOR;
|
|
|
|
|
2015-06-26 20:06:08 -07:00
|
|
|
switch (anv_info->vk_info->tiling) {
|
2015-06-09 14:33:05 -07:00
|
|
|
case VK_IMAGE_TILING_LINEAR:
|
|
|
|
return LINEAR;
|
|
|
|
case VK_IMAGE_TILING_OPTIMAL:
|
2015-06-11 22:07:16 -07:00
|
|
|
return YMAJOR;
|
2015-06-09 14:33:05 -07:00
|
|
|
default:
|
|
|
|
assert(!"bad VKImageTiling");
|
|
|
|
return LINEAR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-26 21:27:54 -07:00
|
|
|
static VkResult
|
2015-06-26 18:48:34 -07:00
|
|
|
anv_image_make_surface(const struct anv_image_create_info *create_info,
|
|
|
|
uint64_t *inout_image_size,
|
|
|
|
uint32_t *inout_image_alignment,
|
|
|
|
struct anv_surface *out_surface)
|
|
|
|
{
|
2015-06-26 21:27:54 -07:00
|
|
|
/* See RENDER_SURFACE_STATE.SurfaceQPitch */
|
|
|
|
static const uint16_t min_qpitch UNUSED = 0x4;
|
|
|
|
static const uint16_t max_qpitch UNUSED = 0x1ffc;
|
|
|
|
|
2015-06-26 18:48:34 -07:00
|
|
|
const VkExtent3D *restrict extent = &create_info->vk_info->extent;
|
2015-06-26 21:27:54 -07:00
|
|
|
const uint32_t levels = create_info->vk_info->mipLevels;
|
|
|
|
const uint32_t array_size = create_info->vk_info->arraySize;
|
2015-06-26 18:48:34 -07:00
|
|
|
|
|
|
|
const uint8_t tile_mode = anv_image_choose_tile_mode(create_info);
|
|
|
|
|
|
|
|
const struct anv_tile_info *tile_info =
|
|
|
|
&anv_tile_info_table[tile_mode];
|
|
|
|
|
|
|
|
const struct anv_format *format_info =
|
|
|
|
anv_format_for_vk_format(create_info->vk_info->format);
|
|
|
|
|
2015-06-26 21:27:54 -07:00
|
|
|
const uint32_t i = 4; /* FINISHME: Stop hardcoding subimage alignment */
|
|
|
|
const uint32_t j = 4; /* FINISHME: Stop hardcoding subimage alignment */
|
|
|
|
const uint32_t w0 = align_u32(extent->width, i);
|
|
|
|
const uint32_t h0 = align_u32(extent->height, j);
|
|
|
|
|
|
|
|
uint16_t qpitch;
|
|
|
|
uint32_t mt_width;
|
|
|
|
uint32_t mt_height;
|
|
|
|
|
|
|
|
if (levels == 1 && array_size == 1) {
|
|
|
|
qpitch = min_qpitch;
|
|
|
|
mt_width = w0;
|
|
|
|
mt_height = h0;
|
|
|
|
} else {
|
|
|
|
uint32_t w1 = align_u32(anv_minify(extent->width, 1), i);
|
|
|
|
uint32_t h1 = align_u32(anv_minify(extent->height, 1), j);
|
|
|
|
uint32_t w2 = align_u32(anv_minify(extent->width, 2), i);
|
|
|
|
|
|
|
|
qpitch = h0 + h1 + 11 * j;
|
|
|
|
mt_width = MAX(w0, w1 + w2);
|
|
|
|
mt_height = array_size * qpitch;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(qpitch >= min_qpitch);
|
|
|
|
if (qpitch > max_qpitch) {
|
|
|
|
anv_loge("image qpitch > 0x%x\n", max_qpitch);
|
|
|
|
return vk_error(VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* From the Broadwell PRM, RENDER_SURFACE_STATE.SurfaceQpitch:
|
|
|
|
*
|
|
|
|
* This field must be set an integer multiple of the Surface Vertical
|
|
|
|
* Alignment.
|
|
|
|
*/
|
|
|
|
assert(anv_is_aligned(qpitch, j));
|
|
|
|
|
|
|
|
const uint32_t stride = align_u32(mt_width * format_info->cpp,
|
|
|
|
tile_info->width);
|
|
|
|
const uint32_t size = stride * align_u32(mt_height, tile_info->height);
|
|
|
|
const uint32_t offset = align_u32(*inout_image_size,
|
|
|
|
tile_info->surface_alignment);
|
2015-06-26 18:48:34 -07:00
|
|
|
|
|
|
|
*inout_image_size = offset + size;
|
|
|
|
*inout_image_alignment = MAX(*inout_image_alignment,
|
|
|
|
tile_info->surface_alignment);
|
|
|
|
|
|
|
|
*out_surface = (struct anv_surface) {
|
|
|
|
.offset = offset,
|
|
|
|
.stride = stride,
|
|
|
|
.tile_mode = tile_mode,
|
2015-06-26 21:27:54 -07:00
|
|
|
.qpitch = qpitch,
|
|
|
|
.h_align = i,
|
|
|
|
.v_align = j,
|
2015-06-26 18:48:34 -07:00
|
|
|
};
|
2015-06-26 21:27:54 -07:00
|
|
|
|
|
|
|
return VK_SUCCESS;
|
2015-06-26 18:48:34 -07:00
|
|
|
}
|
|
|
|
|
2015-06-26 20:12:42 -07:00
|
|
|
VkResult
|
|
|
|
anv_image_create(VkDevice _device,
|
|
|
|
const struct anv_image_create_info *create_info,
|
|
|
|
VkImage *pImage)
|
2015-05-08 22:32:37 -07:00
|
|
|
{
|
2015-07-09 20:24:07 -07:00
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
2015-06-26 20:06:08 -07:00
|
|
|
const VkImageCreateInfo *pCreateInfo = create_info->vk_info;
|
2015-06-26 09:17:52 -07:00
|
|
|
const VkExtent3D *restrict extent = &pCreateInfo->extent;
|
2015-06-26 21:27:54 -07:00
|
|
|
struct anv_image *image = NULL;
|
|
|
|
VkResult r;
|
2015-05-08 22:32:37 -07:00
|
|
|
|
|
|
|
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO);
|
|
|
|
|
2015-06-10 21:04:51 -07:00
|
|
|
/* XXX: We don't handle any of these */
|
|
|
|
anv_assert(pCreateInfo->imageType == VK_IMAGE_TYPE_2D);
|
2015-06-26 21:27:54 -07:00
|
|
|
anv_assert(pCreateInfo->mipLevels > 0);
|
|
|
|
anv_assert(pCreateInfo->arraySize > 0);
|
2015-06-10 21:04:51 -07:00
|
|
|
anv_assert(pCreateInfo->samples == 1);
|
2015-06-26 09:05:46 -07:00
|
|
|
anv_assert(pCreateInfo->extent.width > 0);
|
|
|
|
anv_assert(pCreateInfo->extent.height > 0);
|
2015-06-26 21:27:54 -07:00
|
|
|
anv_assert(pCreateInfo->extent.depth > 0);
|
2015-06-10 21:04:51 -07:00
|
|
|
|
2015-05-28 07:45:31 -07:00
|
|
|
/* TODO(chadv): How should we validate inputs? */
|
2015-06-26 09:17:52 -07:00
|
|
|
const uint8_t surf_type =
|
|
|
|
anv_surf_type_from_image_type[pCreateInfo->imageType];
|
2015-05-28 07:45:31 -07:00
|
|
|
|
2015-05-28 07:40:22 -07:00
|
|
|
const struct anv_surf_type_limits *limits =
|
2015-06-26 09:17:52 -07:00
|
|
|
&anv_surf_type_limits[surf_type];
|
2015-05-28 07:40:22 -07:00
|
|
|
|
2015-06-26 09:17:52 -07:00
|
|
|
if (extent->width > limits->width ||
|
|
|
|
extent->height > limits->height ||
|
|
|
|
extent->depth > limits->depth) {
|
2015-05-28 07:40:22 -07:00
|
|
|
/* TODO(chadv): What is the correct error? */
|
2015-06-26 09:17:52 -07:00
|
|
|
anv_loge("image extent is too large");
|
2015-05-28 07:40:22 -07:00
|
|
|
return vk_error(VK_ERROR_INVALID_MEMORY_SIZE);
|
|
|
|
}
|
|
|
|
|
2015-06-26 09:17:52 -07:00
|
|
|
const struct anv_format *format_info =
|
|
|
|
anv_format_for_vk_format(pCreateInfo->format);
|
2015-05-22 22:59:12 -07:00
|
|
|
|
2015-06-26 18:48:34 -07:00
|
|
|
image = anv_device_alloc(device, sizeof(*image), 8,
|
|
|
|
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
|
|
|
if (!image)
|
|
|
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
2015-06-26 09:17:52 -07:00
|
|
|
|
2015-06-26 18:48:34 -07:00
|
|
|
memset(image, 0, sizeof(*image));
|
|
|
|
image->type = pCreateInfo->imageType;
|
|
|
|
image->extent = pCreateInfo->extent;
|
|
|
|
image->format = pCreateInfo->format;
|
2015-06-26 21:27:54 -07:00
|
|
|
image->levels = pCreateInfo->mipLevels;
|
|
|
|
image->array_size = pCreateInfo->arraySize;
|
2015-06-26 18:48:34 -07:00
|
|
|
image->surf_type = surf_type;
|
2015-06-26 09:17:52 -07:00
|
|
|
|
2015-06-26 18:48:34 -07:00
|
|
|
if (likely(!format_info->has_stencil || format_info->depth_format)) {
|
|
|
|
/* The image's primary surface is a color or depth surface. */
|
2015-06-26 21:27:54 -07:00
|
|
|
r = anv_image_make_surface(create_info, &image->size, &image->alignment,
|
|
|
|
&image->primary_surface);
|
|
|
|
if (r != VK_SUCCESS)
|
|
|
|
goto fail;
|
2015-05-22 22:59:12 -07:00
|
|
|
}
|
|
|
|
|
2015-06-25 19:03:43 -07:00
|
|
|
if (format_info->has_stencil) {
|
2015-06-26 09:47:17 -07:00
|
|
|
/* From the GPU's perspective, the depth buffer and stencil buffer are
|
|
|
|
* separate buffers. From Vulkan's perspective, though, depth and
|
|
|
|
* stencil reside in the same image. To satisfy Vulkan and the GPU, we
|
|
|
|
* place the depth and stencil buffers in the same bo.
|
|
|
|
*/
|
2015-06-26 18:48:34 -07:00
|
|
|
VkImageCreateInfo stencil_info = *pCreateInfo;
|
|
|
|
stencil_info.format = VK_FORMAT_S8_UINT;
|
|
|
|
|
2015-06-26 21:27:54 -07:00
|
|
|
r = anv_image_make_surface(
|
|
|
|
&(struct anv_image_create_info) {
|
|
|
|
.vk_info = &stencil_info,
|
|
|
|
},
|
|
|
|
&image->size, &image->alignment, &image->stencil_surface);
|
|
|
|
|
|
|
|
if (r != VK_SUCCESS)
|
|
|
|
goto fail;
|
2015-05-22 22:59:12 -07:00
|
|
|
}
|
2015-05-08 22:32:37 -07:00
|
|
|
|
2015-07-09 20:24:07 -07:00
|
|
|
*pImage = anv_image_to_handle(image);
|
2015-05-08 22:32:37 -07:00
|
|
|
|
|
|
|
return VK_SUCCESS;
|
2015-06-26 21:27:54 -07:00
|
|
|
|
|
|
|
fail:
|
|
|
|
if (image)
|
|
|
|
anv_device_free(device, image);
|
|
|
|
|
|
|
|
return r;
|
2015-05-08 22:32:37 -07:00
|
|
|
}
|
|
|
|
|
2015-06-26 20:12:42 -07:00
|
|
|
VkResult
|
|
|
|
anv_CreateImage(VkDevice device,
|
|
|
|
const VkImageCreateInfo *pCreateInfo,
|
|
|
|
VkImage *pImage)
|
2015-05-15 22:04:52 -07:00
|
|
|
{
|
2015-06-26 20:06:08 -07:00
|
|
|
return anv_image_create(device,
|
|
|
|
&(struct anv_image_create_info) {
|
|
|
|
.vk_info = pCreateInfo,
|
|
|
|
},
|
|
|
|
pImage);
|
2015-05-15 22:04:52 -07:00
|
|
|
}
|
|
|
|
|
2015-07-07 18:20:18 -07:00
|
|
|
VkResult anv_GetImageSubresourceLayout(
|
|
|
|
VkDevice device,
|
|
|
|
VkImage image,
|
|
|
|
const VkImageSubresource* pSubresource,
|
|
|
|
VkSubresourceLayout* pLayout)
|
2015-05-08 22:32:37 -07:00
|
|
|
{
|
2015-05-12 13:44:43 -07:00
|
|
|
stub_return(VK_UNSUPPORTED);
|
2015-05-08 22:32:37 -07:00
|
|
|
}
|
|
|
|
|
2015-06-09 11:08:03 -07:00
|
|
|
void
|
|
|
|
anv_surface_view_destroy(struct anv_device *device,
|
|
|
|
struct anv_object *obj, VkObjectType obj_type)
|
|
|
|
{
|
|
|
|
struct anv_surface_view *view = (struct anv_surface_view *)obj;
|
|
|
|
|
|
|
|
assert(obj_type == VK_OBJECT_TYPE_BUFFER_VIEW ||
|
|
|
|
obj_type == VK_OBJECT_TYPE_IMAGE_VIEW ||
|
|
|
|
obj_type == VK_OBJECT_TYPE_COLOR_ATTACHMENT_VIEW);
|
|
|
|
|
|
|
|
anv_state_pool_free(&device->surface_state_pool, view->surface_state);
|
|
|
|
|
|
|
|
anv_device_free(device, view);
|
|
|
|
}
|
|
|
|
|
2015-05-25 22:12:24 -07:00
|
|
|
void
|
|
|
|
anv_image_view_init(struct anv_surface_view *view,
|
|
|
|
struct anv_device *device,
|
|
|
|
const VkImageViewCreateInfo* pCreateInfo,
|
|
|
|
struct anv_cmd_buffer *cmd_buffer)
|
2015-05-08 22:32:37 -07:00
|
|
|
{
|
2015-07-09 20:24:07 -07:00
|
|
|
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
2015-06-26 21:27:54 -07:00
|
|
|
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
|
|
|
|
struct anv_surface *surface;
|
2015-06-26 19:50:04 -07:00
|
|
|
|
|
|
|
const struct anv_format *format_info =
|
2015-05-25 22:12:24 -07:00
|
|
|
anv_format_for_vk_format(pCreateInfo->format);
|
2015-05-22 22:59:12 -07:00
|
|
|
|
2015-07-06 16:25:59 -07:00
|
|
|
const struct anv_image_view_info *view_type_info
|
|
|
|
= &anv_image_view_info_table[pCreateInfo->viewType];
|
|
|
|
|
2015-06-26 21:27:54 -07:00
|
|
|
if (pCreateInfo->viewType != VK_IMAGE_VIEW_TYPE_2D)
|
|
|
|
anv_finishme("non-2D image views");
|
2015-06-26 19:50:04 -07:00
|
|
|
|
2015-05-25 22:12:24 -07:00
|
|
|
switch (pCreateInfo->subresourceRange.aspect) {
|
|
|
|
case VK_IMAGE_ASPECT_STENCIL:
|
2015-06-26 19:23:21 -07:00
|
|
|
anv_finishme("stencil image views");
|
|
|
|
abort();
|
2015-05-25 22:12:24 -07:00
|
|
|
break;
|
|
|
|
case VK_IMAGE_ASPECT_DEPTH:
|
|
|
|
case VK_IMAGE_ASPECT_COLOR:
|
|
|
|
view->offset = image->offset;
|
2015-06-26 18:48:34 -07:00
|
|
|
surface = &image->primary_surface;
|
2015-05-25 22:12:24 -07:00
|
|
|
break;
|
|
|
|
default:
|
2015-06-05 11:51:30 -07:00
|
|
|
unreachable("");
|
2015-05-25 22:12:24 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-06-26 21:27:54 -07:00
|
|
|
view->bo = image->bo;
|
2015-06-26 18:48:34 -07:00
|
|
|
view->offset = image->offset + surface->offset;
|
2015-06-26 21:27:54 -07:00
|
|
|
view->format = pCreateInfo->format;
|
|
|
|
|
|
|
|
view->extent = (VkExtent3D) {
|
|
|
|
.width = anv_minify(image->extent.width, range->baseMipLevel),
|
|
|
|
.height = anv_minify(image->extent.height, range->baseMipLevel),
|
|
|
|
.depth = anv_minify(image->extent.depth, range->baseMipLevel),
|
|
|
|
};
|
2015-06-26 18:48:34 -07:00
|
|
|
|
2015-06-26 21:27:54 -07:00
|
|
|
uint32_t depth = 1;
|
|
|
|
if (range->arraySize > 1) {
|
|
|
|
depth = range->arraySize;
|
|
|
|
} else if (image->extent.depth > 1) {
|
|
|
|
depth = image->extent.depth;
|
|
|
|
}
|
2015-05-25 22:12:24 -07:00
|
|
|
|
|
|
|
static const uint32_t vk_to_gen_swizzle[] = {
|
2015-05-31 22:35:11 -07:00
|
|
|
[VK_CHANNEL_SWIZZLE_ZERO] = SCS_ZERO,
|
|
|
|
[VK_CHANNEL_SWIZZLE_ONE] = SCS_ONE,
|
|
|
|
[VK_CHANNEL_SWIZZLE_R] = SCS_RED,
|
|
|
|
[VK_CHANNEL_SWIZZLE_G] = SCS_GREEN,
|
|
|
|
[VK_CHANNEL_SWIZZLE_B] = SCS_BLUE,
|
|
|
|
[VK_CHANNEL_SWIZZLE_A] = SCS_ALPHA
|
2015-05-25 22:12:24 -07:00
|
|
|
};
|
2015-05-08 22:32:37 -07:00
|
|
|
|
|
|
|
struct GEN8_RENDER_SURFACE_STATE surface_state = {
|
2015-07-06 16:25:59 -07:00
|
|
|
.SurfaceType = view_type_info->surface_type,
|
2015-06-26 21:27:54 -07:00
|
|
|
.SurfaceArray = image->array_size > 1,
|
2015-06-26 19:50:04 -07:00
|
|
|
.SurfaceFormat = format_info->surface_format,
|
2015-06-26 18:48:34 -07:00
|
|
|
.SurfaceVerticalAlignment = anv_valign[surface->v_align],
|
|
|
|
.SurfaceHorizontalAlignment = anv_halign[surface->h_align],
|
|
|
|
.TileMode = surface->tile_mode,
|
2015-05-08 22:32:37 -07:00
|
|
|
.VerticalLineStride = 0,
|
|
|
|
.VerticalLineStrideOffset = 0,
|
|
|
|
.SamplerL2BypassModeDisable = true,
|
|
|
|
.RenderCacheReadWriteMode = WriteOnlyCache,
|
2015-05-21 14:35:34 -07:00
|
|
|
.MemoryObjectControlState = GEN8_MOCS,
|
2015-07-08 14:39:05 -07:00
|
|
|
|
|
|
|
/* The driver sets BaseMipLevel in SAMPLER_STATE, not here in
|
|
|
|
* RENDER_SURFACE_STATE. The Broadwell PRM says "it is illegal to have
|
|
|
|
* both Base Mip Level fields nonzero".
|
|
|
|
*/
|
|
|
|
.BaseMipLevel = 0.0,
|
|
|
|
|
2015-06-26 21:27:54 -07:00
|
|
|
.SurfaceQPitch = surface->qpitch >> 2,
|
2015-05-08 22:32:37 -07:00
|
|
|
.Height = image->extent.height - 1,
|
|
|
|
.Width = image->extent.width - 1,
|
2015-06-26 21:27:54 -07:00
|
|
|
.Depth = depth - 1,
|
2015-06-26 18:48:34 -07:00
|
|
|
.SurfacePitch = surface->stride - 1,
|
2015-06-26 21:27:54 -07:00
|
|
|
.MinimumArrayElement = range->baseArraySlice,
|
2015-05-08 22:32:37 -07:00
|
|
|
.NumberofMultisamples = MULTISAMPLECOUNT_1,
|
|
|
|
.XOffset = 0,
|
|
|
|
.YOffset = 0,
|
2015-06-26 21:27:54 -07:00
|
|
|
|
|
|
|
/* For sampler surfaces, the hardware interprets field MIPCount/LOD as
|
|
|
|
* MIPCount. The range of levels accessible by the sampler engine is
|
|
|
|
* [SurfaceMinLOD, SurfaceMinLOD + MIPCountLOD].
|
|
|
|
*/
|
|
|
|
.MIPCountLOD = range->mipLevels - 1,
|
|
|
|
.SurfaceMinLOD = range->baseMipLevel,
|
|
|
|
|
2015-05-08 22:32:37 -07:00
|
|
|
.AuxiliarySurfaceMode = AUX_NONE,
|
|
|
|
.RedClearColor = 0,
|
|
|
|
.GreenClearColor = 0,
|
|
|
|
.BlueClearColor = 0,
|
|
|
|
.AlphaClearColor = 0,
|
2015-05-25 22:12:24 -07:00
|
|
|
.ShaderChannelSelectRed = vk_to_gen_swizzle[pCreateInfo->channels.r],
|
|
|
|
.ShaderChannelSelectGreen = vk_to_gen_swizzle[pCreateInfo->channels.g],
|
|
|
|
.ShaderChannelSelectBlue = vk_to_gen_swizzle[pCreateInfo->channels.b],
|
|
|
|
.ShaderChannelSelectAlpha = vk_to_gen_swizzle[pCreateInfo->channels.a],
|
2015-06-10 23:11:37 -07:00
|
|
|
.ResourceMinLOD = 0.0,
|
2015-05-25 22:12:24 -07:00
|
|
|
.SurfaceBaseAddress = { NULL, view->offset },
|
2015-05-08 22:32:37 -07:00
|
|
|
};
|
|
|
|
|
2015-05-25 22:12:24 -07:00
|
|
|
if (cmd_buffer)
|
|
|
|
view->surface_state =
|
|
|
|
anv_state_stream_alloc(&cmd_buffer->surface_state_stream, 64, 64);
|
|
|
|
else
|
|
|
|
view->surface_state =
|
|
|
|
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
|
2015-05-18 20:42:03 -07:00
|
|
|
|
2015-05-25 22:12:24 -07:00
|
|
|
GEN8_RENDER_SURFACE_STATE_pack(NULL, view->surface_state.map, &surface_state);
|
2015-05-18 20:42:03 -07:00
|
|
|
}
|
|
|
|
|
2015-07-06 16:24:28 -07:00
|
|
|
VkResult
|
|
|
|
anv_validate_CreateImageView(VkDevice _device,
|
|
|
|
const VkImageViewCreateInfo *pCreateInfo,
|
|
|
|
VkImageView *pView)
|
|
|
|
{
|
2015-07-09 20:24:07 -07:00
|
|
|
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
2015-07-06 17:04:13 -07:00
|
|
|
const VkImageSubresourceRange *subresource;
|
|
|
|
const struct anv_image_view_info *view_info;
|
|
|
|
const struct anv_format *view_format_info;
|
|
|
|
const struct anv_format *image_format_info;
|
2015-07-06 16:24:28 -07:00
|
|
|
|
2015-07-06 17:04:13 -07:00
|
|
|
/* Validate structure type before dereferencing it. */
|
2015-07-06 16:24:28 -07:00
|
|
|
assert(pCreateInfo);
|
|
|
|
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO);
|
2015-07-06 17:04:13 -07:00
|
|
|
subresource = &pCreateInfo->subresourceRange;
|
2015-07-06 16:24:28 -07:00
|
|
|
|
2015-07-06 17:04:13 -07:00
|
|
|
/* 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);
|
|
|
|
view_info = &anv_image_view_info_table[pCreateInfo->viewType];
|
|
|
|
|
|
|
|
/* Validate format is in range before using it. */
|
|
|
|
assert(pCreateInfo->format >= VK_FORMAT_BEGIN_RANGE);
|
|
|
|
assert(pCreateInfo->format <= VK_FORMAT_END_RANGE);
|
|
|
|
image_format_info = anv_format_for_vk_format(image->format);
|
|
|
|
view_format_info = anv_format_for_vk_format(pCreateInfo->format);
|
|
|
|
|
|
|
|
/* Validate channel swizzles. */
|
|
|
|
assert(pCreateInfo->channels.r >= VK_CHANNEL_SWIZZLE_BEGIN_RANGE);
|
|
|
|
assert(pCreateInfo->channels.r <= VK_CHANNEL_SWIZZLE_END_RANGE);
|
|
|
|
assert(pCreateInfo->channels.g >= VK_CHANNEL_SWIZZLE_BEGIN_RANGE);
|
|
|
|
assert(pCreateInfo->channels.g <= VK_CHANNEL_SWIZZLE_END_RANGE);
|
|
|
|
assert(pCreateInfo->channels.b >= VK_CHANNEL_SWIZZLE_BEGIN_RANGE);
|
|
|
|
assert(pCreateInfo->channels.b <= VK_CHANNEL_SWIZZLE_END_RANGE);
|
|
|
|
assert(pCreateInfo->channels.a >= VK_CHANNEL_SWIZZLE_BEGIN_RANGE);
|
|
|
|
assert(pCreateInfo->channels.a <= VK_CHANNEL_SWIZZLE_END_RANGE);
|
|
|
|
|
|
|
|
/* Validate subresource. */
|
|
|
|
assert(subresource->aspect >= VK_IMAGE_ASPECT_BEGIN_RANGE);
|
|
|
|
assert(subresource->aspect <= VK_IMAGE_ASPECT_END_RANGE);
|
|
|
|
assert(subresource->mipLevels > 0);
|
|
|
|
assert(subresource->arraySize > 0);
|
|
|
|
assert(subresource->baseMipLevel < image->levels);
|
|
|
|
assert(subresource->baseMipLevel + subresource->mipLevels <= image->levels);
|
|
|
|
assert(subresource->baseArraySlice < image->array_size);
|
|
|
|
assert(subresource->baseArraySlice + subresource->arraySize <= image->array_size);
|
|
|
|
assert(pView);
|
|
|
|
|
|
|
|
if (view_info->is_cube) {
|
|
|
|
assert(subresource->baseArraySlice % 6 == 0);
|
|
|
|
assert(subresource->arraySize % 6 == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Validate format. */
|
|
|
|
switch (subresource->aspect) {
|
|
|
|
case VK_IMAGE_ASPECT_COLOR:
|
|
|
|
assert(!image_format_info->depth_format);
|
|
|
|
assert(!image_format_info->has_stencil);
|
|
|
|
assert(!view_format_info->depth_format);
|
|
|
|
assert(!view_format_info->has_stencil);
|
|
|
|
assert(view_format_info->cpp == image_format_info->cpp);
|
|
|
|
break;
|
|
|
|
case VK_IMAGE_ASPECT_DEPTH:
|
|
|
|
assert(image_format_info->depth_format);
|
|
|
|
assert(view_format_info->depth_format);
|
|
|
|
assert(view_format_info->cpp == image_format_info->cpp);
|
|
|
|
break;
|
|
|
|
case VK_IMAGE_ASPECT_STENCIL:
|
|
|
|
/* FINISHME: Is it legal to have an R8 view of S8? */
|
|
|
|
assert(image_format_info->has_stencil);
|
|
|
|
assert(view_format_info->has_stencil);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert(!"bad VkImageAspect");
|
|
|
|
break;
|
|
|
|
}
|
2015-07-06 16:24:28 -07:00
|
|
|
|
|
|
|
return anv_CreateImageView(_device, pCreateInfo, pView);
|
|
|
|
}
|
|
|
|
|
2015-06-26 20:12:42 -07:00
|
|
|
VkResult
|
|
|
|
anv_CreateImageView(VkDevice _device,
|
|
|
|
const VkImageViewCreateInfo *pCreateInfo,
|
|
|
|
VkImageView *pView)
|
2015-05-08 22:32:37 -07:00
|
|
|
{
|
2015-07-09 20:24:07 -07:00
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
2015-05-13 15:31:26 -07:00
|
|
|
struct anv_surface_view *view;
|
2015-05-08 22:32:37 -07:00
|
|
|
|
|
|
|
view = anv_device_alloc(device, sizeof(*view), 8,
|
|
|
|
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
|
|
|
if (view == NULL)
|
|
|
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
|
|
|
|
2015-05-18 20:42:03 -07:00
|
|
|
anv_image_view_init(view, device, pCreateInfo, NULL);
|
2015-05-13 17:37:12 -07:00
|
|
|
|
2015-06-09 11:08:03 -07:00
|
|
|
view->base.destructor = anv_surface_view_destroy;
|
|
|
|
|
2015-05-08 22:32:37 -07:00
|
|
|
*pView = (VkImageView) view;
|
|
|
|
|
|
|
|
return VK_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2015-05-18 20:42:03 -07:00
|
|
|
void
|
|
|
|
anv_color_attachment_view_init(struct anv_surface_view *view,
|
|
|
|
struct anv_device *device,
|
|
|
|
const VkColorAttachmentViewCreateInfo* pCreateInfo,
|
|
|
|
struct anv_cmd_buffer *cmd_buffer)
|
|
|
|
{
|
2015-07-09 20:24:07 -07:00
|
|
|
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
2015-06-26 18:48:34 -07:00
|
|
|
struct anv_surface *surface = &image->primary_surface;
|
2015-06-26 21:27:54 -07:00
|
|
|
const struct anv_format *format_info =
|
2015-05-18 20:42:03 -07:00
|
|
|
anv_format_for_vk_format(pCreateInfo->format);
|
|
|
|
|
2015-06-26 21:27:54 -07:00
|
|
|
anv_assert(pCreateInfo->arraySize > 0);
|
|
|
|
anv_assert(pCreateInfo->mipLevel < image->levels);
|
|
|
|
anv_assert(pCreateInfo->baseArraySlice + pCreateInfo->arraySize <= image->array_size);
|
|
|
|
|
|
|
|
if (pCreateInfo->msaaResolveImage)
|
|
|
|
anv_finishme("msaaResolveImage");
|
2015-06-10 21:04:51 -07:00
|
|
|
|
2015-05-18 20:42:03 -07:00
|
|
|
view->bo = image->bo;
|
2015-06-26 21:27:54 -07:00
|
|
|
view->offset = image->offset + surface->offset;
|
2015-05-18 20:42:03 -07:00
|
|
|
view->format = pCreateInfo->format;
|
2015-05-25 22:12:24 -07:00
|
|
|
|
2015-06-26 21:27:54 -07:00
|
|
|
view->extent = (VkExtent3D) {
|
|
|
|
.width = anv_minify(image->extent.width, pCreateInfo->mipLevel),
|
|
|
|
.height = anv_minify(image->extent.height, pCreateInfo->mipLevel),
|
|
|
|
.depth = anv_minify(image->extent.depth, pCreateInfo->mipLevel),
|
|
|
|
};
|
|
|
|
|
|
|
|
uint32_t depth = 1;
|
|
|
|
if (pCreateInfo->arraySize > 1) {
|
|
|
|
depth = pCreateInfo->arraySize;
|
|
|
|
} else if (image->extent.depth > 1) {
|
|
|
|
depth = image->extent.depth;
|
|
|
|
}
|
|
|
|
|
2015-05-25 22:12:24 -07:00
|
|
|
if (cmd_buffer)
|
|
|
|
view->surface_state =
|
|
|
|
anv_state_stream_alloc(&cmd_buffer->surface_state_stream, 64, 64);
|
|
|
|
else
|
|
|
|
view->surface_state =
|
|
|
|
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
|
|
|
|
|
|
|
|
struct GEN8_RENDER_SURFACE_STATE surface_state = {
|
|
|
|
.SurfaceType = SURFTYPE_2D,
|
2015-06-26 21:27:54 -07:00
|
|
|
.SurfaceArray = image->array_size > 1,
|
|
|
|
.SurfaceFormat = format_info->surface_format,
|
2015-06-26 18:48:34 -07:00
|
|
|
.SurfaceVerticalAlignment = anv_valign[surface->v_align],
|
|
|
|
.SurfaceHorizontalAlignment = anv_halign[surface->h_align],
|
|
|
|
.TileMode = surface->tile_mode,
|
2015-05-25 22:12:24 -07:00
|
|
|
.VerticalLineStride = 0,
|
|
|
|
.VerticalLineStrideOffset = 0,
|
|
|
|
.SamplerL2BypassModeDisable = true,
|
|
|
|
.RenderCacheReadWriteMode = WriteOnlyCache,
|
|
|
|
.MemoryObjectControlState = GEN8_MOCS,
|
2015-07-08 14:39:05 -07:00
|
|
|
|
|
|
|
/* The driver sets BaseMipLevel in SAMPLER_STATE, not here in
|
|
|
|
* RENDER_SURFACE_STATE. The Broadwell PRM says "it is illegal to have
|
|
|
|
* both Base Mip Level fields nonzero".
|
|
|
|
*/
|
2015-06-10 23:11:37 -07:00
|
|
|
.BaseMipLevel = 0.0,
|
2015-07-08 14:39:05 -07:00
|
|
|
|
2015-06-26 21:27:54 -07:00
|
|
|
.SurfaceQPitch = surface->qpitch >> 2,
|
2015-05-25 22:12:24 -07:00
|
|
|
.Height = image->extent.height - 1,
|
|
|
|
.Width = image->extent.width - 1,
|
2015-06-26 21:27:54 -07:00
|
|
|
.Depth = depth - 1,
|
2015-06-26 18:48:34 -07:00
|
|
|
.SurfacePitch = surface->stride - 1,
|
2015-06-26 21:27:54 -07:00
|
|
|
.MinimumArrayElement = pCreateInfo->baseArraySlice,
|
2015-05-25 22:12:24 -07:00
|
|
|
.NumberofMultisamples = MULTISAMPLECOUNT_1,
|
|
|
|
.XOffset = 0,
|
|
|
|
.YOffset = 0,
|
2015-06-26 21:27:54 -07:00
|
|
|
|
|
|
|
/* For render target surfaces, the hardware interprets field MIPCount/LOD as
|
|
|
|
* LOD. The Broadwell PRM says:
|
|
|
|
*
|
|
|
|
* MIPCountLOD defines the LOD that will be rendered into.
|
|
|
|
* SurfaceMinLOD is ignored.
|
|
|
|
*/
|
2015-05-25 22:12:24 -07:00
|
|
|
.SurfaceMinLOD = 0,
|
2015-06-26 21:27:54 -07:00
|
|
|
.MIPCountLOD = pCreateInfo->mipLevel,
|
|
|
|
|
2015-05-25 22:12:24 -07:00
|
|
|
.AuxiliarySurfaceMode = AUX_NONE,
|
|
|
|
.RedClearColor = 0,
|
|
|
|
.GreenClearColor = 0,
|
|
|
|
.BlueClearColor = 0,
|
|
|
|
.AlphaClearColor = 0,
|
|
|
|
.ShaderChannelSelectRed = SCS_RED,
|
|
|
|
.ShaderChannelSelectGreen = SCS_GREEN,
|
|
|
|
.ShaderChannelSelectBlue = SCS_BLUE,
|
|
|
|
.ShaderChannelSelectAlpha = SCS_ALPHA,
|
2015-06-10 23:11:37 -07:00
|
|
|
.ResourceMinLOD = 0.0,
|
2015-05-25 22:12:24 -07:00
|
|
|
.SurfaceBaseAddress = { NULL, view->offset },
|
|
|
|
};
|
|
|
|
|
|
|
|
GEN8_RENDER_SURFACE_STATE_pack(NULL, view->surface_state.map, &surface_state);
|
2015-05-18 20:42:03 -07:00
|
|
|
}
|
|
|
|
|
2015-06-26 20:12:42 -07:00
|
|
|
VkResult
|
|
|
|
anv_CreateColorAttachmentView(VkDevice _device,
|
|
|
|
const VkColorAttachmentViewCreateInfo *pCreateInfo,
|
|
|
|
VkColorAttachmentView *pView)
|
2015-05-08 22:32:37 -07:00
|
|
|
{
|
2015-07-09 20:24:07 -07:00
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
2015-05-13 15:31:26 -07:00
|
|
|
struct anv_surface_view *view;
|
2015-05-08 22:32:37 -07:00
|
|
|
|
|
|
|
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_COLOR_ATTACHMENT_VIEW_CREATE_INFO);
|
|
|
|
|
|
|
|
view = anv_device_alloc(device, sizeof(*view), 8,
|
|
|
|
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
|
|
|
if (view == NULL)
|
|
|
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
|
|
|
|
2015-05-18 20:42:03 -07:00
|
|
|
anv_color_attachment_view_init(view, device, pCreateInfo, NULL);
|
2015-05-08 22:32:37 -07:00
|
|
|
|
2015-06-09 11:08:03 -07:00
|
|
|
view->base.destructor = anv_surface_view_destroy;
|
|
|
|
|
2015-05-08 22:32:37 -07:00
|
|
|
*pView = (VkColorAttachmentView) view;
|
|
|
|
|
|
|
|
return VK_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2015-06-26 20:12:42 -07:00
|
|
|
VkResult
|
|
|
|
anv_CreateDepthStencilView(VkDevice _device,
|
|
|
|
const VkDepthStencilViewCreateInfo *pCreateInfo,
|
|
|
|
VkDepthStencilView *pView)
|
2015-05-08 22:32:37 -07:00
|
|
|
{
|
2015-07-09 20:24:07 -07:00
|
|
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
|
|
|
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
2015-05-22 22:59:12 -07:00
|
|
|
struct anv_depth_stencil_view *view;
|
2015-06-26 18:48:34 -07:00
|
|
|
struct anv_surface *depth_surface = &image->primary_surface;
|
|
|
|
struct anv_surface *stencil_surface = &image->stencil_surface;
|
2015-05-22 22:59:12 -07:00
|
|
|
const struct anv_format *format =
|
|
|
|
anv_format_for_vk_format(image->format);
|
|
|
|
|
|
|
|
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DEPTH_STENCIL_VIEW_CREATE_INFO);
|
|
|
|
|
|
|
|
view = anv_device_alloc(device, sizeof(*view), 8,
|
|
|
|
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
|
|
|
if (view == NULL)
|
|
|
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
|
|
|
|
2015-06-10 21:04:51 -07:00
|
|
|
/* XXX: We don't handle any of these */
|
|
|
|
anv_assert(pCreateInfo->mipLevel == 0);
|
|
|
|
anv_assert(pCreateInfo->baseArraySlice == 0);
|
|
|
|
anv_assert(pCreateInfo->arraySize == 1);
|
|
|
|
|
2015-05-22 22:59:12 -07:00
|
|
|
view->bo = image->bo;
|
|
|
|
|
2015-06-26 18:48:34 -07:00
|
|
|
view->depth_stride = depth_surface->stride;
|
|
|
|
view->depth_offset = image->offset + depth_surface->offset;
|
2015-06-25 19:29:59 -07:00
|
|
|
view->depth_format = format->depth_format;
|
2015-06-25 19:46:42 -07:00
|
|
|
view->depth_qpitch = 0; /* FINISHME: QPitch */
|
2015-05-22 22:59:12 -07:00
|
|
|
|
2015-06-26 18:48:34 -07:00
|
|
|
view->stencil_stride = stencil_surface->stride;
|
|
|
|
view->stencil_offset = image->offset + stencil_surface->offset;
|
2015-06-25 19:46:42 -07:00
|
|
|
view->stencil_qpitch = 0; /* FINISHME: QPitch */
|
2015-05-22 22:59:12 -07:00
|
|
|
|
2015-07-09 20:24:07 -07:00
|
|
|
*pView = anv_depth_stencil_view_to_handle(view);
|
2015-05-22 22:59:12 -07:00
|
|
|
|
|
|
|
return VK_SUCCESS;
|
2015-05-08 22:32:37 -07:00
|
|
|
}
|