=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: libs/vkd3d: Add remaining helper functions for CPU descriptor handles.
Alexandre Julliard
julliard at winehq.org
Thu Feb 8 15:10:58 CST 2018
Module: vkd3d
Branch: master
Commit: dd6dedd9d199bb0c03e9fd34ded813a422838861
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=dd6dedd9d199bb0c03e9fd34ded813a422838861
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Wed Feb 7 21:27:09 2018 +0100
libs/vkd3d: Add remaining helper functions for CPU descriptor handles.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d/command.c | 8 ++++----
libs/vkd3d/device.c | 12 ++++++------
libs/vkd3d/vkd3d_private.h | 10 ++++++++++
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index 3b7d2ee..4273a66 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -3390,7 +3390,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_OMSetRenderTargets(ID3D12Graphi
list->fb_height = 0;
for (i = 0; i < render_target_descriptor_count; ++i)
{
- const struct d3d12_rtv_desc *rtv_desc = (const struct d3d12_rtv_desc *)render_target_descriptors[i].ptr;
+ const struct d3d12_rtv_desc *rtv_desc = d3d12_rtv_desc_from_cpu_handle(render_target_descriptors[i]);
d3d12_command_list_track_resource_usage(list, rtv_desc->resource);
@@ -3403,7 +3403,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_OMSetRenderTargets(ID3D12Graphi
if (depth_stencil_descriptor)
{
- const struct d3d12_dsv_desc *dsv_desc = (const struct d3d12_dsv_desc *)depth_stencil_descriptor->ptr;
+ const struct d3d12_dsv_desc *dsv_desc = d3d12_dsv_desc_from_cpu_handle(*depth_stencil_descriptor);
d3d12_command_list_track_resource_usage(list, dsv_desc->resource);
@@ -3523,7 +3523,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearDepthStencilView(ID3D12Gra
{
const union VkClearValue clear_value = {.depthStencil = {depth, stencil}};
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface);
- struct d3d12_dsv_desc *dsv_desc = (struct d3d12_dsv_desc *)dsv.ptr;
+ const struct d3d12_dsv_desc *dsv_desc = d3d12_dsv_desc_from_cpu_handle(dsv);
struct VkAttachmentDescription attachment_desc;
struct VkAttachmentReference ds_reference;
@@ -3570,7 +3570,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ClearRenderTargetView(ID3D12Gra
{
const union VkClearValue clear_value = {{{color[0], color[1], color[2], color[3]}}};
struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface);
- struct d3d12_rtv_desc *rtv_desc = (struct d3d12_rtv_desc *)rtv.ptr;
+ const struct d3d12_rtv_desc *rtv_desc = d3d12_rtv_desc_from_cpu_handle(rtv);
struct VkAttachmentDescription attachment_desc;
struct VkAttachmentReference color_reference;
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c
index 31fee8a..54b3d0e 100644
--- a/libs/vkd3d/device.c
+++ b/libs/vkd3d/device.c
@@ -1605,7 +1605,7 @@ static void STDMETHODCALLTYPE d3d12_device_CreateConstantBufferView(ID3D12Device
{
TRACE("iface %p, desc %p, descriptor %#lx.\n", iface, desc, descriptor.ptr);
- d3d12_desc_create_cbv((struct d3d12_desc *)descriptor.ptr,
+ d3d12_desc_create_cbv(d3d12_desc_from_cpu_handle(descriptor),
impl_from_ID3D12Device(iface), desc);
}
@@ -1616,7 +1616,7 @@ static void STDMETHODCALLTYPE d3d12_device_CreateShaderResourceView(ID3D12Device
TRACE("iface %p, resource %p, desc %p, descriptor %#lx.\n",
iface, resource, desc, descriptor.ptr);
- d3d12_desc_create_srv((struct d3d12_desc *)descriptor.ptr,
+ d3d12_desc_create_srv(d3d12_desc_from_cpu_handle(descriptor),
impl_from_ID3D12Device(iface), unsafe_impl_from_ID3D12Resource(resource), desc);
}
@@ -1627,7 +1627,7 @@ static void STDMETHODCALLTYPE d3d12_device_CreateUnorderedAccessView(ID3D12Devic
TRACE("iface %p, resource %p, counter_resource %p, desc %p, descriptor %#lx.\n",
iface, resource, counter_resource, desc, descriptor.ptr);
- d3d12_desc_create_uav((struct d3d12_desc *)descriptor.ptr,
+ d3d12_desc_create_uav(d3d12_desc_from_cpu_handle(descriptor),
impl_from_ID3D12Device(iface), unsafe_impl_from_ID3D12Resource(resource),
unsafe_impl_from_ID3D12Resource(counter_resource), desc);
}
@@ -1639,7 +1639,7 @@ static void STDMETHODCALLTYPE d3d12_device_CreateRenderTargetView(ID3D12Device *
TRACE("iface %p, resource %p, desc %p, descriptor %#lx.\n",
iface, resource, desc, descriptor.ptr);
- d3d12_rtv_desc_create_rtv((struct d3d12_rtv_desc *)descriptor.ptr,
+ d3d12_rtv_desc_create_rtv(d3d12_rtv_desc_from_cpu_handle(descriptor),
impl_from_ID3D12Device(iface), unsafe_impl_from_ID3D12Resource(resource), desc);
}
@@ -1650,7 +1650,7 @@ static void STDMETHODCALLTYPE d3d12_device_CreateDepthStencilView(ID3D12Device *
TRACE("iface %p, resource %p, desc %p, descriptor %#lx.\n",
iface, resource, desc, descriptor.ptr);
- d3d12_dsv_desc_create_dsv((struct d3d12_dsv_desc *)descriptor.ptr,
+ d3d12_dsv_desc_create_dsv(d3d12_dsv_desc_from_cpu_handle(descriptor),
impl_from_ID3D12Device(iface), unsafe_impl_from_ID3D12Resource(resource), desc);
}
@@ -1659,7 +1659,7 @@ static void STDMETHODCALLTYPE d3d12_device_CreateSampler(ID3D12Device *iface,
{
TRACE("iface %p, desc %p, descriptor %#lx.\n", iface, desc, descriptor.ptr);
- d3d12_desc_create_sampler((struct d3d12_desc *)descriptor.ptr,
+ d3d12_desc_create_sampler(d3d12_desc_from_cpu_handle(descriptor),
impl_from_ID3D12Device(iface), desc);
}
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index f222871..89e4f23 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -286,6 +286,11 @@ struct d3d12_rtv_desc
struct d3d12_resource *resource;
};
+static inline struct d3d12_rtv_desc *d3d12_rtv_desc_from_cpu_handle(D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle)
+{
+ return (struct d3d12_rtv_desc *)cpu_handle.ptr;
+}
+
void d3d12_rtv_desc_create_rtv(struct d3d12_rtv_desc *rtv_desc, struct d3d12_device *device,
struct d3d12_resource *resource, const D3D12_RENDER_TARGET_VIEW_DESC *desc) DECLSPEC_HIDDEN;
@@ -299,6 +304,11 @@ struct d3d12_dsv_desc
struct d3d12_resource *resource;
};
+static inline struct d3d12_dsv_desc *d3d12_dsv_desc_from_cpu_handle(D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle)
+{
+ return (struct d3d12_dsv_desc *)cpu_handle.ptr;
+}
+
void d3d12_dsv_desc_create_dsv(struct d3d12_dsv_desc *dsv_desc, struct d3d12_device *device,
struct d3d12_resource *resource, const D3D12_DEPTH_STENCIL_VIEW_DESC *desc) DECLSPEC_HIDDEN;
More information about the wine-cvs
mailing list