wined3d: Set GL_UNPACK_ALIGNMENT to 1.

Alignment should be taken care by the surface pitch and
GL_UNPACK_ROW_LENGTH alone just fine, as long as the pitch is a
multiple of the pixel size. Client APIs respect that,
internally we need to do the same and the changes to
surface_load_texture and wined3d_volume_upload_data are there
for this reason (e.g. WINED3DFMT_R16G16_SNORM is emulated with
GL_RGB16 when NV_texture_shader isn't supported).
This commit is contained in:
Matteo Bruni 2015-02-20 13:06:02 +01:00 committed by Alexandre Julliard
parent d91ba373b7
commit 78ae4f66d7
3 changed files with 1 additions and 4 deletions

View File

@ -1685,7 +1685,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
gl_info->gl_ops.gl.p_glPixelStorei(GL_PACK_ALIGNMENT, device->surface_alignment);
checkGLcall("glPixelStorei(GL_PACK_ALIGNMENT, device->surface_alignment);");
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ALIGNMENT, device->surface_alignment);
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
checkGLcall("glPixelStorei(GL_UNPACK_ALIGNMENT, device->surface_alignment);");
if (gl_info->supported[ARB_VERTEX_BLEND])

View File

@ -4192,7 +4192,6 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
format.byte_count = format.conv_byte_count;
dst_pitch = wined3d_format_calculate_pitch(&format, width);
dst_pitch = (dst_pitch + device->surface_alignment - 1) & ~(device->surface_alignment - 1);
if (!(mem = HeapAlloc(GetProcessHeap(), 0, dst_pitch * height)))
{

View File

@ -84,7 +84,6 @@ void wined3d_volume_upload_data(struct wined3d_volume *volume, const struct wine
{
UINT dst_row_pitch, dst_slice_pitch;
UINT src_row_pitch, src_slice_pitch;
UINT alignment = volume->resource.device->surface_alignment;
if (data->buffer_object)
ERR("Loading a converted volume from a PBO.\n");
@ -92,7 +91,6 @@ void wined3d_volume_upload_data(struct wined3d_volume *volume, const struct wine
ERR("Converting a block-based format.\n");
dst_row_pitch = width * format->conv_byte_count;
dst_row_pitch = (dst_row_pitch + alignment - 1) & ~(alignment - 1);
dst_slice_pitch = dst_row_pitch * height;
wined3d_volume_get_pitch(volume, &src_row_pitch, &src_slice_pitch);