2 * shaders implementation
4 * Copyright 2005 Oliver Stieber
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "wined3d_private.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
30 /* *******************************************
31 IWineD3DPixelShader IUnknown parts follow
32 ******************************************* */
33 HRESULT WINAPI IWineD3DPixelShaderImpl_QueryInterface(IWineD3DPixelShader *iface, REFIID riid, LPVOID *ppobj)
35 IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
36 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
37 if (IsEqualGUID(riid, &IID_IUnknown)
38 || IsEqualGUID(riid, &IID_IWineD3DPixelShader)) {
39 IUnknown_AddRef(iface);
46 ULONG WINAPI IWineD3DPixelShaderImpl_AddRef(IWineD3DPixelShader *iface) {
47 IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
48 TRACE("(%p) : AddRef increasing from %ld\n", This, This->ref);
49 return InterlockedIncrement(&This->ref);
52 ULONG WINAPI IWineD3DPixelShaderImpl_Release(IWineD3DPixelShader *iface) {
53 IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
55 TRACE("(%p) : Releasing from %ld\n", This, This->ref);
56 ref = InterlockedDecrement(&This->ref);
58 HeapFree(GetProcessHeap(), 0, This);
63 /* *******************************************
64 IWineD3DPixelShader IWineD3DPixelShader parts follow
65 ******************************************* */
67 HRESULT WINAPI IWineD3DPixelShaderImpl_GetParent(IWineD3DPixelShader *iface, IUnknown** parent){
68 IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
70 *parent= (IUnknown*) parent;
71 IUnknown_AddRef(*parent);
72 TRACE("(%p) : returning %p\n", This, *parent);
76 HRESULT WINAPI IWineD3DPixelShaderImpl_GetDevice(IWineD3DPixelShader* iface, IWineD3DDevice **pDevice){
77 IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
78 IWineD3DDevice_AddRef((IWineD3DDevice *)This->wineD3DDevice);
79 *pDevice = (IWineD3DDevice *)This->wineD3DDevice;
80 TRACE("(%p) returning %p\n", This, *pDevice);
85 HRESULT WINAPI IWineD3DPixelShaderImpl_GetFunction(IWineD3DPixelShader* impl, VOID* pData, UINT* pSizeOfData) {
86 IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)impl;
87 FIXME("(%p) : pData(%p), pSizeOfData(%p)\n", This, pData, pSizeOfData);
90 *pSizeOfData = This->functionLength;
93 if (*pSizeOfData < This->functionLength) {
94 *pSizeOfData = This->functionLength;
95 return D3DERR_MOREDATA;
97 if (NULL == This->function) { /* no function defined */
98 TRACE("(%p) : GetFunction no User Function defined using NULL to %p\n", This, pData);
99 (*(DWORD **) pData) = NULL;
101 if(This->functionLength == 0){
104 TRACE("(%p) : GetFunction copying to %p\n", This, pData);
105 memcpy(pData, This->function, This->functionLength);
112 const IWineD3DPixelShaderVtbl IWineD3DPixelShader_Vtbl =
114 /*** IUnknown methods ***/
115 IWineD3DPixelShaderImpl_QueryInterface,
116 IWineD3DPixelShaderImpl_AddRef,
117 IWineD3DPixelShaderImpl_Release,
118 /*** IWineD3DPixelShader methods ***/
119 IWineD3DPixelShaderImpl_GetParent,
120 IWineD3DPixelShaderImpl_GetDevice,
121 IWineD3DPixelShaderImpl_GetFunction