mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-29 17:52:18 +01:00
[d3d11] Implement extended shader interface
This commit is contained in:
parent
610472e658
commit
e882a7f8ba
@ -125,4 +125,60 @@ namespace dxvk {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
D3D11ExtShader::D3D11ExtShader(
|
||||
ID3D11DeviceChild* pParent,
|
||||
D3D11CommonShader* pShader)
|
||||
: m_parent(pParent), m_shader(pShader) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
D3D11ExtShader::~D3D11ExtShader() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
ULONG STDMETHODCALLTYPE D3D11ExtShader::AddRef() {
|
||||
return m_parent->AddRef();
|
||||
}
|
||||
|
||||
|
||||
ULONG STDMETHODCALLTYPE D3D11ExtShader::Release() {
|
||||
return m_parent->Release();
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D11ExtShader::QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject) {
|
||||
return m_parent->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D11ExtShader::GetSpirvCode(
|
||||
SIZE_T* pCodeSize,
|
||||
void* pCode) {
|
||||
auto shader = m_shader->GetShader();
|
||||
auto code = shader->getRawCode();
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (pCode) {
|
||||
size_t size = code.size();
|
||||
|
||||
if (size > *pCodeSize) {
|
||||
size = *pCodeSize;
|
||||
hr = S_FALSE;
|
||||
}
|
||||
|
||||
std::memcpy(pCode, code.data(), size);
|
||||
*pCodeSize = size;
|
||||
return hr;
|
||||
} else {
|
||||
*pCodeSize = code.size();
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -59,8 +59,41 @@ namespace dxvk {
|
||||
Rc<DxvkBuffer> m_buffer;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Extended shader interface
|
||||
*/
|
||||
class D3D11ExtShader : public ID3D11VkExtShader {
|
||||
|
||||
public:
|
||||
|
||||
D3D11ExtShader(
|
||||
ID3D11DeviceChild* pParent,
|
||||
D3D11CommonShader* pShader);
|
||||
|
||||
~D3D11ExtShader();
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef();
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetSpirvCode(
|
||||
SIZE_T* pCodeSize,
|
||||
void* pCode);
|
||||
|
||||
private:
|
||||
|
||||
ID3D11DeviceChild* m_parent;
|
||||
D3D11CommonShader* m_shader;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Common shader interface
|
||||
*
|
||||
@ -75,7 +108,7 @@ namespace dxvk {
|
||||
|
||||
D3D11Shader(D3D11Device* device, const D3D11CommonShader& shader)
|
||||
: D3D11DeviceChild<D3D11Interface>(device),
|
||||
m_shader(shader), m_d3d10(this) { }
|
||||
m_shader(shader), m_d3d10(this), m_shaderExt(this, &m_shader) { }
|
||||
|
||||
~D3D11Shader() { }
|
||||
|
||||
@ -95,7 +128,12 @@ namespace dxvk {
|
||||
*ppvObject = ref(&m_d3d10);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
if (riid == __uuidof(ID3D11VkExtShader)) {
|
||||
*ppvObject = ref(&m_shaderExt);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
Logger::warn("D3D11Shader::QueryInterface: Unknown interface query");
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
@ -112,6 +150,7 @@ namespace dxvk {
|
||||
|
||||
D3D11CommonShader m_shader;
|
||||
D3D10ShaderClass m_d3d10;
|
||||
D3D11ExtShader m_shaderExt;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user