Stefan Dösinger : wined3d: Define the surface alignment in the header.
Module: wine Branch: master Commit: d45c16ba98421633fbf9067207619146fd6b8f08 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d45c16ba98421633fbf9067207... Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Thu Oct 5 21:36:19 2006 +0200 wined3d: Define the surface alignment in the header. --- dlls/wined3d/device.c | 10 +++++----- dlls/wined3d/surface.c | 2 +- dlls/wined3d/wined3d_private.h | 3 +++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 82c8044..3ad28f8 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1016,7 +1016,7 @@ static HRESULT WINAPI IWineD3DDeviceImp Size = ((max(pow2Width,4) * tableEntry->bpp) * max(pow2Height,4)); } else { /* The pitch is a multiple of 4 bytes */ - Size = ((pow2Width * tableEntry->bpp) + 3) & ~3; + Size = ((pow2Width * tableEntry->bpp) + SURFACE_ALIGNMENT - 1) & ~(SURFACE_ALIGNMENT - 1); Size *= pow2Height; } @@ -1866,10 +1866,10 @@ #endif } /* Set the surface alignment. This never changes, so we are safe to set it once per context*/ - glPixelStorei(GL_PACK_ALIGNMENT, 4); - checkGLcall("glPixelStorei(GL_PACK_ALIGNMENT, 4);"); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - checkGLcall("glPixelStorei(GL_UNPACK_ALIGNMENT, 4);"); + glPixelStorei(GL_PACK_ALIGNMENT, SURFACE_ALIGNMENT); + checkGLcall("glPixelStorei(GL_PACK_ALIGNMENT, SURFACE_ALIGNMENT);"); + glPixelStorei(GL_UNPACK_ALIGNMENT, SURFACE_ALIGNMENT); + checkGLcall("glPixelStorei(GL_UNPACK_ALIGNMENT, SURFACE_ALIGNMENT);"); LEAVE_GL(); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index be10b37..f78d651 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -3021,7 +3021,7 @@ DWORD WINAPI IWineD3DSurfaceImpl_GetPitc ret = This->bytesPerPixel * This->pow2Width; } /* Surfaces are 32 bit aligned */ - ret = (ret + 3) & ~3; + ret = (ret + SURFACE_ALIGNMENT - 1) & ~(SURFACE_ALIGNMENT - 1); } TRACE("(%p) Returning %d\n", This, ret); return ret; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index c9fb365..208ffa4 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -996,6 +996,9 @@ #define SFLAG_DONOTFREE (SFLAG_OVERSIZE BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4]); +/* Alignment of the pitch */ +#define SURFACE_ALIGNMENT 4 + /***************************************************************************** * IWineD3DVertexDeclaration implementation structure */
participants (1)
-
Alexandre Julliard