wined3d: Fix the IWineD3DVertexShader and IWineD3DPixelShader IUnknown methods.
IWineD3DVertexShader isn't supposed to implement IWineD3DPixelShader.
This commit is contained in:
parent
4997bee1bf
commit
50a87e23e7
|
@ -1158,6 +1158,18 @@ void shader_trace_init(
|
|||
This->baseShader.functionLength = (len + 1) * sizeof(DWORD);
|
||||
}
|
||||
|
||||
void shader_cleanup(IWineD3DBaseShader *iface)
|
||||
{
|
||||
IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)iface;
|
||||
|
||||
((IWineD3DDeviceImpl *)This->baseShader.device)->shader_backend->shader_destroy(iface);
|
||||
HeapFree(GetProcessHeap(), 0, This->baseShader.function);
|
||||
shader_delete_constant_list(&This->baseShader.constantsF);
|
||||
shader_delete_constant_list(&This->baseShader.constantsB);
|
||||
shader_delete_constant_list(&This->baseShader.constantsI);
|
||||
list_remove(&This->baseShader.shader_list_entry);
|
||||
}
|
||||
|
||||
static const SHADER_HANDLER shader_none_instruction_handler_table[WINED3DSIH_TABLE_SIZE] = {0};
|
||||
static void shader_none_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {}
|
||||
static void shader_none_select_depth_blt(IWineD3DDevice *iface, enum tex_types tex_type) {}
|
||||
|
@ -1222,46 +1234,3 @@ const shader_backend_t none_shader_backend = {
|
|||
shader_none_get_caps,
|
||||
shader_none_color_fixup_supported,
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
IWineD3DPixelShader IUnknown parts follow
|
||||
******************************************* */
|
||||
HRESULT WINAPI IWineD3DBaseShaderImpl_QueryInterface(IWineD3DBaseShader *iface, REFIID riid, LPVOID *ppobj)
|
||||
{
|
||||
IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)iface;
|
||||
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DBase)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DBaseShader)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DPixelShader)) {
|
||||
IUnknown_AddRef(iface);
|
||||
*ppobj = This;
|
||||
return S_OK;
|
||||
}
|
||||
*ppobj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG WINAPI IWineD3DBaseShaderImpl_AddRef(IWineD3DBaseShader *iface) {
|
||||
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
|
||||
TRACE("(%p) : AddRef increasing from %d\n", This, This->baseShader.ref);
|
||||
return InterlockedIncrement(&This->baseShader.ref);
|
||||
}
|
||||
|
||||
ULONG WINAPI IWineD3DBaseShaderImpl_Release(IWineD3DBaseShader *iface) {
|
||||
IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)iface;
|
||||
IWineD3DDeviceImpl *deviceImpl = (IWineD3DDeviceImpl *) This->baseShader.device;
|
||||
ULONG ref;
|
||||
TRACE("(%p) : Releasing from %d\n", This, This->baseShader.ref);
|
||||
ref = InterlockedDecrement(&This->baseShader.ref);
|
||||
if (ref == 0) {
|
||||
deviceImpl->shader_backend->shader_destroy(iface);
|
||||
HeapFree(GetProcessHeap(), 0, This->baseShader.function);
|
||||
shader_delete_constant_list(&This->baseShader.constantsF);
|
||||
shader_delete_constant_list(&This->baseShader.constantsB);
|
||||
shader_delete_constant_list(&This->baseShader.constantsI);
|
||||
list_remove(&This->baseShader.shader_list_entry);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
|
|
@ -37,15 +37,46 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
|
|||
#define GLNAME_REQUIRE_GLSL ((const char *)1)
|
||||
|
||||
static HRESULT WINAPI IWineD3DPixelShaderImpl_QueryInterface(IWineD3DPixelShader *iface, REFIID riid, LPVOID *ppobj) {
|
||||
return IWineD3DBaseShaderImpl_QueryInterface((IWineD3DBaseShader *) iface, riid, ppobj);
|
||||
TRACE("iface %p, riid %s, ppobj %p\n", iface, debugstr_guid(riid), ppobj);
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IWineD3DPixelShader)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DBaseShader)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DBase)
|
||||
|| IsEqualGUID(riid, &IID_IUnknown))
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
*ppobj = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
|
||||
|
||||
*ppobj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IWineD3DPixelShaderImpl_AddRef(IWineD3DPixelShader *iface) {
|
||||
return IWineD3DBaseShaderImpl_AddRef((IWineD3DBaseShader *) iface);
|
||||
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
|
||||
ULONG refcount = InterlockedIncrement(&This->baseShader.ref);
|
||||
|
||||
TRACE("%p increasing refcount to %u\n", This, refcount);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IWineD3DPixelShaderImpl_Release(IWineD3DPixelShader *iface) {
|
||||
return IWineD3DBaseShaderImpl_Release((IWineD3DBaseShader *) iface);
|
||||
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
|
||||
ULONG refcount = InterlockedDecrement(&This->baseShader.ref);
|
||||
|
||||
TRACE("%p decreasing refcount to %u\n", This, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
shader_cleanup((IWineD3DBaseShader *)iface);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
/* *******************************************
|
||||
|
|
|
@ -334,15 +334,46 @@ static void IWineD3DVertexShaderImpl_GenerateShader(IWineD3DVertexShader *iface,
|
|||
IWineD3DVertexShader IUnknown parts follow
|
||||
******************************************* */
|
||||
static HRESULT WINAPI IWineD3DVertexShaderImpl_QueryInterface(IWineD3DVertexShader *iface, REFIID riid, LPVOID *ppobj) {
|
||||
return IWineD3DBaseShaderImpl_QueryInterface((IWineD3DBaseShader *) iface, riid, ppobj);
|
||||
TRACE("iface %p, riid %s, ppobj %p\n", iface, debugstr_guid(riid), ppobj);
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IWineD3DVertexShader)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DBaseShader)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DBase)
|
||||
|| IsEqualGUID(riid, &IID_IUnknown))
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
*ppobj = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
|
||||
|
||||
*ppobj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IWineD3DVertexShaderImpl_AddRef(IWineD3DVertexShader *iface) {
|
||||
return IWineD3DBaseShaderImpl_AddRef((IWineD3DBaseShader *) iface);
|
||||
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
|
||||
ULONG refcount = InterlockedIncrement(&This->baseShader.ref);
|
||||
|
||||
TRACE("%p increasing refcount to %u\n", This, refcount);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IWineD3DVertexShaderImpl_Release(IWineD3DVertexShader *iface) {
|
||||
return IWineD3DBaseShaderImpl_Release((IWineD3DBaseShader *) iface);
|
||||
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
|
||||
ULONG refcount = InterlockedDecrement(&This->baseShader.ref);
|
||||
|
||||
TRACE("%p decreasing refcount to %u\n", This, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
shader_cleanup((IWineD3DBaseShader *)iface);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
/* *******************************************
|
||||
|
|
|
@ -2226,11 +2226,9 @@ typedef struct IWineD3DBaseShaderImpl {
|
|||
IWineD3DBaseShaderClass baseShader;
|
||||
} IWineD3DBaseShaderImpl;
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseShaderImpl_QueryInterface(IWineD3DBaseShader *iface, REFIID riid, LPVOID *ppobj);
|
||||
ULONG WINAPI IWineD3DBaseShaderImpl_AddRef(IWineD3DBaseShader *iface);
|
||||
ULONG WINAPI IWineD3DBaseShaderImpl_Release(IWineD3DBaseShader *iface);
|
||||
void shader_buffer_init(struct SHADER_BUFFER *buffer);
|
||||
void shader_buffer_free(struct SHADER_BUFFER *buffer);
|
||||
void shader_cleanup(IWineD3DBaseShader *iface);
|
||||
|
||||
extern HRESULT shader_get_registers_used(
|
||||
IWineD3DBaseShader *iface,
|
||||
|
|
Loading…
Reference in New Issue