Fixes Wine test failure in d3d11 test_copy_subresource_region(). The test failure could be unstable as there was read after data end in glTexSubImage2D() called from wined3d_texture_gl_upload_data().
Signed-off-by: Paul Gofman gofmanp@gmail.com --- dlls/d3d11/tests/d3d11.c | 5 ++++- dlls/wined3d/texture.c | 35 +++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 3214e456b1..c588736d84 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -12741,10 +12741,13 @@ static void test_copy_subresource_region(void) check_texture_color(test_context.backbuffer, 0x800000ff, 2);
memset(float_colors, 0, sizeof(float_colors)); + for (i = 0; i < texture_desc.Width; ++i) + ((unsigned int *)float_colors)[i] = 0x45454545; + ID3D11DeviceContext1_UpdateSubresource1(context1, (ID3D11Resource *)dst_texture, 0, NULL, float_colors, 0, 0, 0); draw_quad(&test_context); - check_texture_color(test_context.backbuffer, 0x00000000, 1); + check_texture_color(test_context.backbuffer, 0x45454545, 1);
ID3D11DeviceContext1_CopySubresourceRegion1(context1, (ID3D11Resource *)dst_texture, 0, 0, 0, 0, (ID3D11Resource *)src_texture, 0, NULL, 0); diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index ff25f64043..c4ef184484 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -2052,26 +2052,41 @@ static void wined3d_texture_gl_upload_data(struct wined3d_context *context, } else { + unsigned int y, y_count; + TRACE("Uploading data, target %#x, level %u, x %u, y %u, z %u, " "w %u, h %u, d %u, format %#x, type %#x, addr %p.\n", target, level, dst_x, dst_y, dst_z, update_w, update_h, update_d, format_gl->format, format_gl->type, bo.addr);
- gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, src_row_pitch / src_format->byte_count); - if (target == GL_TEXTURE_2D_ARRAY || target == GL_TEXTURE_3D) + if (src_row_pitch) { - GL_EXTCALL(glTexSubImage3D(target, level, dst_x, dst_y, dst_z, - update_w, update_h, update_d, format_gl->format, format_gl->type, bo.addr)); + gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, src_row_pitch / src_format->byte_count); + y_count = 1; } - else if (target == GL_TEXTURE_1D) + else { - gl_info->gl_ops.gl.p_glTexSubImage1D(target, level, dst_x, - update_w, format_gl->format, format_gl->type, bo.addr); + y_count = update_h; + update_h = 1; } - else + + for (y = 0; y < y_count; ++y) { - gl_info->gl_ops.gl.p_glTexSubImage2D(target, level, dst_x, dst_y, - update_w, update_h, format_gl->format, format_gl->type, bo.addr); + if (target == GL_TEXTURE_2D_ARRAY || target == GL_TEXTURE_3D) + { + GL_EXTCALL(glTexSubImage3D(target, level, dst_x, dst_y + y, dst_z, + update_w, update_h, update_d, format_gl->format, format_gl->type, bo.addr)); + } + else if (target == GL_TEXTURE_1D) + { + gl_info->gl_ops.gl.p_glTexSubImage1D(target, level, dst_x, + update_w, format_gl->format, format_gl->type, bo.addr); + } + else + { + gl_info->gl_ops.gl.p_glTexSubImage2D(target, level, dst_x, dst_y + y, + update_w, update_h, format_gl->format, format_gl->type, bo.addr); + } } gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); checkGLcall("Upload texture data");
Hi,
While running your changed tests, 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=57004
Your paranoid android.
=== debian10 (32 bit report) ===
d3d11: d3d11.c:6122: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0. d3d11.c:16863: Test failed: Got {-1.00787401e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001} at (0, 0), sub-resource 0.
=== debian10 (32 bit French report) ===
d3d11: d3d11.c:6112: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0. d3d11.c:16863: Test failed: Got {-1.00787401e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001} at (0, 0), sub-resource 0.
=== debian10 (32 bit Japanese:Japan report) ===
d3d11: d3d11.c:6112: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0. d3d11.c:6122: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0.
=== debian10 (32 bit Chinese:China report) ===
d3d11: d3d11.c:6112: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0. d3d11.c:6122: Test succeeded inside todo block: Got unexpected PrimitivesStorageNeeded: 0.
=== debian10 (32 bit WoW report) ===
d3d11: d3d11.c:16863: Test failed: Got {-1.00787401e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001}, expected {-1.00000000e+000, 0.00000000e+000, 1.00000000e+000, 5.03937006e-001} at (0, 0), sub-resource 0.