[PATCH vkd3d 1/5] vkd3d: Use helper functions for null resource initialisation.

Rémi Bernon rbernon at codeweavers.com
Wed Dec 11 07:14:06 CST 2019


On 12/10/19 3:57 PM, Conor McCarthy wrote:
> +static HRESULT vkd3d_create_null_ua_texture(struct d3d12_device *device, D3D12_RESOURCE_DIMENSION dimension,
> +        VkImage *vk_image, VkDeviceMemory *vk_memory)
> +{
> +    const bool use_sparse_resources = device->vk_info.sparse_properties.residencyNonResidentStrict;
> +    D3D12_HEAP_PROPERTIES heap_properties;
> +    D3D12_RESOURCE_DESC resource_desc;
> +    HRESULT hr;
> +
> +    memset(&heap_properties, 0, sizeof(heap_properties));
> +    heap_properties.Type = D3D12_HEAP_TYPE_DEFAULT;
> +
> +    resource_desc.Dimension = dimension;
> +    resource_desc.Alignment = 0;
> +    resource_desc.Width = 1;
> +    resource_desc.Height = 1;
> +    resource_desc.DepthOrArraySize = 1;
> +    resource_desc.MipLevels = 1;
> +    resource_desc.Format = VKD3D_NULL_VIEW_FORMAT;
> +    resource_desc.SampleDesc.Count = 1;
> +    resource_desc.SampleDesc.Quality = 0;
> +    resource_desc.Layout = use_sparse_resources
> +            ? D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE : D3D12_TEXTURE_LAYOUT_UNKNOWN;
> +    resource_desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
> +
> +    if (FAILED(hr = vkd3d_create_image(device, use_sparse_resources ? NULL : &heap_properties, D3D12_HEAP_FLAG_NONE,
> +            &resource_desc, NULL, vk_image)))
> +        return hr;
> +    if (!use_sparse_resources && FAILED(hr = vkd3d_allocate_image_memory(device, *vk_image,
> +            &heap_properties, D3D12_HEAP_FLAG_NONE, vk_memory, NULL, NULL)))
> +        return hr;
> +
> +    return S_OK;
> +}
> +

I believe this triggers this vulkan validation error when used to create 
null 1D uav image in the following patch:

[ VUID-VkImageCreateInfo-imageType-00970 ] Object: VK_NULL_HANDLE (Type 
= 0) | vkCreateImage: cannot specify VK_IMAGE_CREATE_SPARSE_BINDING_BIT 
for 1D image. The Vulkan spec states: If imageType is VK_IMAGE_TYPE_1D, 
flags must not contain VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT 
(https://www.khronos.org/registry/vulkan/specs/1.1-extensions/html/vkspec.html#VUID-VkImageCreateInfo-imageType-00970)

I'm not sure what's right, but I guess use_sparse_resources could be 0 
when dimension is 1D.
-- 
Rémi Bernon <rbernon at codeweavers.com>



More information about the wine-devel mailing list