Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46617 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46618 Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 1b2f7e09318..b823ada802f 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4894,6 +4894,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, wined3d_texture_decref(device->cursor_texture); device->cursor_texture = NULL; } + wined3d_stateblock_state_cleanup(&device->stateblock_state); state_unbind_resources(&device->state); }
@@ -5082,7 +5083,6 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, } wined3d_cs_emit_reset_state(device->cs); state_cleanup(&device->state); - wined3d_stateblock_state_cleanup(&device->stateblock_state);
if (device->d3d_initialized) wined3d_device_delete_opengl_contexts(device);
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Fix patch according to Józef's review. v3: Merge reset of the auto_mipmaps field into a preexisting block (Henri).
dlls/d3d9/d3d9_private.h | 2 ++ dlls/d3d9/device.c | 21 +++++++++++++++++++-- dlls/d3d9/stateblock.c | 16 +++++++++++++++- 3 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index 1032f8e8e9c..3fe0376e5c1 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -111,6 +111,8 @@ struct d3d9_device DWORD recording : 1; DWORD padding : 11;
+ DWORD auto_mipmaps; /* D3D9_MAX_TEXTURE_UNITS */ + unsigned int max_user_clip_planes;
UINT implicit_swapchain_count; diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 98ada03af8b..6cc3f180b09 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -991,6 +991,7 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device, if (!extended) { device->recording = FALSE; + device->auto_mipmaps = 0; wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil); } @@ -2456,6 +2457,19 @@ static HRESULT WINAPI d3d9_device_SetTexture(IDirect3DDevice9Ex *iface, DWORD st wined3d_mutex_lock(); hr = wined3d_device_set_texture(device->wined3d_device, stage, texture_impl ? texture_impl->wined3d_texture : NULL); + if (SUCCEEDED(hr) && !device->recording) + { + unsigned int i = stage < 16 || (stage >= D3DVERTEXTEXTURESAMPLER0 && stage <= D3DVERTEXTEXTURESAMPLER3) + ? stage < 16 ? stage : stage - D3DVERTEXTEXTURESAMPLER0 + 16 : ~0u; + + if (i < D3D9_MAX_TEXTURE_UNITS) + { + if (texture_impl && texture_impl->usage & D3DUSAGE_AUTOGENMIPMAP) + device->auto_mipmaps |= 1u << i; + else + device->auto_mipmaps &= ~(1u << i); + } + } wined3d_mutex_unlock();
return hr; @@ -2700,10 +2714,13 @@ static float WINAPI d3d9_device_GetNPatchMode(IDirect3DDevice9Ex *iface) static void d3d9_generate_auto_mipmaps(struct d3d9_device *device) { struct wined3d_texture *texture; - unsigned int i, stage; + unsigned int i, stage, map;
- for (i = 0; i < D3D9_MAX_TEXTURE_UNITS; ++i) + map = device->auto_mipmaps; + while (map) { + i = wined3d_bit_scan(&map); + stage = i >= 16 ? i - 16 + D3DVERTEXTEXTURESAMPLER0 : i; if ((texture = wined3d_device_get_texture(device->wined3d_device, stage))) d3d9_texture_gen_auto_mipmap(wined3d_texture_get_parent(texture)); diff --git a/dlls/d3d9/stateblock.c b/dlls/d3d9/stateblock.c index 8431ef77002..14f47d929bc 100644 --- a/dlls/d3d9/stateblock.c +++ b/dlls/d3d9/stateblock.c @@ -109,10 +109,12 @@ static HRESULT WINAPI d3d9_stateblock_Capture(IDirect3DStateBlock9 *iface) static HRESULT WINAPI d3d9_stateblock_Apply(IDirect3DStateBlock9 *iface) { struct d3d9_stateblock *stateblock = impl_from_IDirect3DStateBlock9(iface); + struct wined3d_texture *wined3d_texture; + unsigned int i, offset, stride, stage; struct wined3d_buffer *wined3d_buffer; struct d3d9_vertexbuffer *buffer; - unsigned int i, offset, stride; enum wined3d_format_id format; + struct d3d9_texture *texture; struct d3d9_device *device; HRESULT hr;
@@ -134,6 +136,18 @@ static HRESULT WINAPI d3d9_stateblock_Apply(IDirect3DStateBlock9 *iface) } device->sysmem_ib = (wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device, &format, &offset)) && (buffer = wined3d_buffer_get_parent(wined3d_buffer)) && buffer->draw_buffer; + device->auto_mipmaps = 0; + for (i = 0; i < D3D9_MAX_TEXTURE_UNITS; ++i) + { + stage = i >= 16 ? i - 16 + D3DVERTEXTEXTURESAMPLER0 : i; + + if ((wined3d_texture = wined3d_device_get_texture(device->wined3d_device, stage)) + && (texture = wined3d_texture_get_parent(wined3d_texture)) + && texture->usage & D3DUSAGE_AUTOGENMIPMAP) + device->auto_mipmaps |= 1u << i; + else + device->auto_mipmaps &= ~(1u << i); + } wined3d_mutex_unlock();
return D3D_OK;
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=47468
Your paranoid android.
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Avoids two failures in (upcoming) d3d11:test_viewport().
My understanding of what's happening is: the affected quad extends to the left of the viewport bounds and moving the viewport even a tiny bit to the left makes GL take an extra column of pixels in consideration. Those pixels are covered by the quad since the pixel center is inside the quad, so they are drawn.
My reading of the spec doesn't entirely clarify if this is correct / expected behavior, of course the pixel center of those "extra" pixels isn't inside the viewport, but part of the pixel is. It looks to me as the first few lines at https://docs.microsoft.com/en-us/windows/desktop/direct3d11/d3d10-graphics-p... might be interpreted as implying this is actually correct behavior as far as d3d is concerned and I suspect the hardware to be quite tied to it.
FWIW decreasing the offset fixes the issue only when the offset is effectively set to 0.
Of course the offset was added in the first place for a reason, specifically to force the expected (d3d) top-left rule for triangle rasterization, since OpenGL leaves that unspecified except for requiring that only one of two adjacent triangles get to cover any pixel. I suspect that all the GPUs supporting ARB_clip_control also in practice make use of the same rule in OpenGL. Also the test should check that case too and it passes for me on AMD and Nvidia.
If this all seems too much of a hassle I can drop this patch and update the test accordingly, no worries. I really only wanted to get to the bottom of the test failure, this patch created itself while debugging :P
dlls/wined3d/state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 1b5eacdf216..43fef746f11 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -4089,7 +4089,7 @@ static void viewport_miscpart_cc(struct wined3d_context *context, { /* See get_projection_matrix() in utils.c for a discussion about those values. */ float pixel_center_offset = context->d3d_info->wined3d_creation_flags - & WINED3D_PIXEL_CENTER_INTEGER ? 63.0f / 128.0f : -1.0f / 128.0f; + & WINED3D_PIXEL_CENTER_INTEGER ? 63.0f / 128.0f : 0.0f; const struct wined3d_gl_info *gl_info = context->gl_info; struct wined3d_viewport vp[WINED3D_MAX_VIEWPORTS]; GLdouble depth_ranges[2 * WINED3D_MAX_VIEWPORTS];
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=47469
Your paranoid android.
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- The next patch would require this test to set vertex buffer stride in the test context but, as it turns out, in this case there is no need to create a specific input layout at all.
dlls/d3d11/tests/d3d11.c | 8 -------- 1 file changed, 8 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 3c870c27e77..27b0775cea1 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -14816,10 +14816,6 @@ static void test_cb_relative_addressing(void) ID3D11Device *device; HRESULT hr;
- static const D3D11_INPUT_ELEMENT_DESC layout_desc[] = - { - {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, - }; static const DWORD vs_code[] = { #if 0 @@ -14932,10 +14928,6 @@ float4 main(const ps_in v) : SV_TARGET device = test_context.device; context = test_context.immediate_context;
- hr = ID3D11Device_CreateInputLayout(device, layout_desc, ARRAY_SIZE(layout_desc), - vs_code, sizeof(vs_code), &test_context.input_layout); - ok(SUCCEEDED(hr), "Failed to create input layout, hr %#x.\n", hr); - colors_cb = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER, sizeof(colors), &colors); index_cb = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER, sizeof(index), NULL);
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=47470
Your paranoid android.
=== debian9 (32 bit report) ===
d3d11: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debian9 (32 bit French report) ===
d3d11: d3d11.c:5341: Test failed: Got unexpected hr 0x8876086a for query type 4. Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debian9 (32 bit Chinese:China report) ===
d3d11: d3d11.c:5346: Test failed: Got unexpected hr 0x8876086a for query type 4. d3d11.c:5593: Test failed: Got unexpected hr 0x8876086a.
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
=== debian9 (32 bit WoW report) ===
d3d11: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debian9 (64 bit WoW report) ===
d3d11: d3d11.c:17791: Test failed: Got {0x00000001, 0xffffffff, 0x00000000, 0x00000000}, expected {0x00000001, 0x00000000, 0x00000000, 0x00000000} at (0, 0), sub-resource 0.
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d11/tests/d3d11.c | 201 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 197 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 27b0775cea1..dacfa0af4ac 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -1282,6 +1282,67 @@ static void check_texture_uvec4_(unsigned int line, ID3D11Texture2D *texture, check_texture_sub_resource_uvec4_(line, texture, sub_resource_idx, NULL, expected_value); }
+static void check_rect(struct resource_readback *rb, RECT r, const char *message) +{ + LONG x_coords[2][2] = + { + {r.left - 1, r.left + 1}, + {r.right + 1, r.right - 1}, + }; + LONG y_coords[2][2] = + { + {r.top - 1, r.top + 1}, + {r.bottom + 1, r.bottom - 1} + }; + unsigned int i, j, x_side, y_side; + DWORD color = 0; + LONG x = 0, y; + + if (r.left < 0 && r.top < 0 && r.right < 0 && r.bottom < 0) + { + BOOL all_match = TRUE; + + for (y = 0; y < rb->height; ++y) + { + for (x = 0; x < rb->width; ++x) + { + color = get_readback_color(rb, x, y, 0); + if (color != 0xff000000) + { + all_match = FALSE; + break; + } + } + if (!all_match) + break; + } + ok(all_match, "%s: pixel (%d, %d) has color %08x.\n", message, x, y, color); + return; + } + + for (i = 0; i < 2; ++i) + { + for (j = 0; j < 2; ++j) + { + for (x_side = 0; x_side < 2; ++x_side) + { + for (y_side = 0; y_side < 2; ++y_side) + { + DWORD expected = (x_side == 1 && y_side == 1) ? 0xffffffff : 0xff000000; + + x = x_coords[i][x_side]; + y = y_coords[j][y_side]; + if (x < 0 || x >= rb->width || y < 0 || y >= rb->height) + continue; + color = get_readback_color(rb, x, y, 0); + ok(color == expected, "%s: pixel (%d, %d) has color %08x, expected %08x.\n", + message, x, y, color, expected); + } + } + } + } +} + static IDXGIAdapter *create_adapter(void) { IDXGIFactory4 *factory4; @@ -1540,10 +1601,11 @@ struct d3d11_test_context ID3D11DeviceContext *immediate_context;
ID3D11InputLayout *input_layout; + ID3D11Buffer *vb; + unsigned int vb_stride; ID3D11VertexShader *vs; const DWORD *vs_code; ID3D11Buffer *vs_cb; - ID3D11Buffer *vb;
ID3D11PixelShader *ps; ID3D11Buffer *ps_cb; @@ -1662,7 +1724,7 @@ static void draw_quad_vs_(unsigned int line, struct d3d11_test_context *context, };
ID3D11Device *device = context->device; - unsigned int stride, offset; + unsigned int offset; HRESULT hr;
if (!vs_code) @@ -1690,13 +1752,15 @@ static void draw_quad_vs_(unsigned int line, struct d3d11_test_context *context, }
if (!context->vb) + { context->vb = create_buffer(device, D3D11_BIND_VERTEX_BUFFER, sizeof(quad), quad); + context->vb_stride = sizeof(*quad); + }
ID3D11DeviceContext_IASetInputLayout(context->immediate_context, context->input_layout); ID3D11DeviceContext_IASetPrimitiveTopology(context->immediate_context, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); - stride = sizeof(*quad); offset = 0; - ID3D11DeviceContext_IASetVertexBuffers(context->immediate_context, 0, 1, &context->vb, &stride, &offset); + ID3D11DeviceContext_IASetVertexBuffers(context->immediate_context, 0, 1, &context->vb, &context->vb_stride, &offset); ID3D11DeviceContext_VSSetShader(context->immediate_context, context->vs, NULL, 0);
ID3D11DeviceContext_Draw(context->immediate_context, 4, 0); @@ -1792,6 +1856,77 @@ static void draw_color_quad_(unsigned int line, struct d3d11_test_context *conte draw_quad_vs_(line, context, vs_code, vs_code_size); }
+#define draw_custom_quad(context, color, vs_code, vs_code_size, quad) \ + draw_custom_quad_(__LINE__, context, color, vs_code, vs_code_size, quad) +static void draw_custom_quad_(unsigned int line, struct d3d11_test_context *context, + const struct vec4 *color, const DWORD *vs_code, unsigned int vs_code_size, + const struct vec4 *quad) +{ + static const D3D11_INPUT_ELEMENT_DESC default_layout_desc[] = + { + {"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + }; + static const DWORD default_vs_code[] = + { +#if 0 + float4 main(float4 position : POSITION) : SV_POSITION + { + return position; + } +#endif + 0x43425844, 0x4fb19b86, 0x955fa240, 0x1a630688, 0x24eb9db4, 0x00000001, 0x000001e0, 0x00000006, + 0x00000038, 0x00000084, 0x000000d0, 0x00000134, 0x00000178, 0x000001ac, 0x53414e58, 0x00000044, + 0x00000044, 0xfffe0200, 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, + 0x00240000, 0xfffe0200, 0x0200001f, 0x80000005, 0x900f0000, 0x02000001, 0xc00f0000, 0x80e40000, + 0x0000ffff, 0x50414e58, 0x00000044, 0x00000044, 0xfffe0200, 0x00000020, 0x00000024, 0x00240000, + 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0xfffe0200, 0x0200001f, 0x80000005, 0x900f0000, + 0x02000001, 0xc00f0000, 0x80e40000, 0x0000ffff, 0x396e6f41, 0x0000005c, 0x0000005c, 0xfffe0200, + 0x00000034, 0x00000028, 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240001, 0x00000000, + 0xfffe0200, 0x0200001f, 0x80000005, 0x900f0000, 0x04000004, 0xc0030000, 0x90ff0000, 0xa0e40000, + 0x90e40000, 0x02000001, 0xc00c0000, 0x90e40000, 0x0000ffff, 0x52444853, 0x0000003c, 0x00010040, + 0x0000000f, 0x0300005f, 0x001010f2, 0x00000000, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, + 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x0100003e, 0x4e475349, 0x0000002c, + 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, + 0x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, + }; + ID3D11Device *device = context->device; + HRESULT hr; + + if (!vs_code) + { + vs_code = default_vs_code; + vs_code_size = sizeof(default_vs_code); + } + + if (!context->input_layout) + { + hr = ID3D11Device_CreateInputLayout(device, default_layout_desc, + sizeof(default_layout_desc) / sizeof(*default_layout_desc), + vs_code, vs_code_size, &context->input_layout); + ok_(__FILE__, line)(SUCCEEDED(hr), "Failed to create input layout, hr %#x.\n", hr); + } + + if (!context->vb) + { + context->vb = create_buffer(device, D3D11_BIND_VERTEX_BUFFER, sizeof(*quad) * 4, quad); + context->vb_stride = sizeof(*quad); + } + + if (context->vs_code != vs_code) + { + if (context->vs) + ID3D11VertexShader_Release(context->vs); + + hr = ID3D11Device_CreateVertexShader(device, vs_code, vs_code_size, NULL, &context->vs); + ok_(__FILE__, line)(hr == S_OK, "Failed to create vertex shader, hr %#x.\n", hr); + + context->vs_code = vs_code; + } + + draw_color_quad_(line, context, color, vs_code, vs_code_size); +} + static void test_create_device(void) { static const D3D_FEATURE_LEVEL default_feature_levels[] = @@ -29142,6 +29277,63 @@ static void test_standard_pattern(void) release_test_context(&test_context); }
+static void test_viewport(void) +{ + static const struct + { + D3D11_VIEWPORT vp; + RECT expected_rect; + const char *message; + } + tests[] = + { + {{ 0.0f, 0.0f, 640.0f, 480.0f}, { 0, 120, 479, 359}, "(0, 0) - (640, 480) viewport"}, + {{ 0.0f, 0.0f, 320.0f, 240.0f}, { 0, 60, 239, 179}, "(0, 0) - (320, 240) viewport"}, + {{ 0.0f, 0.0f, 1280.0f, 960.0f}, { 0, 240, 639, 479}, "(0, 0) - (1280, 960) viewport"}, + {{ 0.0f, 0.0f, 2000.0f, 1600.0f}, { 0, 400, 639, 479}, "(0, 0) - (2000, 1600) viewport"}, + {{ 100.0f, 100.0f, 640.0f, 480.0f}, {100, 220, 579, 459}, "(100, 100) - (640, 480) viewport"}, + {{ 100.4f, 100.4f, 640.0f, 480.0f}, {100, 220, 579, 459}, "(100.4, 100.4) - (640, 480) viewport"}, + {{ 100.5f, 100.5f, 640.0f, 480.0f}, {100, 220, 579, 459}, "(100.5, 100.5) - (640, 480) viewport"}, + {{ 100.6f, 100.6f, 640.0f, 480.0f}, {100, 220, 580, 460}, "(100.6, 100.6) - (640, 480) viewport"}, + {{ 100.9f, 100.9f, 640.0f, 480.0f}, {100, 220, 580, 460}, "(100.9, 100.9) - (640, 480) viewport"}, + {{-100.0f, -100.0f, 640.0f, 480.0f}, { 0, 20, 379, 259}, "(-100, -100) - (640, 480) viewport"}, + {{ 0.0f, 0.0f, 8192.0f, 8192.0f}, {-10, -10, -1, -1}, "(0, 0) - (8192, 8192) viewport"}, + {{ 0.0f, 0.0f, 8192.0f, 480.0f}, { 0, 120, 639, 359}, "(0, 0) - (8192, 480) viewport"}, + }; + static const struct vec4 quad[] = + { + {-1.5f, -0.5f, 0.1f, 1.0f}, + {-1.5f, 0.5f, 0.1f, 1.0f}, + { 0.5f, -0.5f, 0.1f, 1.0f}, + { 0.5f, 0.5f, 0.1f, 1.0f}, + }; + static const struct vec4 black = {0.0f, 0.0f, 0.0f, 1.0f}; + static const struct vec4 white = {1.0f, 1.0f, 1.0f, 1.0f}; + struct d3d11_test_context test_context; + ID3D11DeviceContext *context; + struct resource_readback rb; + unsigned int i; + + if (!init_test_context(&test_context, NULL)) + return; + + context = test_context.immediate_context; + + for (i = 0; i < ARRAY_SIZE(tests); ++i) + { + ID3D11DeviceContext_ClearRenderTargetView(context, test_context.backbuffer_rtv, &black.x); + + ID3D11DeviceContext_RSSetViewports(context, 1, &tests[i].vp); + draw_custom_quad(&test_context, &white, NULL, 0, quad); + + get_texture_readback(test_context.backbuffer, 0, &rb); + check_rect(&rb, tests[i].expected_rect, tests[i].message); + release_resource_readback(&rb); + } + + release_test_context(&test_context); +} + START_TEST(d3d11) { unsigned int argc, i; @@ -29297,6 +29489,7 @@ START_TEST(d3d11) queue_test(test_staging_buffers); queue_test(test_render_a8); queue_test(test_standard_pattern); + queue_test(test_viewport);
run_queued_tests(); }
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=47471
Your paranoid android.
=== debian9 (32 bit report) ===
d3d11: Unhandled exception: page fault on read access to 0x00000002 in 32-bit code (0x7ed1106d).
=== debian9 (32 bit French report) ===
d3d11: Unhandled exception: page fault on read access to 0x69766560 in 32-bit code (0x7ed11072).
=== debian9 (32 bit Chinese:China report) ===
d3d11: d3d11.c:5481: Test failed: Got unexpected hr 0x8876086a for query type 4. d3d11.c:5728: Test failed: Got unexpected hr 0x8876086a. Unhandled exception: page fault on read access to 0x3f800000 in 32-bit code (0x7eb4406d).
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
=== debian9 (32 bit WoW report) ===
d3d11: Unhandled exception: page fault on read access to 0xd5d5d4f0 in 32-bit code (0x7ed11072).
=== debian9 (64 bit WoW report) ===
d3d11: d3d11.c:16842: Test failed: Got {-1.00787401e+00, 0.00000000e+00, 1.00000000e+00, 5.03937006e-01}, expected {-1.00000000e+00, 0.00000000e+00, 1.00000000e+00, 5.03937006e-01} at (0, 0), sub-resource 0.
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)