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
February 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
804 discussions
Start a n
N
ew thread
Józef Kucia : tests: Add test for rendering to DXGI_FORMAT_A8_UNORM.
by Alexandre Julliard
13 Feb '18
13 Feb '18
Module: vkd3d Branch: master Commit: fb034dd32590d4d9d2f1631ffe461177a04b36ca URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=fb034dd32590d4d9d2f1631…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Tue Feb 13 13:15:06 2018 +0100 tests: Add test for rendering to DXGI_FORMAT_A8_UNORM. Rendering to A8_UNORM doesn't work yet, because we cannot easily swizzle components for render target image views. 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> --- tests/d3d12.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 108 insertions(+), 9 deletions(-) diff --git a/tests/d3d12.c b/tests/d3d12.c index a513142..c140a26 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -143,6 +143,11 @@ static bool compare_uvec4(const struct uvec4* v1, const struct uvec4 *v2) return v1->x == v2->x && v1->y == v2->y && v1->z == v2->z && v1->w == v2->w; } +static bool compare_uint8(uint8_t a, uint8_t b, unsigned int max_diff) +{ + return abs(a - b) <= max_diff; +} + static bool compare_uint16(uint16_t a, uint16_t b, unsigned int max_diff) { return abs(a - b) <= max_diff; @@ -648,6 +653,7 @@ static unsigned int format_size(DXGI_FORMAT format) switch (format) { case DXGI_FORMAT_UNKNOWN: + case DXGI_FORMAT_A8_UNORM: return 1; case DXGI_FORMAT_R32G32B32A32_FLOAT: case DXGI_FORMAT_R32G32B32A32_UINT: @@ -857,6 +863,11 @@ static void *get_readback_data(struct resource_readback *rb, unsigned int x, uns return &((BYTE *)rb->data)[rb->row_pitch * y + x * element_size]; } +static uint8_t get_readback_uint8(struct resource_readback *rb, unsigned int x, unsigned int y) +{ + return *(uint8_t *)get_readback_data(rb, x, y, sizeof(uint8_t)); +} + static uint16_t get_readback_uint16(struct resource_readback *rb, unsigned int x, unsigned int y) { return *(uint16_t *)get_readback_data(rb, x, y, sizeof(uint16_t)); @@ -935,6 +946,47 @@ static void check_sub_resource_float_(unsigned int line, ID3D12Resource *texture release_resource_readback(&rb); } +#define check_readback_data_uint8(a, b, c, d) check_readback_data_uint8_(__LINE__, a, b, c, d) +static void check_readback_data_uint8_(unsigned int line, struct resource_readback *rb, + const RECT *rect, uint8_t expected, unsigned int max_diff) +{ + RECT r = {0, 0, rb->width, rb->height}; + unsigned int x = 0, y; + bool all_match = true; + uint8_t got = 0; + + if (rect) + r = *rect; + + for (y = r.top; y < r.bottom; ++y) + { + for (x = r.left; x < r.right; ++x) + { + got = get_readback_uint8(rb, x, y); + if (!compare_uint8(got, expected, max_diff)) + { + all_match = false; + break; + } + } + if (!all_match) + break; + } + todo_(line)(all_match, "Got 0x%02x, expected 0x%02x at (%u, %u).\n", got, expected, x, y); +} + +#define check_sub_resource_uint8(a, b, c, d, e, f) check_sub_resource_uint8_(__LINE__, a, b, c, d, e, f) +static void check_sub_resource_uint8_(unsigned int line, ID3D12Resource *texture, + unsigned int sub_resource_idx, ID3D12CommandQueue *queue, ID3D12GraphicsCommandList *command_list, + uint8_t expected, unsigned int max_diff) +{ + struct resource_readback rb; + + get_texture_readback_with_command_list(texture, 0, &rb, queue, command_list); + check_readback_data_uint8_(line, &rb, NULL, expected, max_diff); + release_resource_readback(&rb); +} + #define check_readback_data_uint16(a, b, c, d) check_readback_data_uint16_(__LINE__, a, b, c, d) static void check_readback_data_uint16_(unsigned int line, struct resource_readback *rb, const RECT *rect, uint16_t expected, unsigned int max_diff) @@ -1343,6 +1395,7 @@ struct test_context_desc bool no_render_target; bool no_root_signature; bool no_pipeline; + const D3D12_SHADER_BYTECODE *ps; }; struct test_context @@ -1472,7 +1525,7 @@ static bool init_test_context_(unsigned int line, struct test_context *context, context->pipeline_state = create_pipeline_state_(line, device, context->root_signature, context->render_target_desc.Format, - NULL, NULL, NULL); + NULL, desc ? desc->ps : NULL, NULL); return true; } @@ -4450,15 +4503,12 @@ static void test_fragment_coords(void) memset(&desc, 0, sizeof(desc)); desc.rt_format = DXGI_FORMAT_R32G32B32A32_FLOAT; - desc.no_pipeline = true; + desc.ps = &ps; if (!init_test_context(&context, &desc)) return; command_list = context.list; queue = context.queue; - context.pipeline_state = create_pipeline_state(context.device, - context.root_signature, desc.rt_format, NULL, &ps, NULL); - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL); ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, FALSE, NULL); @@ -4678,15 +4728,12 @@ static void test_scissor(void) memset(&desc, 0, sizeof(desc)); desc.rt_width = 640; desc.rt_height = 480; - desc.no_pipeline = true; + desc.ps = &ps; if (!init_test_context(&context, &desc)) return; command_list = context.list; queue = context.queue; - context.pipeline_state = create_pipeline_state(context.device, - context.root_signature, context.render_target_desc.Format, NULL, &ps, NULL); - set_rect(&scissor_rect, 160, 120, 480, 360); ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, red, 0, NULL); @@ -17516,6 +17563,57 @@ static void test_geometry_shader(void) destroy_test_context(&context); } +static void test_render_a8(void) +{ + static const float black[] = {0.0f, 0.0f, 0.0f, 0.0f}; + ID3D12GraphicsCommandList *command_list; + struct test_context_desc desc; + struct test_context context; + ID3D12CommandQueue *queue; + + static const DWORD ps_code[] = + { +#if 0 + void main(out float4 target : SV_Target) + { + target = float4(0.0f, 0.25f, 0.5f, 1.0f); + } +#endif + 0x43425844, 0x2f09e5ff, 0xaa135d5e, 0x7860f4b5, 0x5c7b8cbc, 0x00000001, 0x000000b4, 0x00000003, + 0x0000002c, 0x0000003c, 0x00000070, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x58454853, 0x0000003c, 0x00000050, 0x0000000f, + 0x0100086a, 0x03000065, 0x001020f2, 0x00000000, 0x08000036, 0x001020f2, 0x00000000, 0x00004002, + 0x00000000, 0x3e800000, 0x3f000000, 0x3f800000, 0x0100003e, + }; + static const D3D12_SHADER_BYTECODE ps = {ps_code, sizeof(ps_code)}; + + memset(&desc, 0, sizeof(desc)); + desc.rt_format = DXGI_FORMAT_A8_UNORM; + desc.ps = &ps; + if (!init_test_context(&context, &desc)) + return; + command_list = context.list; + queue = context.queue; + + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, black, 0, NULL); + + ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, FALSE, NULL); + ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); + ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state); + ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport); + ID3D12GraphicsCommandList_RSSetScissorRects(command_list, 1, &context.scissor_rect); + ID3D12GraphicsCommandList_DrawInstanced(command_list, 3, 1, 0, 0); + + transition_resource_state(command_list, context.render_target, + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + + check_sub_resource_uint8(context.render_target, 0, queue, command_list, 0xff, 0); + + destroy_test_context(&context); +} + START_TEST(d3d12) { bool enable_debug_layer = false; @@ -17621,4 +17719,5 @@ START_TEST(d3d12) run_test(test_face_culling); run_test(test_multithread_command_queue_exec); run_test(test_geometry_shader); + run_test(test_render_a8); }
1
0
0
0
Józef Kucia : tests: Add test for sampling from DXGI_FORMAT_A8_UNORM.
by Alexandre Julliard
13 Feb '18
13 Feb '18
Module: vkd3d Branch: master Commit: 2d3a291b015039118630f5227e4cefbe7e3d13b0 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=2d3a291b015039118630f52…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Tue Feb 13 13:15:05 2018 +0100 tests: Add test for sampling from DXGI_FORMAT_A8_UNORM. 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> --- tests/d3d12.c | 108 ++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 75 insertions(+), 33 deletions(-) diff --git a/tests/d3d12.c b/tests/d3d12.c index 6580f9d..a513142 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -9071,14 +9071,14 @@ static void test_texture(void) ID3D12GraphicsCommandList *command_list; D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle; D3D12_GPU_DESCRIPTOR_HANDLE gpu_handle; - D3D12_SUBRESOURCE_DATA texture_data; struct test_context_desc desc; struct resource_readback rb; struct test_context context; + unsigned int x_step, y_step; ID3D12DescriptorHeap *heap; ID3D12CommandQueue *queue; ID3D12Resource *texture; - unsigned int x, y; + unsigned int i, x, y; static const DWORD ps_code[] = { @@ -9108,15 +9108,51 @@ static void test_texture(void) }; static const D3D12_SHADER_BYTECODE ps = {ps_code, sizeof(ps_code)}; static const float red[] = {1.0f, 0.0f, 0.0f, 0.5f}; - static const unsigned int bitmap_data[] = + static const unsigned int r8g8b8a8_data[] = { 0xff0000ff, 0xff00ffff, 0xff00ff00, 0xffffff00, 0xffff0000, 0xffff00ff, 0xff000000, 0xff7f7f7f, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, }; + static const uint8_t a8_data[] = + { + 0x00, 0xff, 0x7f, 0xf0, + 0x0f, 0x11, 0x00, 0x00, + 0xff, 0xf0, 0x0f, 0xff, + 0xfa, 0xfe, 0xaa, 0xcc, + }; + static const unsigned int a8_expected_data[] = + { + 0x00000000, 0xff000000, 0x7f000000, 0xf0000000, + 0x0f000000, 0x11000000, 0x00000000, 0x00000000, + 0xff000000, 0xf0000000, 0x0f000000, 0xff000000, + 0xfa000000, 0xfe000000, 0xaa000000, 0xcc000000, + }; + static const struct + { + unsigned int width; + unsigned int height; + DXGI_FORMAT format; + D3D12_SUBRESOURCE_DATA data; + const unsigned int *expected_data; + } + tests[] = + { + { + 4, 4, DXGI_FORMAT_R8G8B8A8_UNORM, + {r8g8b8a8_data, 4 * sizeof(*r8g8b8a8_data), 16 * sizeof(*r8g8b8a8_data)}, + r8g8b8a8_data, + }, + { + 4, 4, DXGI_FORMAT_A8_UNORM, + {a8_data, 4 * sizeof(*a8_data), 16 * sizeof(*a8_data)}, + a8_expected_data, + }, + }; memset(&desc, 0, sizeof(desc)); + desc.rt_width = desc.rt_height = 32; desc.no_root_signature = true; if (!init_test_context(&context, &desc)) return; @@ -9132,46 +9168,52 @@ static void test_texture(void) cpu_handle = ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(heap); gpu_handle = ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(heap); - texture = create_texture(context.device, 4, 4, DXGI_FORMAT_R8G8B8A8_UNORM, D3D12_RESOURCE_STATE_COPY_DEST); - texture_data.pData = bitmap_data; - texture_data.RowPitch = 4 * sizeof(*bitmap_data); - texture_data.SlicePitch = texture_data.RowPitch * 4; - upload_texture_data(texture, &texture_data, 1, queue, command_list); - reset_command_list(command_list, context.allocator); + for (i = 0; i < ARRAY_SIZE(tests); ++i) + { + texture = create_texture(context.device, + tests[i].width, tests[i].height, tests[i].format, D3D12_RESOURCE_STATE_COPY_DEST); + upload_texture_data(texture, &tests[i].data, 1, queue, command_list); + reset_command_list(command_list, context.allocator); - transition_resource_state(command_list, texture, - D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); + transition_resource_state(command_list, texture, + D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE); - ID3D12Device_CreateShaderResourceView(context.device, texture, NULL, cpu_handle); + ID3D12Device_CreateShaderResourceView(context.device, texture, NULL, cpu_handle); - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, red, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, red, 0, NULL); - ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, FALSE, NULL); - ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); - ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state); - ID3D12GraphicsCommandList_SetDescriptorHeaps(command_list, 1, &heap); - ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(command_list, 0, gpu_handle); - ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); - ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport); - ID3D12GraphicsCommandList_RSSetScissorRects(command_list, 1, &context.scissor_rect); - ID3D12GraphicsCommandList_DrawInstanced(command_list, 3, 1, 0, 0); + ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, FALSE, NULL); + ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); + ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state); + ID3D12GraphicsCommandList_SetDescriptorHeaps(command_list, 1, &heap); + ID3D12GraphicsCommandList_SetGraphicsRootDescriptorTable(command_list, 0, gpu_handle); + ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport); + ID3D12GraphicsCommandList_RSSetScissorRects(command_list, 1, &context.scissor_rect); + ID3D12GraphicsCommandList_DrawInstanced(command_list, 3, 1, 0, 0); - transition_resource_state(command_list, context.render_target, - D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + transition_resource_state(command_list, context.render_target, + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); - get_texture_readback_with_command_list(context.render_target, 0, &rb, queue, command_list); - for (y = 0; y < 4; ++y) - { - for (x = 0; x < 4; ++x) + x_step = desc.rt_width / tests[i].width; + y_step = desc.rt_height / tests[i].height; + get_texture_readback_with_command_list(context.render_target, 0, &rb, queue, command_list); + for (y = 0; y < tests[i].height; ++y) { - unsigned int color = get_readback_uint(&rb, 4 + 8 * x, 4 + 8 * y); - ok(compare_color(color, bitmap_data[4 * y + x], 1), - "Got color 0x%08x, expected 0x%08x at (%u, %u).\n", color, bitmap_data[4 * y + x], x, y); + for (x = 0; x < tests[i].width; ++x) + { + unsigned int color = get_readback_uint(&rb, x * x_step + x_step / 2, y * y_step + y_step / 2); + ok(compare_color(color, tests[i].expected_data[tests[i].width * y + x], 1), + "Got color 0x%08x, expected 0x%08x at (%u, %u).\n", + color, tests[i].expected_data[tests[i].width * y + x], x, y); + } } + release_resource_readback(&rb); + + ID3D12Resource_Release(texture); + reset_command_list(command_list, context.allocator); } - release_resource_readback(&rb); - ID3D12Resource_Release(texture); ID3D12DescriptorHeap_Release(heap); destroy_test_context(&context); }
1
0
0
0
Józef Kucia : libs/vkd3d: Disallow image view swizzles on framebuffer attachments and storage images.
by Alexandre Julliard
13 Feb '18
13 Feb '18
Module: vkd3d Branch: master Commit: 3bf017b331c337ba2a3b843571a5c30d5145dc64 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=3bf017b331c337ba2a3b843…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Tue Feb 13 13:15:04 2018 +0100 libs/vkd3d: Disallow image view swizzles on framebuffer attachments and storage images. The Vulkan spec says that image views must be created with the identity swizzle for attachments and storage images. 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 | 74 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 26 deletions(-) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 77f4f0d..e0ceb4c 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -977,10 +977,52 @@ static bool vkd3d_create_buffer_view(struct d3d12_device *device, offset * element_size, size * element_size, vk_view); } +static void vkd3d_set_view_swizzle_for_format(VkComponentMapping *components, + const struct vkd3d_format *format, bool allowed_swizzle) +{ + if (format->vk_aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT) + { + if (allowed_swizzle) + { + components->r = VK_COMPONENT_SWIZZLE_ZERO; + components->g = VK_COMPONENT_SWIZZLE_R; + components->b = VK_COMPONENT_SWIZZLE_ZERO; + components->a = VK_COMPONENT_SWIZZLE_ZERO; + return; + } + else + { + FIXME("Stencil swizzle is not supported for format %#x.\n", + format->dxgi_format); + } + } + + if (format->dxgi_format == DXGI_FORMAT_A8_UNORM) + { + if (allowed_swizzle) + { + components->r = VK_COMPONENT_SWIZZLE_ZERO; + components->g = VK_COMPONENT_SWIZZLE_ZERO; + components->b = VK_COMPONENT_SWIZZLE_ZERO; + components->a = VK_COMPONENT_SWIZZLE_R; + return; + } + else + { + FIXME("Alpha swizzle is not supported.\n"); + } + } + + components->r = VK_COMPONENT_SWIZZLE_R; + components->g = VK_COMPONENT_SWIZZLE_G; + components->b = VK_COMPONENT_SWIZZLE_B; + components->a = VK_COMPONENT_SWIZZLE_A; +} + static VkResult vkd3d_create_texture_view(struct d3d12_device *device, struct d3d12_resource *resource, const struct vkd3d_format *format, VkImageViewType view_type, uint32_t miplevel_idx, uint32_t miplevel_count, uint32_t layer_idx, uint32_t layer_count, - VkImageView *vk_view) + bool allowed_swizzle, VkImageView *vk_view) { const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; struct VkImageViewCreateInfo view_desc; @@ -994,27 +1036,7 @@ static VkResult vkd3d_create_texture_view(struct d3d12_device *device, view_desc.image = resource->u.vk_image; view_desc.viewType = view_type; view_desc.format = format->vk_format; - if (format->vk_aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT) - { - view_desc.components.r = VK_COMPONENT_SWIZZLE_ZERO; - view_desc.components.g = VK_COMPONENT_SWIZZLE_R; - view_desc.components.b = VK_COMPONENT_SWIZZLE_ZERO; - view_desc.components.a = VK_COMPONENT_SWIZZLE_ZERO; - } - else if (format->dxgi_format == DXGI_FORMAT_A8_UNORM) - { - view_desc.components.r = VK_COMPONENT_SWIZZLE_ZERO; - view_desc.components.g = VK_COMPONENT_SWIZZLE_ZERO; - view_desc.components.b = VK_COMPONENT_SWIZZLE_ZERO; - view_desc.components.a = VK_COMPONENT_SWIZZLE_R; - } - else - { - view_desc.components.r = VK_COMPONENT_SWIZZLE_R; - view_desc.components.g = VK_COMPONENT_SWIZZLE_G; - view_desc.components.b = VK_COMPONENT_SWIZZLE_B; - view_desc.components.a = VK_COMPONENT_SWIZZLE_A; - } + vkd3d_set_view_swizzle_for_format(&view_desc.components, format, allowed_swizzle); view_desc.subresourceRange.aspectMask = format->vk_aspect_mask; view_desc.subresourceRange.baseMipLevel = miplevel_idx; view_desc.subresourceRange.levelCount = miplevel_count; @@ -1149,7 +1171,7 @@ void d3d12_desc_create_srv(struct d3d12_desc *descriptor, vk_view_type = resource->desc.DepthOrArraySize > 1 ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D; if (vkd3d_create_texture_view(device, resource, format, vk_view_type, - 0, VK_REMAINING_MIP_LEVELS, 0, VK_REMAINING_ARRAY_LAYERS, &view->u.vk_image_view) < 0) + 0, VK_REMAINING_MIP_LEVELS, 0, VK_REMAINING_ARRAY_LAYERS, true, &view->u.vk_image_view) < 0) { vkd3d_free(view); return; @@ -1292,7 +1314,7 @@ static void vkd3d_create_texture_uav(struct d3d12_desc *descriptor, return; if (vkd3d_create_texture_view(device, resource, format, vk_view_type, - miplevel_idx, 1, layer_idx, layer_count, &view->u.vk_image_view) < 0) + miplevel_idx, 1, layer_idx, layer_count, false, &view->u.vk_image_view) < 0) { vkd3d_free(view); return; @@ -1527,7 +1549,7 @@ void d3d12_rtv_desc_create_rtv(struct d3d12_rtv_desc *rtv_desc, struct d3d12_dev miplevel_idx = desc ? desc->u.Texture2D.MipSlice : 0; if (vkd3d_create_texture_view(device, resource, format, VK_IMAGE_VIEW_TYPE_2D, - miplevel_idx, 1, 0, 1, &rtv_desc->vk_view) < 0) + miplevel_idx, 1, 0, 1, false, &rtv_desc->vk_view) < 0) return; rtv_desc->format = format->vk_format; @@ -1586,7 +1608,7 @@ void d3d12_dsv_desc_create_dsv(struct d3d12_dsv_desc *dsv_desc, struct d3d12_dev miplevel_idx = desc ? desc->u.Texture2D.MipSlice : 0; if (vkd3d_create_texture_view(device, resource, format, VK_IMAGE_VIEW_TYPE_2D, - miplevel_idx, 1, 0, 1, &dsv_desc->vk_view) < 0) + miplevel_idx, 1, 0, 1, false, &dsv_desc->vk_view) < 0) return; dsv_desc->format = format->vk_format;
1
0
0
0
Józef Kucia : libs/vkd3d: Implement DXGI_FORMAT_A8_UNORM.
by Alexandre Julliard
13 Feb '18
13 Feb '18
Module: vkd3d Branch: master Commit: 850f09e7033925c4d7fc77f5e2ad648f20017a88 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=850f09e7033925c4d7fc77f…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Tue Feb 13 13:15:03 2018 +0100 libs/vkd3d: Implement DXGI_FORMAT_A8_UNORM. 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 | 7 +++++++ libs/vkd3d/utils.c | 1 + 2 files changed, 8 insertions(+) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 712ff9c..77f4f0d 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -1001,6 +1001,13 @@ static VkResult vkd3d_create_texture_view(struct d3d12_device *device, view_desc.components.b = VK_COMPONENT_SWIZZLE_ZERO; view_desc.components.a = VK_COMPONENT_SWIZZLE_ZERO; } + else if (format->dxgi_format == DXGI_FORMAT_A8_UNORM) + { + view_desc.components.r = VK_COMPONENT_SWIZZLE_ZERO; + view_desc.components.g = VK_COMPONENT_SWIZZLE_ZERO; + view_desc.components.b = VK_COMPONENT_SWIZZLE_ZERO; + view_desc.components.a = VK_COMPONENT_SWIZZLE_R; + } else { view_desc.components.r = VK_COMPONENT_SWIZZLE_R; diff --git a/libs/vkd3d/utils.c b/libs/vkd3d/utils.c index a326cae..b3a8027 100644 --- a/libs/vkd3d/utils.c +++ b/libs/vkd3d/utils.c @@ -50,6 +50,7 @@ static const struct vkd3d_format vkd3d_formats[] = {DXGI_FORMAT_R8_UNORM, VK_FORMAT_R8_UNORM, 1, 1, 1, 1, COLOR}, {DXGI_FORMAT_R8_UINT, VK_FORMAT_R8_UINT, 1, 1, 1, 1, COLOR}, {DXGI_FORMAT_R8_SNORM, VK_FORMAT_R8_SNORM, 1, 1, 1, 1, COLOR}, + {DXGI_FORMAT_A8_UNORM, VK_FORMAT_R8_UNORM, 1, 1, 1, 1, COLOR}, {DXGI_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_UNORM, 4, 1, 1, 1, COLOR}, {DXGI_FORMAT_B8G8R8A8_TYPELESS, VK_FORMAT_B8G8R8A8_UNORM, 4, 1, 1, 1, COLOR}, {DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, VK_FORMAT_B8G8R8A8_SRGB, 4, 1, 1, 1, COLOR},
1
0
0
0
Józef Kucia : tests: Add test for OMSetRenderTargets( ).
by Alexandre Julliard
13 Feb '18
13 Feb '18
Module: vkd3d Branch: master Commit: d1e62117ea9b38acc28ba1e587f2a102464c656f URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=d1e62117ea9b38acc28ba1e…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Tue Feb 13 13:15:02 2018 +0100 tests: Add test for OMSetRenderTargets(). 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> --- tests/d3d12.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) diff --git a/tests/d3d12.c b/tests/d3d12.c index 80d2233..6580f9d 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -3968,6 +3968,133 @@ static void test_draw_indexed_instanced(void) destroy_test_context(&context); } +static void test_multiple_render_targets(void) +{ + static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f}; + struct vec4 expected_vec4 = {0.0f, 0.0f, 0.0f, 1.0f}; + D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc; + ID3D12GraphicsCommandList *command_list; + D3D12_CPU_DESCRIPTOR_HANDLE rtvs[3]; + ID3D12Resource *render_targets[2]; + struct test_context_desc desc; + struct test_context context; + ID3D12CommandQueue *queue; + unsigned int i; + HRESULT hr; + + static const DWORD ps_code[] = + { +#if 0 + void main(out float4 target0 : SV_Target0, out float4 target1 : SV_Target1, + out float4 target2 : SV_Target2) + { + target0 = float4(1.0f, 0.0f, 0.0f, 1.0f); + target1 = float4(2.0f, 0.0f, 0.0f, 1.0f); + target2 = float4(3.0f, 0.0f, 0.0f, 1.0f); + } +#endif + 0x43425844, 0xc4325131, 0x8ba4a693, 0x08d15431, 0xcb990885, 0x00000001, 0x0000013c, 0x00000003, + 0x0000002c, 0x0000003c, 0x000000a0, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, 0x4e47534f, + 0x0000005c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x00000050, 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, 0x00000050, + 0x00000002, 0x00000000, 0x00000003, 0x00000002, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, + 0x58454853, 0x00000094, 0x00000050, 0x00000025, 0x0100086a, 0x03000065, 0x001020f2, 0x00000000, + 0x03000065, 0x001020f2, 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x08000036, 0x001020f2, + 0x00000000, 0x00004002, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, 0x08000036, 0x001020f2, + 0x00000001, 0x00004002, 0x40000000, 0x00000000, 0x00000000, 0x3f800000, 0x08000036, 0x001020f2, + 0x00000002, 0x00004002, 0x40400000, 0x00000000, 0x00000000, 0x3f800000, 0x0100003e, + }; + static const D3D12_SHADER_BYTECODE ps = {ps_code, sizeof(ps_code)}; + + memset(&desc, 0, sizeof(desc)); + desc.rt_format = DXGI_FORMAT_R32G32B32A32_FLOAT; + desc.rt_descriptor_count = ARRAY_SIZE(rtvs); + desc.no_pipeline = true; + if (!init_test_context(&context, &desc)) + return; + command_list = context.list; + queue = context.queue; + + init_pipeline_state_desc(&pso_desc, context.root_signature, 0, NULL, &ps, NULL); + pso_desc.NumRenderTargets = ARRAY_SIZE(rtvs); + for (i = 0; i < ARRAY_SIZE(rtvs); ++i) + pso_desc.RTVFormats[i] = desc.rt_format; + hr = ID3D12Device_CreateGraphicsPipelineState(context.device, &pso_desc, + &IID_ID3D12PipelineState, (void **)&context.pipeline_state); + ok(hr == S_OK, "Failed to create state, hr %#x.\n", hr); + + rtvs[0] = get_cpu_rtv_handle(&context, context.rtv_heap, 2); + rtvs[1] = get_cpu_rtv_handle(&context, context.rtv_heap, 0); + rtvs[2] = get_cpu_rtv_handle(&context, context.rtv_heap, 1); + + create_render_target(&context, &desc, &render_targets[0], &rtvs[0]); + create_render_target(&context, &desc, &render_targets[1], &rtvs[2]); + + for (i = 0; i < ARRAY_SIZE(rtvs); ++i) + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, rtvs[i], white, 0, NULL); + + ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, ARRAY_SIZE(rtvs), rtvs, FALSE, NULL); + ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); + ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state); + ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport); + ID3D12GraphicsCommandList_RSSetScissorRects(command_list, 1, &context.scissor_rect); + ID3D12GraphicsCommandList_DrawInstanced(command_list, 3, 1, 0, 0); + + transition_resource_state(command_list, context.render_target, + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + transition_resource_state(command_list, render_targets[0], + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + transition_resource_state(command_list, render_targets[1], + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + + expected_vec4.x = 2.0f; + check_sub_resource_vec4(context.render_target, 0, queue, command_list, &expected_vec4, 0); + reset_command_list(command_list, context.allocator); + expected_vec4.x = 1.0f; + check_sub_resource_vec4(render_targets[0], 0, queue, command_list, &expected_vec4, 0); + reset_command_list(command_list, context.allocator); + expected_vec4.x = 3.0f; + check_sub_resource_vec4(render_targets[1], 0, queue, command_list, &expected_vec4, 0); + reset_command_list(command_list, context.allocator); + + transition_resource_state(command_list, context.render_target, + D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET); + transition_resource_state(command_list, render_targets[0], + D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET); + transition_resource_state(command_list, render_targets[1], + D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET); + + ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, ARRAY_SIZE(rtvs), &context.rtv, TRUE, NULL); + ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); + ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state); + ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + ID3D12GraphicsCommandList_RSSetViewports(command_list, 1, &context.viewport); + ID3D12GraphicsCommandList_RSSetScissorRects(command_list, 1, &context.scissor_rect); + ID3D12GraphicsCommandList_DrawInstanced(command_list, 3, 1, 0, 0); + + transition_resource_state(command_list, context.render_target, + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + transition_resource_state(command_list, render_targets[0], + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + transition_resource_state(command_list, render_targets[1], + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + + expected_vec4.x = 1.0f; + check_sub_resource_vec4(context.render_target, 0, queue, command_list, &expected_vec4, 0); + reset_command_list(command_list, context.allocator); + expected_vec4.x = 3.0f; + check_sub_resource_vec4(render_targets[0], 0, queue, command_list, &expected_vec4, 0); + reset_command_list(command_list, context.allocator); + expected_vec4.x = 2.0f; + check_sub_resource_vec4(render_targets[1], 0, queue, command_list, &expected_vec4, 0); + reset_command_list(command_list, context.allocator); + + for (i = 0; i < ARRAY_SIZE(render_targets); ++i) + ID3D12Resource_Release(render_targets[i]); + destroy_test_context(&context); +} + static void test_append_aligned_element(void) { ID3D12GraphicsCommandList *command_list; @@ -17391,6 +17518,7 @@ START_TEST(d3d12) run_test(test_clear_unordered_access_view); run_test(test_draw_instanced); run_test(test_draw_indexed_instanced); + run_test(test_multiple_render_targets); run_test(test_append_aligned_element); run_test(test_gpu_virtual_address); run_test(test_fragment_coords);
1
0
0
0
Józef Kucia : libs/vkd3d: Fix single descriptor handles in d3d12_command_list_OMSetRenderTargets().
by Alexandre Julliard
13 Feb '18
13 Feb '18
Module: vkd3d Branch: master Commit: abcd0348a088de64772fb517170aee383beac2b2 URL:
https://source.winehq.org/git/vkd3d.git/?a=commit;h=abcd0348a088de64772fb51…
Author: Józef Kucia <jkucia(a)codeweavers.com> Date: Tue Feb 13 13:15:01 2018 +0100 libs/vkd3d: Fix single descriptor handles in d3d12_command_list_OMSetRenderTargets(). 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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 4273a66..847581c 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -3372,6 +3372,8 @@ static void STDMETHODCALLTYPE d3d12_command_list_OMSetRenderTargets(ID3D12Graphi BOOL single_descriptor_handle, const D3D12_CPU_DESCRIPTOR_HANDLE *depth_stencil_descriptor) { struct d3d12_command_list *list = impl_from_ID3D12GraphicsCommandList(iface); + const struct d3d12_rtv_desc *rtv_desc; + const struct d3d12_dsv_desc *dsv_desc; unsigned int i; TRACE("iface %p, render_target_descriptor_count %u, render_target_descriptors %p, " @@ -3390,7 +3392,10 @@ static void STDMETHODCALLTYPE d3d12_command_list_OMSetRenderTargets(ID3D12Graphi list->fb_height = 0; for (i = 0; i < render_target_descriptor_count; ++i) { - const struct d3d12_rtv_desc *rtv_desc = d3d12_rtv_desc_from_cpu_handle(render_target_descriptors[i]); + if (single_descriptor_handle) + rtv_desc = d3d12_rtv_desc_from_cpu_handle(*render_target_descriptors) + i; + else + rtv_desc = d3d12_rtv_desc_from_cpu_handle(render_target_descriptors[i]); d3d12_command_list_track_resource_usage(list, rtv_desc->resource); @@ -3403,7 +3408,7 @@ static void STDMETHODCALLTYPE d3d12_command_list_OMSetRenderTargets(ID3D12Graphi if (depth_stencil_descriptor) { - const struct d3d12_dsv_desc *dsv_desc = d3d12_dsv_desc_from_cpu_handle(*depth_stencil_descriptor); + dsv_desc = d3d12_dsv_desc_from_cpu_handle(*depth_stencil_descriptor); d3d12_command_list_track_resource_usage(list, dsv_desc->resource);
1
0
0
0
Mark Jansen : ntdll: Parse manifest compatibility section.
by Alexandre Julliard
12 Feb '18
12 Feb '18
Module: wine Branch: master Commit: 0f1cb96b694a38106464044285296e531f90bb67 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0f1cb96b694a381064640442…
Author: Mark Jansen <mark.jansen(a)reactos.org> Date: Tue Feb 6 16:32:45 2018 +0100 ntdll: Parse manifest compatibility section. Signed-off-by: Mark Jansen <mark.jansen(a)reactos.org> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/actctx.c | 4 -- dlls/ntdll/actctx.c | 138 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 4 deletions(-) diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c index 2cb856a..a182cfa 100644 --- a/dlls/kernel32/tests/actctx.c +++ b/dlls/kernel32/tests/actctx.c @@ -2555,10 +2555,8 @@ static void test_no_compat(HANDLE handle, int line) CompatibilityInformationInActivationContext, &compat_info, sizeof(compat_info), &size); -todo_wine { ok_(__FILE__, line)(b, "CompatibilityInformationInActivationContext failed\n"); ok_(__FILE__, line)(size == sizeof(DWORD), "size mismatch (got %lu, expected 4)\n", size); -} ok_(__FILE__, line)(compat_info.ElementCount == 0, "unexpected ElementCount %u\n", compat_info.ElementCount); } @@ -2575,7 +2573,6 @@ static void test_with_compat(HANDLE handle, DWORD num_compat, const GUID* expect CompatibilityInformationInActivationContext, &compat_info, sizeof(compat_info), &size); -todo_wine { ok_(__FILE__, line)(b, "CompatibilityInformationInActivationContext failed\n"); ok_(__FILE__, line)(size == expected, "size mismatch (got %lu, expected %lu)\n", size, expected); ok_(__FILE__, line)(compat_info.ElementCount == num_compat, "unexpected ElementCount %u\n", compat_info.ElementCount); @@ -2591,7 +2588,6 @@ todo_wine { "Wrong type, got %u for %u\n", (DWORD)compat_info.Elements[n].Type, n); } } -} static void test_compatibility(void) { diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c index b978438..956f255 100644 --- a/dlls/ntdll/actctx.c +++ b/dlls/ntdll/actctx.c @@ -499,6 +499,8 @@ struct assembly unsigned int num_dlls; unsigned int allocated_dlls; struct entity_array entities; + COMPATIBILITY_CONTEXT_ELEMENT* compat_contexts; + ULONG num_compat_contexts; }; enum context_sections @@ -622,6 +624,12 @@ static const WCHAR staticW[] = {'s','t','a','t','i','c',0}; static const WCHAR supportsmultilevelundoW[] = {'s','u','p','p','o','r','t','s','m','u','l','t','i','l','e','v','e','l','u','n','d','o',0}; static const WCHAR wantstomenumergeW[] = {'w','a','n','t','s','t','o','m','e','n','u','m','e','r','g','e',0}; +static const WCHAR compatibilityW[] = {'c','o','m','p','a','t','i','b','i','l','i','t','y',0}; +static const WCHAR compatibilityNSW[] = {'u','r','n',':','s','c','h','e','m','a','s','-','m','i','c','r','o','s','o','f','t','-','c','o','m',':','c','o','m','p','a','t','i','b','i','l','i','t','y','.','v','1',0}; +static const WCHAR applicationW[] = {'a','p','p','l','i','c','a','t','i','o','n',0}; +static const WCHAR supportedOSW[] = {'s','u','p','p','o','r','t','e','d','O','S',0}; +static const WCHAR IdW[] = {'I','d',0}; + struct olemisc_entry { const WCHAR *name; @@ -792,6 +800,25 @@ static struct dll_redirect* add_dll_redirect(struct assembly* assembly) return &assembly->dlls[assembly->num_dlls++]; } +static PCOMPATIBILITY_CONTEXT_ELEMENT add_compat_context(struct assembly* assembly) +{ + void *ptr; + if (assembly->num_compat_contexts) + { + unsigned int new_count = assembly->num_compat_contexts + 1; + ptr = RtlReAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, + assembly->compat_contexts, + new_count * sizeof(COMPATIBILITY_CONTEXT_ELEMENT) ); + } + else + { + ptr = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(COMPATIBILITY_CONTEXT_ELEMENT) ); + } + if (!ptr) return NULL; + assembly->compat_contexts = ptr; + return &assembly->compat_contexts[assembly->num_compat_contexts++]; +} + static void free_assembly_identity(struct assembly_identity *ai) { RtlFreeHeap( GetProcessHeap(), 0, ai->name ); @@ -1075,6 +1102,7 @@ static void actctx_release( ACTIVATION_CONTEXT *actctx ) RtlFreeHeap( GetProcessHeap(), 0, assembly->dlls ); RtlFreeHeap( GetProcessHeap(), 0, assembly->manifest.info ); RtlFreeHeap( GetProcessHeap(), 0, assembly->directory ); + RtlFreeHeap( GetProcessHeap(), 0, assembly->compat_contexts ); free_entity_array( &assembly->entities ); free_assembly_identity(&assembly->id); } @@ -2211,6 +2239,84 @@ static BOOL parse_file_elem(xmlbuf_t* xmlbuf, struct assembly* assembly, struct return ret; } +static BOOL parse_compatibility_application_elem(xmlbuf_t* xmlbuf, struct assembly* assembly, + struct actctx_loader* acl) +{ + xmlstr_t attr_name, attr_value, elem; + BOOL end = FALSE, ret = TRUE, error; + + while (ret && (ret = next_xml_elem(xmlbuf, &elem))) + { + if (xmlstr_cmp_end(&elem, applicationW)) + { + ret = parse_end_element(xmlbuf); + break; + } + else if (xmlstr_cmp(&elem, supportedOSW)) + { + while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, &end)) + { + if (xmlstr_cmp(&attr_name, IdW)) + { + UNICODE_STRING str; + COMPATIBILITY_CONTEXT_ELEMENT* compat; + GUID compat_id; + str.Buffer = (PWSTR)attr_value.ptr; + str.Length = str.MaximumLength = (USHORT)attr_value.len * sizeof(WCHAR); + if (RtlGUIDFromString(&str, &compat_id) == STATUS_SUCCESS) + { + if (!(compat = add_compat_context(assembly))) return FALSE; + compat->Type = ACTCX_COMPATIBILITY_ELEMENT_TYPE_OS; + compat->Id = compat_id; + } + else + { + WARN("Invalid guid %s\n", debugstr_xmlstr(&attr_value)); + } + } + else + { + WARN("unknown attr %s=%s\n", debugstr_xmlstr(&attr_name), + debugstr_xmlstr(&attr_value)); + } + } + } + else + { + WARN("unknown elem %s\n", debugstr_xmlstr(&elem)); + ret = parse_unknown_elem(xmlbuf, &elem); + } + } + + return ret; +} + +static BOOL parse_compatibility_elem(xmlbuf_t* xmlbuf, struct assembly* assembly, + struct actctx_loader* acl) +{ + xmlstr_t elem; + BOOL ret = TRUE; + + while (ret && (ret = next_xml_elem(xmlbuf, &elem))) + { + if (xmlstr_cmp_end(&elem, compatibilityW)) + { + ret = parse_end_element(xmlbuf); + break; + } + else if (xmlstr_cmp(&elem, applicationW)) + { + ret = parse_compatibility_application_elem(xmlbuf, assembly, acl); + } + else + { + WARN("unknown elem %s\n", debugstr_xmlstr(&elem)); + ret = parse_unknown_elem(xmlbuf, &elem); + } + } + return ret; +} + static BOOL parse_assembly_elem(xmlbuf_t* xmlbuf, struct actctx_loader* acl, struct assembly* assembly, struct assembly_identity* expected_ai) @@ -2328,6 +2434,10 @@ static BOOL parse_assembly_elem(xmlbuf_t* xmlbuf, struct actctx_loader* acl, } } } + else if (xml_elem_cmp(&elem, compatibilityW, compatibilityNSW)) + { + ret = parse_compatibility_elem(xmlbuf, assembly, acl); + } else { WARN("unknown element %s\n", debugstr_xmlstr(&elem)); @@ -4987,6 +5097,34 @@ NTSTATUS WINAPI RtlQueryInformationActivationContext( ULONG flags, HANDLE handle } break; + case CompatibilityInformationInActivationContext: + { + /*ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION*/DWORD *acci = buffer; + COMPATIBILITY_CONTEXT_ELEMENT *elements; + struct assembly *assembly = NULL; + ULONG num_compat_contexts = 0, n; + SIZE_T len; + + if (!(actctx = check_actctx(handle))) return STATUS_INVALID_PARAMETER; + + if (actctx->num_assemblies) assembly = actctx->assemblies; + + if (assembly) + num_compat_contexts = assembly->num_compat_contexts; + len = sizeof(*acci) + num_compat_contexts * sizeof(COMPATIBILITY_CONTEXT_ELEMENT); + + if (retlen) *retlen = len; + if (!buffer || bufsize < len) return STATUS_BUFFER_TOO_SMALL; + + *acci = num_compat_contexts; + elements = (COMPATIBILITY_CONTEXT_ELEMENT*)(acci + 1); + for (n = 0; n < num_compat_contexts; ++n) + { + elements[n] = assembly->compat_contexts[n]; + } + } + break; + default: FIXME( "class %u not implemented\n", class ); return STATUS_NOT_IMPLEMENTED;
1
0
0
0
Mark Jansen : kernel32/tests: Add tests for the compatibility section in actctx.
by Alexandre Julliard
12 Feb '18
12 Feb '18
Module: wine Branch: master Commit: 74862f2e96f7a5b3cc1c204824d99460f75aa96a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=74862f2e96f7a5b3cc1c2048…
Author: Mark Jansen <mark.jansen(a)reactos.org> Date: Tue Feb 6 16:10:20 2018 +0100 kernel32/tests: Add tests for the compatibility section in actctx. Signed-off-by: Mark Jansen <mark.jansen(a)reactos.org> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/actctx.c | 229 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=74862f2e96f7a5b3cc1c…
1
0
0
0
Mark Jansen : include: Add ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION and related struct/enum.
by Alexandre Julliard
12 Feb '18
12 Feb '18
Module: wine Branch: master Commit: 7960ce3ddd43e7776c06abdc18b6970487e2334b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=7960ce3ddd43e7776c06abdc…
Author: Mark Jansen <mark.jansen(a)reactos.org> Date: Tue Feb 6 16:07:41 2018 +0100 include: Add ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION and related struct/enum. Signed-off-by: Mark Jansen <mark.jansen(a)reactos.org> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- include/winnt.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/winnt.h b/include/winnt.h index a9d718a..04f00a6 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -5746,11 +5746,29 @@ typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION { typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION; +typedef enum { + ACTCX_COMPATIBILITY_ELEMENT_TYPE_UNKNOWN = 0, + ACTCX_COMPATIBILITY_ELEMENT_TYPE_OS +} ACTCTX_COMPATIBILITY_ELEMENT_TYPE; + +typedef struct _COMPATIBILITY_CONTEXT_ELEMENT { + GUID Id; + ACTCTX_COMPATIBILITY_ELEMENT_TYPE Type; +} COMPATIBILITY_CONTEXT_ELEMENT, *PCOMPATIBILITY_CONTEXT_ELEMENT; + +#if !defined(__WINESRC__) && (defined(_MSC_EXTENSIONS) || ((defined(__GNUC__) && __GNUC__ >= 3))) +typedef struct _ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION { + DWORD ElementCount; + COMPATIBILITY_CONTEXT_ELEMENT Elements[]; +} ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION, *PACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION; +#endif + typedef enum _ACTIVATION_CONTEXT_INFO_CLASS { ActivationContextBasicInformation = 1, ActivationContextDetailedInformation = 2, AssemblyDetailedInformationInActivationContext = 3, FileInformationInAssemblyOfAssemblyInActivationContext = 4, + CompatibilityInformationInActivationContext = 6, MaxActivationContextInfoClass, AssemblyDetailedInformationInActivationContxt = 3,
1
0
0
0
Zhiyi Zhang : urlmon: Do not canonicalize Unicode characters.
by Alexandre Julliard
12 Feb '18
12 Feb '18
Module: wine Branch: master Commit: ac066d3eee85fd6e3a27ca59b158c5e040d91727 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ac066d3eee85fd6e3a27ca59…
Author: Zhiyi Zhang <yi.gd.cn(a)gmail.com> Date: Fri Feb 9 23:22:51 2018 +0800 urlmon: Do not canonicalize Unicode characters. Signed-off-by: Zhiyi Zhang <yi.gd.cn(a)gmail.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/urlmon/tests/uri.c | 268 +++++++++++++++++++++++++++++++++++++++++++++++- dlls/urlmon/uri.c | 21 ++-- 2 files changed, 279 insertions(+), 10 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=ac066d3eee85fd6e3a27…
1
0
0
0
← Newer
1
...
43
44
45
46
47
48
49
...
81
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Results per page:
10
25
50
100
200