wined3d: Remove pow2Size from the surfaces.
This commit is contained in:
parent
e16d08f011
commit
c3f0eb489b
|
@ -832,11 +832,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
|
||||||
|
|
||||||
if (WINED3DFMT_UNKNOWN != Format) {
|
if (WINED3DFMT_UNKNOWN != Format) {
|
||||||
object->bytesPerPixel = tableEntry->bpp;
|
object->bytesPerPixel = tableEntry->bpp;
|
||||||
object->pow2Size = ((pow2Width * object->bytesPerPixel) + SURFACE_ALIGNMENT - 1) & ~(SURFACE_ALIGNMENT - 1);
|
|
||||||
object->pow2Size *= pow2Height;
|
|
||||||
} else {
|
} else {
|
||||||
object->bytesPerPixel = 0;
|
object->bytesPerPixel = 0;
|
||||||
object->pow2Size = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TODO: change this into a texture transform matrix so that it's processed in hardware **/
|
/** TODO: change this into a texture transform matrix so that it's processed in hardware **/
|
||||||
|
|
|
@ -628,12 +628,10 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED
|
||||||
/*Surface has no memory currently allocated to it!*/
|
/*Surface has no memory currently allocated to it!*/
|
||||||
TRACE("(%p) Locking rect\n" , This);
|
TRACE("(%p) Locking rect\n" , This);
|
||||||
if(!This->resource.allocatedMemory) {
|
if(!This->resource.allocatedMemory) {
|
||||||
This->resource.allocatedMemory = HeapAlloc(GetProcessHeap() ,0 , This->pow2Size);
|
This->resource.allocatedMemory = HeapAlloc(GetProcessHeap() ,0 , This->resource.size + 4);
|
||||||
}
|
}
|
||||||
if (0 != This->glDescription.textureName) {
|
if (0 != This->glDescription.textureName) {
|
||||||
/* Now I have to copy thing bits back */
|
/* Now I have to copy thing bits back */
|
||||||
This->Flags |= SFLAG_ACTIVELOCK; /* When this flag is set to true, loading the surface again won't free THis->resource.allocatedMemory */
|
|
||||||
/* TODO: make activeLock a bit more intelligent, maybe implement a method to purge the texture memory. */
|
|
||||||
|
|
||||||
/* Make sure that a proper texture unit is selected, bind the texture and dirtify the sampler to restore the texture on the next draw */
|
/* Make sure that a proper texture unit is selected, bind the texture and dirtify the sampler to restore the texture on the next draw */
|
||||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||||
|
@ -681,7 +679,6 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED
|
||||||
if (This->resource.allocatedMemory == NULL)
|
if (This->resource.allocatedMemory == NULL)
|
||||||
This->resource.allocatedMemory = HeapAlloc(GetProcessHeap() ,0 ,This->resource.size);
|
This->resource.allocatedMemory = HeapAlloc(GetProcessHeap() ,0 ,This->resource.size);
|
||||||
|
|
||||||
This->Flags |= SFLAG_ACTIVELOCK; /*When this flag is set to true, loading the surface again won't free THis->resource.allocatedMemory*/
|
|
||||||
pLockedRect->pBits = This->resource.allocatedMemory;
|
pLockedRect->pBits = This->resource.allocatedMemory;
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
|
@ -1243,10 +1240,6 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
|
||||||
int extraline = 0;
|
int extraline = 0;
|
||||||
SYSTEM_INFO sysInfo;
|
SYSTEM_INFO sysInfo;
|
||||||
|
|
||||||
if(This->Flags & SFLAG_ACTIVELOCK) {
|
|
||||||
ERR("Creating a DIB section while a lock is active. Uncertain consequences\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (This->bytesPerPixel) {
|
switch (This->bytesPerPixel) {
|
||||||
case 2:
|
case 2:
|
||||||
case 4:
|
case 4:
|
||||||
|
@ -2092,17 +2085,15 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3DFORM
|
||||||
|
|
||||||
if (format != WINED3DFMT_UNKNOWN) {
|
if (format != WINED3DFMT_UNKNOWN) {
|
||||||
This->bytesPerPixel = formatEntry->bpp;
|
This->bytesPerPixel = formatEntry->bpp;
|
||||||
This->pow2Size = (This->pow2Width * This->bytesPerPixel) * This->pow2Height;
|
|
||||||
} else {
|
} else {
|
||||||
This->bytesPerPixel = 0;
|
This->bytesPerPixel = 0;
|
||||||
This->pow2Size = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
This->Flags |= (WINED3DFMT_D16_LOCKABLE == format) ? SFLAG_LOCKABLE : 0;
|
This->Flags |= (WINED3DFMT_D16_LOCKABLE == format) ? SFLAG_LOCKABLE : 0;
|
||||||
|
|
||||||
This->resource.format = format;
|
This->resource.format = format;
|
||||||
|
|
||||||
TRACE("(%p) : Size %d, pow2Size %d, bytesPerPixel %d, glFormat %d, glFotmatInternal %d, glType %d\n", This, This->resource.size, This->pow2Size, This->bytesPerPixel, This->glDescription.glFormat, This->glDescription.glFormatInternal, This->glDescription.glType);
|
TRACE("(%p) : Size %d, bytesPerPixel %d, glFormat %d, glFotmatInternal %d, glType %d\n", This, This->resource.size, This->bytesPerPixel, This->glDescription.glFormat, This->glDescription.glFormatInternal, This->glDescription.glType);
|
||||||
|
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1522,7 +1522,6 @@ IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface)
|
||||||
|
|
||||||
/* We don't mind the nonpow2 stuff in GDI */
|
/* We don't mind the nonpow2 stuff in GDI */
|
||||||
This->resource.size = IWineD3DSurface_GetPitch(iface) * This->currentDesc.Height;
|
This->resource.size = IWineD3DSurface_GetPitch(iface) * This->currentDesc.Height;
|
||||||
This->pow2Size = This->resource.size;
|
|
||||||
This->pow2Width = This->currentDesc.Width;
|
This->pow2Width = This->currentDesc.Width;
|
||||||
This->pow2Height = This->currentDesc.Height;
|
This->pow2Height = This->currentDesc.Height;
|
||||||
This->Flags &= ~SFLAG_NONPOW2;
|
This->Flags &= ~SFLAG_NONPOW2;
|
||||||
|
|
|
@ -1069,18 +1069,17 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, RECT *S
|
||||||
#define SFLAG_LOCKABLE 0x00000010 /* Surface can be locked */
|
#define SFLAG_LOCKABLE 0x00000010 /* Surface can be locked */
|
||||||
#define SFLAG_DISCARD 0x00000020 /* ??? */
|
#define SFLAG_DISCARD 0x00000020 /* ??? */
|
||||||
#define SFLAG_LOCKED 0x00000040 /* Surface is locked atm */
|
#define SFLAG_LOCKED 0x00000040 /* Surface is locked atm */
|
||||||
#define SFLAG_ACTIVELOCK 0x00000080 /* Not locked, but surface memory is needed */
|
#define SFLAG_INTEXTURE 0x00000080 /* ??? */
|
||||||
#define SFLAG_INTEXTURE 0x00000100 /* ??? */
|
#define SFLAG_INPBUFFER 0x00000100 /* ??? */
|
||||||
#define SFLAG_INPBUFFER 0x00000200 /* ??? */
|
#define SFLAG_NONPOW2 0x00000200 /* Surface sizes are not a power of 2 */
|
||||||
#define SFLAG_NONPOW2 0x00000400 /* Surface sizes are not a power of 2 */
|
#define SFLAG_DYNLOCK 0x00000400 /* Surface is often locked by the app */
|
||||||
#define SFLAG_DYNLOCK 0x00000800 /* Surface is often locked by the app */
|
#define SFLAG_DYNCHANGE 0x00000C00 /* Surface contents are changed very often, implies DYNLOCK */
|
||||||
#define SFLAG_DYNCHANGE 0x00001800 /* Surface contents are changed very often, implies DYNLOCK */
|
#define SFLAG_DCINUSE 0x00001000 /* Set between GetDC and ReleaseDC calls */
|
||||||
#define SFLAG_DCINUSE 0x00002000 /* Set between GetDC and ReleaseDC calls */
|
#define SFLAG_GLDIRTY 0x00002000 /* The opengl texture is more up to date than the surface mem */
|
||||||
#define SFLAG_GLDIRTY 0x00004000 /* The opengl texture is more up to date than the surface mem */
|
#define SFLAG_LOST 0x00004000 /* Surface lost flag for DDraw */
|
||||||
#define SFLAG_LOST 0x00008000 /* Surface lost flag for DDraw */
|
#define SFLAG_FORCELOAD 0x00008000 /* To force PreLoading of a scratch cursor */
|
||||||
#define SFLAG_FORCELOAD 0x00010000 /* To force PreLoading of a scratch cursor */
|
#define SFLAG_USERPTR 0x00010000 /* The application allocated the memory for this surface */
|
||||||
#define SFLAG_USERPTR 0x00020000 /* The application allocated the memory for this surface */
|
#define SFLAG_GLCKEY 0x00020000 /* The gl texture was created with a color key */
|
||||||
#define SFLAG_GLCKEY 0x00040000 /* The gl texture was created with a color key */
|
|
||||||
|
|
||||||
/* In some conditions the surface memory must not be freed:
|
/* In some conditions the surface memory must not be freed:
|
||||||
* SFLAG_OVERSIZE: Not all data can be kept in GL
|
* SFLAG_OVERSIZE: Not all data can be kept in GL
|
||||||
|
@ -1088,7 +1087,6 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, RECT *S
|
||||||
* SFLAG_DIBSECTION: The dib code manages the memory
|
* SFLAG_DIBSECTION: The dib code manages the memory
|
||||||
* SFLAG_DIRTY: GL surface isn't up to date
|
* SFLAG_DIRTY: GL surface isn't up to date
|
||||||
* SFLAG_LOCKED: The app requires access to the surface data
|
* SFLAG_LOCKED: The app requires access to the surface data
|
||||||
* SFLAG_ACTIVELOCK: Some wined3d code needs the memory
|
|
||||||
* SFLAG_DYNLOCK: Avoid freeing the data for performance
|
* SFLAG_DYNLOCK: Avoid freeing the data for performance
|
||||||
* SFLAG_DYNCHANGE: Same reason as DYNLOCK
|
* SFLAG_DYNCHANGE: Same reason as DYNLOCK
|
||||||
*/
|
*/
|
||||||
|
@ -1097,7 +1095,6 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, RECT *S
|
||||||
SFLAG_DIBSECTION | \
|
SFLAG_DIBSECTION | \
|
||||||
SFLAG_DIRTY | \
|
SFLAG_DIRTY | \
|
||||||
SFLAG_LOCKED | \
|
SFLAG_LOCKED | \
|
||||||
SFLAG_ACTIVELOCK | \
|
|
||||||
SFLAG_DYNLOCK | \
|
SFLAG_DYNLOCK | \
|
||||||
SFLAG_DYNCHANGE | \
|
SFLAG_DYNCHANGE | \
|
||||||
SFLAG_USERPTR)
|
SFLAG_USERPTR)
|
||||||
|
|
Loading…
Reference in New Issue