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-shader: Translate retc instructions.
by Alexandre Julliard
27 Sep '18
27 Sep '18
Module: vkd3d Branch: master Commit: b66d4ed521e61decb16597ddc1949ec66b8392ab URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=b66d4ed521e61decb16597d…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Thu Sep 27 13:30:53 2018 +0200 vkd3d-shader: Translate retc instructions. 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-shader/spirv.c | 19 +++++++++++++++++++ tests/d3d12.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 62e1f3f..07ac808 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -4817,6 +4817,20 @@ static void vkd3d_dxbc_compiler_emit_return(struct vkd3d_dxbc_compiler *compiler vkd3d_spirv_build_op_return(builder); } +static void vkd3d_dxbc_compiler_emit_retc(struct vkd3d_dxbc_compiler *compiler, + const struct vkd3d_shader_instruction *instruction) +{ + struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; + uint32_t target_id, merge_block_id; + + target_id = vkd3d_spirv_alloc_id(builder); + merge_block_id = vkd3d_dxbc_compiler_emit_conditional_branch(compiler, instruction, target_id); + + vkd3d_spirv_build_op_label(builder, target_id); + vkd3d_dxbc_compiler_emit_return(compiler, instruction); + vkd3d_spirv_build_op_label(builder, merge_block_id); +} + static void vkd3d_dxbc_compiler_emit_kill(struct vkd3d_dxbc_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { @@ -5166,6 +5180,10 @@ static void vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_ cf_info->inside_block = false; break; + case VKD3DSIH_RETP: + vkd3d_dxbc_compiler_emit_retc(compiler, instruction); + break; + case VKD3DSIH_TEXKILL: vkd3d_dxbc_compiler_emit_kill(compiler, instruction); break; @@ -6369,6 +6387,7 @@ void vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler case VKD3DSIH_IF: case VKD3DSIH_LOOP: case VKD3DSIH_RET: + case VKD3DSIH_RETP: case VKD3DSIH_SWITCH: case VKD3DSIH_TEXKILL: vkd3d_dxbc_compiler_emit_control_flow_instruction(compiler, instruction); diff --git a/tests/d3d12.c b/tests/d3d12.c index 69b9fe7..9424ca1 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -5718,6 +5718,38 @@ static void test_shader_instructions(void) 0x00004002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0100003e, }; static const D3D12_SHADER_BYTECODE ps_continuec_nz = {ps_continuec_nz_code, sizeof(ps_continuec_nz_code)}; + static const DWORD ps_retc_nz_code[] = + { +#if 0 + float src; + + float4 main() : SV_TARGET + { + for (int i = 0; i < 255; ++i) + { + if (i == src) + return float4(1, 0, 0, 0); + } + + return 0; + } +#endif + /* compiled with /Gfa */ + 0x43425844, 0xf829c302, 0xf21361cb, 0x963b87e9, 0x92f9470e, 0x00000001, 0x00000188, 0x00000003, + 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054, 0x52444853, 0x00000110, 0x00000040, 0x00000044, + 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000001, 0x05000036, 0x00100012, 0x00000000, 0x00004001, 0x00000000, 0x01000030, 0x07000021, + 0x00100022, 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x000000ff, 0x03040003, 0x0010001a, + 0x00000000, 0x0500002b, 0x00100022, 0x00000000, 0x0010000a, 0x00000000, 0x08000018, 0x00100022, + 0x00000000, 0x0010001a, 0x00000000, 0x0020800a, 0x00000000, 0x00000000, 0x08000036, 0x001020f2, + 0x00000000, 0x00004002, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x0304003f, 0x0010001a, + 0x00000000, 0x0700001e, 0x00100012, 0x00000000, 0x0010000a, 0x00000000, 0x00004001, 0x00000001, + 0x01000016, 0x08000036, 0x001020f2, 0x00000000, 0x00004002, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x0100003e, + }; + static const D3D12_SHADER_BYTECODE ps_retc_nz = {ps_retc_nz_code, sizeof(ps_retc_nz_code)}; static const DWORD ps_src_modifiers_code[] = { #if 0 @@ -6823,6 +6855,11 @@ static void test_shader_instructions(void) {&ps_continue, {}, {{254.0f}}, TRUE}, {&ps_continuec_nz, {}, {{509.0f}}}, + {&ps_retc_nz, {{ 0.0f}}, {{1.0f}}}, + {&ps_retc_nz, {{ 10.0f}}, {{1.0f}}}, + {&ps_retc_nz, {{ 99.0f}}, {{1.0f}}}, + {&ps_retc_nz, {{300.0f}}, {{0.0f}}}, + {&ps_src_modifiers, {{ 1.0f, 1.0f, 1.0f, 2.0f}}, {{-1.0f, 1.0f, -1.0f, -2.0f}}}, {&ps_src_modifiers, {{-1.0f, -1.0f, -1.0f, -2.0f}}, {{ 1.0f, 1.0f, -1.0f, -2.0f}}},
1
0
0
0
Józef Kucia : vkd3d-shader: Use vkd3d_dxbc_compiler_emit_conditional_branch() in more places.
by Alexandre Julliard
27 Sep '18
27 Sep '18
Module: vkd3d Branch: master Commit: 99939f626bff70d3a765cddd62c622f4016466c1 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=99939f626bff70d3a765cdd…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Thu Sep 27 13:30:52 2018 +0200 vkd3d-shader: Use vkd3d_dxbc_compiler_emit_conditional_branch() in more places. 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-shader/spirv.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index a3e8c39..62e1f3f 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -4770,7 +4770,7 @@ static void vkd3d_dxbc_compiler_emit_comparison_instruction(struct vkd3d_dxbc_co vkd3d_dxbc_compiler_emit_store_reg(compiler, &dst->reg, dst->write_mask, result_id); } -static void vkd3d_dxbc_compiler_emit_conditional_branch(struct vkd3d_dxbc_compiler *compiler, +static uint32_t vkd3d_dxbc_compiler_emit_conditional_branch(struct vkd3d_dxbc_compiler *compiler, const struct vkd3d_shader_instruction *instruction, uint32_t target_block_id) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; @@ -4784,7 +4784,8 @@ static void vkd3d_dxbc_compiler_emit_conditional_branch(struct vkd3d_dxbc_compil vkd3d_spirv_build_op_selection_merge(builder, merge_block_id, SpvSelectionControlMaskNone); vkd3d_spirv_build_op_branch_conditional(builder, condition_id, target_block_id, merge_block_id); - vkd3d_spirv_build_op_label(builder, merge_block_id); + + return merge_block_id; } static void vkd3d_dxbc_compiler_emit_output_setup_invocation(struct vkd3d_dxbc_compiler *compiler) @@ -4820,18 +4821,12 @@ static void vkd3d_dxbc_compiler_emit_kill(struct vkd3d_dxbc_compiler *compiler, const struct vkd3d_shader_instruction *instruction) { struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - const struct vkd3d_shader_src_param *src = instruction->src; - uint32_t condition_id, target_block_id, merge_block_id; + uint32_t target_id, merge_block_id; - condition_id = vkd3d_dxbc_compiler_emit_load_src(compiler, src, VKD3DSP_WRITEMASK_0); - condition_id = vkd3d_dxbc_compiler_emit_int_to_bool(compiler, instruction->flags, 1, condition_id); + target_id = vkd3d_spirv_alloc_id(builder); + merge_block_id = vkd3d_dxbc_compiler_emit_conditional_branch(compiler, instruction, target_id); - merge_block_id = vkd3d_spirv_alloc_id(builder); - target_block_id = vkd3d_spirv_alloc_id(builder); - - vkd3d_spirv_build_op_selection_merge(builder, merge_block_id, SpvSelectionControlMaskNone); - vkd3d_spirv_build_op_branch_conditional(builder, condition_id, target_block_id, merge_block_id); - vkd3d_spirv_build_op_label(builder, target_block_id); + vkd3d_spirv_build_op_label(builder, target_id); vkd3d_spirv_build_op_kill(builder); vkd3d_spirv_build_op_label(builder, merge_block_id); } @@ -5126,8 +5121,9 @@ static void vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_ return; } - vkd3d_dxbc_compiler_emit_conditional_branch(compiler, + merge_block_id = vkd3d_dxbc_compiler_emit_conditional_branch(compiler, instruction, loop_cf_info->u.loop.merge_block_id); + vkd3d_spirv_build_op_label(builder, merge_block_id); break; } @@ -5157,8 +5153,9 @@ static void vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_ return; } - vkd3d_dxbc_compiler_emit_conditional_branch(compiler, + merge_block_id = vkd3d_dxbc_compiler_emit_conditional_branch(compiler, instruction, loop_cf_info->u.loop.continue_block_id); + vkd3d_spirv_build_op_label(builder, merge_block_id); break; }
1
0
0
0
Józef Kucia : vkd3d: Fix shader stage bits for pipeline barriers.
by Alexandre Julliard
27 Sep '18
27 Sep '18
Module: vkd3d Branch: master Commit: 2e65b78102540f2ece890601582d719f141a30d1 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=2e65b78102540f2ece89060…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Thu Sep 27 13:30:51 2018 +0200 vkd3d: Fix shader stage bits for pipeline barriers. The Vulkan spec says: "Any pipeline stage included in srcStageMask or dstStageMask must be supported by the capabilities of the queue family..." 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 | 49 ++++++++++++++++++++++++---------------------- libs/vkd3d/vkd3d_private.h | 5 ++++- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 031f61e..5fd0936 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -37,6 +37,7 @@ HRESULT vkd3d_queue_create(struct d3d12_device *device, } object->vk_family_index = family_index; + object->vk_queue_flags = properties->queueFlags; object->timestamp_bits = properties->timestampValidBits; VK_CALL(vkGetDeviceQueue(device->vk_device, family_index, 0, &object->vk_queue)); @@ -667,6 +668,8 @@ static HRESULT d3d12_command_allocator_allocate_command_buffer(struct d3d12_comm return hresult_from_vk_result(vr); } + list->vk_queue_flags = allocator->vk_queue_flags; + if (FAILED(hr = d3d12_command_list_begin_command_buffer(list))) { VK_CALL(vkFreeCommandBuffers(device->vk_device, allocator->vk_command_pool, @@ -1169,6 +1172,7 @@ static HRESULT d3d12_command_allocator_init(struct d3d12_command_allocator *allo allocator->refcount = 1; allocator->type = type; + allocator->vk_queue_flags = queue->vk_queue_flags; command_pool_info.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; command_pool_info.pNext = NULL; @@ -1297,9 +1301,22 @@ static void d3d12_command_list_invalidate_bindings(struct d3d12_command_list *li } static bool vk_barrier_parameters_from_d3d12_resource_state(unsigned int state, - bool is_swapchain_image, D3D12_RESOURCE_STATES present_state, + bool is_swapchain_image, D3D12_RESOURCE_STATES present_state, VkQueueFlags vk_queue_flags, VkAccessFlags *access_mask, VkPipelineStageFlags *stage_flags, VkImageLayout *image_layout) { + VkPipelineStageFlags queue_shader_stages = 0; + + if (vk_queue_flags & VK_QUEUE_GRAPHICS_BIT) + { + queue_shader_stages |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT + | VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT + | VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT + | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT + | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; + } + if (vk_queue_flags & VK_QUEUE_COMPUTE_BIT) + queue_shader_stages |= VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT; + switch (state) { case D3D12_RESOURCE_STATE_COMMON: /* D3D12_RESOURCE_STATE_PRESENT */ @@ -1321,7 +1338,7 @@ static bool vk_barrier_parameters_from_d3d12_resource_state(unsigned int state, else { vk_barrier_parameters_from_d3d12_resource_state(present_state, - false, 0, access_mask, stage_flags, image_layout); + false, 0, vk_queue_flags, access_mask, stage_flags, image_layout); } } else @@ -1344,12 +1361,7 @@ static bool vk_barrier_parameters_from_d3d12_resource_state(unsigned int state, case D3D12_RESOURCE_STATE_UNORDERED_ACCESS: *access_mask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; - *stage_flags = VK_PIPELINE_STAGE_VERTEX_SHADER_BIT - | VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT - | VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT - | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT - | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT - | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT; + *stage_flags = queue_shader_stages; if (image_layout) *image_layout = VK_IMAGE_LAYOUT_GENERAL; return true; @@ -1419,12 +1431,7 @@ static bool vk_barrier_parameters_from_d3d12_resource_state(unsigned int state, *access_mask |= VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT | VK_ACCESS_UNIFORM_READ_BIT; *stage_flags |= VK_PIPELINE_STAGE_VERTEX_INPUT_BIT - | VK_PIPELINE_STAGE_VERTEX_SHADER_BIT - | VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT - | VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT - | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT - | VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT - | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT; + | queue_shader_stages; state &= ~D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER; } @@ -1446,11 +1453,7 @@ static bool vk_barrier_parameters_from_d3d12_resource_state(unsigned int state, if (state & D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE) { *access_mask |= VK_ACCESS_SHADER_READ_BIT; - *stage_flags |= VK_PIPELINE_STAGE_VERTEX_SHADER_BIT - | VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT - | VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT - | VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT - | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT; + *stage_flags |= (queue_shader_stages & ~VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT); state &= ~D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE; } if (state & D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE) @@ -1509,7 +1512,7 @@ static void d3d12_command_list_transition_resource_to_initial_state(struct d3d12 if (!vk_barrier_parameters_from_d3d12_resource_state(resource->initial_state, resource->flags & VKD3D_RESOURCE_PRESENT_STATE_TRANSITION, resource->present_state, - &barrier.dstAccessMask, &dst_stage_mask, &barrier.newLayout)) + list->vk_queue_flags, &barrier.dstAccessMask, &dst_stage_mask, &barrier.newLayout)) { FIXME("Unhandled state %#x.\n", resource->initial_state); return; @@ -3069,14 +3072,14 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResourceBarrier(ID3D12GraphicsC if (!vk_barrier_parameters_from_d3d12_resource_state(transition->StateBefore, resource->flags & VKD3D_RESOURCE_PRESENT_STATE_TRANSITION, resource->present_state, - &src_access_mask, &src_stage_mask, &layout_before)) + list->vk_queue_flags, &src_access_mask, &src_stage_mask, &layout_before)) { FIXME("Unhandled state %#x.\n", transition->StateBefore); continue; } if (!vk_barrier_parameters_from_d3d12_resource_state(transition->StateAfter, resource->flags & VKD3D_RESOURCE_PRESENT_STATE_TRANSITION, resource->present_state, - &dst_access_mask, &dst_stage_mask, &layout_after)) + list->vk_queue_flags, &dst_access_mask, &dst_stage_mask, &layout_after)) { FIXME("Unhandled state %#x.\n", transition->StateAfter); continue; @@ -3097,7 +3100,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_ResourceBarrier(ID3D12GraphicsC resource = unsafe_impl_from_ID3D12Resource(uav->pResource); vk_barrier_parameters_from_d3d12_resource_state(D3D12_RESOURCE_STATE_UNORDERED_ACCESS, resource && (resource->flags & VKD3D_RESOURCE_PRESENT_STATE_TRANSITION), - resource ? resource->present_state : 0, + resource ? resource->present_state : 0, list->vk_queue_flags, &access_mask, &stage_mask, &image_layout); src_access_mask = dst_access_mask = access_mask; src_stage_mask = dst_stage_mask = stage_mask; diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index e47e538..bffae35 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -593,6 +593,7 @@ struct d3d12_command_allocator LONG refcount; D3D12_COMMAND_LIST_TYPE type; + VkQueueFlags vk_queue_flags; VkCommandPool vk_command_pool; @@ -658,10 +659,11 @@ struct d3d12_command_list LONG refcount; D3D12_COMMAND_LIST_TYPE type; + VkQueueFlags vk_queue_flags; - VkCommandBuffer vk_command_buffer; bool is_recording; bool is_valid; + VkCommandBuffer vk_command_buffer; uint32_t strides[D3D12_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT]; VkPrimitiveTopology primitive_topology; @@ -692,6 +694,7 @@ struct vkd3d_queue pthread_mutex_t mutex; VkQueue vk_queue; uint32_t vk_family_index; + VkQueueFlags vk_queue_flags; uint32_t timestamp_bits; };
1
0
0
0
Józef Kucia : vkd3d: Pass VkQueueFamilyProperties to vkd3d_queue_create().
by Alexandre Julliard
27 Sep '18
27 Sep '18
Module: vkd3d Branch: master Commit: 82fdd800e299918580f926c364ea1bff76851cf6 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=82fdd800e299918580f926c…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Thu Sep 27 13:30:50 2018 +0200 vkd3d: Pass VkQueueFamilyProperties to vkd3d_queue_create(). 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 | 4 ++-- libs/vkd3d/device.c | 44 ++++++++++++++------------------------------ libs/vkd3d/vkd3d_private.h | 3 ++- 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index a7cac8f..031f61e 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -20,7 +20,7 @@ #include "vkd3d_private.h" HRESULT vkd3d_queue_create(struct d3d12_device *device, - uint32_t family_index, uint32_t timestamp_bits, struct vkd3d_queue **queue) + uint32_t family_index, const VkQueueFamilyProperties *properties, struct vkd3d_queue **queue) { const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; struct vkd3d_queue *object; @@ -37,7 +37,7 @@ HRESULT vkd3d_queue_create(struct d3d12_device *device, } object->vk_family_index = family_index; - object->timestamp_bits = timestamp_bits; + object->timestamp_bits = properties->timestampValidBits; VK_CALL(vkGetDeviceQueue(device->vk_device, family_index, 0, &object->vk_queue)); diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 1a8f9a0..3a9dad0 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -952,9 +952,8 @@ static void d3d12_device_destroy_vkd3d_queues(struct d3d12_device *device) } static HRESULT d3d12_device_create_vkd3d_queues(struct d3d12_device *device, - uint32_t direct_queue_family_index, uint32_t direct_queue_timestamp_bits, - uint32_t compute_queue_family_index, uint32_t compute_queue_timestamp_bits, - uint32_t copy_queue_family_index, uint32_t copy_queue_timestamp_bits) + const VkQueueFamilyProperties *queue_properties, uint32_t direct_queue_family_index, + uint32_t compute_queue_family_index, uint32_t copy_queue_family_index) { HRESULT hr; @@ -963,39 +962,33 @@ static HRESULT d3d12_device_create_vkd3d_queues(struct d3d12_device *device, device->copy_queue = NULL; if (FAILED((hr = vkd3d_queue_create(device, direct_queue_family_index, - direct_queue_timestamp_bits, &device->direct_queue)))) - { - d3d12_device_destroy_vkd3d_queues(device); - return hr; - } + &queue_properties[direct_queue_family_index], &device->direct_queue)))) + goto out_destroy_queues; if (compute_queue_family_index == direct_queue_family_index) device->compute_queue = device->direct_queue; else if (FAILED(hr = vkd3d_queue_create(device, compute_queue_family_index, - compute_queue_timestamp_bits, &device->compute_queue))) - { - d3d12_device_destroy_vkd3d_queues(device); - return hr; - } + &queue_properties[compute_queue_family_index], &device->compute_queue))) + goto out_destroy_queues; if (copy_queue_family_index == direct_queue_family_index) device->copy_queue = device->direct_queue; else if (copy_queue_family_index == compute_queue_family_index) device->copy_queue = device->compute_queue; else if (FAILED(hr = vkd3d_queue_create(device, copy_queue_family_index, - copy_queue_timestamp_bits, &device->copy_queue))) - { - d3d12_device_destroy_vkd3d_queues(device); - return hr; - } + &queue_properties[copy_queue_family_index], &device->copy_queue))) + goto out_destroy_queues; return S_OK; + +out_destroy_queues: + d3d12_device_destroy_vkd3d_queues(device); + return hr; } static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, const struct vkd3d_device_create_info *create_info) { - uint32_t direct_queue_timestamp_bits, copy_queue_timestamp_bits, compute_queue_timestamp_bits; unsigned int direct_queue_family_index, copy_queue_family_index, compute_queue_family_index; const struct vkd3d_vk_instance_procs *vk_procs = &device->vkd3d_instance->vk_procs; VkQueueFamilyProperties *queue_properties = NULL; @@ -1032,11 +1025,8 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, } direct_queue_family_index = ~0u; - direct_queue_timestamp_bits = 0; copy_queue_family_index = ~0u; - copy_queue_timestamp_bits = 0; compute_queue_family_index = ~0u; - compute_queue_timestamp_bits = 0; for (i = 0; i < queue_family_count; ++i) { static float priorities[] = {1.0f}; @@ -1052,18 +1042,15 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, == (VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT)) { direct_queue_family_index = i; - direct_queue_timestamp_bits = queue_properties[i].timestampValidBits; } if (queue_properties[i].queueFlags & VK_QUEUE_TRANSFER_BIT) { copy_queue_family_index = i; - copy_queue_timestamp_bits = queue_properties[i].timestampValidBits; } if ((queue_properties[i].queueFlags & (VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT)) == VK_QUEUE_COMPUTE_BIT) { compute_queue_family_index = i; - compute_queue_timestamp_bits = queue_properties[i].timestampValidBits; } } @@ -1083,7 +1070,6 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, { /* No compute-only queue family, reuse the direct queue family with graphics and compute. */ compute_queue_family_index = direct_queue_family_index; - compute_queue_timestamp_bits = direct_queue_timestamp_bits; } TRACE("Using queue family %u for direct command queues.\n", direct_queue_family_index); @@ -1137,10 +1123,8 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, device->vk_device = vk_device; - if (FAILED(hr = d3d12_device_create_vkd3d_queues(device, - direct_queue_family_index, direct_queue_timestamp_bits, - compute_queue_family_index, compute_queue_timestamp_bits, - copy_queue_family_index, copy_queue_timestamp_bits))) + if (FAILED(hr = d3d12_device_create_vkd3d_queues(device, queue_properties, + direct_queue_family_index, compute_queue_family_index, copy_queue_family_index))) { ERR("Failed to create queues, hr %#x.\n", hr); device->vk_procs.vkDestroyDevice(vk_device, NULL); diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index aca0e50..e47e538 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -696,7 +696,8 @@ struct vkd3d_queue }; HRESULT vkd3d_queue_create(struct d3d12_device *device, - uint32_t family_index, uint32_t timestamp_bits, struct vkd3d_queue **queue) DECLSPEC_HIDDEN; + uint32_t family_index, const VkQueueFamilyProperties *properties, + struct vkd3d_queue **queue) DECLSPEC_HIDDEN; void vkd3d_queue_destroy(struct vkd3d_queue *queue) DECLSPEC_HIDDEN; /* ID3D12CommandQueue */
1
0
0
0
Józef Kucia : vkd3d: Simplify error handling in vkd3d_create_vk_device().
by Alexandre Julliard
27 Sep '18
27 Sep '18
Module: vkd3d Branch: master Commit: 873a26a061af40e18d757c2cfa91188893e442cb URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=873a26a061af40e18d757c2…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Thu Sep 27 13:30:49 2018 +0200 vkd3d: Simplify error handling in vkd3d_create_vk_device(). 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 | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 8cc6142..1a8f9a0 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -998,9 +998,9 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, uint32_t direct_queue_timestamp_bits, copy_queue_timestamp_bits, compute_queue_timestamp_bits; unsigned int direct_queue_family_index, copy_queue_family_index, compute_queue_family_index; const struct vkd3d_vk_instance_procs *vk_procs = &device->vkd3d_instance->vk_procs; - VkQueueFamilyProperties *queue_properties; + VkQueueFamilyProperties *queue_properties = NULL; + VkDeviceQueueCreateInfo *queue_info = NULL; VkPhysicalDeviceFeatures device_features; - VkDeviceQueueCreateInfo *queue_info; VkPhysicalDevice physical_device; VkDeviceCreateInfo device_info; uint32_t queue_family_count; @@ -1027,8 +1027,8 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, if (!(queue_info = vkd3d_calloc(queue_family_count, sizeof(*queue_info)))) { - vkd3d_free(queue_properties); - return E_OUTOFMEMORY; + hr = E_OUTOFMEMORY; + goto fail; } direct_queue_family_index = ~0u; @@ -1066,19 +1066,18 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, compute_queue_timestamp_bits = queue_properties[i].timestampValidBits; } } - vkd3d_free(queue_properties); if (direct_queue_family_index == ~0u) { FIXME("Could not find a suitable queue family for a direct command queue.\n"); - vkd3d_free(queue_info); - return E_FAIL; + hr = E_FAIL; + goto fail; } if (copy_queue_family_index == ~0u) { FIXME("Could not find a suitable queue family for a copy command queue.\n"); - vkd3d_free(queue_info); - return E_FAIL; + hr = E_FAIL; + goto fail; } if (compute_queue_family_index == ~0u) { @@ -1096,15 +1095,12 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, VK_CALL(vkGetPhysicalDeviceFeatures(physical_device, &device_features)); device->vk_physical_device = physical_device; if (FAILED(hr = vkd3d_init_device_caps(device, create_info, &device_features, &extension_count))) - { - vkd3d_free(queue_info); - return E_FAIL; - } + goto fail; if (!(extensions = vkd3d_calloc(extension_count, sizeof(*extensions)))) { - vkd3d_free(queue_info); - return E_OUTOFMEMORY; + hr = E_OUTOFMEMORY; + goto fail; } /* Create device */ @@ -1125,7 +1121,6 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, vr = VK_CALL(vkCreateDevice(physical_device, &device_info, NULL, &vk_device)); vkd3d_free(extensions); - vkd3d_free(queue_info); if (vr < 0) { ERR("Failed to create Vulkan device, vr %d.\n", vr); @@ -1137,7 +1132,7 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, ERR("Failed to load device procs, hr %#x.\n", hr); if (device->vk_procs.vkDestroyDevice) device->vk_procs.vkDestroyDevice(vk_device, NULL); - return hr; + goto fail; } device->vk_device = vk_device; @@ -1149,12 +1144,17 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, { ERR("Failed to create queues, hr %#x.\n", hr); device->vk_procs.vkDestroyDevice(vk_device, NULL); - return hr; + goto fail; } TRACE("Created Vulkan device %p.\n", vk_device); - return S_OK; +fail: + if (queue_properties) + vkd3d_free(queue_properties); + if (queue_info) + vkd3d_free(queue_info); + return hr; } static HRESULT d3d12_device_create_dummy_sampler(struct d3d12_device *device)
1
0
0
0
Józef Kucia : d3d11/tests: Use SetRect() in more places.
by Alexandre Julliard
26 Sep '18
26 Sep '18
Module: wine Branch: master Commit: 37edf1ec182bfc0b738e3eeadce0e8adb4cadec2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=37edf1ec182bfc0b738e3eea…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 26 13:58:42 2018 +0200 d3d11/tests: Use SetRect() in more places. 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> --- dlls/d3d11/tests/d3d11.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 3ab2642..41afdf9 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -9597,10 +9597,7 @@ static void test_scissor(void) hr = ID3D11Device_CreateRasterizerState(device, &rs_desc, &rs); ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr); - scissor_rect.left = 160; - scissor_rect.top = 120; - scissor_rect.right = 480; - scissor_rect.bottom = 360; + SetRect(&scissor_rect, 160, 120, 480, 360); ID3D11DeviceContext_RSSetScissorRects(immediate_context, 1, &scissor_rect); ID3D11DeviceContext_ClearRenderTargetView(immediate_context, test_context.backbuffer_rtv, red); @@ -27272,10 +27269,7 @@ static void test_multiple_viewports(void) ID3D11DeviceContext_ClearRenderTargetView(context, rtv, clear_color); ID3D11DeviceContext_RSSetViewports(context, 2, vp); - rects[0].left = 0; - rects[0].top = 0; - rects[0].right = width; - rects[0].bottom = texture_desc.Height / 2; + SetRect(&rects[0], 0, 0, width, texture_desc.Height / 2); memset(&rects[1], 0, sizeof(*rects)); ID3D11DeviceContext_RSSetScissorRects(context, 1, rects); constant.draw_id = 4; @@ -27290,14 +27284,8 @@ static void test_multiple_viewports(void) check_texture_sub_resource_vec4(texture, 0, &rect, &expected_values[7], 1); /* Set both rectangles. */ - rects[0].left = 0; - rects[0].top = 0; - rects[0].right = width; - rects[0].bottom = texture_desc.Height / 2; - rects[1].left = width; - rects[1].top = 0; - rects[1].right = width * 2; - rects[1].bottom = texture_desc.Height / 2; + SetRect(&rects[0], 0, 0, width, texture_desc.Height / 2); + SetRect(&rects[1], width, 0, 2 * width, texture_desc.Height / 2); ID3D11DeviceContext_ClearRenderTargetView(context, rtv, clear_color); ID3D11DeviceContext_RSSetScissorRects(context, 2, rects); constant.draw_id = 5;
1
0
0
0
Józef Kucia : d3d10core/tests: Use SetRect() in more places.
by Alexandre Julliard
26 Sep '18
26 Sep '18
Module: wine Branch: master Commit: 2a1e2ad2e5422e9dd46f79a91cd0c886f298245d URL:
https://source.winehq.org/git/wine.git/?a=commit;h=2a1e2ad2e5422e9dd46f79a9…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 26 13:58:41 2018 +0200 d3d10core/tests: Use SetRect() in more places. 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> --- dlls/d3d10core/tests/d3d10core.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index 4ee79af..158a3e3 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -4809,10 +4809,7 @@ static void test_scissor(void) hr = ID3D10Device_CreateRasterizerState(device, &rs_desc, &rs); ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr); - scissor_rect.left = 160; - scissor_rect.top = 120; - scissor_rect.right = 480; - scissor_rect.bottom = 360; + SetRect(&scissor_rect, 160, 120, 480, 360); ID3D10Device_RSSetScissorRects(device, 1, &scissor_rect); ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, red); @@ -16923,10 +16920,7 @@ static void test_multiple_viewports(void) ID3D10Device_ClearRenderTargetView(device, rtv, clear_color); ID3D10Device_RSSetViewports(device, 2, vp); - rects[0].left = 0; - rects[0].top = 0; - rects[0].right = width; - rects[0].bottom = texture_desc.Height / 2; + SetRect(&rects[0], 0, 0, width, texture_desc.Height / 2); memset(&rects[1], 0, sizeof(*rects)); ID3D10Device_RSSetScissorRects(device, 1, rects); constant.draw_id = 4; @@ -16941,14 +16935,8 @@ static void test_multiple_viewports(void) check_texture_sub_resource_vec4(texture, 0, &rect, &expected_values[7], 1); /* Set both rectangles. */ - rects[0].left = 0; - rects[0].top = 0; - rects[0].right = width; - rects[0].bottom = texture_desc.Height / 2; - rects[1].left = width; - rects[1].top = 0; - rects[1].right = width * 2; - rects[1].bottom = texture_desc.Height / 2; + SetRect(&rects[0], 0, 0, width, texture_desc.Height / 2); + SetRect(&rects[1], width, 0, 2 * width, texture_desc.Height / 2); ID3D10Device_ClearRenderTargetView(device, rtv, clear_color); ID3D10Device_RSSetScissorRects(device, 2, rects); constant.draw_id = 5;
1
0
0
0
Józef Kucia : d3d10core/tests: Add a few more tests for texture formats.
by Alexandre Julliard
26 Sep '18
26 Sep '18
Module: wine Branch: master Commit: 5ab8d43c30580c056b09546de60e7b68a3257320 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5ab8d43c30580c056b09546d…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 26 13:58:40 2018 +0200 d3d10core/tests: Add a few more tests for texture formats. 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> --- dlls/d3d10core/tests/d3d10core.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index c41a4eb..4ee79af 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -6714,6 +6714,13 @@ static void test_texture(void) 0xffb1c4de, 0xfff0f1f2, 0xfffafdfe, 0xff5a560f, 0xffd5ff00, 0xffc8f99f, 0xffaa00aa, 0xffdd55bb, }; + static const WORD r8g8_data[] = + { + 0x0000, 0xffff, 0x0000, 0x7fff, + 0x0203, 0xff10, 0x0b0c, 0x8000, + 0xc4de, 0xfff0, 0xfdfe, 0x5a6f, + 0xff00, 0xffc8, 0x00aa, 0xdd5b, + }; static const BYTE a8_data[] = { 0x00, 0x10, 0x20, 0x30, @@ -6816,10 +6823,14 @@ static void test_texture(void) {blue_data, 5 * sizeof(*blue_data)}, } }; + static const struct texture r32f_float = {4, 4, 1, 1, DXGI_FORMAT_R32_FLOAT, + {{r32_float, 4 * sizeof(*r32_float)}}}; static const struct texture r32f_typeless = {4, 4, 1, 1, DXGI_FORMAT_R32_TYPELESS, {{r32_float, 4 * sizeof(*r32_float)}}}; static const struct texture r32u_typeless = {4, 4, 1, 1, DXGI_FORMAT_R32_TYPELESS, {{r32_uint, 4 * sizeof(*r32_uint)}}}; + static const struct texture r8g8_snorm = {4, 4, 1, 1, DXGI_FORMAT_R8G8_SNORM, + {{r8g8_data, 4 * sizeof(*r8g8_data)}}}; static const struct texture r9g9b9e5_texture = {4, 4, 1, 1, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, {{r9g9b9e5_data, 4 * sizeof(*r9g9b9e5_data)}}}; static const DWORD red_colors[] = @@ -6899,6 +6910,13 @@ static void test_texture(void) 0x7e7e7e7e, 0x7e7e7e7e, 0x7e7e7e7e, 0x7e808080, 0x7e7e7e7e, 0x7e7f7f7f, 0x7e7f7f7f, 0x7e7f7f7f, }; + static const DWORD snorm_colors[] = + { + 0xff000000, 0xff000000, 0xff000000, 0xff00ff00, + 0xff000406, 0xff000020, 0xff001618, 0xff000000, + 0xff000000, 0xff000000, 0xff000000, 0xff00b5df, + 0xff000000, 0xff000000, 0xff000000, 0xff0000b7, + }; static const DWORD r32f_colors[] = { 0xff000000, 0xff0000ff, 0xff00007f, 0xff00007f, @@ -7060,6 +7078,7 @@ static void test_texture(void) #define BC3_UNORM_SRGB DXGI_FORMAT_BC3_UNORM_SRGB #define R8G8B8A8_UNORM_SRGB DXGI_FORMAT_R8G8B8A8_UNORM_SRGB #define R8G8B8A8_UNORM DXGI_FORMAT_R8G8B8A8_UNORM +#define R8G8_SNORM DXGI_FORMAT_R8G8_SNORM #define R32_FLOAT DXGI_FORMAT_R32_FLOAT #define R32_UINT DXGI_FORMAT_R32_UINT #define FMT_UNKNOWN DXGI_FORMAT_UNKNOWN @@ -7072,6 +7091,8 @@ static void test_texture(void) {&ps_sample, &srgb_typeless, {R8G8B8A8_UNORM_SRGB, TEX_2D, 0, 1}, 0.0f, srgb_colors}, {&ps_sample, &srgb_typeless, {R8G8B8A8_UNORM, TEX_2D, 0, 1}, 0.0f, srgb_data}, {&ps_sample, &r32f_typeless, {R32_FLOAT, TEX_2D, 0, 1}, 0.0f, r32f_colors}, + {&ps_sample, &r32f_float, {R32_FLOAT, TEX_2D, 0, 1}, 0.0f, r32f_colors}, + {&ps_sample, &r8g8_snorm, {R8G8_SNORM, TEX_2D, 0, 1}, 0.0f, snorm_colors}, {&ps_sample, &array_2d_texture, {FMT_UNKNOWN, TEX_2D, 0, 1}, 0.0f, red_colors}, {&ps_sample_2d_array, &array_2d_texture, {FMT_UNKNOWN, TEX_2D_ARRAY, 0, 1, 0, 1}, 0.0f, red_colors}, {&ps_sample_2d_array, &array_2d_texture, {FMT_UNKNOWN, TEX_2D_ARRAY, 0, 1, 1, 1}, 0.0f, green_data}, @@ -7087,6 +7108,7 @@ static void test_texture(void) #undef BC3_UNORM_SRGB #undef R8G8B8A8_UNORM_SRGB #undef R8G8B8A8_UNORM +#undef R8G8_SNORM #undef R32_FLOAT #undef R32_UINT #undef FMT_UNKNOWN
1
0
0
0
Józef Kucia : d3d10core/tests: Add test for staging buffers.
by Alexandre Julliard
26 Sep '18
26 Sep '18
Module: wine Branch: master Commit: 8a3573c0b0ce9fd665e422b4163f90112a162f7e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=8a3573c0b0ce9fd665e422b4…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Wed Sep 26 13:58:39 2018 +0200 d3d10core/tests: Add test for staging buffers. 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> --- dlls/d3d10core/tests/d3d10core.c | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index 11eede7..c41a4eb 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -17223,6 +17223,69 @@ static void test_depth_clip(void) release_test_context(&test_context); } +static void test_staging_buffers(void) +{ + struct d3d10core_test_context test_context; + ID3D10Buffer *dst_buffer, *src_buffer; + D3D10_SUBRESOURCE_DATA resource_data; + D3D10_BUFFER_DESC buffer_desc; + struct resource_readback rb; + float data[16], value; + ID3D10Device *device; + unsigned int i; + HRESULT hr; + + if (!init_test_context(&test_context)) + return; + device = test_context.device; + + buffer_desc.ByteWidth = sizeof(data); + buffer_desc.Usage = D3D10_USAGE_STAGING; + buffer_desc.BindFlags = 0; + buffer_desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; + buffer_desc.MiscFlags = 0; + + for (i = 0; i < ARRAY_SIZE(data); ++i) + data[i] = i; + resource_data.pSysMem = data; + resource_data.SysMemPitch = 0; + resource_data.SysMemSlicePitch = 0; + + hr = ID3D10Device_CreateBuffer(device, &buffer_desc, &resource_data, &src_buffer); + ok(hr == S_OK, "Failed to create buffer, hr %#x.\n", hr); + + buffer_desc.Usage = D3D10_USAGE_DEFAULT; + buffer_desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER; + buffer_desc.CPUAccessFlags = 0; + hr = ID3D10Device_CreateBuffer(device, &buffer_desc, NULL, &dst_buffer); + ok(hr == S_OK, "Failed to create buffer, hr %#x.\n", hr); + + ID3D10Device_CopyResource(device, (ID3D10Resource *)dst_buffer, (ID3D10Resource *)src_buffer); + get_buffer_readback(dst_buffer, &rb); + for (i = 0; i < ARRAY_SIZE(data); ++i) + { + value = get_readback_float(&rb, i, 0); + ok(value == data[i], "Got unexpected value %.8e at %u.\n", value, i); + } + release_resource_readback(&rb); + + for (i = 0; i < ARRAY_SIZE(data); ++i) + data[i] = 2 * i; + ID3D10Device_UpdateSubresource(device, (ID3D10Resource *)src_buffer, 0, NULL, data, 0, 0); + ID3D10Device_CopyResource(device, (ID3D10Resource *)dst_buffer, (ID3D10Resource *)src_buffer); + get_buffer_readback(dst_buffer, &rb); + for (i = 0; i < ARRAY_SIZE(data); ++i) + { + value = get_readback_float(&rb, i, 0); + ok(value == i, "Got unexpected value %.8e at %u.\n", value, i); + } + release_resource_readback(&rb); + + ID3D10Buffer_Release(dst_buffer); + ID3D10Buffer_Release(src_buffer); + release_test_context(&test_context); +} + START_TEST(d3d10core) { unsigned int argc, i; @@ -17331,6 +17394,7 @@ START_TEST(d3d10core) queue_test(test_multiple_viewports); queue_test(test_multisample_resolve); queue_test(test_depth_clip); + queue_test(test_staging_buffers); run_queued_tests();
1
0
0
0
Nikolay Sivov : d2d1: Use surface format for shared bitmap if it wasn' t specified.
by Alexandre Julliard
26 Sep '18
26 Sep '18
Module: wine Branch: master Commit: bf5066a3ff48877eebcd7fc371ebfe569184bbc1 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=bf5066a3ff48877eebcd7fc3…
Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Wed Sep 26 03:34:48 2018 +0300 d2d1: Use surface format for shared bitmap if it wasn't specified. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d2d1/bitmap.c | 4 ++ dlls/d2d1/tests/d2d1.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 110 insertions(+), 6 deletions(-) diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c index c8d099c..8551462 100644 --- a/dlls/d2d1/bitmap.c +++ b/dlls/d2d1/bitmap.c @@ -464,7 +464,11 @@ HRESULT d2d_bitmap_create_shared(struct d2d_device_context *context, REFIID iid, d.pixelFormat.format = surface_desc.Format; } else + { d = *desc; + if (d.pixelFormat.format == DXGI_FORMAT_UNKNOWN) + d.pixelFormat.format = surface_desc.Format; + } if (d.dpiX == 0.0f || d.dpiY == 0.0f) { diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index eaa0b64..3005b43 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -4123,6 +4123,7 @@ static void test_shared_bitmap(void) IWICImagingFactory *wic_factory; ID2D1Bitmap *bitmap1, *bitmap2; DXGI_SURFACE_DESC surface_desc; + D2D1_PIXEL_FORMAT pixel_format; D2D1_SIZE_U size = {4, 4}; IDXGISurface1 *surface3; HWND window1, window2; @@ -4279,6 +4280,32 @@ static void test_shared_bitmap(void) if (SUCCEEDED(hr)) { + static const struct bitmap_format_test + { + D2D1_PIXEL_FORMAT original; + D2D1_PIXEL_FORMAT result; + HRESULT hr; + } + bitmap_format_tests[] = + { + { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED }, + { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED } }, + + { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_IGNORE }, + { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE } }, + + { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN }, { 0 }, WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT }, + + { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN }, { 0 }, WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT }, + + { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE }, + { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE } }, + + { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_STRAIGHT }, { 0 }, WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT }, + { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT }, { 0 }, WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT }, + }; + unsigned int i; + size = ID2D1Bitmap_GetPixelSize(bitmap2); hr = IDXGISurface_GetDesc(surface2, &surface_desc); ok(SUCCEEDED(hr), "Failed to get surface description, hr %#x.\n", hr); @@ -4297,6 +4324,26 @@ static void test_shared_bitmap(void) ID2D1Bitmap_Release(bitmap2); IDXGISurface1_Release(surface3); } + + for (i = 0; i < ARRAY_SIZE(bitmap_format_tests); ++i) + { + bitmap_desc.pixelFormat = bitmap_format_tests[i].original; + + hr = ID2D1RenderTarget_CreateSharedBitmap(rt2, &IID_IDXGISurface, surface2, &bitmap_desc, &bitmap2); + todo_wine_if(i == 2 || i == 3 || i == 5 || i == 6) + ok(hr == bitmap_format_tests[i].hr, "%u: unexpected hr %#x.\n", i, hr); + + if (SUCCEEDED(bitmap_format_tests[i].hr)) + { + pixel_format = ID2D1Bitmap_GetPixelFormat(bitmap2); + ok(pixel_format.format == bitmap_format_tests[i].result.format, "%u: unexpected pixel format %#x.\n", + i, pixel_format.format); + ok(pixel_format.alphaMode == bitmap_format_tests[i].result.alphaMode, "%u: unexpected alpha mode %d.\n", + i, pixel_format.alphaMode); + + ID2D1Bitmap_Release(bitmap2); + } + } } ID2D1RenderTarget_Release(rt2); @@ -6767,7 +6814,15 @@ static void check_rt_bitmap_surface_(unsigned int line, ID2D1RenderTarget *rt, B target = NULL; } if (bitmap) + { + D2D1_PIXEL_FORMAT rt_format, bitmap_format; + + rt_format = ID2D1RenderTarget_GetPixelFormat(rt); + bitmap_format = ID2D1Bitmap_GetPixelFormat(bitmap); + ok_(__FILE__, line)(!memcmp(&rt_format, &bitmap_format, sizeof(rt_format)), "Unexpected bitmap format.\n"); + ID2D1Bitmap_Release(bitmap); + } /* Pixel format is not defined until target is set, for DC target it's specified on creation. */ if (target || dc_rt) @@ -6805,7 +6860,7 @@ static void check_rt_bitmap_surface_(unsigned int line, ID2D1RenderTarget *rt, B hr = ID2D1RenderTarget_CreateCompatibleRenderTarget(rt, NULL, NULL, NULL, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, (ID2D1BitmapRenderTarget **)&compatible_rt); todo_wine - ok_(__FILE__, line)(hr == WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT, " --- Unexpected hr %#x.\n", hr); + ok_(__FILE__, line)(hr == WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT, "Unexpected hr %#x.\n", hr); } ID2D1DeviceContext_Release(context); @@ -6817,6 +6872,31 @@ static void check_rt_bitmap_surface_(unsigned int line, ID2D1RenderTarget *rt, B static void test_bitmap_surface(void) { + static const struct bitmap_format_test + { + D2D1_PIXEL_FORMAT original; + D2D1_PIXEL_FORMAT result; + HRESULT hr; + } + bitmap_format_tests[] = + { + { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_PREMULTIPLIED }, + { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED } }, + + { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_STRAIGHT }, { 0 }, WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT }, + + { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_IGNORE }, + { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE } }, + + { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN }, { 0 }, WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT }, + + { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_UNKNOWN }, { 0 }, WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT }, + + { { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE }, + { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE } }, + + { { DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_STRAIGHT }, { 0 }, WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT }, + }; D2D1_HWND_RENDER_TARGET_PROPERTIES hwnd_rt_desc; D2D1_RENDER_TARGET_PROPERTIES rt_desc; D2D1_BITMAP_PROPERTIES1 bitmap_desc; @@ -6830,6 +6910,7 @@ static void test_bitmap_surface(void) ID2D1Bitmap1 *bitmap; ID2D1Device *device; ID2D1Image *target; + unsigned int i; HWND window; HRESULT hr; @@ -6889,11 +6970,30 @@ todo_wine if (SUCCEEDED(hr)) { - memset(&bitmap_desc, 0, sizeof(bitmap_desc)); - bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; - bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE; - bitmap_desc.dpiX = 96.0f; - bitmap_desc.dpiY = 96.0f; + for (i = 0; i < ARRAY_SIZE(bitmap_format_tests); ++i) + { + D2D1_PIXEL_FORMAT pixel_format; + + memset(&bitmap_desc, 0, sizeof(bitmap_desc)); + bitmap_desc.pixelFormat = bitmap_format_tests[i].original; + bitmap_desc.bitmapOptions = D2D1_BITMAP_OPTIONS_TARGET | D2D1_BITMAP_OPTIONS_CANNOT_DRAW; + + hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(device_context, surface, &bitmap_desc, &bitmap); + ok(hr == bitmap_format_tests[i].hr, "%u: unexpected hr %#x.\n", i, hr); + + if (SUCCEEDED(hr)) + { + pixel_format = ID2D1Bitmap1_GetPixelFormat(bitmap); + + ok(pixel_format.format == bitmap_format_tests[i].result.format, "%u: unexpected pixel format %#x.\n", + i, pixel_format.format); + ok(pixel_format.alphaMode == bitmap_format_tests[i].result.alphaMode, "%u: unexpected alpha mode %d.\n", + i, pixel_format.alphaMode); + + ID2D1Bitmap1_Release(bitmap); + } + } + hr = ID2D1DeviceContext_CreateBitmapFromDxgiSurface(device_context, surface, NULL, &bitmap); ok(SUCCEEDED(hr), "Failed to create a bitmap, hr %#x.\n", hr);
1
0
0
0
← Newer
1
...
4
5
6
7
8
9
10
...
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