1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-14 09:23:53 +01:00
dxvk/src/d3d11/d3d11_class_linkage.cpp
Joshua Ashton 5ea8648cd9 [d3d11, d3d10, dxgi] Handle null ppvObject in QueryInterface. (#909)
When a null ppvObject is passed into a QueryInterface on any IUnknown, a E_POINTER should be returned as the result (and it should not crash.)

This matches native d3d11/d3d10/dxgi behaviour and the documentation found here https://docs.microsoft.com/en-us/windows/desktop/api/unknwn/nf-unknwn-iunknown-queryinterface(q_) for IUnknown.
2019-02-10 08:01:01 +01:00

65 lines
1.7 KiB
C++

#include "d3d11_class_linkage.h"
#include "d3d11_device.h"
namespace dxvk {
D3D11ClassLinkage::D3D11ClassLinkage(
D3D11Device* pDevice)
: m_device(pDevice) {
}
D3D11ClassLinkage::~D3D11ClassLinkage() {
}
HRESULT STDMETHODCALLTYPE D3D11ClassLinkage::QueryInterface(REFIID riid, void** ppvObject) {
if (ppvObject == nullptr)
return E_POINTER;
*ppvObject = nullptr;
if (riid == __uuidof(IUnknown)
|| riid == __uuidof(ID3D11DeviceChild)
|| riid == __uuidof(ID3D11ClassLinkage)) {
*ppvObject = ref(this);
return S_OK;
}
Logger::warn("D3D11ClassLinkage::QueryInterface: Unknown interface query");
Logger::warn(str::format(riid));
return E_NOINTERFACE;
}
void STDMETHODCALLTYPE D3D11ClassLinkage::GetDevice(ID3D11Device** ppDevice) {
*ppDevice = m_device.ref();
}
HRESULT STDMETHODCALLTYPE D3D11ClassLinkage::CreateClassInstance(
LPCSTR pClassTypeName,
UINT ConstantBufferOffset,
UINT ConstantVectorOffset,
UINT TextureOffset,
UINT SamplerOffset,
ID3D11ClassInstance **ppInstance) {
InitReturnPtr(ppInstance);
Logger::err("D3D11ClassLinkage::CreateClassInstance: Not implemented yet");
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE D3D11ClassLinkage::GetClassInstance(
LPCSTR pClassInstanceName,
UINT InstanceIndex,
ID3D11ClassInstance **ppInstance) {
Logger::err("D3D11ClassLinkage::GetClassInstance: Not implemented yet");
return E_NOTIMPL;
}
}