mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d: Add DXGI_FORMAT_UNKNOWN to the array of vkd3d_format objects.
This results in a valid format instead of NULL being returned for buffers and any other case where DXGI_FORMAT_UNKNOWN is specified. In some cases invalid use of a buffer or DXGI_FORMAT_UNKNOWN will not result in E_INVALIDARG, and would need to be tested explicitly if proven to be an issue. Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b93edeccfd
commit
ecb854c6c1
@ -3726,8 +3726,6 @@ static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints(ID3D12Device *i
|
||||
UINT *row_counts, UINT64 *row_sizes, UINT64 *total_bytes)
|
||||
{
|
||||
struct d3d12_device *device = impl_from_ID3D12Device(iface);
|
||||
static const struct vkd3d_format vkd3d_format_unknown
|
||||
= {DXGI_FORMAT_UNKNOWN, VK_FORMAT_UNDEFINED, 1, 1, 1, 1, 0};
|
||||
|
||||
unsigned int i, sub_resource_idx, miplevel_idx, row_count, row_size, row_pitch;
|
||||
unsigned int width, height, depth, plane_count, sub_resources_per_plane;
|
||||
@ -3748,11 +3746,7 @@ static void STDMETHODCALLTYPE d3d12_device_GetCopyableFootprints(ID3D12Device *i
|
||||
if (total_bytes)
|
||||
*total_bytes = ~(uint64_t)0;
|
||||
|
||||
if (desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
|
||||
{
|
||||
format = &vkd3d_format_unknown;
|
||||
}
|
||||
else if (!(format = vkd3d_format_from_d3d12_resource_desc(device, desc, 0)))
|
||||
if (!(format = vkd3d_format_from_d3d12_resource_desc(device, desc, 0)))
|
||||
{
|
||||
WARN("Invalid format %#x.\n", desc->Format);
|
||||
return;
|
||||
|
@ -1589,6 +1589,12 @@ static void d3d12_validate_resource_flags(D3D12_RESOURCE_FLAGS flags)
|
||||
static bool d3d12_resource_validate_texture_format(const D3D12_RESOURCE_DESC *desc,
|
||||
const struct vkd3d_format *format)
|
||||
{
|
||||
if (desc->Format == DXGI_FORMAT_UNKNOWN)
|
||||
{
|
||||
WARN("DXGI_FORMAT_UNKNOWN is invalid for textures.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!vkd3d_format_is_compressed(format))
|
||||
return true;
|
||||
|
||||
@ -2273,6 +2279,8 @@ static bool vkd3d_create_buffer_view_for_resource(struct d3d12_device *device,
|
||||
}
|
||||
else if ((format = vkd3d_format_from_d3d12_resource_desc(device, &resource->desc, view_format)))
|
||||
{
|
||||
/* TODO: if view_format is DXGI_FORMAT_UNKNOWN, this is always 1, which
|
||||
* may not match driver behaviour (return false?). */
|
||||
element_size = format->byte_count;
|
||||
}
|
||||
else
|
||||
|
@ -2328,6 +2328,8 @@ static HRESULT compute_input_layout_offsets(const struct d3d12_device *device,
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
/* TODO: DXGI_FORMAT_UNKNOWN will return a format with byte_count == 1,
|
||||
* which may not match driver behaviour (return E_INVALIDARG?). */
|
||||
if (!(format = vkd3d_get_format(device, e->Format, false)))
|
||||
{
|
||||
WARN("Invalid input element format %#x.\n", e->Format);
|
||||
@ -2816,6 +2818,8 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
|
||||
const D3D12_INPUT_ELEMENT_DESC *e = &desc->InputLayout.pInputElementDescs[i];
|
||||
const struct vkd3d_shader_signature_element *signature_element;
|
||||
|
||||
/* TODO: DXGI_FORMAT_UNKNOWN will succeed here, which may not match
|
||||
* driver behaviour (return E_INVALIDARG?). */
|
||||
if (!(format = vkd3d_get_format(device, e->Format, false)))
|
||||
{
|
||||
WARN("Invalid input element format %#x.\n", e->Format);
|
||||
|
@ -29,6 +29,7 @@
|
||||
#define UINT VKD3D_FORMAT_TYPE_UINT
|
||||
static const struct vkd3d_format vkd3d_formats[] =
|
||||
{
|
||||
{DXGI_FORMAT_UNKNOWN, VK_FORMAT_UNDEFINED, 1, 1, 1, 1},
|
||||
{DXGI_FORMAT_R32G32B32A32_TYPELESS, VK_FORMAT_R32G32B32A32_SFLOAT, 16, 1, 1, 1, COLOR, 1, TYPELESS},
|
||||
{DXGI_FORMAT_R32G32B32A32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, 16, 1, 1, 1, COLOR, 1},
|
||||
{DXGI_FORMAT_R32G32B32A32_UINT, VK_FORMAT_R32G32B32A32_UINT, 16, 1, 1, 1, COLOR, 1, UINT},
|
||||
|
@ -1167,7 +1167,7 @@ static void test_format_support(void)
|
||||
memset(&format_support, 0, sizeof(format_support));
|
||||
hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FORMAT_SUPPORT,
|
||||
&format_support, sizeof(format_support));
|
||||
todo ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||
todo ok(format_support.Support1 == D3D12_FORMAT_SUPPORT1_BUFFER,
|
||||
"Got unexpected support1 %#x.\n", format_support.Support1);
|
||||
ok(!format_support.Support2 || format_support.Support2 == D3D12_FORMAT_SUPPORT2_TILED,
|
||||
|
Loading…
x
Reference in New Issue
Block a user