Matteo Bruni : wined3d: Set GL_UNPACK_ALIGNMENT to 1.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Feb 20 08:24:46 CST 2015
Module: wine
Branch: master
Commit: 78ae4f66d7a6181499261ca4e8311de7175404cc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=78ae4f66d7a6181499261ca4e8311de7175404cc
Author: Matteo Bruni <mbruni at codeweavers.com>
Date: Fri Feb 20 13:06:02 2015 +0100
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).
---
dlls/wined3d/context.c | 2 +-
dlls/wined3d/surface.c | 1 -
dlls/wined3d/volume.c | 2 --
3 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 843905a..fa8d768 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -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])
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 429147e..36806ec 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -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)))
{
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index 0d13dd0..91325dc 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -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);
More information about the wine-cvs
mailing list