mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Introduce d3d12_resource_is_cpu_accessible() helper.
The condition in d3d12_resource_is_cpu_accessible() is going to be changed in the following commits. Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8d242b32ac
commit
110830aca0
@ -2090,7 +2090,7 @@ static void d3d12_command_list_transition_resource_to_initial_state(struct d3d12
|
||||
/* vkQueueSubmit() defines a memory dependency with prior host writes. */
|
||||
src_stage_mask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
|
||||
barrier.srcAccessMask = 0;
|
||||
barrier.oldLayout = is_cpu_accessible_heap(&resource->heap_properties) ?
|
||||
barrier.oldLayout = d3d12_resource_is_cpu_accessible(resource) ?
|
||||
VK_IMAGE_LAYOUT_PREINITIALIZED : VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
|
||||
if (!vk_barrier_parameters_from_d3d12_resource_state(resource->initial_state,
|
||||
|
@ -23,6 +23,18 @@
|
||||
|
||||
#define VKD3D_HEAP_TYPE_INVALID ((D3D12_HEAP_TYPE)~0u)
|
||||
|
||||
static inline bool is_cpu_accessible_heap(const D3D12_HEAP_PROPERTIES *properties)
|
||||
{
|
||||
if (properties->Type == D3D12_HEAP_TYPE_DEFAULT)
|
||||
return false;
|
||||
if (properties->Type == D3D12_HEAP_TYPE_CUSTOM)
|
||||
{
|
||||
return properties->CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE
|
||||
|| properties->CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_BACK;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static unsigned int vkd3d_select_memory_type(struct d3d12_device *device, uint32_t memory_type_mask,
|
||||
const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags)
|
||||
{
|
||||
@ -894,6 +906,11 @@ static ULONG d3d12_resource_decref(struct d3d12_resource *resource)
|
||||
return refcount;
|
||||
}
|
||||
|
||||
bool d3d12_resource_is_cpu_accessible(const struct d3d12_resource *resource)
|
||||
{
|
||||
return is_cpu_accessible_heap(&resource->heap_properties);
|
||||
}
|
||||
|
||||
/* ID3D12Resource */
|
||||
static inline struct d3d12_resource *impl_from_ID3D12Resource(ID3D12Resource *iface)
|
||||
{
|
||||
@ -1034,7 +1051,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_resource_Map(ID3D12Resource *iface, UINT
|
||||
|
||||
device = resource->device;
|
||||
|
||||
if (!is_cpu_accessible_heap(&resource->heap_properties))
|
||||
if (!d3d12_resource_is_cpu_accessible(resource))
|
||||
{
|
||||
WARN("Resource is not CPU accessible.\n");
|
||||
return E_INVALIDARG;
|
||||
|
@ -414,6 +414,7 @@ static inline bool d3d12_resource_is_texture(const struct d3d12_resource *resour
|
||||
return resource->desc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER;
|
||||
}
|
||||
|
||||
bool d3d12_resource_is_cpu_accessible(const struct d3d12_resource *resource) DECLSPEC_HIDDEN;
|
||||
HRESULT d3d12_resource_validate_desc(const D3D12_RESOURCE_DESC *desc) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT d3d12_committed_resource_create(struct d3d12_device *device,
|
||||
@ -1165,18 +1166,6 @@ bool is_valid_feature_level(D3D_FEATURE_LEVEL feature_level) DECLSPEC_HIDDEN;
|
||||
bool is_valid_resource_state(D3D12_RESOURCE_STATES state) DECLSPEC_HIDDEN;
|
||||
bool is_write_resource_state(D3D12_RESOURCE_STATES state) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline bool is_cpu_accessible_heap(const D3D12_HEAP_PROPERTIES *properties)
|
||||
{
|
||||
if (properties->Type == D3D12_HEAP_TYPE_DEFAULT)
|
||||
return false;
|
||||
if (properties->Type == D3D12_HEAP_TYPE_CUSTOM)
|
||||
{
|
||||
return properties->CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE
|
||||
|| properties->CPUPageProperty == D3D12_CPU_PAGE_PROPERTY_WRITE_BACK;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
HRESULT return_interface(void *iface, REFIID iface_iid,
|
||||
REFIID requested_iid, void **object) DECLSPEC_HIDDEN;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user