SHADERDECL(int) ShaderSetPixelShader(void *pShaderContext, void *pShaderObj) { IWineD3DDeviceImpl *This; IWineD3DPixelShader* pShader; IWineD3DPixelShader* oldShader; SHADER_SET_CURRENT_CONTEXT(pShaderContext); This = g_pCurrentContext->pDeviceContext; pShader = (IWineD3DPixelShader* )pShaderObj; oldShader = This->updateStateBlock->pixelShader; if(oldShader == pShader) { /* Checked here to allow proper stateblock recording */ Log(("App is setting the old shader over, nothing to do\n")); return VINF_SUCCESS; } This->updateStateBlock->pixelShader = pShader; This->updateStateBlock->changed.pixelShader = TRUE; Log(("(%p) : setting pShader(%p)\n", This, pShader)); if(pShader) IWineD3DPixelShader_AddRef(pShader); if(oldShader) IWineD3DPixelShader_Release(oldShader); g_pCurrentContext->fChangedPixelShader = true; g_pCurrentContext->fChangedPixelShaderConstant = true; /* force constant reload. */ return VINF_SUCCESS; }
static ULONG STDMETHODCALLTYPE d3d10_pixel_shader_AddRef(ID3D10PixelShader *iface) { struct d3d10_pixel_shader *This = (struct d3d10_pixel_shader *)iface; ULONG refcount = InterlockedIncrement(&This->refcount); TRACE("%p increasing refcount to %u\n", This, refcount); if (refcount == 1) { IWineD3DPixelShader_AddRef(This->wined3d_shader); } return refcount; }
static ULONG WINAPI IDirect3DPixelShader8Impl_AddRef(IDirect3DPixelShader8 *iface) { IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)iface; ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); if (ref == 1) { wined3d_mutex_lock(); IWineD3DPixelShader_AddRef(This->wineD3DPixelShader); wined3d_mutex_unlock(); } return ref; }
static ULONG WINAPI IDirect3DPixelShader9Impl_AddRef(LPDIRECT3DPIXELSHADER9 iface) { IDirect3DPixelShader9Impl *This = (IDirect3DPixelShader9Impl *)iface; ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); if (ref == 1) { IDirect3DDevice9Ex_AddRef(This->parentDevice); wined3d_mutex_lock(); IWineD3DPixelShader_AddRef(This->wineD3DPixelShader); wined3d_mutex_unlock(); } return ref; }