From 07f4f7048760e0f7814e538d51e837096e1649cc Mon Sep 17 00:00:00 2001 From: Ivan Gyurdiev Date: Tue, 25 Apr 2006 17:59:12 -0400 Subject: [PATCH] wined3d: QueryInterface corrections. --- dlls/wined3d/basetexture.c | 3 ++- dlls/wined3d/cubetexture.c | 3 ++- dlls/wined3d/device.c | 4 ++-- dlls/wined3d/directx.c | 4 ++-- dlls/wined3d/drawprim.c | 40 ++++++++++++++++++++++++++++++++ dlls/wined3d/indexbuffer.c | 3 ++- dlls/wined3d/palette.c | 1 + dlls/wined3d/pixelshader.c | 3 ++- dlls/wined3d/query.c | 3 ++- dlls/wined3d/resource.c | 3 ++- dlls/wined3d/stateblock.c | 3 ++- dlls/wined3d/surface.c | 8 +++++-- dlls/wined3d/swapchain.c | 1 + dlls/wined3d/texture.c | 1 + dlls/wined3d/vertexbuffer.c | 3 ++- dlls/wined3d/vertexdeclaration.c | 3 ++- dlls/wined3d/vertexshader.c | 3 ++- dlls/wined3d/volume.c | 8 +++++-- dlls/wined3d/volumetexture.c | 3 ++- 19 files changed, 81 insertions(+), 19 deletions(-) diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c index a3a10ec757d..0e2263346bb 100644 --- a/dlls/wined3d/basetexture.c +++ b/dlls/wined3d/basetexture.c @@ -68,8 +68,9 @@ HRESULT WINAPI IWineD3DBaseTextureImpl_QueryInterface(IWineD3DBaseTexture *iface || IsEqualGUID(riid, &IID_IWineD3DBaseTexture)) { IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c index ae1e294eb26..c94617c140c 100644 --- a/dlls/wined3d/cubetexture.c +++ b/dlls/wined3d/cubetexture.c @@ -58,8 +58,9 @@ HRESULT WINAPI IWineD3DCubeTextureImpl_QueryInterface(IWineD3DCubeTexture *iface || IsEqualGUID(riid, &IID_IWineD3DTexture)) { IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index e337b8d6025..b2497c41ea9 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -341,9 +341,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_QueryInterface(IWineD3DDevice *iface,REFIID ri || IsEqualGUID(riid, &IID_IWineD3DDevice)) { IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } - + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 760dd946017..b58aeeb95be 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -173,9 +173,9 @@ HRESULT WINAPI IWineD3DImpl_QueryInterface(IWineD3D *iface,REFIID riid,LPVOID *p || IsEqualGUID(riid, &IID_IWineD3DDevice)) { IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } - + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 8753203f7fd..8dd23dbbfca 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -2110,6 +2110,33 @@ void drawPrimitive(IWineD3DDevice *iface, } #endif /* TODO: vertex and pixel shaders */ +#if 0 /* TODO: vertex and pixel shaders */ + /* If we will be using a pixel, do some initialization for it */ + if ((pixel_shader = PIXEL_SHADER(This->stateBlock->PixelShader))) { + TRACE("drawing with pixel shader handle %p\n", pixel_shader); + memset(&pixel_shader->input, 0, sizeof(PSHADERINPUTDATA8)); + + GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, pixel_shader->prgId)); + checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, pixel_shader->prgId);"); + glEnable(GL_FRAGMENT_PROGRAM_ARB); + checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB);"); + + /* init Constants */ + if (This->stateBlock->Changed.pixelShaderConstant) { + TRACE_(d3d_shader)("pixel shader initializing constants %p\n",pixel_shader); + IDirect3DPixelShaderImpl_SetConstantF(pixel_shader, 0, (CONST FLOAT*) + &This->stateBlock->pixelShaderConstant[0], 8); + } + /* Update the constants */ + for (i = 0; i < D3D8_PSHADER_MAX_CONSTANTS; ++i) { + GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, + (GLfloat *)&This->stateBlock->pixelShaderConstant[i])); + + checkGLcall("glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB"); + } + } +#endif /* TODO: vertex and pixel shaders */ + /* Initialize all values to null */ memset(&dataLocations, 0x00, sizeof(dataLocations)); /* convert the FVF or vertexDeclaration into a strided stream (this should be done when the fvf or declaration is created) */ @@ -2171,6 +2198,19 @@ void drawPrimitive(IWineD3DDevice *iface, TRACE("Restored lighting to original state\n"); } +#if 0 /* TODO: vertex and pixel shaders */ + if (pixel_shader) + { +#if 0 + GLint errPos; + glGetIntegerv( GL_PROGRAM_ERROR_POSITION_ARB, &errPos ); + if (errPos != -1) + FIXME("HW PixelShader Error at position: %d\n%s\n", errPos, glGetString( GL_PROGRAM_ERROR_STRING_ARB) ); +#endif + glDisable(GL_FRAGMENT_PROGRAM_ARB); + } +#endif + #if 0 /* TODO: vertex and pixel shaders */ if (pixel_shader) { diff --git a/dlls/wined3d/indexbuffer.c b/dlls/wined3d/indexbuffer.c index 9794367d4d9..f28855e4439 100644 --- a/dlls/wined3d/indexbuffer.c +++ b/dlls/wined3d/indexbuffer.c @@ -40,8 +40,9 @@ HRESULT WINAPI IWineD3DIndexBufferImpl_QueryInterface(IWineD3DIndexBuffer *iface || IsEqualGUID(riid, &IID_IWineD3DIndexBuffer)){ IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/palette.c b/dlls/wined3d/palette.c index ebc34290337..0ff130f69b8 100644 --- a/dlls/wined3d/palette.c +++ b/dlls/wined3d/palette.c @@ -42,6 +42,7 @@ HRESULT WINAPI IWineD3DPaletteImpl_QueryInterface(IWineD3DPalette *iface, REFIID return S_OK; } else { + *obj = NULL; return E_NOINTERFACE; } } diff --git a/dlls/wined3d/pixelshader.c b/dlls/wined3d/pixelshader.c index d382ce0d00f..0a0f9206cc2 100644 --- a/dlls/wined3d/pixelshader.c +++ b/dlls/wined3d/pixelshader.c @@ -54,8 +54,9 @@ HRESULT WINAPI IWineD3DPixelShaderImpl_QueryInterface(IWineD3DPixelShader *iface || IsEqualGUID(riid, &IID_IWineD3DPixelShader)) { IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c index 4fc53b253d6..3b0c312e943 100644 --- a/dlls/wined3d/query.c +++ b/dlls/wined3d/query.c @@ -42,8 +42,9 @@ HRESULT WINAPI IWineD3DQueryImpl_QueryInterface(IWineD3DQuery *iface, REFIID rii || IsEqualGUID(riid, &IID_IWineD3DQuery)) { IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 5a4b5506651..f25f25b6104 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -37,8 +37,9 @@ HRESULT WINAPI IWineD3DResourceImpl_QueryInterface(IWineD3DResource *iface, REFI || IsEqualGUID(riid, &IID_IWineD3DResource)) { IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index c0d3a369ca4..9c0e85163bc 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -38,8 +38,9 @@ HRESULT WINAPI IWineD3DStateBlockImpl_QueryInterface(IWineD3DStateBlock *iface,R || IsEqualGUID(riid, &IID_IWineD3DStateBlock)){ IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 374e2625a0e..ed62f73459b 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -45,8 +45,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_QueryInterface(IWineD3DSurface *iface, REFIID || IsEqualGUID(riid, &IID_IWineD3DSurface)) { IUnknown_AddRef((IUnknown*)iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } + *ppobj = NULL; return E_NOINTERFACE; } @@ -218,7 +219,10 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetContainer(IWineD3DSurface* iface, REFIID r } TRACE("Relaying to QueryInterface\n"); - return IUnknown_QueryInterface(container, riid, ppContainer); + if (IUnknown_QueryInterface(container, riid, ppContainer) != S_OK) + return WINED3DERR_INVALIDCALL; + + return WINED3D_OK; } HRESULT WINAPI IWineD3DSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC *pDesc) { diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index f20198cf11b..05e31e45e97 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -77,6 +77,7 @@ HRESULT WINAPI IWineD3DSwapChainImpl_QueryInterface(IWineD3DSwapChain *iface, RE *ppobj = This; return WINED3D_OK; } + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 66df5b8fb44..d8deb818ea4 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -42,6 +42,7 @@ HRESULT WINAPI IWineD3DTextureImpl_QueryInterface(IWineD3DTexture *iface, REFIID *ppobj = This; return WINED3D_OK; } + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/vertexbuffer.c b/dlls/wined3d/vertexbuffer.c index d432cfd84ec..62ccfc45ca7 100644 --- a/dlls/wined3d/vertexbuffer.c +++ b/dlls/wined3d/vertexbuffer.c @@ -39,8 +39,9 @@ HRESULT WINAPI IWineD3DVertexBufferImpl_QueryInterface(IWineD3DVertexBuffer *ifa || IsEqualGUID(riid, &IID_IWineD3DVertexBuffer)){ IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c index 8db4288fe95..da4ec15756c 100644 --- a/dlls/wined3d/vertexdeclaration.c +++ b/dlls/wined3d/vertexdeclaration.c @@ -403,8 +403,9 @@ HRESULT WINAPI IWineD3DVertexDeclarationImpl_QueryInterface(IWineD3DVertexDeclar || IsEqualGUID(riid, &IID_IWineD3DVertexDeclaration)){ IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/vertexshader.c b/dlls/wined3d/vertexshader.c index f4056a8780a..857b46d14c9 100644 --- a/dlls/wined3d/vertexshader.c +++ b/dlls/wined3d/vertexshader.c @@ -2068,8 +2068,9 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_QueryInterface(IWineD3DVertexShader *ifa || IsEqualGUID(riid, &IID_IWineD3DVertexShader)) { IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } + *ppobj = NULL; return E_NOINTERFACE; } diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index 24a3d650ed7..e8eaa0d953a 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -38,8 +38,9 @@ HRESULT WINAPI IWineD3DVolumeImpl_QueryInterface(IWineD3DVolume *iface, REFIID r || IsEqualGUID(riid, &IID_IWineD3DVolume)){ IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } + *ppobj = NULL; return E_NOINTERFACE; } @@ -141,7 +142,10 @@ HRESULT WINAPI IWineD3DVolumeImpl_GetContainer(IWineD3DVolume *iface, REFIID rii } TRACE("Relaying to QueryInterface\n"); - return IUnknown_QueryInterface(This->container, riid, ppContainer); + if (IUnknown_QueryInterface(This->container, riid, ppContainer) != S_OK) + return WINED3DERR_INVALIDCALL; + + return WINED3D_OK; } HRESULT WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, WINED3DVOLUME_DESC* pDesc) { diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c index 34402328476..4ac3764bc57 100644 --- a/dlls/wined3d/volumetexture.c +++ b/dlls/wined3d/volumetexture.c @@ -40,8 +40,9 @@ HRESULT WINAPI IWineD3DVolumeTextureImpl_QueryInterface(IWineD3DVolumeTexture *i || IsEqualGUID(riid, &IID_IWineD3DVolumeTexture)) { IUnknown_AddRef(iface); *ppobj = This; - return WINED3D_OK; + return S_OK; } + *ppobj = NULL; return E_NOINTERFACE; }