winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
September 2018
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
670 discussions
Start a n
N
ew thread
Józef Kucia : vkd3d: Simplify d3d12_device_init().
by Alexandre Julliard
12 Sep '18
12 Sep '18
Module: vkd3d Branch: master Commit: e7eb9ca93648f8f975dda334f3463c4cde32928c URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=e7eb9ca93648f8f975dda33…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 12 15:20:01 2018 +0200 vkd3d: Simplify d3d12_device_init(). Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/vkd3d/device.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index d39eef2..cfb17ea 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -2282,6 +2282,7 @@ struct d3d12_device *unsafe_impl_from_ID3D12Device(ID3D12Device *iface) static HRESULT d3d12_device_init(struct d3d12_device *device, struct vkd3d_instance *instance, const struct vkd3d_device_create_info *create_info) { + const struct vkd3d_vk_device_procs *vk_procs; HRESULT hr; device->ID3D12Device_iface.lpVtbl = &d3d12_device_vtbl; @@ -2295,30 +2296,22 @@ static HRESULT d3d12_device_init(struct d3d12_device *device, device->wchar_size = instance->wchar_size; device->adapter_luid = create_info->adapter_luid; + device->removed_reason = S_OK; + + device->vk_device = VK_NULL_HANDLE; + device->vk_dummy_sampler = VK_NULL_HANDLE; if (FAILED(hr = vkd3d_create_vk_device(device, create_info))) - { - vkd3d_instance_decref(device->vkd3d_instance); - return hr; - } + goto out_free_instance; if (FAILED(hr = d3d12_device_create_dummy_sampler(device))) { - const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; ERR("Failed to create dummy sampler, hr %#x.\n", hr); - VK_CALL(vkDestroyDevice(device->vk_device, NULL)); - vkd3d_instance_decref(device->vkd3d_instance); - return hr; + goto out_free_vk_resources; } if (FAILED(hr = vkd3d_fence_worker_start(&device->fence_worker, device))) - { - const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; - VK_CALL(vkDestroySampler(device->vk_device, device->vk_dummy_sampler, NULL)); - VK_CALL(vkDestroyDevice(device->vk_device, NULL)); - vkd3d_instance_decref(device->vkd3d_instance); - return hr; - } + goto out_free_vk_resources; vkd3d_gpu_va_allocator_init(&device->gpu_va_allocator); @@ -2327,9 +2320,15 @@ static HRESULT d3d12_device_init(struct d3d12_device *device, if ((device->parent = create_info->parent)) IUnknown_AddRef(device->parent); - device->removed_reason = S_OK; - return S_OK; + +out_free_vk_resources: + vk_procs = &device->vk_procs; + VK_CALL(vkDestroySampler(device->vk_device, device->vk_dummy_sampler, NULL)); + VK_CALL(vkDestroyDevice(device->vk_device, NULL)); +out_free_instance: + vkd3d_instance_decref(device->vkd3d_instance); + return hr; } HRESULT d3d12_device_create(struct vkd3d_instance *instance,
1
0
0
0
Józef Kucia : vkd3d: Reset command list state in d3d12_command_list_Reset().
by Alexandre Julliard
12 Sep '18
12 Sep '18
Module: vkd3d Branch: master Commit: f3e48a9192121e903a99ecee3308bc4bf9309614 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=f3e48a9192121e903a99ece…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 12 15:20:00 2018 +0200 vkd3d: Reset command list state in d3d12_command_list_Reset(). Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/vkd3d/command.c | 61 +++++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index d5bbee9..2fc5643 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -1713,15 +1713,39 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_list_Close(ID3D12GraphicsCommandL return S_OK; } +static void d3d12_command_list_reset_state(struct d3d12_command_list *list, + ID3D12PipelineState *initial_pipeline_state) +{ + ID3D12GraphicsCommandList *iface = &list->ID3D12GraphicsCommandList_iface; + + memset(list->strides, 0, sizeof(list->strides)); + list->primitive_topology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST; + + memset(list->views, 0, sizeof(list->views)); + list->fb_width = 0; + list->fb_height = 0; + list->fb_layer_count = 0; + + list->current_framebuffer = VK_NULL_HANDLE; + list->current_pipeline = VK_NULL_HANDLE; + list->current_render_pass = VK_NULL_HANDLE; + + memset(list->pipeline_bindings, 0, sizeof(list->pipeline_bindings)); + + list->state = NULL; + + ID3D12GraphicsCommandList_SetPipelineState(iface, initial_pipeline_state); +} + static HRESULT STDMETHODCALLTYPE d3d12_command_list_Reset(ID3D12GraphicsCommandList *iface, - ID3D12CommandAllocator *allocator, ID3D12PipelineState *initial_state) + ID3D12CommandAllocator *allocator, ID3D12PipelineState *initial_pipeline_state) { struct d3d12_command_allocator *allocator_impl = unsafe_impl_from_ID3D12CommandAllocator(allocator); struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface); HRESULT hr; - TRACE("iface %p, allocator %p, initial_state %p.\n", - iface, allocator, initial_state); + TRACE("iface %p, allocator %p, initial_pipeline_state %p.\n", + iface, allocator, initial_pipeline_state); if (!allocator_impl) { @@ -1738,12 +1762,9 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_list_Reset(ID3D12GraphicsCommandL if (SUCCEEDED(hr = d3d12_command_allocator_allocate_command_buffer(allocator_impl, list))) { list->allocator = allocator_impl; - - ID3D12GraphicsCommandList_SetPipelineState(&list->ID3D12GraphicsCommandList_iface, initial_state); + d3d12_command_list_reset_state(list, initial_pipeline_state); } - memset(list->pipeline_bindings, 0, sizeof(list->pipeline_bindings)); - return hr; } @@ -4239,30 +4260,12 @@ static HRESULT d3d12_command_list_init(struct d3d12_command_list *list, struct d list->allocator = allocator; - memset(list->strides, 0, sizeof(list->strides)); - list->primitive_topology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST; - - memset(list->views, 0, sizeof(list->views)); - list->fb_width = 0; - list->fb_height = 0; - list->fb_layer_count = 0; - - list->current_framebuffer = VK_NULL_HANDLE; - list->current_pipeline = VK_NULL_HANDLE; - list->current_render_pass = VK_NULL_HANDLE; - memset(list->pipeline_bindings, 0, sizeof(list->pipeline_bindings)); - - list->state = NULL; - - if (FAILED(hr = d3d12_command_allocator_allocate_command_buffer(allocator, list))) - { + if (SUCCEEDED(hr = d3d12_command_allocator_allocate_command_buffer(allocator, list))) + d3d12_command_list_reset_state(list, initial_pipeline_state); + else ID3D12Device_Release(&device->ID3D12Device_iface); - return hr; - } - - ID3D12GraphicsCommandList_SetPipelineState(&list->ID3D12GraphicsCommandList_iface, initial_pipeline_state); - return S_OK; + return hr; } HRESULT d3d12_command_list_create(struct d3d12_device *device,
1
0
0
0
Józef Kucia : vkd3d: Fix initial pipeline state.
by Alexandre Julliard
12 Sep '18
12 Sep '18
Module: vkd3d Branch: master Commit: 9fe06825f8dbe1e8fa9fb303334e4b06a2a98096 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=9fe06825f8dbe1e8fa9fb30…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 12 15:19:59 2018 +0200 vkd3d: Fix initial pipeline state. d3d12_command_list_begin_command_buffer() was using the previous initial pipeline state when called from d3d12_command_list_Reset(). Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/vkd3d/command.c | 8 ++++---- libs/vkd3d/vkd3d_private.h | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index f338707..d5bbee9 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -634,8 +634,6 @@ static HRESULT d3d12_command_list_begin_command_buffer(struct d3d12_command_list list->is_recording = true; list->is_valid = true; - ID3D12GraphicsCommandList_SetPipelineState(&list->ID3D12GraphicsCommandList_iface, list->pipeline_state); - return S_OK; } @@ -1740,7 +1738,8 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_list_Reset(ID3D12GraphicsCommandL if (SUCCEEDED(hr = d3d12_command_allocator_allocate_command_buffer(allocator_impl, list))) { list->allocator = allocator_impl; - list->pipeline_state = initial_state; + + ID3D12GraphicsCommandList_SetPipelineState(&list->ID3D12GraphicsCommandList_iface, initial_state); } memset(list->pipeline_bindings, 0, sizeof(list->pipeline_bindings)); @@ -4239,7 +4238,6 @@ static HRESULT d3d12_command_list_init(struct d3d12_command_list *list, struct d ID3D12Device_AddRef(&device->ID3D12Device_iface); list->allocator = allocator; - list->pipeline_state = initial_pipeline_state; memset(list->strides, 0, sizeof(list->strides)); list->primitive_topology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST; @@ -4262,6 +4260,8 @@ static HRESULT d3d12_command_list_init(struct d3d12_command_list *list, struct d return hr; } + ID3D12GraphicsCommandList_SetPipelineState(&list->ID3D12GraphicsCommandList_iface, initial_pipeline_state); + return S_OK; } diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index cb11866..37ad13c 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -614,7 +614,6 @@ struct d3d12_command_list LONG refcount; D3D12_COMMAND_LIST_TYPE type; - ID3D12PipelineState *pipeline_state; VkCommandBuffer vk_command_buffer; bool is_recording;
1
0
0
0
Józef Kucia : vkd3d: Set pointer to NULL if heap creation fails.
by Alexandre Julliard
12 Sep '18
12 Sep '18
Module: vkd3d Branch: master Commit: 605cb12eca2cdfa9c9b4ed29668060d0cf9c1d0a URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=605cb12eca2cdfa9c9b4ed2…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 12 15:19:58 2018 +0200 vkd3d: Set pointer to NULL if heap creation fails. Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/vkd3d/device.c | 3 +++ tests/d3d12.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index e8bf7c9..d39eef2 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -1946,7 +1946,10 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap(ID3D12Device *iface, iface, desc, debugstr_guid(iid), heap); if (FAILED(hr = d3d12_heap_create(device, desc, &object))) + { + *heap = NULL; return hr; + } return return_interface(&object->ID3D12Heap_iface, &IID_ID3D12Heap, iid, heap); } diff --git a/tests/d3d12.c b/tests/d3d12.c index 5a39f0c..221157f 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -1854,9 +1854,12 @@ static void test_create_heap(void) desc.Flags = D3D12_HEAP_FLAG_ALLOW_ONLY_NON_RT_DS_TEXTURES | D3D12_HEAP_FLAG_ALLOW_DISPLAY; hr = ID3D12Device_CreateHeap(device, &desc, &IID_ID3D12Heap, (void **)&heap); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + + heap = (void *)0xdeadbeef; desc.Flags = D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES | D3D12_HEAP_FLAG_ALLOW_DISPLAY; hr = ID3D12Device_CreateHeap(device, &desc, &IID_ID3D12Heap, (void **)&heap); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!heap, "Got unexpected pointer %p.\n", heap); for (i = 0; i < ARRAY_SIZE(tests); ++i) {
1
0
0
0
Józef Kucia : vkd3d: Set pointer to NULL if committed resource creation fails.
by Alexandre Julliard
12 Sep '18
12 Sep '18
Module: vkd3d Branch: master Commit: 150d1f0eb8c7b835d4c8f7c4a7e39579d73bc643 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=150d1f0eb8c7b835d4c8f7c…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 12 15:19:57 2018 +0200 vkd3d: Set pointer to NULL if committed resource creation fails. Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/vkd3d/device.c | 11 +++++++---- tests/d3d12.c | 9 +++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index c11f474..e8bf7c9 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -1914,22 +1914,25 @@ static D3D12_HEAP_PROPERTIES * STDMETHODCALLTYPE d3d12_device_GetCustomHeapPrope static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommittedResource(ID3D12Device *iface, const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, - const D3D12_CLEAR_VALUE *optimized_clear_value, REFIID riid, void **resource) + const D3D12_CLEAR_VALUE *optimized_clear_value, REFIID iid, void **resource) { struct d3d12_device *device = impl_from_ID3D12Device(iface); struct d3d12_resource *object; HRESULT hr; TRACE("iface %p, heap_properties %p, heap_flags %#x, desc %p, initial_state %#x, " - "optimized_clear_value %p, riid %s, resource %p.\n", + "optimized_clear_value %p, iid %s, resource %p.\n", iface, heap_properties, heap_flags, desc, initial_state, - optimized_clear_value, debugstr_guid(riid), resource); + optimized_clear_value, debugstr_guid(iid), resource); if (FAILED(hr = d3d12_committed_resource_create(device, heap_properties, heap_flags, desc, initial_state, optimized_clear_value, &object))) + { + *resource = NULL; return hr; + } - return return_interface(&object->ID3D12Resource_iface, &IID_ID3D12Resource, riid, resource); + return return_interface(&object->ID3D12Resource_iface, &IID_ID3D12Resource, iid, resource); } static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap(ID3D12Device *iface, diff --git a/tests/d3d12.c b/tests/d3d12.c index 34b4fdf..5a39f0c 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -1656,10 +1656,19 @@ static void test_create_committed_resource(void) /* A texture cannot be created on a UPLOAD heap. */ heap_properties.Type = D3D12_HEAP_TYPE_UPLOAD; + resource = (void *)0xdeadbeef; hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, NULL, &IID_ID3D12Resource, (void **)&resource); ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!resource, "Got unexpected pointer %p.\n", resource); + + resource = (void *)0xdeadbeef; + hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE, + &resource_desc, D3D12_RESOURCE_STATE_GENERIC_READ, NULL, + &IID_ID3D12Device, (void **)&resource); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ok(!resource, "Got unexpected pointer %p.\n", resource); /* A texture cannot be created on a READBACK heap. */ heap_properties.Type = D3D12_HEAP_TYPE_READBACK;
1
0
0
0
Józef Kucia : vkd3d: Factor out d3d12_command_list_create_graphics_pipeline().
by Alexandre Julliard
12 Sep '18
12 Sep '18
Module: vkd3d Branch: master Commit: cb247099806b7c946a3f312142cf664070e2c565 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=cb247099806b7c946a3f312…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 12 15:19:56 2018 +0200 vkd3d: Factor out d3d12_command_list_create_graphics_pipeline(). In preparation for pipeline cache. Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/vkd3d/command.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 0940269..f338707 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -1817,7 +1817,8 @@ static bool d3d12_command_list_update_current_framebuffer(struct d3d12_command_l return true; } -static bool d3d12_command_list_update_current_pipeline(struct d3d12_command_list *list) +static VkPipeline d3d12_command_list_create_graphics_pipeline(struct d3d12_command_list *list, + const struct d3d12_graphics_pipeline_state *state) { struct VkVertexInputBindingDescription bindings[D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT]; const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs; @@ -1826,7 +1827,6 @@ static bool d3d12_command_list_update_current_pipeline(struct d3d12_command_list struct VkPipelineColorBlendStateCreateInfo blend_desc; struct VkGraphicsPipelineCreateInfo pipeline_desc; const struct d3d12_device *device = list->device; - struct d3d12_graphics_pipeline_state *state; size_t binding_count = 0; VkPipeline vk_pipeline; unsigned int i; @@ -1858,17 +1858,6 @@ static bool d3d12_command_list_update_current_pipeline(struct d3d12_command_list .pDynamicStates = dynamic_states, }; - if (list->current_pipeline != VK_NULL_HANDLE) - return true; - - if (list->state->vk_bind_point != VK_PIPELINE_BIND_POINT_GRAPHICS) - { - WARN("Pipeline state %p has bind point %#x.\n", list->state, list->state->vk_bind_point); - return false; - } - - state = &list->state->u.graphics; - for (i = 0, mask = 0; i < state->attribute_count; ++i) { struct VkVertexInputBindingDescription *b; @@ -1945,16 +1934,36 @@ static bool d3d12_command_list_update_current_pipeline(struct d3d12_command_list 1, &pipeline_desc, NULL, &vk_pipeline))) < 0) { WARN("Failed to create Vulkan graphics pipeline, vr %d.\n", vr); - return false; + return VK_NULL_HANDLE; } if (!d3d12_command_allocator_add_pipeline(list->allocator, vk_pipeline)) { WARN("Failed to add pipeline.\n"); VK_CALL(vkDestroyPipeline(device->vk_device, vk_pipeline, NULL)); + return VK_NULL_HANDLE; + } + + return vk_pipeline; +} + +static bool d3d12_command_list_update_current_pipeline(struct d3d12_command_list *list) +{ + const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs; + VkPipeline vk_pipeline; + + if (list->current_pipeline != VK_NULL_HANDLE) + return true; + + if (list->state->vk_bind_point != VK_PIPELINE_BIND_POINT_GRAPHICS) + { + WARN("Pipeline state %p has bind point %#x.\n", list->state, list->state->vk_bind_point); return false; } + if (!(vk_pipeline = d3d12_command_list_create_graphics_pipeline(list, &list->state->u.graphics))) + return false; + VK_CALL(vkCmdBindPipeline(list->vk_command_buffer, list->state->vk_bind_point, vk_pipeline)); list->current_pipeline = vk_pipeline;
1
0
0
0
Józef Kucia : vkd3d: Reuse descriptor pools.
by Alexandre Julliard
12 Sep '18
12 Sep '18
Module: vkd3d Branch: master Commit: b0bfe90c9e5d86c66da058a135446b96c705ab37 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=b0bfe90c9e5d86c66da058a…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 12 15:19:55 2018 +0200 vkd3d: Reuse descriptor pools. Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/vkd3d/command.c | 68 ++++++++++++++++++++++++++++++++++++---------- libs/vkd3d/vkd3d_private.h | 4 +++ 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 609edea..0940269 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -806,16 +806,25 @@ static VkDescriptorPool d3d12_command_allocator_allocate_descriptor_pool( VkDescriptorPool vk_pool; VkResult vr; - pool_desc.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; - pool_desc.pNext = NULL; - pool_desc.flags = 0; - pool_desc.maxSets = 512; - pool_desc.poolSizeCount = ARRAY_SIZE(pool_sizes); - pool_desc.pPoolSizes = pool_sizes; - if ((vr = VK_CALL(vkCreateDescriptorPool(vk_device, &pool_desc, NULL, &vk_pool))) < 0) - { - ERR("Failed to create descriptor pool, vr %d.\n", vr); - return VK_NULL_HANDLE; + if (allocator->free_descriptor_pool_count > 0) + { + vk_pool = allocator->free_descriptor_pools[allocator->free_descriptor_pool_count - 1]; + allocator->free_descriptor_pools[allocator->free_descriptor_pool_count - 1] = VK_NULL_HANDLE; + --allocator->free_descriptor_pool_count; + } + else + { + pool_desc.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; + pool_desc.pNext = NULL; + pool_desc.flags = 0; + pool_desc.maxSets = 512; + pool_desc.poolSizeCount = ARRAY_SIZE(pool_sizes); + pool_desc.pPoolSizes = pool_sizes; + if ((vr = VK_CALL(vkCreateDescriptorPool(vk_device, &pool_desc, NULL, &vk_pool))) < 0) + { + ERR("Failed to create descriptor pool, vr %d.\n", vr); + return VK_NULL_HANDLE; + } } if (!(d3d12_command_allocator_add_descriptor_pool(allocator, vk_pool))) @@ -886,14 +895,40 @@ static void vkd3d_buffer_destroy(struct vkd3d_buffer *buffer, struct d3d12_devic VK_CALL(vkDestroyBuffer(device->vk_device, buffer->vk_buffer, NULL)); } -static void d3d12_command_allocator_free_resources(struct d3d12_command_allocator *allocator) +static void d3d12_command_allocator_free_resources(struct d3d12_command_allocator *allocator, + bool keep_reusable_resources) { struct d3d12_device *device = allocator->device; const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; - unsigned int i; + unsigned int i, j; allocator->vk_descriptor_pool = VK_NULL_HANDLE; + if (keep_reusable_resources) + { + if (vkd3d_array_reserve((void **)&allocator->free_descriptor_pools, + &allocator->free_descriptor_pools_size, + allocator->free_descriptor_pool_count + allocator->descriptor_pool_count, + sizeof(*allocator->free_descriptor_pools))) + { + for (i = 0, j = allocator->free_descriptor_pool_count; i < allocator->descriptor_pool_count; ++i, ++j) + { + VK_CALL(vkResetDescriptorPool(device->vk_device, allocator->descriptor_pools[i], 0)); + allocator->free_descriptor_pools[j] = allocator->descriptor_pools[i]; + } + allocator->free_descriptor_pool_count += allocator->descriptor_pool_count; + allocator->descriptor_pool_count = 0; + } + } + else + { + for (i = 0; i < allocator->free_descriptor_pool_count; ++i) + { + VK_CALL(vkDestroyDescriptorPool(device->vk_device, allocator->free_descriptor_pools[i], NULL)); + } + allocator->free_descriptor_pool_count = 0; + } + for (i = 0; i < allocator->transfer_buffer_count; ++i) { vkd3d_buffer_destroy(&allocator->transfer_buffers[i], device); @@ -990,11 +1025,12 @@ static ULONG STDMETHODCALLTYPE d3d12_command_allocator_Release(ID3D12CommandAllo if (allocator->current_command_list) d3d12_command_list_allocator_destroyed(allocator->current_command_list); - d3d12_command_allocator_free_resources(allocator); + d3d12_command_allocator_free_resources(allocator, false); vkd3d_free(allocator->transfer_buffers); vkd3d_free(allocator->buffer_views); vkd3d_free(allocator->views); vkd3d_free(allocator->descriptor_pools); + vkd3d_free(allocator->free_descriptor_pools); vkd3d_free(allocator->pipelines); vkd3d_free(allocator->framebuffers); vkd3d_free(allocator->passes); @@ -1078,7 +1114,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_allocator_Reset(ID3D12CommandAllo device = allocator->device; vk_procs = &device->vk_procs; - d3d12_command_allocator_free_resources(allocator); + d3d12_command_allocator_free_resources(allocator, true); if (allocator->command_buffer_count) { VK_CALL(vkFreeCommandBuffers(device->vk_device, allocator->vk_command_pool, @@ -1168,6 +1204,10 @@ static HRESULT d3d12_command_allocator_init(struct d3d12_command_allocator *allo allocator->vk_descriptor_pool = VK_NULL_HANDLE; + allocator->free_descriptor_pools = NULL; + allocator->free_descriptor_pools_size = 0; + allocator->free_descriptor_pool_count = 0; + allocator->passes = NULL; allocator->passes_size = 0; allocator->pass_count = 0; diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 286186b..cb11866 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -550,6 +550,10 @@ struct d3d12_command_allocator VkDescriptorPool vk_descriptor_pool; + VkDescriptorPool *free_descriptor_pools; + size_t free_descriptor_pools_size; + size_t free_descriptor_pool_count; + VkRenderPass *passes; size_t passes_size; size_t pass_count;
1
0
0
0
Józef Kucia : vkd3d: Use bigger descriptor pools.
by Alexandre Julliard
12 Sep '18
12 Sep '18
Module: vkd3d Branch: master Commit: 7482794b0fc8208954da113de2ac6e903ce6bc20 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=7482794b0fc8208954da113…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 12 15:19:54 2018 +0200 vkd3d: Use bigger descriptor pools. Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/vkd3d/command.c | 150 ++++++++++++++++++++++++++++----------------- libs/vkd3d/vkd3d_private.h | 2 + 2 files changed, 95 insertions(+), 57 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 16c6135..609edea 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -787,6 +787,89 @@ static bool d3d12_command_allocator_add_transfer_buffer(struct d3d12_command_all return true; } +static VkDescriptorPool d3d12_command_allocator_allocate_descriptor_pool( + struct d3d12_command_allocator *allocator) +{ + static const VkDescriptorPoolSize pool_sizes[] = + { + {VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1024}, + {VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1024}, + {VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 1024}, + {VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1024}, + {VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1024}, + {VK_DESCRIPTOR_TYPE_SAMPLER, 1024}, + }; + struct d3d12_device *device = allocator->device; + const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; + struct VkDescriptorPoolCreateInfo pool_desc; + VkDevice vk_device = device->vk_device; + VkDescriptorPool vk_pool; + VkResult vr; + + pool_desc.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; + pool_desc.pNext = NULL; + pool_desc.flags = 0; + pool_desc.maxSets = 512; + pool_desc.poolSizeCount = ARRAY_SIZE(pool_sizes); + pool_desc.pPoolSizes = pool_sizes; + if ((vr = VK_CALL(vkCreateDescriptorPool(vk_device, &pool_desc, NULL, &vk_pool))) < 0) + { + ERR("Failed to create descriptor pool, vr %d.\n", vr); + return VK_NULL_HANDLE; + } + + if (!(d3d12_command_allocator_add_descriptor_pool(allocator, vk_pool))) + { + ERR("Failed to add descriptor pool.\n"); + VK_CALL(vkDestroyDescriptorPool(vk_device, vk_pool, NULL)); + return VK_NULL_HANDLE; + } + + return vk_pool; +} + +static VkDescriptorSet d3d12_command_allocator_allocate_descriptor_set( + struct d3d12_command_allocator *allocator, VkDescriptorSetLayout vk_set_layout) +{ + struct d3d12_device *device = allocator->device; + const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; + struct VkDescriptorSetAllocateInfo set_desc; + VkDevice vk_device = device->vk_device; + VkDescriptorSet vk_descriptor_set; + VkResult vr; + + if (!allocator->vk_descriptor_pool) + allocator->vk_descriptor_pool = d3d12_command_allocator_allocate_descriptor_pool(allocator); + if (!allocator->vk_descriptor_pool) + return VK_NULL_HANDLE; + + set_desc.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; + set_desc.pNext = NULL; + set_desc.descriptorPool = allocator->vk_descriptor_pool; + set_desc.descriptorSetCount = 1; + set_desc.pSetLayouts = &vk_set_layout; + if ((vr = VK_CALL(vkAllocateDescriptorSets(vk_device, &set_desc, &vk_descriptor_set))) >= 0) + return vk_descriptor_set; + + allocator->vk_descriptor_pool = VK_NULL_HANDLE; + if (vr == VK_ERROR_FRAGMENTED_POOL || vr == VK_ERROR_OUT_OF_POOL_MEMORY_KHR) + allocator->vk_descriptor_pool = d3d12_command_allocator_allocate_descriptor_pool(allocator); + if (!allocator->vk_descriptor_pool) + { + ERR("Failed to allocate descriptor set, vr %d.\n", vr); + return VK_NULL_HANDLE; + } + + set_desc.descriptorPool = allocator->vk_descriptor_pool; + if ((vr = VK_CALL(vkAllocateDescriptorSets(vk_device, &set_desc, &vk_descriptor_set))) < 0) + { + FIXME("Failed to allocate descriptor set from a new pool, vr %d.\n", vr); + return VK_NULL_HANDLE; + } + + return vk_descriptor_set; +} + static void d3d12_command_list_allocator_destroyed(struct d3d12_command_list *list) { TRACE("list %p.\n", list); @@ -809,6 +892,8 @@ static void d3d12_command_allocator_free_resources(struct d3d12_command_allocato const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; unsigned int i; + allocator->vk_descriptor_pool = VK_NULL_HANDLE; + for (i = 0; i < allocator->transfer_buffer_count; ++i) { vkd3d_buffer_destroy(&allocator->transfer_buffers[i], device); @@ -1081,6 +1166,8 @@ static HRESULT d3d12_command_allocator_init(struct d3d12_command_allocator *allo return hresult_from_vk_result(vr); } + allocator->vk_descriptor_pool = VK_NULL_HANDLE; + allocator->passes = NULL; allocator->passes_size = 0; allocator->pass_count = 0; @@ -1834,55 +1921,6 @@ static bool d3d12_command_list_update_current_pipeline(struct d3d12_command_list return true; } -static VkDescriptorSet d3d12_command_list_allocate_descriptor_set(struct d3d12_command_list *list, - const VkDescriptorPoolSize *pool_sizes, unsigned int pool_size_count, - VkDescriptorSetLayout vk_set_layout) -{ - const struct vkd3d_vk_device_procs *vk_procs = &list->device->vk_procs; - VkDevice vk_device = list->device->vk_device; - struct VkDescriptorSetAllocateInfo set_desc; - struct VkDescriptorPoolCreateInfo pool_desc; - VkDescriptorSet vk_descriptor_set; - VkDescriptorPool vk_pool; - VkResult vr; - - if (!pool_size_count) - return VK_NULL_HANDLE; - - pool_desc.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; - pool_desc.pNext = NULL; - pool_desc.flags = 0; - pool_desc.maxSets = 1; - pool_desc.poolSizeCount = pool_size_count; - pool_desc.pPoolSizes = pool_sizes; - if ((vr = VK_CALL(vkCreateDescriptorPool(vk_device, &pool_desc, NULL, &vk_pool))) < 0) - { - ERR("Failed to create descriptor pool, vr %d.\n", vr); - return VK_NULL_HANDLE; - } - - set_desc.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; - set_desc.pNext = NULL; - set_desc.descriptorPool = vk_pool; - set_desc.descriptorSetCount = 1; - set_desc.pSetLayouts = &vk_set_layout; - if ((vr = VK_CALL(vkAllocateDescriptorSets(vk_device, &set_desc, &vk_descriptor_set))) < 0) - { - ERR("Failed to allocate descriptor set, vr %d.\n", vr); - VK_CALL(vkDestroyDescriptorPool(vk_device, vk_pool, NULL)); - return VK_NULL_HANDLE; - } - - if (!(d3d12_command_allocator_add_descriptor_pool(list->allocator, vk_pool))) - { - ERR("Failed to add descriptor pool.\n"); - VK_CALL(vkDestroyDescriptorPool(vk_device, vk_pool, NULL)); - return VK_NULL_HANDLE; - } - - return vk_descriptor_set; -} - static void d3d12_command_list_copy_descriptors(struct d3d12_command_list *list, const struct vkd3d_pipeline_bindings *bindings, VkDescriptorSet src_set) { @@ -2010,8 +2048,8 @@ static void d3d12_command_list_prepare_descriptors(struct d3d12_command_list *li * by an update command, or freed) between when the command is recorded * and when the command completes executing on the queue." */ - bindings->descriptor_set = d3d12_command_list_allocate_descriptor_set(list, - root_signature->pool_sizes, root_signature->pool_size_count, root_signature->vk_set_layout); + bindings->descriptor_set = d3d12_command_allocator_allocate_descriptor_set(list->allocator, + root_signature->vk_set_layout); bindings->in_use = false; if (previous_descriptor_set) @@ -2175,7 +2213,6 @@ static void d3d12_command_list_update_uav_counter_descriptors(struct d3d12_comma VkDevice vk_device = list->device->vk_device; VkWriteDescriptorSet *vk_descriptor_writes; VkDescriptorSet vk_descriptor_set; - VkDescriptorPoolSize pool_size; unsigned int uav_counter_count; unsigned int i; @@ -2184,10 +2221,9 @@ static void d3d12_command_list_update_uav_counter_descriptors(struct d3d12_comma uav_counter_count = vkd3d_popcount(state->uav_counter_mask); - pool_size.type = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER; - pool_size.descriptorCount = uav_counter_count; - vk_descriptor_set = d3d12_command_list_allocate_descriptor_set(list, - &pool_size, 1, state->vk_set_layout); + vk_descriptor_set = d3d12_command_allocator_allocate_descriptor_set(list->allocator, state->vk_set_layout); + if (!vk_descriptor_set) + return; if (!(vk_descriptor_writes = vkd3d_calloc(uav_counter_count, sizeof(*vk_descriptor_writes)))) return; @@ -2205,7 +2241,7 @@ static void d3d12_command_list_update_uav_counter_descriptors(struct d3d12_comma vk_descriptor_writes[i].dstBinding = uav_counter->binding.binding; vk_descriptor_writes[i].dstArrayElement = 0; vk_descriptor_writes[i].descriptorCount = 1; - vk_descriptor_writes[i].descriptorType = pool_size.type; + vk_descriptor_writes[i].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER; vk_descriptor_writes[i].pImageInfo = NULL; vk_descriptor_writes[i].pBufferInfo = NULL; vk_descriptor_writes[i].pTexelBufferView = &vk_uav_counter_views[uav_counter->register_index]; diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index df44447..286186b 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -548,6 +548,8 @@ struct d3d12_command_allocator VkCommandPool vk_command_pool; + VkDescriptorPool vk_descriptor_pool; + VkRenderPass *passes; size_t passes_size; size_t pass_count;
1
0
0
0
Józef Kucia : vkd3d: Factor out d3d12_resource_init() .
by Alexandre Julliard
12 Sep '18
12 Sep '18
Module: vkd3d Branch: master Commit: 8ce0d2e72ec45528fc813a4eab851d2eba3bdf60 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=8ce0d2e72ec45528fc813a4…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 12 15:19:53 2018 +0200 vkd3d: Factor out d3d12_resource_init(). In preparation for placed resources. Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/vkd3d/resource.c | 53 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 37c8dff..88ab645 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -893,7 +893,7 @@ HRESULT d3d12_resource_validate_desc(const D3D12_RESOURCE_DESC *desc) return S_OK; } -static HRESULT d3d12_committed_resource_init(struct d3d12_resource *resource, struct d3d12_device *device, +static HRESULT d3d12_resource_init(struct d3d12_resource *resource, struct d3d12_device *device, const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value) @@ -941,6 +941,7 @@ static HRESULT d3d12_committed_resource_init(struct d3d12_resource *resource, st WARN("Ignoring optimized clear value.\n"); resource->gpu_address = 0; + resource->vk_memory = VK_NULL_HANDLE; resource->flags = 0; if (FAILED(hr = d3d12_resource_validate_desc(&resource->desc))) @@ -959,12 +960,6 @@ static HRESULT d3d12_committed_resource_init(struct d3d12_resource *resource, st d3d12_resource_destroy(resource, device); return E_OUTOFMEMORY; } - if (FAILED(hr = vkd3d_allocate_buffer_memory(device, resource->u.vk_buffer, - heap_properties, heap_flags, &resource->vk_memory))) - { - d3d12_resource_destroy(resource, device); - return hr; - } break; case D3D12_RESOURCE_DIMENSION_TEXTURE1D: @@ -975,12 +970,6 @@ static HRESULT d3d12_committed_resource_init(struct d3d12_resource *resource, st resource->flags |= VKD3D_RESOURCE_INITIAL_STATE_TRANSITION; if (FAILED(hr = vkd3d_create_image(resource, device, heap_properties, heap_flags))) return hr; - if (FAILED(hr = vkd3d_allocate_image_memory(device, resource->u.vk_image, - heap_properties, heap_flags, &resource->vk_memory))) - { - d3d12_resource_destroy(resource, device); - return hr; - } break; default: @@ -1001,7 +990,7 @@ static HRESULT d3d12_committed_resource_init(struct d3d12_resource *resource, st return S_OK; } -HRESULT d3d12_committed_resource_create(struct d3d12_device *device, +static HRESULT d3d12_resource_create(struct d3d12_device *device, const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, const D3D12_CLEAR_VALUE *optimized_clear_value, struct d3d12_resource **resource) @@ -1012,13 +1001,47 @@ HRESULT d3d12_committed_resource_create(struct d3d12_device *device, if (!(object = vkd3d_malloc(sizeof(*object)))) return E_OUTOFMEMORY; - if (FAILED(hr = d3d12_committed_resource_init(object, device, heap_properties, heap_flags, + if (FAILED(hr = d3d12_resource_init(object, device, heap_properties, heap_flags, desc, initial_state, optimized_clear_value))) { vkd3d_free(object); return hr; } + *resource = object; + + return hr; +} + +HRESULT d3d12_committed_resource_create(struct d3d12_device *device, + const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, + const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state, + const D3D12_CLEAR_VALUE *optimized_clear_value, struct d3d12_resource **resource) +{ + struct d3d12_resource *object; + HRESULT hr; + + if (FAILED(hr = d3d12_resource_create(device, heap_properties, heap_flags, + desc, initial_state, optimized_clear_value, &object))) + return hr; + + if (d3d12_resource_is_buffer(object)) + { + hr = vkd3d_allocate_buffer_memory(device, object->u.vk_buffer, + heap_properties, heap_flags, &object->vk_memory); + } + else + { + hr = vkd3d_allocate_image_memory(device, object->u.vk_image, + heap_properties, heap_flags, &object->vk_memory); + } + + if (FAILED(hr)) + { + d3d12_resource_Release(&object->ID3D12Resource_iface); + return hr; + } + TRACE("Created committed resource %p.\n", object); *resource = object;
1
0
0
0
Józef Kucia : vkd3d: Pass VkImage to vkd3d_allocate_image_memory().
by Alexandre Julliard
12 Sep '18
12 Sep '18
Module: vkd3d Branch: master Commit: 3dd8683ec5ee2ef2ae2d50c530cd75665b25527a URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=3dd8683ec5ee2ef2ae2d50c…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 12 15:19:52 2018 +0200 vkd3d: Pass VkImage to vkd3d_allocate_image_memory(). For consistency with vkd3d_allocate_buffer_memory(). Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- libs/vkd3d/resource.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 219b95c..37c8dff 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -501,27 +501,25 @@ HRESULT vkd3d_allocate_buffer_memory(struct d3d12_device *device, VkBuffer vk_bu return S_OK; } -static HRESULT vkd3d_allocate_image_memory(struct d3d12_resource *resource, struct d3d12_device *device, - const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags) +static HRESULT vkd3d_allocate_image_memory(struct d3d12_device *device, VkImage vk_image, + const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, + VkDeviceMemory *vk_memory) { const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; VkMemoryRequirements memory_requirements; VkResult vr; HRESULT hr; - assert(D3D12_RESOURCE_DIMENSION_TEXTURE1D <= resource->desc.Dimension - && resource->desc.Dimension <= D3D12_RESOURCE_DIMENSION_TEXTURE3D); - - VK_CALL(vkGetImageMemoryRequirements(device->vk_device, resource->u.vk_image, &memory_requirements)); + VK_CALL(vkGetImageMemoryRequirements(device->vk_device, vk_image, &memory_requirements)); if (FAILED(hr = vkd3d_allocate_device_memory(device, heap_properties, heap_flags, - &memory_requirements, &resource->vk_memory))) + &memory_requirements, vk_memory))) return hr; - if ((vr = VK_CALL(vkBindImageMemory(device->vk_device, resource->u.vk_image, resource->vk_memory, 0))) < 0) + if ((vr = VK_CALL(vkBindImageMemory(device->vk_device, vk_image, *vk_memory, 0))) < 0) { WARN("Failed to bind memory, vr %d.\n", vr); - VK_CALL(vkFreeMemory(device->vk_device, resource->vk_memory, NULL)); - resource->vk_memory = VK_NULL_HANDLE; + VK_CALL(vkFreeMemory(device->vk_device, *vk_memory, NULL)); + *vk_memory = VK_NULL_HANDLE; return hresult_from_vk_result(vr); } @@ -977,7 +975,8 @@ static HRESULT d3d12_committed_resource_init(struct d3d12_resource *resource, st resource->flags |= VKD3D_RESOURCE_INITIAL_STATE_TRANSITION; if (FAILED(hr = vkd3d_create_image(resource, device, heap_properties, heap_flags))) return hr; - if (FAILED(hr = vkd3d_allocate_image_memory(resource, device, heap_properties, heap_flags))) + if (FAILED(hr = vkd3d_allocate_image_memory(device, resource->u.vk_image, + heap_properties, heap_flags, &resource->vk_memory))) { d3d12_resource_destroy(resource, device); return hr;
1
0
0
0
← Newer
1
...
48
49
50
51
52
53
54
...
67
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Results per page:
10
25
50
100
200