wined3d: Support zero row pitch in wined3d_texture_gl_upload_data().
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> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7ec5cd1d47
commit
85c0c49af7
|
@ -12719,10 +12719,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);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
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);
|
||||
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, src_row_pitch / src_format->byte_count);
|
||||
y_count = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
y_count = update_h;
|
||||
update_h = 1;
|
||||
}
|
||||
|
||||
for (y = 0; y < y_count; ++y)
|
||||
{
|
||||
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");
|
||||
|
|
Loading…
Reference in New Issue