Commit d45c16ba authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Define the surface alignment in the header.

parent 90f097f8
...@@ -1016,7 +1016,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U ...@@ -1016,7 +1016,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
Size = ((max(pow2Width,4) * tableEntry->bpp) * max(pow2Height,4)); Size = ((max(pow2Width,4) * tableEntry->bpp) * max(pow2Height,4));
} else { } else {
/* The pitch is a multiple of 4 bytes */ /* 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; Size *= pow2Height;
} }
...@@ -1866,10 +1866,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic ...@@ -1866,10 +1866,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
} }
/* Set the surface alignment. This never changes, so we are safe to set it once per context*/ /* Set the surface alignment. This never changes, so we are safe to set it once per context*/
glPixelStorei(GL_PACK_ALIGNMENT, 4); glPixelStorei(GL_PACK_ALIGNMENT, SURFACE_ALIGNMENT);
checkGLcall("glPixelStorei(GL_PACK_ALIGNMENT, 4);"); checkGLcall("glPixelStorei(GL_PACK_ALIGNMENT, SURFACE_ALIGNMENT);");
glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ALIGNMENT, SURFACE_ALIGNMENT);
checkGLcall("glPixelStorei(GL_UNPACK_ALIGNMENT, 4);"); checkGLcall("glPixelStorei(GL_UNPACK_ALIGNMENT, SURFACE_ALIGNMENT);");
LEAVE_GL(); LEAVE_GL();
......
...@@ -3021,7 +3021,7 @@ DWORD WINAPI IWineD3DSurfaceImpl_GetPitch(IWineD3DSurface *iface) { ...@@ -3021,7 +3021,7 @@ DWORD WINAPI IWineD3DSurfaceImpl_GetPitch(IWineD3DSurface *iface) {
ret = This->bytesPerPixel * This->pow2Width; ret = This->bytesPerPixel * This->pow2Width;
} }
/* Surfaces are 32 bit aligned */ /* Surfaces are 32 bit aligned */
ret = (ret + 3) & ~3; ret = (ret + SURFACE_ALIGNMENT - 1) & ~(SURFACE_ALIGNMENT - 1);
} }
TRACE("(%p) Returning %d\n", This, ret); TRACE("(%p) Returning %d\n", This, ret);
return ret; return ret;
......
...@@ -996,6 +996,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, RECT *S ...@@ -996,6 +996,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, RECT *S
BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4]); BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4]);
/* Alignment of the pitch */
#define SURFACE_ALIGNMENT 4
/***************************************************************************** /*****************************************************************************
* IWineD3DVertexDeclaration implementation structure * IWineD3DVertexDeclaration implementation structure
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment