mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d: Do not require the ALLOW_DEPTH_STENCIL flag for depth/stencil formats in GetCopyableFootprints().
This commit is contained in:
parent
e99906f05d
commit
10edcec030
Notes:
Henri Verbeet
2025-01-20 16:18:31 +01:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/899
@ -4362,7 +4362,7 @@ static void d3d12_device_get_resource1_allocation_info(struct d3d12_device *devi
|
|||||||
{
|
{
|
||||||
desc = &resource_descs[i];
|
desc = &resource_descs[i];
|
||||||
|
|
||||||
if (FAILED(d3d12_resource_validate_desc(desc, device)))
|
if (FAILED(d3d12_resource_validate_desc(desc, device, 0)))
|
||||||
{
|
{
|
||||||
WARN("Invalid resource desc.\n");
|
WARN("Invalid resource desc.\n");
|
||||||
goto invalid;
|
goto invalid;
|
||||||
@ -4708,13 +4708,13 @@ static void d3d12_device_get_copyable_footprints(struct d3d12_device *device,
|
|||||||
if (total_bytes)
|
if (total_bytes)
|
||||||
*total_bytes = ~(uint64_t)0;
|
*total_bytes = ~(uint64_t)0;
|
||||||
|
|
||||||
if (!(format = vkd3d_format_from_d3d12_resource_desc(device, desc, 0)))
|
if (!(format = vkd3d_get_format(device, desc->Format, true)))
|
||||||
{
|
{
|
||||||
WARN("Invalid format %#x.\n", desc->Format);
|
WARN("Invalid format %#x.\n", desc->Format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(d3d12_resource_validate_desc(desc, device)))
|
if (FAILED(d3d12_resource_validate_desc(desc, device, VKD3D_VALIDATE_FORCE_ALLOW_DS)))
|
||||||
{
|
{
|
||||||
WARN("Invalid resource desc.\n");
|
WARN("Invalid resource desc.\n");
|
||||||
return;
|
return;
|
||||||
|
@ -951,7 +951,7 @@ HRESULT vkd3d_get_image_allocation_info(struct d3d12_device *device,
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
VKD3D_ASSERT(desc->Dimension != D3D12_RESOURCE_DIMENSION_BUFFER);
|
VKD3D_ASSERT(desc->Dimension != D3D12_RESOURCE_DIMENSION_BUFFER);
|
||||||
VKD3D_ASSERT(d3d12_resource_validate_desc(desc, device) == S_OK);
|
VKD3D_ASSERT(d3d12_resource_validate_desc(desc, device, 0) == S_OK);
|
||||||
|
|
||||||
if (!desc->MipLevels)
|
if (!desc->MipLevels)
|
||||||
{
|
{
|
||||||
@ -1847,7 +1847,7 @@ static bool d3d12_resource_validate_texture_alignment(const D3D12_RESOURCE_DESC1
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT d3d12_resource_validate_desc(const D3D12_RESOURCE_DESC1 *desc, struct d3d12_device *device)
|
HRESULT d3d12_resource_validate_desc(const D3D12_RESOURCE_DESC1 *desc, struct d3d12_device *device, uint32_t flags)
|
||||||
{
|
{
|
||||||
const D3D12_MIP_REGION *mip_region = &desc->SamplerFeedbackMipRegion;
|
const D3D12_MIP_REGION *mip_region = &desc->SamplerFeedbackMipRegion;
|
||||||
const struct vkd3d_format *format;
|
const struct vkd3d_format *format;
|
||||||
@ -1893,7 +1893,8 @@ HRESULT d3d12_resource_validate_desc(const D3D12_RESOURCE_DESC1 *desc, struct d3
|
|||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(format = vkd3d_format_from_d3d12_resource_desc(device, desc, 0)))
|
if (!(format = vkd3d_get_format(device, desc->Format,
|
||||||
|
desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL || flags & VKD3D_VALIDATE_FORCE_ALLOW_DS)))
|
||||||
{
|
{
|
||||||
WARN("Invalid format %#x.\n", desc->Format);
|
WARN("Invalid format %#x.\n", desc->Format);
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
@ -2013,7 +2014,7 @@ static HRESULT d3d12_resource_init(struct d3d12_resource *resource, struct d3d12
|
|||||||
resource->gpu_address = 0;
|
resource->gpu_address = 0;
|
||||||
resource->flags = 0;
|
resource->flags = 0;
|
||||||
|
|
||||||
if (FAILED(hr = d3d12_resource_validate_desc(&resource->desc, device)))
|
if (FAILED(hr = d3d12_resource_validate_desc(&resource->desc, device, 0)))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
resource->format = vkd3d_format_from_d3d12_resource_desc(device, desc, 0);
|
resource->format = vkd3d_format_from_d3d12_resource_desc(device, desc, 0);
|
||||||
|
@ -70,6 +70,8 @@
|
|||||||
|
|
||||||
#define VKD3D_SHADER_DESCRIPTOR_TYPE_COUNT (VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER + 1)
|
#define VKD3D_SHADER_DESCRIPTOR_TYPE_COUNT (VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER + 1)
|
||||||
|
|
||||||
|
#define VKD3D_VALIDATE_FORCE_ALLOW_DS 0x1u
|
||||||
|
|
||||||
extern uint64_t object_global_serial_id;
|
extern uint64_t object_global_serial_id;
|
||||||
|
|
||||||
struct d3d12_command_list;
|
struct d3d12_command_list;
|
||||||
@ -534,7 +536,7 @@ struct vkd3d_resource_allocation_info
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool d3d12_resource_is_cpu_accessible(const struct d3d12_resource *resource);
|
bool d3d12_resource_is_cpu_accessible(const struct d3d12_resource *resource);
|
||||||
HRESULT d3d12_resource_validate_desc(const D3D12_RESOURCE_DESC1 *desc, struct d3d12_device *device);
|
HRESULT d3d12_resource_validate_desc(const D3D12_RESOURCE_DESC1 *desc, struct d3d12_device *device, uint32_t flags);
|
||||||
void d3d12_resource_get_tiling(struct d3d12_device *device, const struct d3d12_resource *resource,
|
void d3d12_resource_get_tiling(struct d3d12_device *device, const struct d3d12_resource *resource,
|
||||||
UINT *total_tile_count, D3D12_PACKED_MIP_INFO *packed_mip_info, D3D12_TILE_SHAPE *standard_tile_shape,
|
UINT *total_tile_count, D3D12_PACKED_MIP_INFO *packed_mip_info, D3D12_TILE_SHAPE *standard_tile_shape,
|
||||||
UINT *sub_resource_tiling_count, UINT first_sub_resource_tiling,
|
UINT *sub_resource_tiling_count, UINT first_sub_resource_tiling,
|
||||||
|
@ -20482,13 +20482,7 @@ static void test_get_copyable_footprints(void)
|
|||||||
sub_resource_count = resource_desc.MipLevels;
|
sub_resource_count = resource_desc.MipLevels;
|
||||||
if (resources[i].dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D)
|
if (resources[i].dimension != D3D12_RESOURCE_DIMENSION_TEXTURE3D)
|
||||||
sub_resource_count *= resource_desc.DepthOrArraySize;
|
sub_resource_count *= resource_desc.DepthOrArraySize;
|
||||||
if (format_plane_count(resource_desc.Format) > 1)
|
sub_resource_count *= format_plane_count(resource_desc.Format);
|
||||||
{
|
|
||||||
/* FIXME: we require D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL here for DS formats but windows doesn't. */
|
|
||||||
if (!vkd3d_test_platform_is_windows())
|
|
||||||
resource_desc.Flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
|
|
||||||
sub_resource_count *= 2;
|
|
||||||
}
|
|
||||||
assert(sub_resource_count <= ARRAY_SIZE(layouts));
|
assert(sub_resource_count <= ARRAY_SIZE(layouts));
|
||||||
|
|
||||||
for (k = 0; k < ARRAY_SIZE(base_offsets); ++k)
|
for (k = 0; k < ARRAY_SIZE(base_offsets); ++k)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user