wined3d: Support framebuffer reading from texture_rectangle sources.

oldstable
Stefan Dösinger 2008-04-23 02:48:55 +02:00 committed by Alexandre Julliard
parent e3bd5b6dcd
commit 1c9f1f8ddd
3 changed files with 21 additions and 8 deletions

View File

@ -663,7 +663,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
object->glDescription.level = Level;
/* Flags */
object->Flags = 0;
object->Flags = SFLAG_NORMCOORD; /* Default to normalized coords */
object->Flags |= Discard ? SFLAG_DISCARD : 0;
object->Flags |= (WINED3DFMT_D16_LOCKABLE == Format) ? SFLAG_LOCKABLE : 0;
object->Flags |= Lockable ? SFLAG_LOCKABLE : 0;

View File

@ -626,6 +626,11 @@ void WINAPI IWineD3DSurfaceImpl_SetGlTextureDesc(IWineD3DSurface *iface, UINT te
IWineD3DSurface_ModifyLocation(iface, SFLAG_INTEXTURE, FALSE);
IWineD3DSurface_AddDirtyRect(iface, NULL);
}
if(target == GL_TEXTURE_RECTANGLE_ARB && This->glDescription.target != target) {
This->Flags &= ~SFLAG_NORMCOORD;
} else if(This->glDescription.target == GL_TEXTURE_RECTANGLE_ARB && target != GL_TEXTURE_RECTANGLE_ARB) {
This->Flags |= SFLAG_NORMCOORD;
}
This->glDescription.textureName = textureName;
This->glDescription.target = target;
This->Flags &= ~SFLAG_ALLOCATED;
@ -2845,15 +2850,22 @@ static inline void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *This, IWine
}
checkGLcall("glEnd and previous");
left = (float) srect->x1 / (float) Src->pow2Width;
right = (float) srect->x2 / (float) Src->pow2Width;
left = srect->x1;
right = srect->x2;
if(upsidedown) {
top = (float) (Src->currentDesc.Height - srect->y1) / (float) Src->pow2Height;
bottom = (float) (Src->currentDesc.Height - srect->y2) / (float) Src->pow2Height;
top = Src->currentDesc.Height - srect->y1;
bottom = Src->currentDesc.Height - srect->y2;
} else {
top = (float) (Src->currentDesc.Height - srect->y2) / (float) Src->pow2Height;
bottom = (float) (Src->currentDesc.Height - srect->y1) / (float) Src->pow2Height;
top = Src->currentDesc.Height - srect->y2;
bottom = Src->currentDesc.Height - srect->y1;
}
if(Src->Flags & SFLAG_NORMCOORD) {
left /= Src->pow2Width;
right /= Src->pow2Width;
top /= Src->pow2Height;
bottom /= Src->pow2Height;
}
/* draw the source texture stretched and upside down. The correct surface is bound already */
@ -3774,7 +3786,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
This->glDescription.target = GL_TEXTURE_RECTANGLE_ARB;
This->pow2Width = This->currentDesc.Width;
This->pow2Height = This->currentDesc.Height;
This->Flags &= ~SFLAG_NONPOW2;
This->Flags &= ~(SFLAG_NONPOW2 | SFLAG_NORMCOORD);
}
/* No oversize, gl rect is the full texture size */

View File

@ -1365,6 +1365,7 @@ void get_drawable_size_fbo(IWineD3DSurfaceImpl *This, UINT *width, UINT *height)
#define SFLAG_CLIENT 0x00010000 /* GL_APPLE_client_storage is used on that texture */
#define SFLAG_ALLOCATED 0x00020000 /* A gl texture is allocated for this surface */
#define SFLAG_PBO 0x00040000 /* Has a PBO attached for speeding up data transfers for dynamically locked surfaces */
#define SFLAG_NORMCOORD 0x00080000 /* Set if the GL texture coords are normalized(non-texture rectangle) */
/* In some conditions the surface memory must not be freed:
* SFLAG_OVERSIZE: Not all data can be kept in GL