From c0782603d09807c6ca506948bb4a814a73430184 Mon Sep 17 00:00:00 2001 From: Felix Nawothnig Date: Sat, 7 Apr 2007 23:37:41 +0200 Subject: [PATCH] wined3d: Allow np2 textures to be loaded for SFLAG_INDRAWABLE. --- dlls/wined3d/surface.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 1684d1a6583..af90b619f08 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1825,6 +1825,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface) { return WINED3DERR_INVALIDCALL; } + d3dfmt_get_conv(This, TRUE /* We need color keying */, TRUE /* We will use textures */, &format, &internal, &type, &convert, &bpp); + if (This->Flags & SFLAG_INDRAWABLE) { if (This->glDescription.level != 0) FIXME("Surface in texture is only supported for level 0\n"); @@ -1842,16 +1844,16 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface) { glReadBuffer(This->resource.wineD3DDevice->offscreenBuffer); vcheckGLcall("glReadBuffer"); - glCopyTexImage2D(This->glDescription.target, - This->glDescription.level, - This->glDescription.glFormatInternal, - 0, - 0, - This->currentDesc.Width, - This->currentDesc.Height, - 0); + surface_allocate_surface(This, internal, This->pow2Width, + This->pow2Height, format, type); + + glCopyTexSubImage2D(This->glDescription.target, + This->glDescription.level, + 0, 0, 0, 0, + This->currentDesc.Width, + This->currentDesc.Height); + checkGLcall("glCopyTexSubImage2D"); - checkGLcall("glCopyTexImage2D"); glReadBuffer(prevRead); vcheckGLcall("glReadBuffer"); @@ -1869,8 +1871,6 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface) { } else This->Flags &= ~SFLAG_GLCKEY; - d3dfmt_get_conv(This, TRUE /* We need color keying */, TRUE /* We will use textures */, &format, &internal, &type, &convert, &bpp); - /* The width is in 'length' not in bytes */ width = This->currentDesc.Width; pitch = IWineD3DSurface_GetPitch(iface);