mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-05 01:24:14 +01:00
54ed8f0bb0
Co-authored-by: Philip Rebohle <philip.rebohle@tu-dortmund.de> Co-authored-by: Robin Kertels <robin.kertels@gmail.com> Co-authored-by: pchome <pchome@users.noreply.github.com> Co-authored-by: Christopher Egert <cme3000@gmail.com> Co-authored-by: Derek Lesho <dereklesho52@Gmail.com> Co-authored-by: Luis Cáceres <lacaceres97@gmail.com> Co-authored-by: Nelson Chen <crazysim@gmail.com> Co-authored-by: Edmondo Tommasina <edmondo.tommasina@gmail.com> Co-authored-by: Riesi <riesi@opentrash.com> Co-authored-by: gbMichelle <gbmichelle.dev@gmail.com>
114 lines
2.6 KiB
C++
114 lines
2.6 KiB
C++
#include "d3d9_buffer.h"
|
|
|
|
namespace dxvk {
|
|
|
|
////////////////////////
|
|
// D3D9VertexBuffer
|
|
////////////////////////
|
|
|
|
D3D9VertexBuffer::D3D9VertexBuffer(
|
|
D3D9DeviceEx* pDevice,
|
|
const D3D9_BUFFER_DESC* pDesc)
|
|
: D3D9VertexBufferBase( pDevice, pDesc ) { }
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE D3D9VertexBuffer::QueryInterface(
|
|
REFIID riid,
|
|
void** ppvObject) {
|
|
if (ppvObject == nullptr)
|
|
return E_POINTER;
|
|
|
|
*ppvObject = nullptr;
|
|
|
|
if (riid == __uuidof(IUnknown)
|
|
|| riid == __uuidof(IDirect3DResource9)
|
|
|| riid == __uuidof(IDirect3DVertexBuffer9)) {
|
|
*ppvObject = ref(this);
|
|
return S_OK;
|
|
}
|
|
|
|
Logger::warn("D3D9VertexBuffer::QueryInterface: Unknown interface query");
|
|
Logger::warn(str::format(riid));
|
|
return E_NOINTERFACE;
|
|
}
|
|
|
|
|
|
D3DRESOURCETYPE STDMETHODCALLTYPE D3D9VertexBuffer::GetType() {
|
|
return D3DRTYPE_VERTEXBUFFER;
|
|
}
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE D3D9VertexBuffer::GetDesc(
|
|
D3DVERTEXBUFFER_DESC* pDesc) {
|
|
if (pDesc == nullptr)
|
|
return D3DERR_INVALIDCALL;
|
|
|
|
D3D9_BUFFER_DESC desc;
|
|
m_buffer.GetDesc(&desc);
|
|
|
|
pDesc->Format = static_cast<D3DFORMAT>(desc.Format);
|
|
pDesc->Type = desc.Type;
|
|
pDesc->Usage = desc.Usage;
|
|
pDesc->Pool = desc.Pool;
|
|
pDesc->Size = desc.Size;
|
|
pDesc->FVF = desc.FVF;
|
|
|
|
return D3D_OK;
|
|
}
|
|
|
|
|
|
//////////////////////
|
|
// D3D9IndexBuffer
|
|
//////////////////////
|
|
|
|
|
|
D3D9IndexBuffer::D3D9IndexBuffer(
|
|
D3D9DeviceEx* pDevice,
|
|
const D3D9_BUFFER_DESC* pDesc)
|
|
: D3D9IndexBufferBase( pDevice, pDesc ) { }
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE D3D9IndexBuffer::QueryInterface(
|
|
REFIID riid,
|
|
void** ppvObject) {
|
|
if (ppvObject == nullptr)
|
|
return E_POINTER;
|
|
|
|
*ppvObject = nullptr;
|
|
|
|
if (riid == __uuidof(IUnknown)
|
|
|| riid == __uuidof(IDirect3DResource9)
|
|
|| riid == __uuidof(IDirect3DIndexBuffer9)) {
|
|
*ppvObject = ref(this);
|
|
return S_OK;
|
|
}
|
|
|
|
Logger::warn("D3D9IndexBuffer::QueryInterface: Unknown interface query");
|
|
Logger::warn(str::format(riid));
|
|
return E_NOINTERFACE;
|
|
}
|
|
|
|
|
|
D3DRESOURCETYPE STDMETHODCALLTYPE D3D9IndexBuffer::GetType() {
|
|
return D3DRTYPE_INDEXBUFFER;
|
|
}
|
|
|
|
|
|
HRESULT STDMETHODCALLTYPE D3D9IndexBuffer::GetDesc(
|
|
D3DINDEXBUFFER_DESC* pDesc) {
|
|
if (pDesc == nullptr)
|
|
return D3DERR_INVALIDCALL;
|
|
|
|
D3D9_BUFFER_DESC desc;
|
|
m_buffer.GetDesc(&desc);
|
|
|
|
pDesc->Format = static_cast<D3DFORMAT>(desc.Format);
|
|
pDesc->Type = desc.Type;
|
|
pDesc->Usage = desc.Usage;
|
|
pDesc->Pool = desc.Pool;
|
|
pDesc->Size = desc.Size;
|
|
|
|
return D3D_OK;
|
|
}
|
|
|
|
} |