mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-11-30 04:24:11 +01:00
[d3d10] Implement D3D10RenderTargetView
This commit is contained in:
parent
e0a27fd05e
commit
ea46a0340e
@ -243,16 +243,16 @@ namespace dxvk {
|
||||
Com<ID3D11Resource> d3d11Resource;
|
||||
GetD3D11Resource(pResource, &d3d11Resource);
|
||||
|
||||
ID3D11ShaderResourceView* d3d11Srv = nullptr;
|
||||
ID3D11ShaderResourceView* d3d11View = nullptr;
|
||||
HRESULT hr = m_device->CreateShaderResourceView(d3d11Resource.ptr(),
|
||||
reinterpret_cast<const D3D11_SHADER_RESOURCE_VIEW_DESC*>(pDesc),
|
||||
ppSRView ? &d3d11Srv : nullptr);
|
||||
ppSRView ? &d3d11View : nullptr);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (ppSRView != nullptr) {
|
||||
*ppSRView = static_cast<D3D11ShaderResourceView*>(d3d11Srv)->GetD3D10Iface();
|
||||
*ppSRView = static_cast<D3D11ShaderResourceView*>(d3d11View)->GetD3D10Iface();
|
||||
return S_OK;
|
||||
} return S_FALSE;
|
||||
}
|
||||
@ -262,8 +262,21 @@ namespace dxvk {
|
||||
ID3D10Resource* pResource,
|
||||
const D3D10_RENDER_TARGET_VIEW_DESC* pDesc,
|
||||
ID3D10RenderTargetView** ppRTView) {
|
||||
Logger::err("D3D10Device::CreateRenderTargetView: Not implemented");
|
||||
return E_NOTIMPL;
|
||||
Com<ID3D11Resource> d3d11Resource;
|
||||
GetD3D11Resource(pResource, &d3d11Resource);
|
||||
|
||||
ID3D11RenderTargetView* d3d11View = nullptr;
|
||||
HRESULT hr = m_device->CreateRenderTargetView(d3d11Resource.ptr(),
|
||||
reinterpret_cast<const D3D11_RENDER_TARGET_VIEW_DESC*>(pDesc),
|
||||
ppRTView ? &d3d11View : nullptr);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (ppRTView != nullptr) {
|
||||
*ppRTView = static_cast<D3D11RenderTargetView*>(d3d11View)->GetD3D10Iface();
|
||||
return S_OK;
|
||||
} return S_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
68
src/d3d10/d3d10_view_rtv.cpp
Normal file
68
src/d3d10/d3d10_view_rtv.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
#include "d3d10_view_rtv.h"
|
||||
|
||||
#include "../d3d11/d3d11_device.h"
|
||||
#include "../d3d11/d3d11_view_rtv.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D10RenderTargetView::QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject) {
|
||||
return m_d3d11->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
|
||||
ULONG STDMETHODCALLTYPE D3D10RenderTargetView::AddRef() {
|
||||
return m_d3d11->AddRef();
|
||||
}
|
||||
|
||||
|
||||
ULONG STDMETHODCALLTYPE D3D10RenderTargetView::Release() {
|
||||
return m_d3d11->Release();
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D10RenderTargetView::GetDevice(
|
||||
ID3D10Device** ppDevice) {
|
||||
GetD3D10Device(m_d3d11, ppDevice);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D10RenderTargetView::GetPrivateData(
|
||||
REFGUID guid,
|
||||
UINT* pDataSize,
|
||||
void* pData) {
|
||||
return m_d3d11->GetPrivateData(guid, pDataSize, pData);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D10RenderTargetView::SetPrivateData(
|
||||
REFGUID guid,
|
||||
UINT DataSize,
|
||||
const void* pData) {
|
||||
return m_d3d11->SetPrivateData(guid, DataSize, pData);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D10RenderTargetView::SetPrivateDataInterface(
|
||||
REFGUID guid,
|
||||
const IUnknown* pData) {
|
||||
return m_d3d11->SetPrivateDataInterface(guid, pData);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D10RenderTargetView::GetResource(
|
||||
ID3D10Resource** ppResource) {
|
||||
GetD3D10ResourceFromView(m_d3d11, ppResource);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE D3D10RenderTargetView::GetDesc(
|
||||
D3D10_RENDER_TARGET_VIEW_DESC* pDesc) {
|
||||
static_assert(sizeof(D3D10_RENDER_TARGET_VIEW_DESC) ==
|
||||
sizeof(D3D11_RENDER_TARGET_VIEW_DESC));
|
||||
|
||||
m_d3d11->GetDesc(reinterpret_cast<D3D11_RENDER_TARGET_VIEW_DESC*>(pDesc));
|
||||
}
|
||||
|
||||
}
|
58
src/d3d10/d3d10_view_rtv.h
Normal file
58
src/d3d10/d3d10_view_rtv.h
Normal file
@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#include "d3d10_util.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
class D3D11Device;
|
||||
class D3D11RenderTargetView;
|
||||
|
||||
class D3D10RenderTargetView : public ID3D10RenderTargetView {
|
||||
|
||||
public:
|
||||
|
||||
D3D10RenderTargetView(D3D11RenderTargetView* pParent)
|
||||
: m_d3d11(pParent) { }
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject);
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef();
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release();
|
||||
|
||||
void STDMETHODCALLTYPE GetDevice(
|
||||
ID3D10Device** ppDevice);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetPrivateData(
|
||||
REFGUID guid,
|
||||
UINT* pDataSize,
|
||||
void* pData);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateData(
|
||||
REFGUID guid,
|
||||
UINT DataSize,
|
||||
const void* pData);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
|
||||
REFGUID guid,
|
||||
const IUnknown* pData);
|
||||
|
||||
void STDMETHODCALLTYPE GetResource(
|
||||
ID3D10Resource** ppResource);
|
||||
|
||||
void STDMETHODCALLTYPE GetDesc(
|
||||
D3D10_RENDER_TARGET_VIEW_DESC* pDesc);
|
||||
|
||||
D3D11RenderTargetView* GetD3D11Iface() {
|
||||
return m_d3d11;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
D3D11RenderTargetView* m_d3d11;
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -10,7 +10,7 @@ namespace dxvk {
|
||||
D3D11Device* pDevice,
|
||||
ID3D11Resource* pResource,
|
||||
const D3D11_RENDER_TARGET_VIEW_DESC* pDesc)
|
||||
: m_device(pDevice), m_resource(pResource), m_desc(*pDesc) {
|
||||
: m_device(pDevice), m_resource(pResource), m_desc(*pDesc), m_d3d10(this) {
|
||||
ResourceAddRefPrivate(m_resource);
|
||||
|
||||
DxvkImageViewCreateInfo viewInfo;
|
||||
@ -108,6 +108,13 @@ namespace dxvk {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (riid == __uuidof(ID3D10DeviceChild)
|
||||
|| riid == __uuidof(ID3D10View)
|
||||
|| riid == __uuidof(ID3D10RenderTargetView)) {
|
||||
*ppvObject = ref(this);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
Logger::warn("D3D11RenderTargetView::QueryInterface: Unknown interface query");
|
||||
Logger::warn(str::format(riid));
|
||||
return E_NOINTERFACE;
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include "../dxvk/dxvk_device.h"
|
||||
|
||||
#include "../d3d10/d3d10_view_rtv.h"
|
||||
|
||||
#include "d3d11_device_child.h"
|
||||
|
||||
namespace dxvk {
|
||||
@ -46,6 +48,10 @@ namespace dxvk {
|
||||
: VK_IMAGE_LAYOUT_GENERAL;
|
||||
}
|
||||
|
||||
D3D10RenderTargetView* GetD3D10Iface() {
|
||||
return &m_d3d10;
|
||||
}
|
||||
|
||||
static HRESULT GetDescFromResource(
|
||||
ID3D11Resource* pResource,
|
||||
D3D11_RENDER_TARGET_VIEW_DESC* pDesc);
|
||||
@ -60,6 +66,7 @@ namespace dxvk {
|
||||
ID3D11Resource* m_resource;
|
||||
D3D11_RENDER_TARGET_VIEW_DESC m_desc;
|
||||
Rc<DxvkImageView> m_view;
|
||||
D3D10RenderTargetView m_d3d10;
|
||||
|
||||
};
|
||||
|
||||
|
@ -8,6 +8,7 @@ d3d10_src = [
|
||||
'../d3d10/d3d10_sampler.cpp',
|
||||
'../d3d10/d3d10_texture.cpp',
|
||||
'../d3d10/d3d10_util.cpp',
|
||||
'../d3d10/d3d10_view_rtv.cpp',
|
||||
'../d3d10/d3d10_view_srv.cpp',
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user