From c5e129cf67a4a670e57eba1cce31972aa1b22b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Tue, 28 Aug 2018 12:19:48 +0200 Subject: [PATCH] vkd3d: Add support for default 1D texture views. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- libs/vkd3d/resource.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index ed2d11a4..e40ccbc5 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -1295,15 +1295,21 @@ static bool init_default_texture_view_desc(struct vkd3d_texture_view_desc *desc, return false; } + desc->miplevel_idx = 0; + desc->miplevel_count = 1; + desc->layer_idx = 0; + desc->layer_count = VK_REMAINING_ARRAY_LAYERS; + switch (resource->desc.Dimension) { + case D3D12_RESOURCE_DIMENSION_TEXTURE1D: + desc->view_type = resource->desc.DepthOrArraySize > 1 + ? VK_IMAGE_VIEW_TYPE_1D_ARRAY : VK_IMAGE_VIEW_TYPE_1D; + break; + case D3D12_RESOURCE_DIMENSION_TEXTURE2D: desc->view_type = resource->desc.DepthOrArraySize > 1 ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D; - desc->miplevel_idx = 0; - desc->miplevel_count = 1; - desc->layer_idx = 0; - desc->layer_count = VK_REMAINING_ARRAY_LAYERS; break; default: @@ -1324,7 +1330,7 @@ static VkResult vkd3d_create_texture_view(struct d3d12_device *device, struct VkImageViewCreateInfo view_desc; VkResult vr; - assert(resource->desc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D); + assert(d3d12_resource_is_texture(resource)); view_desc.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; view_desc.pNext = NULL;