[PATCH vkd3d] libs/vkd3d: Use VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT only if array size is >= 6.
From: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> --- libs/vkd3d/resource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index acd3bada63ec..2ccb84797514 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -132,7 +132,8 @@ static HRESULT vkd3d_create_image(struct d3d12_resource *resource, struct d3d12_ image_info.flags = 0; if (!(desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) && dxgi_format_is_typeless(desc->Format)) image_info.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; - if (desc->Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D && desc->Width == desc->Height) + if (desc->Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D + && desc->Width == desc->Height && desc->DepthOrArraySize >= 6) image_info.flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; image_info.imageType = vk_image_type_from_d3d12_resource_dimension(desc->Dimension); -- 2.16.4
On 7 June 2018 at 15:52, Józef Kucia <joseph.kucia(a)gmail.com> wrote:
+ if (desc->Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D + && desc->Width == desc->Height && desc->DepthOrArraySize >= 6) image_info.flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; Should that be a multiple of 6? I.e., are partial cubemap arrays a thing in Direct3D 12?
On Thu, Jun 7, 2018 at 4:03 PM, Henri Verbeet <hverbeet(a)gmail.com> wrote:
On 7 June 2018 at 15:52, Józef Kucia <joseph.kucia(a)gmail.com> wrote:
+ if (desc->Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D + && desc->Width == desc->Height && desc->DepthOrArraySize >= 6) image_info.flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; Should that be a multiple of 6? I.e., are partial cubemap arrays a thing in Direct3D 12?
I think you can create a cube shader resource view for 2D textures, even if the array size is not a multiple of 6. At least, it works that way in Direct3D 11. We have some tests in test_create_shader_resource_view().
participants (3)
-
Henri Verbeet -
Henri Verbeet -
Józef Kucia