Module: wine Branch: master Commit: d09cbcec91561186bee77aaba55b29cbf2d7e7ef URL: http://source.winehq.org/git/wine.git/?a=commit;h=d09cbcec91561186bee77aaba5...
Author: Stefan Dösinger stefan@codeweavers.com Date: Wed Nov 28 20:35:04 2007 +0100
wined3d: Activate GL_ARB_texture_rectangle.
---
dlls/wined3d/device.c | 18 ++++++++++++++---- dlls/wined3d/surface.c | 8 ++++++++ dlls/wined3d/texture.c | 2 +- dlls/wined3d/wined3d_private.h | 1 + 4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 33c7628..6d9e7bb 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -891,10 +891,20 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U
/** FIXME: add support for real non-power-two if it's provided by the video card **/ /* Precalculated scaling for 'faked' non power of two texture coords */ - object->baseTexture.pow2Matrix[0] = (((float)Width) / ((float)pow2Width)); - object->baseTexture.pow2Matrix[5] = (((float)Height) / ((float)pow2Height)); - object->baseTexture.pow2Matrix[10] = 1.0; - object->baseTexture.pow2Matrix[15] = 1.0; + if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE) && + (Width != pow2Width || Height != pow2Height)) { + object->baseTexture.pow2Matrix[0] = (float)Width; + object->baseTexture.pow2Matrix[5] = (float)Height; + object->baseTexture.pow2Matrix[10] = 1.0; + object->baseTexture.pow2Matrix[15] = 1.0; + object->target = GL_TEXTURE_RECTANGLE_ARB; + } else { + object->baseTexture.pow2Matrix[0] = (((float)Width) / ((float)pow2Width)); + object->baseTexture.pow2Matrix[5] = (((float)Height) / ((float)pow2Height)); + object->baseTexture.pow2Matrix[10] = 1.0; + object->baseTexture.pow2Matrix[15] = 1.0; + object->target = GL_TEXTURE_2D; + } TRACE(" xf(%f) yf(%f)\n", object->baseTexture.pow2Matrix[0], object->baseTexture.pow2Matrix[5]);
/* Calculate levels for mip mapping */ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 89f8e93..2030f95 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -3505,6 +3505,14 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) { This->glRect.right = 0; This->glRect.bottom = 0; } else { + /* Check this after the oversize check - do not make an oversized surface a texture_rectangle one */ + if(This->Flags & SFLAG_NONPOW2 && GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) { + This->glDescription.target = GL_TEXTURE_RECTANGLE_ARB; + This->pow2Width = This->currentDesc.Width; + This->pow2Height = This->currentDesc.Height; + This->Flags &= ~SFLAG_NONPOW2; + } + /* No oversize, gl rect is the full texture size */ This->Flags &= ~SFLAG_OVERSIZE; This->glRect.left = 0; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 1bdd664..c96d35d 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -207,7 +207,7 @@ static UINT WINAPI IWineD3DTextureImpl_GetTextureDimensions(IWineD3DTexture *ifa IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; TRACE("(%p)\n", This);
- return GL_TEXTURE_2D; + return This->target; }
static void WINAPI IWineD3DTextureImpl_ApplyStateChanges(IWineD3DTexture *iface, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index f1a4287..a06083d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -948,6 +948,7 @@ typedef struct IWineD3DTextureImpl
UINT width; UINT height; + UINT target;
} IWineD3DTextureImpl;