D3D11.X and DXGI impl

This commit is contained in:
Rodrigo Todescatto
2026-02-06 23:11:31 -03:00
parent 903a847191
commit 5848f20e03
22 changed files with 2986 additions and 374 deletions

View File

@@ -16,13 +16,14 @@ set(FILES
Exports.def
)
add_library(WinDurango.D3D11X SHARED ${FILES} "include/WinDurango.D3D11X/ID3D11DeviceChild.h" "src/ID3D11DeviceChild.cpp" "include/WinDurango.D3D11X/ID3D11Resource.h" "src/ID3D11Resource.cpp" "include/WinDurango.D3D11X/ID3D11Shader.h" "src/ID3D11Shader.cpp" "include/WinDurango.D3D11X/ID3D11State.h" "src/ID3D11State.cpp" "include/WinDurango.D3D11X/ID3D11View.h" "src/ID3D11View.cpp" "include/WinDurango.D3D11X/ID3D11DeviceContext.h" "src/ID3D11DeviceContext.cpp" "include/WinDurango.D3D11X/ID3D11DMAEngineContext.h" "src/ID3D11DMAEngineContext.cpp" "include/WinDurango.D3D11X/ID3D11Device.h" "src/ID3D11Device.cpp" "include/WinDurango.D3D11X/ID3D11Runtime.h" "src/dllmain.cpp")
add_library(WinDurango.D3D11X SHARED ${FILES} "include/WinDurango.D3D11X/ID3D11DeviceChild.h" "src/ID3D11DeviceChild.cpp" "include/WinDurango.D3D11X/ID3D11Resource.h" "src/ID3D11Resource.cpp" "include/WinDurango.D3D11X/ID3D11Shader.h" "src/ID3D11Shader.cpp" "include/WinDurango.D3D11X/ID3D11State.h" "src/ID3D11State.cpp" "include/WinDurango.D3D11X/ID3D11View.h" "src/ID3D11View.cpp" "include/WinDurango.D3D11X/ID3D11DeviceContext.h" "src/ID3D11DeviceContext.cpp" "include/WinDurango.D3D11X/ID3D11DMAEngineContext.h" "src/ID3D11DMAEngineContext.cpp" "include/WinDurango.D3D11X/ID3D11Device.h" "src/ID3D11Device.cpp" "include/WinDurango.D3D11X/ID3D11Runtime.h" "src/dllmain.cpp" "include/WinDurango.D3D11X/IDXGIAdapter.h" "include/WinDurango.D3D11X/IDXGIDevice.h" "include/WinDurango.D3D11X/IDXGIFactory.h" "include/WinDurango.D3D11X/IDXGISwapChain.h" "src/IDXGIAdapter.cpp" "src/IDXGIDevice.cpp" "src/IDXGIFactory.cpp" "src/IDXGISwapChain.cpp")
target_link_libraries(WinDurango.D3D11X PRIVATE WinDurango.Common)
target_include_directories(WinDurango.D3D11X PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include/WinDurango.D3D11X/
../WinDurango.Common/include/
../WinDurango.KernelX/include/WinDurango.KernelX/
)
target_link_options(WinDurango.D3D11X

View File

@@ -1,6 +1,30 @@
#pragma once
#include "d3d11_x.g.h"
#define D3D11X_MISC_FLAGS_MASK (0x4000000 | 0x8000000 | 0x20000 | 0x40000 | 0x80000 | 0x100000 | 0x200000)
#define D3D11_MISC_FLAGS_MASK \
(D3D11_RESOURCE_MISC_GENERATE_MIPS | D3D11_RESOURCE_MISC_SHARED | D3D11_RESOURCE_MISC_TEXTURECUBE | \
D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS | D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS | \
D3D11_RESOURCE_MISC_BUFFER_STRUCTURED | D3D11_RESOURCE_MISC_RESOURCE_CLAMP | \
D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX | D3D11_RESOURCE_MISC_GDI_COMPATIBLE | \
D3D11_RESOURCE_MISC_SHARED_NTHANDLE | D3D11_RESOURCE_MISC_RESTRICTED_CONTENT | \
D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE | D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE_DRIVER | \
D3D11_RESOURCE_MISC_GUARDED)
#define D3D11_CREATE_DEFERRED_CONTEXT_DRAW_BUNDLES 0x20000
inline UINT ConvertMiscFlags(UINT MiscFlags)
{
UINT Flags = (MiscFlags & ~D3D11X_MISC_FLAGS_MASK) & D3D11_MISC_FLAGS_MASK;
if (MiscFlags & 0x4000000)
Flags |= D3D11_RESOURCE_MISC_TILE_POOL;
if (MiscFlags & 0x8000000)
Flags |= D3D11_RESOURCE_MISC_TILED;
return Flags;
}
template <abi_t ABI> class D3D11DeviceX : public gfx::ID3D11DeviceX<ABI>
{
public:

View File

@@ -48,6 +48,7 @@ public:
void IASetVertexBuffers(UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppVertexBuffers,
UINT const *pStrides, UINT const *pOffsets);
void IASetIndexBuffer(UINT HardwareIndexFormat, gfx::ID3D11Buffer<ABI> *pIndexBuffer, UINT Offset);
void IASetIndexBuffer(gfx::ID3D11Buffer<ABI> *pIndexBuffer, UINT hardwareIndexFormat, UINT Offset);
void DrawIndexedInstanced(UINT StartIndexLocationAndIndexCountPerInstance,
UINT64 BaseVertexLocationAndStartInstanceLocation, UINT64 InstanceCount);
void DrawInstanced(UINT VertexCountPerInstance, UINT64 StartVertexLocationAndStartInstanceLocation,

View File

@@ -3,7 +3,16 @@
template <abi_t ABI> class D3D11Resource : public gfx::ID3D11Resource<ABI>
{
public:
public:
ID3D11Resource *m_pFunction = nullptr;
bool m_IsDirty = false;
D3D11Resource(ID3D11Resource *pResource)
{
m_pFunction = pResource;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -36,7 +45,16 @@ D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11Texture1D : public gfx::ID3D11Texture1D<ABI>
{
public:
public:
ID3D11Texture1D *m_pFunction = nullptr;
bool m_IsDirty = false;
D3D11Texture1D(ID3D11Texture1D *pResource)
{
m_pFunction = pResource;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -75,6 +93,15 @@ D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11Texture2D : public gfx::ID3D11Texture2D<ABI>
{
public:
ID3D11Texture2D *m_pFunction = nullptr;
bool m_IsDirty = false;
D3D11Texture2D(ID3D11Texture2D *pResource)
{
m_pFunction = pResource;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -112,7 +139,16 @@ D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11Texture3D : public gfx::ID3D11Texture3D<ABI>
{
public:
public:
ID3D11Texture3D *m_pFunction = nullptr;
bool m_IsDirty = false;
D3D11Texture3D(ID3D11Texture3D *pResource)
{
m_pFunction = pResource;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -150,7 +186,16 @@ D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11Buffer : public gfx::ID3D11Buffer<ABI>
{
public:
public:
ID3D11Buffer *m_pFunction = nullptr;
bool m_IsDirty = false;
D3D11Buffer(ID3D11Buffer *pResource)
{
m_pFunction = pResource;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -178,7 +223,7 @@ template <abi_t ABI> class D3D11Buffer : public gfx::ID3D11Buffer<ABI>
//
// ID3D11Buffer
//
void GetDesc(D3D11_TEXTURE1D_DESC *pDesc);
void GetDesc(D3D11_BUFFER_DESC *pDesc);
};
#undef ABI_INTERFACE

View File

@@ -4,6 +4,14 @@
template <abi_t ABI> class D3D11VertexShader : public gfx::ID3D11VertexShader<ABI>
{
public:
ID3D11VertexShader *m_pFunction = nullptr;
D3D11VertexShader(ID3D11VertexShader *pShader)
{
m_pFunction = pShader;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -19,16 +27,27 @@ template <abi_t ABI> class D3D11VertexShader : public gfx::ID3D11VertexShader<AB
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
};
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11VertexShader<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11PixelShader : public gfx::ID3D11PixelShader<ABI>
{
public:
ID3D11PixelShader *m_pFunction = nullptr;
D3D11PixelShader(ID3D11PixelShader *pShader)
{
m_pFunction = pShader;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -44,16 +63,27 @@ template <abi_t ABI> class D3D11PixelShader : public gfx::ID3D11PixelShader<ABI>
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
};
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11PixelShader<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11ComputeShader : public gfx::ID3D11ComputeShader<ABI>
{
public:
ID3D11ComputeShader *m_pFunction = nullptr;
D3D11ComputeShader(ID3D11ComputeShader *pShader)
{
m_pFunction = pShader;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -69,16 +99,27 @@ template <abi_t ABI> class D3D11ComputeShader : public gfx::ID3D11ComputeShader<
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
};
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11ComputeShader<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11GeometryShader : public gfx::ID3D11GeometryShader<ABI>
{
public:
ID3D11GeometryShader *m_pFunction = nullptr;
D3D11GeometryShader(ID3D11GeometryShader *pShader)
{
m_pFunction = pShader;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -94,16 +135,27 @@ template <abi_t ABI> class D3D11GeometryShader : public gfx::ID3D11GeometryShade
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
};
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11GeometryShader<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11HullShader : public gfx::ID3D11HullShader<ABI>
{
public:
ID3D11HullShader *m_pFunction = nullptr;
D3D11HullShader(ID3D11HullShader *pShader)
{
m_pFunction = pShader;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -119,16 +171,27 @@ template <abi_t ABI> class D3D11HullShader : public gfx::ID3D11HullShader<ABI>
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
};
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11HullShader<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11DomainShader : public gfx::ID3D11DomainShader<ABI>
{
public:
ID3D11DomainShader *m_pFunction = nullptr;
D3D11DomainShader(ID3D11DomainShader *pShader)
{
m_pFunction = pShader;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -144,6 +207,10 @@ template <abi_t ABI> class D3D11DomainShader : public gfx::ID3D11DomainShader<AB
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
};
#undef ABI_INTERFACE

View File

@@ -4,6 +4,14 @@
template <abi_t ABI> class D3D11SamplerState : public gfx::ID3D11SamplerState<ABI>
{
public:
ID3D11SamplerState *m_pFunction = nullptr;
D3D11SamplerState(ID3D11SamplerState *pState)
{
m_pFunction = pState;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -19,6 +27,10 @@ template <abi_t ABI> class D3D11SamplerState : public gfx::ID3D11SamplerState<AB
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
//
// ID3D11SamplerState
@@ -31,10 +43,17 @@ template <abi_t ABI> class D3D11SamplerState : public gfx::ID3D11SamplerState<AB
#define ABI_INTERFACE(ABI) D3D11SamplerState<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11RasterizerState : public gfx::ID3D11RasterizerState<ABI>
{
public:
ID3D11RasterizerState *m_pFunction = nullptr;
D3D11RasterizerState(ID3D11RasterizerState *pState)
{
m_pFunction = pState;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -50,6 +69,10 @@ template <abi_t ABI> class D3D11RasterizerState : public gfx::ID3D11RasterizerSt
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
//
// ID3D11RasterizerState
@@ -61,10 +84,17 @@ template <abi_t ABI> class D3D11RasterizerState : public gfx::ID3D11RasterizerSt
#define ABI_INTERFACE(ABI) D3D11RasterizerState<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11BlendState : public gfx::ID3D11BlendState<ABI>
{
public:
ID3D11BlendState *m_pFunction = nullptr;
D3D11BlendState(ID3D11BlendState *pState)
{
m_pFunction = pState;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -80,6 +110,10 @@ template <abi_t ABI> class D3D11BlendState : public gfx::ID3D11BlendState<ABI>
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
//
// ID3D11BlendState
@@ -91,10 +125,17 @@ template <abi_t ABI> class D3D11BlendState : public gfx::ID3D11BlendState<ABI>
#define ABI_INTERFACE(ABI) D3D11BlendState<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11DepthStencilState : public gfx::ID3D11DepthStencilState<ABI>
{
public:
ID3D11DepthStencilState *m_pFunction = nullptr;
D3D11DepthStencilState(ID3D11DepthStencilState *pState)
{
m_pFunction = pState;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -110,6 +151,10 @@ template <abi_t ABI> class D3D11DepthStencilState : public gfx::ID3D11DepthStenc
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
//
// ID3D11DepthStencilState

View File

@@ -1,9 +1,18 @@
#pragma once
#include "ID3D11Resource.h"
#include "d3d11_x.g.h"
template <abi_t ABI> class D3D11View : public gfx::ID3D11View<ABI>
{
public:
ID3D11View *m_pFunction = nullptr;
D3D11View(ID3D11View *pView)
{
m_pFunction = pView;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -19,6 +28,10 @@ template <abi_t ABI> class D3D11View : public gfx::ID3D11View<ABI>
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
//
// ID3D11View
@@ -30,10 +43,21 @@ template <abi_t ABI> class D3D11View : public gfx::ID3D11View<ABI>
#define ABI_INTERFACE(ABI) D3D11View<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11ShaderResourceView : public gfx::ID3D11ShaderResourceView<ABI>
{
public:
ID3D11ShaderResourceView *m_pFunction = nullptr;
D3D11Buffer<ABI> *m_pBuffer = nullptr;
D3D11Texture1D<ABI> *m_pTexture1D = nullptr;
D3D11Texture2D<ABI> *m_pTexture2D = nullptr;
D3D11Texture3D<ABI> *m_pTexture3D = nullptr;
D3D11ShaderResourceView(ID3D11ShaderResourceView *pView)
{
m_pFunction = pView;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -49,6 +73,10 @@ template <abi_t ABI> class D3D11ShaderResourceView : public gfx::ID3D11ShaderRes
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
//
// ID3D11View
@@ -59,7 +87,7 @@ template <abi_t ABI> class D3D11ShaderResourceView : public gfx::ID3D11ShaderRes
// ID3D11ShaderResourceView
//
void GetDesc(D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc);
void GetFormatX(gfx::D3D11X_SRV_FORMAT*);
void GetFormatX(gfx::D3D11X_SRV_FORMAT *);
int32_t SetFormatX(gfx::D3D11X_SRV_FORMAT const *);
};
@@ -67,10 +95,16 @@ template <abi_t ABI> class D3D11ShaderResourceView : public gfx::ID3D11ShaderRes
#define ABI_INTERFACE(ABI) D3D11ShaderResourceView<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11RenderTargetView : public gfx::ID3D11RenderTargetView<ABI>
{
public:
ID3D11RenderTargetView *m_pFunction = nullptr;
D3D11RenderTargetView(ID3D11RenderTargetView *pView)
{
m_pFunction = pView;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -86,6 +120,10 @@ template <abi_t ABI> class D3D11RenderTargetView : public gfx::ID3D11RenderTarge
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
//
// ID3D11View
@@ -102,10 +140,17 @@ template <abi_t ABI> class D3D11RenderTargetView : public gfx::ID3D11RenderTarge
#define ABI_INTERFACE(ABI) D3D11RenderTargetView<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11DepthStencilView : public gfx::ID3D11DepthStencilView<ABI>
{
public:
ID3D11DepthStencilView *m_pFunction = nullptr;
D3D11DepthStencilView(ID3D11DepthStencilView *pView)
{
m_pFunction = pView;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -121,6 +166,10 @@ template <abi_t ABI> class D3D11DepthStencilView : public gfx::ID3D11DepthStenci
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
//
// ID3D11View
@@ -137,10 +186,21 @@ template <abi_t ABI> class D3D11DepthStencilView : public gfx::ID3D11DepthStenci
#define ABI_INTERFACE(ABI) D3D11DepthStencilView<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);
template <abi_t ABI> class D3D11UnorderedAccessView : public gfx::ID3D11UnorderedAccessView<ABI>
{
public:
ID3D11UnorderedAccessView *m_pFunction = nullptr;
D3D11Buffer<ABI> *m_pBuffer = nullptr;
D3D11Texture1D<ABI> *m_pTexture1D = nullptr;
D3D11Texture2D<ABI> *m_pTexture2D = nullptr;
D3D11Texture3D<ABI> *m_pTexture3D = nullptr;
D3D11UnorderedAccessView(ID3D11UnorderedAccessView *pView)
{
m_pFunction = pView;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
@@ -156,6 +216,10 @@ template <abi_t ABI> class D3D11UnorderedAccessView : public gfx::ID3D11Unordere
HRESULT SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT SetName(LPCWSTR pName)
{
return S_OK;
}
//
// ID3D11View

View File

@@ -0,0 +1,45 @@
#pragma once
#include "d3d11_x.g.h"
template <abi_t ABI> class DXGIAdapter1 : public gfx::IDXGIAdapter1<ABI>
{
public:
IDXGIAdapter1 *m_pFunction{};
DXGIAdapter1(IDXGIAdapter1 *pAdapter)
{
m_pFunction = pAdapter;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
HRESULT QueryInterface(REFIID riid, void **ppvObject);
ULONG AddRef();
ULONG Release();
//
// IDXGIObject
//
HRESULT SetPrivateData(GUID const &Name, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(GUID const &Name, IUnknown const *pUnknown);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &Name, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT GetPrivateData(_GUID const &Name, UINT *pDataSize, void *pData);
HRESULT GetParent(_GUID const &riid, void **ppParent);
//
// IDXGIAdapter
//
HRESULT EnumOutputs(UINT Output, IDXGIOutput **ppOutput);
HRESULT GetDesc(DXGI_ADAPTER_DESC *pDesc);
HRESULT CheckInterfaceSupport(_GUID const &InterfaceName, LARGE_INTEGER *pUMDVersion);
//
// IDXGIAdapter1
//
HRESULT GetDesc1(DXGI_ADAPTER_DESC1 *pDesc);
};
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) DXGIAdapter1<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);

View File

@@ -0,0 +1,58 @@
#pragma once
#include "d3d11_x.g.h"
template <abi_t ABI> class DXGIDevice2 : public gfx::IDXGIDevice2<ABI>
{
public:
IDXGIDevice2 *m_pFunction{};
DXGIDevice2(::IDXGIDevice2 *pDevice)
{
m_pFunction = pDevice;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
HRESULT QueryInterface(REFIID riid, void **ppvObject);
ULONG AddRef();
ULONG Release();
//
// IDXGIObject
//
HRESULT SetPrivateData(GUID const &Name, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(GUID const &Name, IUnknown const *pUnknown);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &Name, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT GetPrivateData(_GUID const &Name, UINT *pDataSize, void *pData);
HRESULT GetParent(_GUID const &riid, void **ppParent);
//
// IDXGIDevice
//
HRESULT GetAdapter(gfx::IDXGIAdapter<ABI> **pAdapter);
HRESULT CreateSurface(DXGI_SURFACE_DESC const *pDesc, uint32_t NumSurfaces, DXGI_USAGE Usage,
DXGI_SHARED_RESOURCE const *pSharedResource, IDXGISurface **ppSurface);
HRESULT QueryResourceResidency(xbox::IGraphicsUnknown<ABI> **ppResources, DXGI_RESIDENCY *pResidencyStatus,
uint32_t NumResources);
HRESULT SetGPUThreadPriority(int Priority);
HRESULT GetGPUThreadPriority(int *pPriority);
//
// IDXGIDevice1
//
HRESULT SetMaximumFrameLatency(uint32_t MaxLatency);
HRESULT GetMaximumFrameLatency(uint32_t *pMaxLatency);
//
// IDXGIDevice2
//
HRESULT OfferResources(uint32_t NumResources, IDXGIResource *const *ppResources,
DXGI_OFFER_RESOURCE_PRIORITY Priority);
HRESULT ReclaimResources(uint32_t NumResources, IDXGIResource *const *ppResources, bool *pDiscarded);
HRESULT EnqueueSetEvent(void *hEvent);
};
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) DXGIDevice2<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);

View File

@@ -0,0 +1,69 @@
#pragma once
#include "d3d11_x.g.h"
template <abi_t ABI> class DXGIFactory2 : public gfx::IDXGIFactory2<ABI>
{
public:
IDXGIFactory2 *m_pFunction{};
DXGIFactory2(IDXGIFactory2 *pFactory)
{
m_pFunction = pFactory;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
HRESULT QueryInterface(REFIID riid, void **ppvObject);
ULONG AddRef();
ULONG Release();
//
// IDXGIObject
//
HRESULT SetPrivateData(GUID const &Name, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(GUID const &Name, IUnknown const *pUnknown);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &Name, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT GetPrivateData(_GUID const &Name, UINT *pDataSize, void *pData);
HRESULT GetParent(_GUID const &riid, void **ppParent);
//
// IDXGIFactory
//
HRESULT EnumAdapters(UINT Adapter, gfx::IDXGIAdapter<ABI> **ppAdapter);
HRESULT MakeWindowAssociation(HWND WindowHandle, UINT Flags);
HRESULT GetWindowAssociation(HWND *pWindowHandle);
HRESULT CreateSwapChain(xbox::IGraphicsUnknown<ABI> *pDevice, DXGI_SWAP_CHAIN_DESC *pDesc,
gfx::IDXGISwapChain<ABI> **ppSwapChain);
HRESULT CreateSoftwareAdapter(HMODULE Module, gfx::IDXGIAdapter<ABI> **ppAdapter);
//
// IDXGIFactory1
//
HRESULT EnumAdapters1(UINT Adapter, gfx::IDXGIAdapter1<ABI> **ppAdapter);
bool IsCurrent();
//
// IDXGIFactory2
//
bool IsWindowedStereoEnabled();
HRESULT CreateSwapChainForHwnd(xbox::IGraphicsUnknown<ABI> *pDevice, HWND hWnd, DXGI_SWAP_CHAIN_DESC1 const *pDesc,
DXGI_SWAP_CHAIN_FULLSCREEN_DESC const *pFullscreenDesc,
IDXGIOutput *pRestrictToOutput, gfx::IDXGISwapChain1<ABI> **ppSwapChain);
HRESULT CreateSwapChainForCoreWindow(xbox::IGraphicsUnknown<ABI> *pDevice, IUnknown *pWindow,
DXGI_SWAP_CHAIN_DESC1 *pDesc, IDXGIOutput *pRestrictToOutput,
gfx::IDXGISwapChain1<ABI> **ppSwapChain);
HRESULT GetSharedResourceAdapterLuid(void *hResource, _LUID *pLuid);
HRESULT RegisterStereoStatusWindow(HWND WindowHandle, uint32_t wMsg, uint32_t *pdwCookie);
HRESULT RegisterStereoStatusEvent(void *hEvent, uint32_t *pdwCookie);
void UnregisterStereoStatus(uint32_t dwCookie);
HRESULT RegisterOcclusionStatusWindow(HWND WindowHandle, uint32_t wMsg, uint32_t *pdwCookie);
HRESULT RegisterOcclusionStatusEvent(void *hEvent, uint32_t *pdwCookie);
void UnregisterOcclusionStatus(uint32_t dwCookie);
HRESULT CreateSwapChainForComposition(xbox::IGraphicsUnknown<ABI> *pDevice, DXGI_SWAP_CHAIN_DESC1 const *pDesc,
IDXGIOutput *pRestrictToOutput, gfx::IDXGISwapChain1<ABI> **ppSwapChain);
};
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) DXGIFactory2<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);

View File

@@ -0,0 +1,69 @@
#pragma once
#include "ID3D11Resource.h"
#include "d3d11_x.g.h"
template <abi_t ABI> class DXGISwapChain1 : public gfx::IDXGISwapChain1<ABI>
{
public:
IDXGISwapChain1 *m_pFunction{};
DXGISwapChain1(::IDXGISwapChain1 *pSwapChain)
{
m_pFunction = pSwapChain;
InterlockedIncrement(&this->m_RefCount);
}
//
// IUnknown
//
HRESULT QueryInterface(REFIID riid, void **ppvObject);
ULONG AddRef();
ULONG Release();
//
// IDXGIObject
//
HRESULT SetPrivateData(GUID const &Name, uint32_t DataSize, void const *pData);
HRESULT SetPrivateDataInterface(GUID const &Name, IUnknown const *pUnknown);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &Name, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT GetPrivateData(_GUID const &Name, UINT *pDataSize, void *pData);
HRESULT GetParent(_GUID const &riid, void **ppParent);
//
// IDXGIDeviceSubObject
//
HRESULT GetDevice(REFIID riid, void **ppDevice);
//
// IDXGISwapChain
//
HRESULT Present(uint32_t SyncInterval, uint32_t Flags);
HRESULT GetBuffer(UINT Buffer, REFIID riid, void **ppSurface);
HRESULT SetFullscreenState(bool Fullscreen, IDXGIOutput *pTarget);
HRESULT GetFullscreenState(bool *pFullscreen, IDXGIOutput **ppTarget);
HRESULT GetDesc(DXGI_SWAP_CHAIN_DESC *pDesc);
HRESULT ResizeBuffers(uint32_t BufferCount, uint32_t Width, uint32_t Height, DXGI_FORMAT NewFormat,
uint32_t SwapChainFlags);
HRESULT ResizeTarget(DXGI_MODE_DESC const *pNewTargetParameters);
HRESULT GetContainingOutput(IDXGIOutput **ppOutput);
HRESULT GetFrameStatistics(DXGI_FRAME_STATISTICS *pStats);
HRESULT GetLastPresentCount(uint32_t *pLastPresentCount);
//
// IDXGISwapChain1
//
HRESULT GetDesc1(DXGI_SWAP_CHAIN_DESC1 *pDesc);
HRESULT GetFullscreenDesc(DXGI_SWAP_CHAIN_FULLSCREEN_DESC *pDesc);
HRESULT GetHwnd(HWND *pHwnd);
HRESULT GetCoreWindow(REFIID refiid, void **ppUnk);
HRESULT Present1(uint32_t SyncInterval, uint32_t PresentFlags, DXGI_PRESENT_PARAMETERS const *pPresentParameters);
bool IsTemporaryMonoSupported();
HRESULT GetRestrictToOutput(IDXGIOutput **ppRestrictToOutput);
HRESULT SetBackgroundColor(DXGI_RGBA const *pColor);
HRESULT GetBackgroundColor(DXGI_RGBA *pColor);
HRESULT SetRotation(DXGI_MODE_ROTATION Rotation);
HRESULT GetRotation(DXGI_MODE_ROTATION *pRotation);
};
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) DXGISwapChain1<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);

View File

@@ -6,6 +6,7 @@
#include "unknown.g.h"
#include <d3d11_4.h>
#include <dxgi1_6.h>
namespace gfx
{
@@ -175,6 +176,12 @@ namespace gfx
template<abi_t ABI>
struct ID3D11PerformanceContextXVtbl;
template <abi_t ABI>
struct ID3D11UserDefinedAnnotationX;
template <abi_t ABI>
struct ID3D11UserDefinedAnnotationXVtbl;
template<abi_t ABI>
struct ID3D11Device;
@@ -211,6 +218,78 @@ namespace gfx
template<abi_t ABI>
struct ID3D11PerformanceDeviceXVtbl;
template <abi_t ABI>
struct IDXGIObject;
template <abi_t ABI>
struct IDXGIObjectVtbl;
template <abi_t ABI>
struct IDXGIDevice;
template <abi_t ABI>
struct IDXGIDeviceVtbl;
template <abi_t ABI>
struct IDXGIDevice1;
template <abi_t ABI>
struct IDXGIDevice1Vtbl;
template <abi_t ABI>
struct IDXGIDevice2;
template <abi_t ABI>
struct IDXGIDevice2Vtbl;
template <abi_t ABI>
struct IDXGIAdapter;
template <abi_t ABI>
struct IDXGIAdapterVtbl;
template <abi_t ABI>
struct IDXGIAdapter1;
template <abi_t ABI>
struct IDXGIAdapter1Vtbl;
template <abi_t ABI>
struct IDXGIDeviceSubObject;
template <abi_t ABI>
struct IDXGIDeviceSubObjectVtbl;
template <abi_t ABI>
struct IDXGISwapChain;
template <abi_t ABI>
struct IDXGISwapChainVtbl;
template <abi_t ABI>
struct IDXGISwapChain1;
template <abi_t ABI>
struct IDXGISwapChain1Vtbl;
template <abi_t ABI>
struct IDXGIFactory;
template <abi_t ABI>
struct IDXGIFactoryVtbl;
template <abi_t ABI>
struct IDXGIFactory1;
template <abi_t ABI>
struct IDXGIFactory1Vtbl;
template <abi_t ABI>
struct IDXGIFactory2;
template <abi_t ABI>
struct IDXGIFactory2Vtbl;
enum D3D11X_IMG_NUM_FORMAT
{
@@ -764,8 +843,8 @@ enum D3D11X_IMG_NUM_FORMAT
uint32_t *m_pCeBiasedLimit;
uint32_t *m_pCeLimit;
uint32_t m_Reserved2[64];
static const uint32_t BiasDwordCount = 128; //Placeholder value
static const uint32_t MakeCeSpaceDwordCount = 128; //Placeholder value
static const uint32_t BiasDwordCount = 70;
static const uint32_t MakeCeSpaceDwordCount = 1024;
};
template <abi_t ABI>
@@ -786,8 +865,16 @@ enum D3D11X_IMG_NUM_FORMAT
class ID3D11ComputeContextX;
template<abi_t ABI>
struct ID3D11DeviceChild : xbox::IGraphicsUnknown<ABI>
namespace details
{
template <abi_t ABI> struct ID3D11DeviceChildData
{
gfx::ID3D11Device<ABI> *m_pDevice;
void *m_pPrivateData;
};
}
template<abi_t ABI> struct ID3D11DeviceChild : xbox::IGraphicsUnknown<ABI>, details::ID3D11DeviceChildData<ABI>
{
virtual void GetDevice(gfx::ID3D11Device<ABI> **ppDevice) = 0;
virtual HRESULT GetPrivateData(_GUID const &guid, uint32_t *pDataSize, void *pData) = 0;
@@ -906,13 +993,13 @@ enum D3D11X_IMG_NUM_FORMAT
template<abi_t ABI>
struct ID3D11Buffer : gfx::ID3D11Resource<ABI>, details::ID3D11BufferData<ABI>
{
virtual void GetDesc(D3D11_TEXTURE1D_DESC *pDesc) = 0;
virtual void GetDesc(D3D11_BUFFER_DESC *pDesc) = 0;
};
template<abi_t ABI>
struct ID3D11BufferVtbl : gfx::ID3D11ResourceVtbl<ABI>
{
void(*GetDesc)(void *, D3D11_TEXTURE1D_DESC *pDesc);
void (*GetDesc)(void *, D3D11_BUFFER_DESC *pDesc);
};
template<abi_t ABI>
@@ -1259,7 +1346,7 @@ enum D3D11X_IMG_NUM_FORMAT
virtual void PSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers) = 0;
virtual void IASetInputLayout(ID3D11InputLayout *pInputLayout) = 0;
virtual void IASetVertexBuffers(UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppVertexBuffers, UINT const *pStrides, UINT const *pOffsets) = 0;
virtual void IASetIndexBuffer(UINT HardwareIndexFormat, gfx::ID3D11Buffer<ABI> *pIndexBuffer, UINT Offset) = 0;
virtual void IASetIndexBuffer(gfx::ID3D11Buffer<ABI> *pIndexBuffer, UINT HardwareIndexFormat, UINT Offset) = 0;
virtual void DrawIndexedInstanced(UINT StartIndexLocationAndIndexCountPerInstance, UINT64 BaseVertexLocationAndStartInstanceLocation, UINT64 InstanceCount) = 0;
virtual void DrawInstanced(UINT VertexCountPerInstance, UINT64 StartVertexLocationAndStartInstanceLocation, UINT InstanceCount) = 0;
virtual void GSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers) = 0;
@@ -1485,7 +1572,7 @@ enum D3D11X_IMG_NUM_FORMAT
void(*PSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void(*IASetInputLayout)(void *, ID3D11InputLayout *pInputLayout);
void(*IASetVertexBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppVertexBuffers, UINT const *pStrides, UINT const *pOffsets);
void(*IASetIndexBuffer)(void *, UINT HardwareIndexFormat, gfx::ID3D11Buffer<ABI> *pIndexBuffer, UINT Offset);
void (*IASetIndexBuffer)(void *, gfx::ID3D11Buffer<ABI> *pIndexBuffer, UINT HardwareIndexFormat, UINT Offset);
void(*DrawIndexedInstanced)(void *, UINT StartIndexLocationAndIndexCountPerInstance, UINT64 BaseVertexLocationAndStartInstanceLocation, UINT64 InstanceCount);
void(*DrawInstanced)(void *, UINT VertexCountPerInstance, UINT64 StartVertexLocationAndStartInstanceLocation, UINT InstanceCount);
void(*GSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
@@ -2199,6 +2286,16 @@ enum D3D11X_IMG_NUM_FORMAT
struct ID3D11PerformanceContextXVtbl : gfx::ID3D11DeviceContextXVtbl<ABI>
{
};
template <abi_t ABI>
struct ID3D11UserDefinedAnnotationX : gfx::ID3D11DeviceContextX<ABI>
{
};
template <abi_t ABI>
struct ID3D11UserDefinedAnnotationXVtbl : gfx::ID3D11DeviceContextXVtbl<ABI>
{
};
template<abi_t ABI>
struct ID3D11Device : xbox::IGraphicsUnknown<ABI>
@@ -2526,6 +2623,294 @@ enum D3D11X_IMG_NUM_FORMAT
struct ID3D11PerformanceDeviceXVtbl : gfx::ID3D11DeviceXVtbl<ABI>
{
};
namespace details
{
template <abi_t ABI> struct IDXGIObjectData
{
void *m_pPrivateData;
};
}
template <abi_t ABI> struct IDXGIObject : xbox::IGraphicsUnknown<ABI>, details::IDXGIObjectData<ABI>
{
virtual HRESULT SetPrivateData(GUID const &Name, uint32_t DataSize, void const *pData) = 0;
virtual HRESULT SetPrivateDataInterface(GUID const &Name, IUnknown const *pUnknown) = 0;
virtual HRESULT SetPrivateDataInterfaceGraphics(_GUID const &Name,
xbox::IGraphicsUnknown<ABI> const *pData) = 0;
virtual HRESULT GetPrivateData(_GUID const &Name, UINT *pDataSize, void *pData) = 0;
virtual HRESULT GetParent(_GUID const &riid, void **ppParent) = 0;
};
template <abi_t ABI> struct IDXGIObjectVtbl : xbox::IGraphicsUnknownVtbl<ABI>
{
HRESULT (*SetPrivateData)(void *, GUID const &Name, uint32_t DataSize, void const *pData);
HRESULT (*SetPrivateDataInterface)(void *, GUID const &Name, IUnknown const *pUnknown);
HRESULT (*SetPrivateDataInterfaceGraphics)(void *, _GUID const &Name, xbox::IGraphicsUnknown<ABI> const *pData);
HRESULT (*GetPrivateData)(void *, _GUID const &Name, UINT *pDataSize, void *pData);
HRESULT (*GetParent)(void *, _GUID const &riid, void **ppParent);
};
template <abi_t ABI>
requires(ABI >= abi_t{10, 0, 14393, 2152})
struct IDXGIObject<ABI> : xbox::IGraphicsUnknown<ABI>, details::IDXGIObjectData<ABI>
{
virtual HRESULT SetPrivateData(GUID const &Name, uint32_t DataSize, void const *pData) = 0;
virtual HRESULT SetPrivateDataInterface(GUID const &Name, IUnknown const *pUnknown) = 0;
virtual HRESULT GetPrivateData(_GUID const &Name, UINT *pDataSize, void *pData) = 0;
virtual HRESULT GetParent(_GUID const &riid, void **ppParent) = 0;
};
template <abi_t ABI>
requires(ABI >= abi_t{10, 0, 14393, 2152})
struct IDXGIObjectVtbl<ABI> : xbox::IGraphicsUnknownVtbl<ABI>
{
HRESULT (*SetPrivateData)(void *, GUID const &Name, uint32_t DataSize, void const *pData);
HRESULT (*SetPrivateDataInterface)(void *, GUID const &Name, IUnknown const *pUnknown);
HRESULT (*GetPrivateData)(void *, _GUID const &Name, UINT *pDataSize, void *pData);
HRESULT (*GetParent)(void *, _GUID const &riid, void **ppParent);
};
namespace details
{
template <abi_t ABI> struct IDXGIDeviceData
{
gfx::ID3D11Device<ABI> *m_pDevice;
};
}
template <abi_t ABI> struct IDXGIDevice : gfx::IDXGIObject<ABI>, details::IDXGIDeviceData<ABI>
{
virtual HRESULT GetAdapter(gfx::IDXGIAdapter<ABI> **pAdapter) = 0;
virtual HRESULT CreateSurface(DXGI_SURFACE_DESC const *pDesc, uint32_t NumSurfaces, DXGI_USAGE Usage,
DXGI_SHARED_RESOURCE const *pSharedResource, IDXGISurface **ppSurface) = 0;
virtual HRESULT QueryResourceResidency(xbox::IGraphicsUnknown<ABI> **ppResources,
DXGI_RESIDENCY *pResidencyStatus, uint32_t NumResources) = 0;
virtual HRESULT SetGPUThreadPriority(int Priority) = 0;
virtual HRESULT GetGPUThreadPriority(int *pPriority) = 0;
};
template <abi_t ABI> struct IDXGIDeviceVtbl : gfx::IDXGIObjectVtbl<ABI>
{
HRESULT (*GetAdapter)(void *, gfx::IDXGIAdapter<ABI> **pAdapter);
HRESULT (*CreateSurface)(void *, DXGI_SURFACE_DESC const *pDesc, uint32_t NumSurfaces, DXGI_USAGE Usage,
DXGI_SHARED_RESOURCE const *pSharedResource, IDXGISurface **ppSurface);
HRESULT (*QueryResourceResidency)(void *, xbox::IGraphicsUnknown<ABI> **ppResources,
DXGI_RESIDENCY *pResidencyStatus, uint32_t NumResources);
HRESULT (*SetGPUThreadPriority)(void *, int Priority);
HRESULT (*GetGPUThreadPriority)(void *, int *pPriority);
};
template <abi_t ABI> struct IDXGIDevice1 : gfx::IDXGIDevice<ABI>
{
virtual HRESULT SetMaximumFrameLatency(uint32_t MaxLatency) = 0;
virtual HRESULT GetMaximumFrameLatency(uint32_t *pMaxLatency) = 0;
};
template <abi_t ABI> struct IDXGIDevice1Vtbl : gfx::IDXGIDeviceVtbl<ABI>
{
HRESULT (*SetMaximumFrameLatency)(void *, uint32_t MaxLatency);
HRESULT (*GetMaximumFrameLatency)(void *, uint32_t *pMaxLatency);
};
template <abi_t ABI> struct IDXGIDevice2 : gfx::IDXGIDevice1<ABI>
{
virtual HRESULT OfferResources(uint32_t NumResources, IDXGIResource *const *ppResources,
DXGI_OFFER_RESOURCE_PRIORITY Priority) = 0;
virtual HRESULT ReclaimResources(uint32_t NumResources, IDXGIResource *const *ppResources,
bool *pDiscarded) = 0;
virtual HRESULT EnqueueSetEvent(void *hEvent) = 0;
};
template <abi_t ABI> struct IDXGIDevice2Vtbl : gfx::IDXGIDevice1Vtbl<ABI>
{
HRESULT (*OfferResources)(void *, uint32_t NumResources, IDXGIResource *const *ppResources,
DXGI_OFFER_RESOURCE_PRIORITY Priority);
HRESULT (*ReclaimResources)(void *, uint32_t NumResources, IDXGIResource *const *ppResources, bool *pDiscarded);
HRESULT (*EnqueueSetEvent)(void *, void *hEvent);
};
template <abi_t ABI> struct IDXGIAdapter : gfx::IDXGIObject<ABI>
{
virtual HRESULT EnumOutputs(UINT Output, IDXGIOutput **ppOutput) = 0;
virtual HRESULT GetDesc(DXGI_ADAPTER_DESC *pDesc) = 0;
virtual HRESULT CheckInterfaceSupport(_GUID const &InterfaceName, LARGE_INTEGER *pUMDVersion) = 0;
};
template <abi_t ABI> struct IDXGIAdapterVtbl : gfx::IDXGIObjectVtbl<ABI>
{
HRESULT (*EnumOutputs)(void *, UINT Output, IDXGIOutput **ppOutput);
HRESULT (*GetDesc)(void *, DXGI_ADAPTER_DESC *pDesc);
HRESULT (*CheckInterfaceSupport)(void *, _GUID const &InterfaceName, LARGE_INTEGER *pUMDVersion);
};
template <abi_t ABI> struct IDXGIAdapter1 : gfx::IDXGIAdapter<ABI>
{
virtual HRESULT GetDesc1(DXGI_ADAPTER_DESC1 *pDesc) = 0;
};
template <abi_t ABI> struct IDXGIAdapter1Vtbl : gfx::IDXGIAdapterVtbl<ABI>
{
HRESULT (*GetDesc1)(void *, DXGI_ADAPTER_DESC1 *pDesc);
};
template <abi_t ABI> struct IDXGIDeviceSubObject : gfx::IDXGIObject<ABI>
{
virtual HRESULT GetDevice(REFIID riid, void **ppDevice) = 0;
};
template <abi_t ABI> struct IDXGIDeviceSubObjectVtbl : gfx::IDXGIObjectVtbl<ABI>
{
HRESULT (*GetDevice)(void *, REFIID riid, void **ppDevice);
};
template <abi_t ABI> struct IDXGISwapChain : gfx::IDXGIDeviceSubObject<ABI>
{
virtual HRESULT Present(uint32_t SyncInterval, uint32_t Flags) = 0;
virtual HRESULT GetBuffer(UINT Buffer, REFIID riid, void **ppSurface) = 0;
virtual HRESULT SetFullscreenState(bool Fullscreen, IDXGIOutput *pTarget) = 0;
virtual HRESULT GetFullscreenState(bool *pFullscreen, IDXGIOutput **ppTarget) = 0;
virtual HRESULT GetDesc(DXGI_SWAP_CHAIN_DESC *pDesc) = 0;
virtual HRESULT ResizeBuffers(uint32_t BufferCount, uint32_t Width, uint32_t Height, DXGI_FORMAT NewFormat,
uint32_t SwapChainFlags) = 0;
virtual HRESULT ResizeTarget(DXGI_MODE_DESC const *pNewTargetParameters) = 0;
virtual HRESULT GetContainingOutput(IDXGIOutput **ppOutput) = 0;
virtual HRESULT GetFrameStatistics(DXGI_FRAME_STATISTICS *pStats) = 0;
virtual HRESULT GetLastPresentCount(uint32_t *pLastPresentCount) = 0;
};
template <abi_t ABI> struct IDXGISwapChainVtbl : gfx::IDXGIDeviceSubObjectVtbl<ABI>
{
HRESULT (*Present)(void *, uint32_t SyncInterval, uint32_t Flags);
HRESULT (*GetBuffer)(void *, UINT Buffer, REFIID riid, void **ppSurface);
HRESULT (*SetFullscreenState)(void *, bool Fullscreen, IDXGIOutput *pTarget);
HRESULT (*GetFullscreenState)(void *, bool *pFullscreen, IDXGIOutput **ppTarget);
HRESULT (*GetDesc)(void *, DXGI_SWAP_CHAIN_DESC *pDesc);
HRESULT (*ResizeBuffers)(void *, uint32_t BufferCount, uint32_t Width, uint32_t Height, DXGI_FORMAT NewFormat,
uint32_t SwapChainFlags);
HRESULT (*ResizeTarget)(void *, DXGI_MODE_DESC const *pNewTargetParameters);
HRESULT (*GetContainingOutput)(void *, IDXGIOutput **ppOutput);
HRESULT (*GetFrameStatistics)(void *, DXGI_FRAME_STATISTICS *pStats);
HRESULT (*GetLastPresentCount)(void *, uint32_t *pLastPresentCount);
};
template <abi_t ABI> struct IDXGISwapChain1 : gfx::IDXGISwapChain<ABI>
{
virtual HRESULT GetDesc1(DXGI_SWAP_CHAIN_DESC1 *pDesc) = 0;
virtual HRESULT GetFullscreenDesc(DXGI_SWAP_CHAIN_FULLSCREEN_DESC *pDesc) = 0;
virtual HRESULT GetHwnd(HWND *pHwnd) = 0;
virtual HRESULT GetCoreWindow(REFIID refiid, void **ppUnk) = 0;
virtual HRESULT Present1(uint32_t SyncInterval, uint32_t PresentFlags,
DXGI_PRESENT_PARAMETERS const *pPresentParameters) = 0;
virtual bool IsTemporaryMonoSupported() = 0;
virtual HRESULT GetRestrictToOutput(IDXGIOutput **ppRestrictToOutput) = 0;
virtual HRESULT SetBackgroundColor(DXGI_RGBA const *pColor) = 0;
virtual HRESULT GetBackgroundColor(DXGI_RGBA *pColor) = 0;
virtual HRESULT SetRotation(DXGI_MODE_ROTATION Rotation) = 0;
virtual HRESULT GetRotation(DXGI_MODE_ROTATION *pRotation) = 0;
};
template <abi_t ABI> struct IDXGISwapChain1Vtbl : gfx::IDXGISwapChainVtbl<ABI>
{
HRESULT (*GetDesc1)(void *, DXGI_SWAP_CHAIN_DESC1 *pDesc);
HRESULT (*GetFullscreenDesc)(void *, DXGI_SWAP_CHAIN_FULLSCREEN_DESC *pDesc);
HRESULT (*GetHwnd)(void *, HWND *pHwnd);
HRESULT (*GetCoreWindow)(void *, REFIID refiid, void **ppUnk);
HRESULT (*Present1)(void *, uint32_t SyncInterval, uint32_t PresentFlags,
DXGI_PRESENT_PARAMETERS const *pPresentParameters);
bool (*IsTemporaryMonoSupported)(void *);
HRESULT (*GetRestrictToOutput)(void *, IDXGIOutput **ppRestrictToOutput);
HRESULT (*SetBackgroundColor)(void *, DXGI_RGBA const *pColor);
HRESULT (*GetBackgroundColor)(void *, DXGI_RGBA *pColor);
HRESULT (*SetRotation)(void *, DXGI_MODE_ROTATION Rotation);
HRESULT (*GetRotation)(void *, DXGI_MODE_ROTATION *pRotation);
};
namespace details
{
template <abi_t ABI> struct IDXGIFactoryData
{
IDXGIAdapter2 *m_pAdapter;
};
} // namespace details
template <abi_t ABI> struct IDXGIFactory : gfx::IDXGIObject<ABI>, details::IDXGIFactoryData<ABI>
{
virtual HRESULT EnumAdapters(UINT Adapter, gfx::IDXGIAdapter<ABI> **ppAdapter) = 0;
virtual HRESULT MakeWindowAssociation(HWND WindowHandle, UINT Flags) = 0;
virtual HRESULT GetWindowAssociation(HWND *pWindowHandle) = 0;
virtual HRESULT CreateSwapChain(xbox::IGraphicsUnknown<ABI> *pDevice, DXGI_SWAP_CHAIN_DESC *pDesc,
gfx::IDXGISwapChain<ABI> **ppSwapChain) = 0;
virtual HRESULT CreateSoftwareAdapter(HMODULE Module, gfx::IDXGIAdapter<ABI> **ppAdapter) = 0;
};
template <abi_t ABI> struct IDXGIFactoryVtbl : gfx::IDXGIObjectVtbl<ABI>
{
HRESULT (*EnumAdapters)(void *, UINT Adapter, gfx::IDXGIAdapter<ABI> **ppAdapter);
HRESULT (*MakeWindowAssociation)(void *, HWND WindowHandle, UINT Flags);
HRESULT (*GetWindowAssociation)(void *, HWND *pWindowHandle);
HRESULT (*CreateSwapChain)(void *, xbox::IGraphicsUnknown<ABI> *pDevice, DXGI_SWAP_CHAIN_DESC *pDesc,
gfx::IDXGISwapChain<ABI> **ppSwapChain);
HRESULT (*CreateSoftwareAdapter)(void *, HMODULE Module, gfx::IDXGIAdapter<ABI> **ppAdapter);
};
template <abi_t ABI> struct IDXGIFactory1 : gfx::IDXGIFactory<ABI>
{
virtual HRESULT EnumAdapters1(UINT Adapter, gfx::IDXGIAdapter1<ABI> **ppAdapter) = 0;
virtual bool IsCurrent() = 0;
};
template <abi_t ABI> struct IDXGIFactory1Vtbl : gfx::IDXGIFactoryVtbl<ABI>
{
HRESULT (*EnumAdapters1)(void *, UINT Adapter, gfx::IDXGIAdapter1<ABI> **ppAdapter);
bool (*IsCurrent)(void *);
};
template <abi_t ABI> struct IDXGIFactory2 : gfx::IDXGIFactory1<ABI>
{
virtual bool IsWindowedStereoEnabled() = 0;
virtual HRESULT CreateSwapChainForHwnd(xbox::IGraphicsUnknown<ABI> *pDevice, HWND hWnd,
DXGI_SWAP_CHAIN_DESC1 const *pDesc,
DXGI_SWAP_CHAIN_FULLSCREEN_DESC const *pFullscreenDesc,
IDXGIOutput *pRestrictToOutput,
gfx::IDXGISwapChain1<ABI> **ppSwapChain) = 0;
virtual HRESULT CreateSwapChainForCoreWindow(xbox::IGraphicsUnknown<ABI> *pDevice, IUnknown *pWindow,
DXGI_SWAP_CHAIN_DESC1 *pDesc, IDXGIOutput *pRestrictToOutput,
gfx::IDXGISwapChain1<ABI> **ppSwapChain) = 0;
virtual HRESULT GetSharedResourceAdapterLuid(void *hResource, _LUID *pLuid) = 0;
virtual HRESULT RegisterStereoStatusWindow(HWND WindowHandle, uint32_t wMsg, uint32_t *pdwCookie) = 0;
virtual HRESULT RegisterStereoStatusEvent(void *hEvent, uint32_t *pdwCookie) = 0;
virtual void UnregisterStereoStatus(uint32_t dwCookie) = 0;
virtual HRESULT RegisterOcclusionStatusWindow(HWND WindowHandle, uint32_t wMsg, uint32_t *pdwCookie) = 0;
virtual HRESULT RegisterOcclusionStatusEvent(void *hEvent, uint32_t *pdwCookie) = 0;
virtual void UnregisterOcclusionStatus(uint32_t dwCookie) = 0;
virtual HRESULT CreateSwapChainForComposition(xbox::IGraphicsUnknown<ABI> *pDevice,
DXGI_SWAP_CHAIN_DESC1 const *pDesc,
IDXGIOutput *pRestrictToOutput,
gfx::IDXGISwapChain1<ABI> **ppSwapChain) = 0;
};
template <abi_t ABI> struct IDXGIFactory2Vtbl : gfx::IDXGIFactory1Vtbl<ABI>
{
bool (*IsWindowedStereoEnabled)(void *);
HRESULT (*CreateSwapChainForHwnd)(void *, xbox::IGraphicsUnknown<ABI> *pDevice, HWND hWnd,
DXGI_SWAP_CHAIN_DESC1 const *pDesc,
DXGI_SWAP_CHAIN_FULLSCREEN_DESC const *pFullscreenDesc,
IDXGIOutput *pRestrictToOutput, gfx::IDXGISwapChain1<ABI> **ppSwapChain);
HRESULT (*CreateSwapChainForCoreWindow)(void *, xbox::IGraphicsUnknown<ABI> *pDevice, IUnknown *pWindow,
DXGI_SWAP_CHAIN_DESC1 *pDesc, IDXGIOutput *pRestrictToOutput,
gfx::IDXGISwapChain1<ABI> **ppSwapChain);
HRESULT (*GetSharedResourceAdapterLuid)(void *, void *hResource, _LUID *pLuid);
HRESULT (*RegisterStereoStatusWindow)(void *, HWND WindowHandle, uint32_t wMsg, uint32_t *pdwCookie);
HRESULT (*RegisterStereoStatusEvent)(void *, void *hEvent, uint32_t *pdwCookie);
void (*UnregisterStereoStatus)(void *, uint32_t dwCookie);
HRESULT (*RegisterOcclusionStatusWindow)(void *, HWND WindowHandle, uint32_t wMsg, uint32_t *pdwCookie);
HRESULT (*RegisterOcclusionStatusEvent)(void *, void *hEvent, uint32_t *pdwCookie);
void (*UnregisterOcclusionStatus)(void *, uint32_t dwCookie);
HRESULT (*CreateSwapChainForComposition)(void *, xbox::IGraphicsUnknown<ABI> *pDevice,
DXGI_SWAP_CHAIN_DESC1 const *pDesc, IDXGIOutput *pRestrictToOutput,
gfx::IDXGISwapChain1<ABI> **ppSwapChain);
};
}
DECLARE_ABI_UUIDOF_HELPER(gfx::ID3D11DeviceChild, 0x1841E5C8,0x16B0,0x489B,0xBC,0xC8,0x44,0xCF,0xB0,0xD5,0xDE,0xAE)
@@ -2580,6 +2965,8 @@ DECLARE_ABI_UUIDOF_HELPER(gfx::ID3D11DeviceContextX, 0x48800095,0x7134,0x4BE7,0x
DECLARE_ABI_UUIDOF_HELPER(gfx::ID3D11PerformanceContextX, 0x9458FE06,0xC78D,0x47F7,0x96,0xA0,0xEC,0x7B,0x72,0x7B,0xE1,0xE9)
DECLARE_ABI_UUIDOF_HELPER(gfx::ID3D11UserDefinedAnnotationX, 0xB2DAAD8B, 0x03D4, 0x4DBF, 0x95, 0xEB, 0x32, 0xAB, 0x4B, 0x63, 0xD0, 0xAB)
DECLARE_ABI_UUIDOF_HELPER(gfx::ID3D11Device, 0xDB6F6DDB,0xAC77,0x4E88,0x82,0x53,0x81,0x9D,0xF9,0xBB,0xF1,0x40)
DECLARE_ABI_UUIDOF_HELPER(gfx::ID3D11Device1, 0xA04BFB29,0x08EF,0x43D6,0xA4,0x9C,0xA9,0xBD,0xBD,0xCB,0xE6,0x86)
@@ -2592,6 +2979,30 @@ DECLARE_ABI_UUIDOF_HELPER(gfx::ID3D11DeviceX, 0x177700F9,0x876A,0x4436,0xB3,0x68
DECLARE_ABI_UUIDOF_HELPER(gfx::ID3D11PerformanceDeviceX, 0x88671610,0x712E,0x4F1E,0x84,0xAB,0x01,0xB5,0x94,0x8B,0xD3,0x73)
DECLARE_ABI_UUIDOF_HELPER(gfx::IDXGIObject, 0xAEC22FB8, 0x76F3, 0x4639, 0x9B, 0xE0, 0x28, 0xEB, 0x43, 0xA6, 0x7A, 0x2E)
DECLARE_ABI_UUIDOF_HELPER(gfx::IDXGIDevice, 0x54EC77FA, 0x1377, 0x44E6, 0x8C, 0x32, 0x88, 0xFD, 0x5F, 0x44, 0xC8, 0x4C)
DECLARE_ABI_UUIDOF_HELPER(gfx::IDXGIDevice1, 0x77DB970F, 0x6276, 0x48BA, 0xBA, 0x28, 0x07, 0x01, 0x43, 0xB4, 0x39, 0x2C)
DECLARE_ABI_UUIDOF_HELPER(gfx::IDXGIDevice2, 0x05008617, 0xFBFD, 0x4051, 0xA7, 0x90, 0x14, 0x48, 0x84, 0xB4, 0xF6, 0xA9)
DECLARE_ABI_UUIDOF_HELPER(gfx::IDXGIAdapter, 0x2411E7E1, 0x12AC, 0x4CCF, 0xBD, 0x14, 0x97, 0x98, 0xE8, 0x53, 0x4D, 0xC0)
DECLARE_ABI_UUIDOF_HELPER(gfx::IDXGIAdapter1, 0x29038F61, 0x3839, 0x4626, 0x91, 0xFD, 0x08, 0x68, 0x79, 0x01, 0x1A, 0x05)
DECLARE_ABI_UUIDOF_HELPER(gfx::IDXGIDeviceSubObject, 0x3D3E0379, 0xF9DE, 0x4D58, 0xBB, 0x6C, 0x18, 0xD6, 0x29, 0x92, 0xF1, 0xA6)
DECLARE_ABI_UUIDOF_HELPER(gfx::IDXGISwapChain, 0x310D36A0, 0xD2E7, 0x4C0A, 0xAA, 0x04, 0x6A, 0x9D, 0x23, 0xB8, 0x88, 0x6A)
DECLARE_ABI_UUIDOF_HELPER(gfx::IDXGISwapChain1, 0x310D36A0, 0xD2E7, 0x4C0A, 0xAA, 0x04, 0x6A, 0x9D, 0x23, 0xB8, 0x88, 0x6A)
DECLARE_ABI_UUIDOF_HELPER(gfx::IDXGIFactory, 0x7B7166EC, 0x21C7, 0x44AE, 0xB2, 0x1A, 0xC9, 0xAE, 0x32, 0x1A, 0xE3, 0x69)
DECLARE_ABI_UUIDOF_HELPER(gfx::IDXGIFactory1, 0x29038F61, 0x3839, 0x4626, 0x91, 0xFD, 0x08, 0x68, 0x79, 0x01, 0x1A, 0x05)
DECLARE_ABI_UUIDOF_HELPER(gfx::IDXGIFactory2, 0x29038F61, 0x3839, 0x4626, 0x91, 0xFD, 0x08, 0x68, 0x79, 0x01, 0x1A, 0x05)
template<template<abi_t> typename T>
inline HRESULT d3d11CreateInstance(abi_t ABI, void **ppvObject)
{

View File

@@ -1,24 +1,63 @@
#include "ID3D11Device.h"
#include "IDXGIDevice.h"
#include "ID3D11Resource.h"
#include "ID3D11View.h"
#include "ID3D11State.h"
#include "ID3D11Shader.h"
#include "ID3D11DeviceContext.h"
#include "ID3D11Runtime.h"
//
// IUnknown
//
template <abi_t ABI> HRESULT D3D11DeviceX<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
if (riid == xcom::guid_of<gfx::ID3D11Device>() || riid == xcom::guid_of<gfx::ID3D11Device1>() ||
riid == xcom::guid_of<gfx::ID3D11Device2>() || riid == xcom::guid_of<gfx::ID3D11DeviceX>() ||
riid == xcom::guid_of<gfx::ID3D11PerformanceDeviceX>())
{
*ppvObject = this;
AddRef();
return S_OK;
}
if (riid == xcom::guid_of<gfx::IDXGIDevice>() || riid == xcom::guid_of<gfx::IDXGIDevice1>() ||
riid == xcom::guid_of<gfx::IDXGIDevice2>())
{
m_pFunction->QueryInterface(__uuidof(IDXGIDevice2), ppvObject);
*ppvObject = new DXGIDevice2<ABI>(static_cast<IDXGIDevice2 *>(*ppvObject));
return S_OK;
}
if (riid == xcom::guid_of<xbox::IGraphicsUnwrap>())
{
*ppvObject = m_pFunction;
return S_OK;
}
if (riid == __uuidof(ID3D11InfoQueue))
{
*ppvObject = nullptr;
return E_NOINTERFACE;
}
IMPLEMENT_STUB();
return E_NOTIMPL;
*ppvObject = nullptr;
return E_NOINTERFACE;
}
template <abi_t ABI> ULONG D3D11DeviceX<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11DeviceX<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
@@ -28,32 +67,77 @@ template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateBuffer(D3D11_BUFFER_DESC const *pDesc, D3D11_SUBRESOURCE_DATA const *pData,
gfx::ID3D11Buffer<ABI> **ppBuffer)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
auto pDesc2 = *pDesc;
pDesc2.MiscFlags = ConvertMiscFlags(pDesc->MiscFlags);
HRESULT hr = 0;
ID3D11Buffer *Buffer = nullptr;
hr = m_pFunction->CreateBuffer(&pDesc2, pData, &Buffer);
if (Buffer)
{
*ppBuffer = new D3D11Buffer<ABI>(Buffer);
}
return hr;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateTexture1D(D3D11_TEXTURE1D_DESC const *pDesc, D3D11_SUBRESOURCE_DATA const *pData,
gfx::ID3D11Texture1D<ABI> **ppTexture1D)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
auto pDesc2 = *pDesc;
pDesc2.MiscFlags = ConvertMiscFlags(pDesc->MiscFlags);
HRESULT hr = 0;
ID3D11Texture1D *Tex = nullptr;
hr = m_pFunction->CreateTexture1D(&pDesc2, pData, &Tex);
if (Tex)
{
*ppTexture1D = new D3D11Texture1D<ABI>(Tex);
}
return hr;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateTexture2D(D3D11_TEXTURE2D_DESC const *pDesc, D3D11_SUBRESOURCE_DATA const *pData,
gfx::ID3D11Texture2D<ABI> **ppTexture2D)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
auto pDesc2 = *pDesc;
pDesc2.MiscFlags = ConvertMiscFlags(pDesc->MiscFlags);
pDesc2.SampleDesc.Quality = 0;
HRESULT hr = 0;
ID3D11Texture2D *Tex = nullptr;
hr = m_pFunction->CreateTexture2D(&pDesc2, pData, &Tex);
if (Tex)
{
*ppTexture2D = new D3D11Texture2D<ABI>(Tex);
}
return hr;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateTexture3D(D3D11_TEXTURE3D_DESC const *pDesc, D3D11_SUBRESOURCE_DATA const *pData,
gfx::ID3D11Texture3D<ABI> **ppTexture3D)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
auto pDesc2 = *pDesc;
pDesc2.MiscFlags = ConvertMiscFlags(pDesc->MiscFlags);
HRESULT hr = 0;
ID3D11Texture3D *Tex = nullptr;
hr = m_pFunction->CreateTexture3D(&pDesc2, pData, &Tex);
if (Tex)
{
*ppTexture3D = new D3D11Texture3D<ABI>(Tex);
}
return hr;
}
template <abi_t ABI>
@@ -61,8 +145,66 @@ HRESULT D3D11DeviceX<ABI>::CreateShaderResourceView(gfx::ID3D11Resource<ABI> *pR
D3D11_SHADER_RESOURCE_VIEW_DESC const *pDesc,
gfx::ID3D11ShaderResourceView<ABI> **ppSRV)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
HRESULT hr = 0;
D3D11_RESOURCE_DIMENSION Type{};
pResource->GetType(&Type);
ID3D11ShaderResourceView *pView = nullptr;
if (Type == D3D11_RESOURCE_DIMENSION_BUFFER)
{
hr = m_pFunction->CreateShaderResourceView(static_cast<D3D11Buffer<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE1D)
{
hr = m_pFunction->CreateShaderResourceView(static_cast<D3D11Texture1D<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE2D)
{
hr = m_pFunction->CreateShaderResourceView(static_cast<D3D11Texture2D<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE3D)
{
hr = m_pFunction->CreateShaderResourceView(static_cast<D3D11Texture3D<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_UNKNOWN)
{
hr = m_pFunction->CreateShaderResourceView(static_cast<D3D11Resource<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
if (pView)
{
*ppSRV = new D3D11ShaderResourceView<ABI>(pView);
(*ppSRV)->m_pAllocationStart = pResource->m_pAllocationStart;
if (Type == D3D11_RESOURCE_DIMENSION_BUFFER)
{
static_cast<D3D11ShaderResourceView<ABI> *>(*ppSRV)->m_pBuffer = static_cast<D3D11Buffer<ABI> *>(pResource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE1D)
{
static_cast<D3D11ShaderResourceView<ABI> *>(*ppSRV)->m_pTexture1D =
static_cast<D3D11Texture1D<ABI> *>(pResource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE2D)
{
static_cast<D3D11ShaderResourceView<ABI> *>(*ppSRV)->m_pTexture2D =
static_cast<D3D11Texture2D<ABI> *>(pResource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE3D)
{
static_cast<D3D11ShaderResourceView<ABI> *>(*ppSRV)->m_pTexture3D =
static_cast<D3D11Texture3D<ABI> *>(pResource);
}
}
return hr;
}
template <abi_t ABI>
@@ -70,8 +212,67 @@ HRESULT D3D11DeviceX<ABI>::CreateUnorderedAccessView(gfx::ID3D11Resource<ABI> *p
D3D11_UNORDERED_ACCESS_VIEW_DESC const *pDesc,
gfx::ID3D11UnorderedAccessView<ABI> **ppUAV)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
HRESULT hr = 0;
D3D11_RESOURCE_DIMENSION Type{};
pResource->GetType(&Type);
ID3D11UnorderedAccessView *pView = nullptr;
if (Type == D3D11_RESOURCE_DIMENSION_BUFFER)
{
hr = m_pFunction->CreateUnorderedAccessView(static_cast<D3D11Buffer<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE1D)
{
hr = m_pFunction->CreateUnorderedAccessView(static_cast<D3D11Texture1D<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE2D)
{
hr = m_pFunction->CreateUnorderedAccessView(static_cast<D3D11Texture2D<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE3D)
{
hr = m_pFunction->CreateUnorderedAccessView(static_cast<D3D11Texture3D<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_UNKNOWN)
{
hr = m_pFunction->CreateUnorderedAccessView(static_cast<D3D11Resource<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
if (pView)
{
*ppUAV = new D3D11UnorderedAccessView<ABI>(pView);
(*ppUAV)->m_pAllocationStart = pResource->m_pAllocationStart;
if (Type == D3D11_RESOURCE_DIMENSION_BUFFER)
{
static_cast<D3D11UnorderedAccessView<ABI> *>(*ppUAV)->m_pBuffer =
static_cast<D3D11Buffer<ABI> *>(pResource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE1D)
{
static_cast<D3D11UnorderedAccessView<ABI> *>(*ppUAV)->m_pTexture1D =
static_cast<D3D11Texture1D<ABI> *>(pResource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE2D)
{
static_cast<D3D11UnorderedAccessView<ABI> *>(*ppUAV)->m_pTexture2D =
static_cast<D3D11Texture2D<ABI> *>(pResource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE3D)
{
static_cast<D3D11UnorderedAccessView<ABI> *>(*ppUAV)->m_pTexture3D =
static_cast<D3D11Texture3D<ABI> *>(pResource);
}
}
return hr;
}
template <abi_t ABI>
@@ -79,8 +280,45 @@ HRESULT D3D11DeviceX<ABI>::CreateRenderTargetView(gfx::ID3D11Resource<ABI> *pRes
D3D11_RENDER_TARGET_VIEW_DESC const *pDesc,
gfx::ID3D11RenderTargetView<ABI> **ppRTV)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
HRESULT hr = 0;
D3D11_RESOURCE_DIMENSION Type{};
pResource->GetType(&Type);
ID3D11RenderTargetView *pView = nullptr;
if (Type == D3D11_RESOURCE_DIMENSION_BUFFER)
{
hr =
m_pFunction->CreateRenderTargetView(static_cast<D3D11Buffer<ABI> *>(pResource)->m_pFunction, pDesc, &pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE1D)
{
hr = m_pFunction->CreateRenderTargetView(static_cast<D3D11Texture1D<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE2D)
{
hr = m_pFunction->CreateRenderTargetView(static_cast<D3D11Texture2D<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE3D)
{
hr = m_pFunction->CreateRenderTargetView(static_cast<D3D11Texture3D<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_UNKNOWN)
{
hr = m_pFunction->CreateRenderTargetView(static_cast<D3D11Resource<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
if (pView)
{
*ppRTV = new D3D11RenderTargetView<ABI>(pView);
}
return hr;
}
template <abi_t ABI>
@@ -88,25 +326,67 @@ HRESULT D3D11DeviceX<ABI>::CreateDepthStencilView(gfx::ID3D11Resource<ABI> *pRes
D3D11_DEPTH_STENCIL_VIEW_DESC const *pDesc,
gfx::ID3D11DepthStencilView<ABI> **ppDSV)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
HRESULT hr = 0;
D3D11_RESOURCE_DIMENSION Type{};
pResource->GetType(&Type);
ID3D11DepthStencilView *pView = nullptr;
if (Type == D3D11_RESOURCE_DIMENSION_BUFFER)
{
hr =
m_pFunction->CreateDepthStencilView(static_cast<D3D11Buffer<ABI> *>(pResource)->m_pFunction, pDesc, &pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE1D)
{
hr = m_pFunction->CreateDepthStencilView(static_cast<D3D11Texture1D<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE2D)
{
hr = m_pFunction->CreateDepthStencilView(static_cast<D3D11Texture2D<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE3D)
{
hr = m_pFunction->CreateDepthStencilView(static_cast<D3D11Texture3D<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
else if (Type == D3D11_RESOURCE_DIMENSION_UNKNOWN)
{
hr = m_pFunction->CreateDepthStencilView(static_cast<D3D11Resource<ABI> *>(pResource)->m_pFunction, pDesc,
&pView);
}
if (pView)
{
*ppDSV = new D3D11DepthStencilView<ABI>(pView);
}
return hr;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateInputLayout(D3D11_INPUT_ELEMENT_DESC const *pDesc, uint32_t NumElements,
void const *pShaderBytecodeWithInputSignature, uint64_t BytecodeLength,
HRESULT D3D11DeviceX<ABI>::CreateInputLayout(const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs, uint32_t NumElements,
const void *pShaderBytecodeWithInputSignature, SIZE_T BytecodeLength,
ID3D11InputLayout **ppInputLayout)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->CreateInputLayout(pInputElementDescs, NumElements, pShaderBytecodeWithInputSignature,
BytecodeLength, ppInputLayout);
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateVertexShader(void const *pBytecode, uint64_t BytecodeLength,
ID3D11ClassLinkage *pClassLinkage, gfx::ID3D11VertexShader<ABI> **ppVS)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
ID3D11VertexShader *Shader{};
HRESULT hr = m_pFunction->CreateVertexShader(pBytecode, BytecodeLength, pClassLinkage, &Shader);
if (Shader)
{
*ppVS = new D3D11VertexShader<ABI>(Shader);
}
return hr;
}
template <abi_t ABI>
@@ -114,8 +394,13 @@ HRESULT D3D11DeviceX<ABI>::CreateGeometryShader(void const *pBytecode, uint64_t
ID3D11ClassLinkage *pClassLinkage,
gfx::ID3D11GeometryShader<ABI> **ppGS)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
ID3D11GeometryShader *Shader{};
HRESULT hr = m_pFunction->CreateGeometryShader(pBytecode, BytecodeLentgh, pClassLinkage, &Shader);
if (Shader)
{
*ppGS = new D3D11GeometryShader<ABI>(Shader);
}
return hr;
}
template <abi_t ABI>
@@ -126,40 +411,67 @@ HRESULT D3D11DeviceX<ABI>::CreateGeometryShaderWithStreamOutput(void const *pByt
ID3D11ClassLinkage *pClassLinkage,
gfx::ID3D11GeometryShader<ABI> **ppGS)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
ID3D11GeometryShader *Shader{};
HRESULT hr = m_pFunction->CreateGeometryShaderWithStreamOutput(pBytecode, BytecodeLentgh, pSODeclaration,
NumEntries, pStrides, NumStides, RasterizedStream,
pClassLinkage, &Shader);
if (Shader)
{
*ppGS = new D3D11GeometryShader<ABI>(Shader);
}
return hr;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreatePixelShader(void const *pBytecode, uint64_t BytecodeLentgh,
ID3D11ClassLinkage *pClassLinkage, gfx::ID3D11PixelShader<ABI> **ppPS)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
ID3D11PixelShader *Shader{};
HRESULT hr = m_pFunction->CreatePixelShader(pBytecode, BytecodeLentgh, pClassLinkage, &Shader);
if (Shader)
{
*ppPS = new D3D11PixelShader<ABI>(Shader);
}
return hr;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateHullShader(void const *pBytecode, uint64_t BytecodeLentgh,
ID3D11ClassLinkage *pClassLinkage, gfx::ID3D11HullShader<ABI> **ppHS)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
ID3D11HullShader *Shader{};
HRESULT hr = m_pFunction->CreateHullShader(pBytecode, BytecodeLentgh, pClassLinkage, &Shader);
if (Shader)
{
*ppHS = new D3D11HullShader<ABI>(Shader);
}
return hr;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateDomainShader(void const *pBytecode, uint64_t BytecodeLentgh,
ID3D11ClassLinkage *pClassLinkage, gfx::ID3D11DomainShader<ABI> **ppDS)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
ID3D11DomainShader *Shader{};
HRESULT hr = m_pFunction->CreateDomainShader(pBytecode, BytecodeLentgh, pClassLinkage, &Shader);
if (Shader)
{
*ppDS = new D3D11DomainShader<ABI>(Shader);
}
return hr;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateComputeShader(void const *pBytecode, uint64_t BytecodeLentgh,
ID3D11ClassLinkage *pClassLinkage, gfx::ID3D11ComputeShader<ABI> **ppCS)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
ID3D11ComputeShader *Shader{};
HRESULT hr = m_pFunction->CreateComputeShader(pBytecode, BytecodeLentgh, pClassLinkage, &Shader);
if (Shader)
{
*ppCS = new D3D11ComputeShader<ABI>(Shader);
}
return hr;
}
template <abi_t ABI> HRESULT D3D11DeviceX<ABI>::CreateClassLinkage(ID3D11ClassLinkage **ppClassLinkage)
@@ -171,59 +483,78 @@ template <abi_t ABI> HRESULT D3D11DeviceX<ABI>::CreateClassLinkage(ID3D11ClassLi
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateBlendState(D3D11_BLEND_DESC const *pDesc, gfx::ID3D11BlendState<ABI> **ppBlendState)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
ID3D11BlendState *State{};
HRESULT hr = m_pFunction->CreateBlendState(pDesc, &State);
if (State)
{
*ppBlendState = new D3D11BlendState<ABI>(State);
}
return hr;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateDepthStencilState(D3D11_DEPTH_STENCIL_DESC const *pDesc,
gfx::ID3D11DepthStencilState<ABI> **ppDepthStencilState)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
ID3D11DepthStencilState *State{};
HRESULT hr = m_pFunction->CreateDepthStencilState(pDesc, &State);
if (State)
{
*ppDepthStencilState = new D3D11DepthStencilState<ABI>(State);
}
return hr;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateRasterizerState(D3D11_RASTERIZER_DESC const *pDesc,
gfx::ID3D11RasterizerState<ABI> **ppRasterizerState)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
ID3D11RasterizerState *State{};
HRESULT hr = m_pFunction->CreateRasterizerState(pDesc, &State);
if (State)
{
*ppRasterizerState = new D3D11RasterizerState<ABI>(State);
}
return hr;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateSamplerState(D3D11_SAMPLER_DESC const *pDesc,
gfx::ID3D11SamplerState<ABI> **ppSamplerState)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
ID3D11SamplerState *State{};
HRESULT hr = m_pFunction->CreateSamplerState(pDesc, &State);
if (State)
{
*ppSamplerState = new D3D11SamplerState<ABI>(State);
}
return hr;
}
template <abi_t ABI> HRESULT D3D11DeviceX<ABI>::CreateQuery(D3D11_QUERY_DESC const *pDesc, ID3D11Query **ppQuery)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->CreateQuery(pDesc, ppQuery);
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreatePredicate(D3D11_QUERY_DESC const *pDesc, ID3D11Predicate **ppPrediticate)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->CreatePredicate(pDesc, ppPrediticate);
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateCounter(D3D11_COUNTER_DESC const *pDesc, ID3D11Counter **ppCounter)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->CreateCounter(pDesc, ppCounter);
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateDeferredContext(uint32_t Flags, gfx::ID3D11DeviceContext<ABI> **ppDeferredContext)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
ID3D11DeviceContext2 *pContext = nullptr;
HRESULT hr = m_pFunction->CreateDeferredContext2(0, &pContext);
*ppDeferredContext = new D3D11DeviceContextX<ABI>(pContext);
return hr;
}
template <abi_t ABI>
@@ -314,7 +645,13 @@ template <abi_t ABI> HRESULT D3D11DeviceX<ABI>::GetDeviceRemovedReason()
template <abi_t ABI> void D3D11DeviceX<ABI>::GetImmediateContext(gfx::ID3D11DeviceContext<ABI> **ppImmediateContext)
{
IMPLEMENT_STUB();
ID3D11DeviceContext *pContext = nullptr;
ID3D11DeviceContext2 *pContext2 = nullptr;
m_pFunction->GetImmediateContext(&pContext);
if (pContext) pContext->QueryInterface(IID_PPV_ARGS(&pContext2));
*ppImmediateContext = new D3D11DeviceContextX<ABI>(pContext2);
}
template <abi_t ABI> HRESULT D3D11DeviceX<ABI>::SetExceptionMode(uint32_t ExceptionMode)

View File

@@ -1,24 +1,46 @@
#include "ID3D11DeviceContext.h"
#include "ID3D11Device.h"
#include "ID3D11View.h"
#include "ID3D11Resource.h"
#include "ID3D11Shader.h"
#include "ID3D11State.h"
//
// IUnknown
//
template <abi_t ABI> HRESULT D3D11DeviceContextX<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
if (riid == xcom::guid_of<gfx::ID3D11DeviceContext>() || riid == xcom::guid_of<gfx::ID3D11DeviceContext1>() ||
riid == xcom::guid_of<gfx::ID3D11DeviceContext2>() || riid == xcom::guid_of<gfx::ID3D11DeviceContextX>() ||
riid == xcom::guid_of<gfx::ID3D11PerformanceContextX>() || riid == xcom::guid_of<gfx::ID3D11UserDefinedAnnotationX>())
{
*ppvObject = this;
AddRef();
return S_OK;
}
if (riid == xcom::guid_of<xbox::IGraphicsUnwrap>())
{
*ppvObject = m_pFunction;
return S_OK;
}
IMPLEMENT_STUB();
return E_NOTIMPL;
*ppvObject = nullptr;
return E_NOINTERFACE;
}
template <abi_t ABI> ULONG D3D11DeviceContextX<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11DeviceContextX<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
@@ -64,31 +86,78 @@ template <abi_t ABI>
void D3D11DeviceContextX<ABI>::VSSetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers)
{
IMPLEMENT_STUB();
ID3D11Buffer *Buffers[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT]{};
for (UINT i = 0; i < NumBuffers; i++)
{
if (!ppConstantBuffers[i])
Buffers[i] = 0;
else
{
Buffers[i] = static_cast<D3D11Buffer<ABI> *>(ppConstantBuffers[i])->m_pFunction;
}
}
m_pFunction->VSSetConstantBuffers(StartSlot, NumBuffers, Buffers);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::PSSetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews)
{
IMPLEMENT_STUB();
ID3D11ShaderResourceView *SRVs[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT]{};
UINT Slot = StartSlot;
for (UINT i = 0; i < NumViews; i++)
{
if (!ppShaderResourceViews[i])
{
SRVs[i] = nullptr;
}
else
{
SRVs[i] = static_cast<D3D11ShaderResourceView<ABI> *>(ppShaderResourceViews[i])->m_pFunction;
}
}
m_pFunction->PSSetShaderResources(StartSlot, NumViews, SRVs);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::PSSetShader(gfx::ID3D11PixelShader<ABI> *pPixelShader)
{
IMPLEMENT_STUB();
ID3D11PixelShader *Shader{};
if (pPixelShader)
{
Shader = static_cast<D3D11PixelShader<ABI>*>(pPixelShader)->m_pFunction;
}
m_pFunction->PSSetShader(Shader, nullptr, 0);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::PSSetSamplers(UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers)
{
IMPLEMENT_STUB();
ID3D11SamplerState *Samplers[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT]{};
for (UINT i = 0; i < NumSamplers; i++)
{
if (!ppSamplers[i])
Samplers[i] = 0;
else
Samplers[i] = static_cast<D3D11SamplerState<ABI> *>(ppSamplers[i])->m_pFunction;
}
m_pFunction->PSSetSamplers(StartSlot, NumSamplers, Samplers);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::VSSetShader(gfx::ID3D11VertexShader<ABI> *pVertexShader)
{
IMPLEMENT_STUB();
ID3D11VertexShader *Shader{};
if (pVertexShader)
{
Shader = static_cast<D3D11VertexShader<ABI>*>(pVertexShader)->m_pFunction;
}
m_pFunction->VSSetShader(Shader, nullptr, 0);
}
template <abi_t ABI>
@@ -106,25 +175,92 @@ template <abi_t ABI>
HRESULT D3D11DeviceContextX<ABI>::Map(gfx::ID3D11Resource<ABI> *pResource, UINT Subresource, D3D11_MAP MapType,
UINT MapFlags, D3D11_MAPPED_SUBRESOURCE *pMappedResource)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
if (pResource)
{
D3D11_RESOURCE_DIMENSION Type{};
pResource->GetType(&Type);
if (Type == D3D11_RESOURCE_DIMENSION_BUFFER)
{
return m_pFunction->Map(static_cast<D3D11Buffer<ABI> *>(pResource)->m_pFunction, Subresource, MapType,
MapFlags, pMappedResource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE1D)
{
return m_pFunction->Map(static_cast<D3D11Texture1D<ABI> *>(pResource)->m_pFunction, Subresource, MapType,
MapFlags, pMappedResource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE2D)
{
return m_pFunction->Map(static_cast<D3D11Texture2D<ABI> *>(pResource)->m_pFunction, Subresource, MapType,
MapFlags, pMappedResource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE3D)
{
return m_pFunction->Map(static_cast<D3D11Texture3D<ABI> *>(pResource)->m_pFunction, Subresource, MapType,
MapFlags, pMappedResource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_UNKNOWN)
{
return m_pFunction->Map(static_cast<D3D11Resource<ABI> *>(pResource)->m_pFunction, Subresource, MapType,
MapFlags, pMappedResource);
}
}
return E_INVALIDARG;
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::Unmap(gfx::ID3D11Resource<ABI> *pResource, UINT Subresource)
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::Unmap(gfx::ID3D11Resource<ABI> *pResource, UINT Subresource)
{
IMPLEMENT_STUB();
if (pResource)
{
D3D11_RESOURCE_DIMENSION Type{};
pResource->GetType(&Type);
if (Type == D3D11_RESOURCE_DIMENSION_BUFFER)
{
m_pFunction->Unmap(static_cast<D3D11Buffer<ABI> *>(pResource)->m_pFunction, Subresource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE1D)
{
m_pFunction->Unmap(static_cast<D3D11Texture1D<ABI> *>(pResource)->m_pFunction, Subresource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE2D)
{
m_pFunction->Unmap(static_cast<D3D11Texture2D<ABI> *>(pResource)->m_pFunction, Subresource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE3D)
{
m_pFunction->Unmap(static_cast<D3D11Texture3D<ABI> *>(pResource)->m_pFunction, Subresource);
}
else if (Type == D3D11_RESOURCE_DIMENSION_UNKNOWN)
{
m_pFunction->Unmap(static_cast<D3D11Resource<ABI> *>(pResource)->m_pFunction, Subresource);
}
}
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::PSSetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers)
{
IMPLEMENT_STUB();
ID3D11Buffer *Buffers[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT]{};
for (UINT i = 0; i < NumBuffers; i++)
{
if (!ppConstantBuffers[i])
Buffers[i] = 0;
else
{
Buffers[i] = static_cast<D3D11Buffer<ABI> *>(ppConstantBuffers[i])->m_pFunction;
}
}
m_pFunction->PSSetConstantBuffers(StartSlot, NumBuffers, Buffers);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::IASetInputLayout(ID3D11InputLayout *pInputLayout)
{
IMPLEMENT_STUB();
m_pFunction->IASetInputLayout(pInputLayout);
}
template <abi_t ABI>
@@ -132,14 +268,49 @@ void D3D11DeviceContextX<ABI>::IASetVertexBuffers(UINT StartSlot, UINT NumBuffer
gfx::ID3D11Buffer<ABI> *const *ppVertexBuffers, UINT const *pStrides,
UINT const *pOffsets)
{
IMPLEMENT_STUB();
ID3D11Buffer *Buffers[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT]{};
for (UINT i = 0; i < NumBuffers; i++)
{
if (!ppVertexBuffers[i])
Buffers[i] = 0;
else
{
Buffers[i] = static_cast<D3D11Buffer<ABI> *>(ppVertexBuffers[i])->m_pFunction;
}
}
m_pFunction->IASetVertexBuffers(StartSlot, NumBuffers, Buffers, pStrides, pOffsets);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::IASetIndexBuffer(gfx::ID3D11Buffer<ABI> *pIndexBuffer, UINT HardwareIndexFormat,
UINT Offset)
{
ID3D11Buffer *Buffer{};
if (pIndexBuffer)
{
Buffer = static_cast<D3D11Buffer<ABI> *>(pIndexBuffer)->m_pFunction;
}
m_pFunction->IASetIndexBuffer(Buffer, (DXGI_FORMAT)HardwareIndexFormat, Offset);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::IASetIndexBuffer(UINT HardwareIndexFormat, gfx::ID3D11Buffer<ABI> *pIndexBuffer,
UINT Offset)
{
IMPLEMENT_STUB();
DXGI_FORMAT Format = HardwareIndexFormat != 0 ? DXGI_FORMAT_R32_UINT : DXGI_FORMAT_R16_UINT;
ID3D11Buffer *Buffer{};
if (pIndexBuffer)
{
Buffer = static_cast<D3D11Buffer<ABI> *>(pIndexBuffer)->m_pFunction;
}
m_pFunction->IASetIndexBuffer(Buffer, Format, Offset);
}
template <abi_t ABI>
@@ -161,12 +332,29 @@ template <abi_t ABI>
void D3D11DeviceContextX<ABI>::GSSetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers)
{
IMPLEMENT_STUB();
ID3D11Buffer *Buffers[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT]{};
for (UINT i = 0; i < NumBuffers; i++)
{
if (!ppConstantBuffers[i])
Buffers[i] = 0;
else
{
Buffers[i] = static_cast<D3D11Buffer<ABI> *>(ppConstantBuffers[i])->m_pFunction;
}
}
m_pFunction->GSSetConstantBuffers(StartSlot, NumBuffers, Buffers);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::GSSetShader(gfx::ID3D11GeometryShader<ABI> *pShader)
{
IMPLEMENT_STUB();
ID3D11GeometryShader *Shader{};
if (pShader)
{
Shader = static_cast<D3D11GeometryShader<ABI>*>(pShader)->m_pFunction;
}
m_pFunction->GSSetShader(Shader, nullptr, 0);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY PrimitiveTopology)
@@ -178,14 +366,37 @@ template <abi_t ABI>
void D3D11DeviceContextX<ABI>::VSSetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews)
{
IMPLEMENT_STUB();
ID3D11ShaderResourceView *SRVs[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT]{};
UINT Slot = StartSlot;
for (UINT i = 0; i < NumViews; i++)
{
if (!ppShaderResourceViews[i])
{
SRVs[i] = nullptr;
}
else
{
SRVs[i] = static_cast<D3D11ShaderResourceView<ABI> *>(ppShaderResourceViews[i])->m_pFunction;
}
}
m_pFunction->VSSetShaderResources(StartSlot, NumViews, SRVs);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::VSSetSamplers(UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers)
{
IMPLEMENT_STUB();
ID3D11SamplerState *Samplers[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT]{};
for (UINT i = 0; i < NumSamplers; i++)
{
if (!ppSamplers[i])
Samplers[i] = 0;
else
Samplers[i] = static_cast<D3D11SamplerState<ABI> *>(ppSamplers[i])->m_pFunction;
}
m_pFunction->VSSetSamplers(StartSlot, NumSamplers, Samplers);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::Begin(ID3D11Asynchronous *pAsync)
@@ -214,44 +425,132 @@ template <abi_t ABI>
void D3D11DeviceContextX<ABI>::GSSetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews)
{
IMPLEMENT_STUB();
ID3D11ShaderResourceView *SRVs[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT]{};
UINT Slot = StartSlot;
for (UINT i = 0; i < NumViews; i++)
{
if (!ppShaderResourceViews[i])
{
SRVs[i] = nullptr;
}
else
{
SRVs[i] = static_cast<D3D11ShaderResourceView<ABI> *>(ppShaderResourceViews[i])->m_pFunction;
}
}
m_pFunction->GSSetShaderResources(StartSlot, NumViews, SRVs);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::GSSetSamplers(UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers)
{
IMPLEMENT_STUB();
ID3D11SamplerState *Samplers[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT]{};
for (UINT i = 0; i < NumSamplers; i++)
{
if (!ppSamplers[i])
Samplers[i] = 0;
else
Samplers[i] = static_cast<D3D11SamplerState<ABI> *>(ppSamplers[i])->m_pFunction;
}
m_pFunction->GSSetSamplers(StartSlot, NumSamplers, Samplers);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::OMSetRenderTargets(UINT NumViews, gfx::ID3D11RenderTargetView<ABI> *const *,
void D3D11DeviceContextX<ABI>::OMSetRenderTargets(UINT NumViews, gfx::ID3D11RenderTargetView<ABI> *const *ppRTVs,
gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView)
{
IMPLEMENT_STUB();
ID3D11DepthStencilView *DepthStencilView{};
ID3D11RenderTargetView *RenderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT]{};
if (ppRTVs)
{
for (UINT i = 0; i < NumViews; i++)
{
if (!ppRTVs[i])
RenderTargetViews[i] = 0;
else
RenderTargetViews[i] = static_cast<D3D11RenderTargetView<ABI> *>(ppRTVs[i])->m_pFunction;
}
}
if (pDepthStencilView)
{
DepthStencilView = static_cast<D3D11DepthStencilView<ABI> *>(pDepthStencilView)->m_pFunction;
}
m_pFunction->OMSetRenderTargets(NumViews, RenderTargetViews, DepthStencilView);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::OMSetRenderTargetsAndUnorderedAccessViews(
UINT NumRTVs, gfx::ID3D11RenderTargetView<ABI> *const *ppRenderTargetViews,
gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView, UINT UAVStartSlot, UINT NumUAVs,
gfx::ID3D11UnorderedAccessView<ABI> *const *ppUnorderedAccessViews, UINT const *pUAVInitialCounts)
UINT NumRTVs, gfx::ID3D11RenderTargetView<ABI> *const *ppRTVs, gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView,
UINT UAVStartSlot, UINT NumUAVs, gfx::ID3D11UnorderedAccessView<ABI> *const *ppUnorderedAccessViews,
UINT const *pUAVInitialCounts)
{
IMPLEMENT_STUB();
ID3D11DepthStencilView *DepthStencilView{};
ID3D11RenderTargetView *RenderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT]{};
ID3D11UnorderedAccessView *UnorderedAccessViews[D3D11_1_UAV_SLOT_COUNT]{};
if (ppRTVs)
{
for (UINT i = 0; i < NumRTVs; i++)
{
if (!ppRTVs[i])
RenderTargetViews[i] = 0;
else
RenderTargetViews[i] = static_cast<D3D11RenderTargetView<ABI> *>(ppRTVs[i])->m_pFunction;
}
}
if (ppUnorderedAccessViews)
{
for (UINT i = 0; i < NumUAVs; i++)
{
if (!ppUnorderedAccessViews[i])
UnorderedAccessViews[i] = 0;
else
UnorderedAccessViews[i] =
static_cast<D3D11UnorderedAccessView<ABI> *>(ppUnorderedAccessViews[i])->m_pFunction;
}
}
if (pDepthStencilView)
{
DepthStencilView = static_cast<D3D11DepthStencilView<ABI> *>(pDepthStencilView)->m_pFunction;
}
m_pFunction->OMSetRenderTargetsAndUnorderedAccessViews(NumRTVs, RenderTargetViews, DepthStencilView, UAVStartSlot,
NumUAVs, UnorderedAccessViews, pUAVInitialCounts);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::OMSetBlendState(gfx::ID3D11BlendState<ABI> *pBlendState, FLOAT const BlendFactor[4],
UINT SampleMask)
{
IMPLEMENT_STUB();
}
ID3D11BlendState *BlendState{};
if (pBlendState)
{
BlendState = static_cast<D3D11BlendState<ABI> *>(pBlendState)->m_pFunction;
}
m_pFunction->OMSetBlendState(BlendState, BlendFactor, SampleMask);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::OMSetDepthStencilState(gfx::ID3D11DepthStencilState<ABI> *pDepthStencilState,
UINT StencilRef)
{
IMPLEMENT_STUB();
ID3D11DepthStencilState *State{};
if (pDepthStencilState)
{
State = static_cast<D3D11DepthStencilState<ABI> *>(pDepthStencilState)->m_pFunction;
}
m_pFunction->OMSetDepthStencilState(State, StencilRef);
}
template <abi_t ABI>
@@ -299,7 +598,7 @@ template <abi_t ABI> void D3D11DeviceContextX<ABI>::RSSetState(gfx::ID3D11Raster
template <abi_t ABI> void D3D11DeviceContextX<ABI>::RSSetViewports(UINT NumViewports, D3D11_VIEWPORT const *pViewports)
{
IMPLEMENT_STUB();
m_pFunction->RSSetViewports(NumViewports, pViewports);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::RSSetScissorRects(UINT NumRects, D3D11_RECT const *pRects)
@@ -328,7 +627,37 @@ void D3D11DeviceContextX<ABI>::UpdateSubresource(gfx::ID3D11Resource<ABI> *pDstR
D3D11_BOX const *pDstBox, void const *pSrcData, UINT SrcRowPitch,
UINT SrcDepthPitch)
{
IMPLEMENT_STUB();
if (pDstResource && pSrcData)
{
D3D11_RESOURCE_DIMENSION Type{};
pDstResource->GetType(&Type);
if (Type == D3D11_RESOURCE_DIMENSION_BUFFER)
{
m_pFunction->UpdateSubresource(static_cast<D3D11Buffer<ABI> *>(pDstResource)->m_pFunction, DstSubresource,
pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE1D)
{
m_pFunction->UpdateSubresource(static_cast<D3D11Texture1D<ABI> *>(pDstResource)->m_pFunction,
DstSubresource, pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE2D)
{
m_pFunction->UpdateSubresource(static_cast<D3D11Texture2D<ABI> *>(pDstResource)->m_pFunction,
DstSubresource, pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch);
}
else if (Type == D3D11_RESOURCE_DIMENSION_TEXTURE3D)
{
m_pFunction->UpdateSubresource(static_cast<D3D11Texture3D<ABI> *>(pDstResource)->m_pFunction,
DstSubresource, pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch);
}
else if (Type == D3D11_RESOURCE_DIMENSION_UNKNOWN)
{
m_pFunction->UpdateSubresource(static_cast<D3D11Resource<ABI> *>(pDstResource)->m_pFunction, DstSubresource,
pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch);
}
}
}
template <abi_t ABI>
@@ -401,59 +730,152 @@ template <abi_t ABI>
void D3D11DeviceContextX<ABI>::HSSetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews)
{
IMPLEMENT_STUB();
ID3D11ShaderResourceView *SRVs[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT]{};
UINT Slot = StartSlot;
for (UINT i = 0; i < NumViews; i++)
{
if (!ppShaderResourceViews[i])
{
SRVs[i] = nullptr;
}
else
{
SRVs[i] = static_cast<D3D11ShaderResourceView<ABI> *>(ppShaderResourceViews[i])->m_pFunction;
}
}
m_pFunction->HSSetShaderResources(StartSlot, NumViews, SRVs);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::HSSetShader(gfx::ID3D11HullShader<ABI> *pHullShader)
{
IMPLEMENT_STUB();
ID3D11HullShader *Shader{};
if (pHullShader)
{
Shader = static_cast<D3D11HullShader<ABI>*>(pHullShader)->m_pFunction;
}
m_pFunction->HSSetShader(Shader, nullptr, 0);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::HSSetSamplers(UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers)
{
IMPLEMENT_STUB();
ID3D11SamplerState *Samplers[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT]{};
for (UINT i = 0; i < NumSamplers; i++)
{
if (!ppSamplers[i])
Samplers[i] = 0;
else
Samplers[i] = static_cast<D3D11SamplerState<ABI> *>(ppSamplers[i])->m_pFunction;
}
m_pFunction->HSSetSamplers(StartSlot, NumSamplers, Samplers);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::HSSetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers)
{
IMPLEMENT_STUB();
ID3D11Buffer *Buffers[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT]{};
for (UINT i = 0; i < NumBuffers; i++)
{
if (!ppConstantBuffers[i])
Buffers[i] = 0;
else
{
Buffers[i] = static_cast<D3D11Buffer<ABI> *>(ppConstantBuffers[i])->m_pFunction;
}
}
m_pFunction->HSSetConstantBuffers(StartSlot, NumBuffers, Buffers);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::DSSetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews)
{
IMPLEMENT_STUB();
ID3D11ShaderResourceView *SRVs[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT]{};
UINT Slot = StartSlot;
for (UINT i = 0; i < NumViews; i++)
{
if (!ppShaderResourceViews[i])
{
SRVs[i] = nullptr;
}
else
{
SRVs[i] = static_cast<D3D11ShaderResourceView<ABI> *>(ppShaderResourceViews[i])->m_pFunction;
}
}
m_pFunction->DSSetShaderResources(StartSlot, NumViews, SRVs);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::DSSetShader(gfx::ID3D11DomainShader<ABI> *pDomainShader)
{
IMPLEMENT_STUB();
ID3D11DomainShader *Shader{};
if (pDomainShader)
{
Shader = static_cast<D3D11DomainShader<ABI> *>(pDomainShader)->m_pFunction;
}
m_pFunction->DSSetShader(Shader, nullptr, 0);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::DSSetSamplers(UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers)
{
IMPLEMENT_STUB();
ID3D11SamplerState *Samplers[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT]{};
for (UINT i = 0; i < NumSamplers; i++)
{
if (!ppSamplers[i])
Samplers[i] = 0;
else
Samplers[i] = static_cast<D3D11SamplerState<ABI> *>(ppSamplers[i])->m_pFunction;
}
m_pFunction->DSSetSamplers(StartSlot, NumSamplers, Samplers);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::DSSetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers)
{
IMPLEMENT_STUB();
ID3D11Buffer *Buffers[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT]{};
for (UINT i = 0; i < NumBuffers; i++)
{
if (!ppConstantBuffers[i])
Buffers[i] = 0;
else
{
Buffers[i] = static_cast<D3D11Buffer<ABI> *>(ppConstantBuffers[i])->m_pFunction;
}
}
m_pFunction->DSSetConstantBuffers(StartSlot, NumBuffers, Buffers);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::CSSetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews)
{
IMPLEMENT_STUB();
ID3D11ShaderResourceView *SRVs[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT]{};
UINT Slot = StartSlot;
for (UINT i = 0; i < NumViews; i++)
{
if (!ppShaderResourceViews[i])
{
SRVs[i] = nullptr;
}
else
{
SRVs[i] = static_cast<D3D11ShaderResourceView<ABI> *>(ppShaderResourceViews[i])->m_pFunction;
}
}
m_pFunction->CSSetShaderResources(StartSlot, NumViews, SRVs);
}
template <abi_t ABI>
@@ -466,21 +888,48 @@ void D3D11DeviceContextX<ABI>::CSSetUnorderedAccessViews(
template <abi_t ABI> void D3D11DeviceContextX<ABI>::CSSetShader(gfx::ID3D11ComputeShader<ABI> *pComputeShader)
{
IMPLEMENT_STUB();
ID3D11ComputeShader *Shader{};
if (pComputeShader)
{
Shader = static_cast<D3D11ComputeShader<ABI>*>(pComputeShader)->m_pFunction;
}
m_pFunction->CSSetShader(Shader, nullptr, 0);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::CSSetSamplers(UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers)
{
IMPLEMENT_STUB();
ID3D11SamplerState *Samplers[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT]{};
for (UINT i = 0; i < NumSamplers; i++)
{
if (!ppSamplers[i])
Samplers[i] = 0;
else
Samplers[i] = static_cast<D3D11SamplerState<ABI> *>(ppSamplers[i])->m_pFunction;
}
m_pFunction->CSSetSamplers(StartSlot, NumSamplers, Samplers);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::CSSetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers)
{
IMPLEMENT_STUB();
ID3D11Buffer *Buffers[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT]{};
for (UINT i = 0; i < NumBuffers; i++)
{
if (!ppConstantBuffers[i])
Buffers[i] = 0;
else
{
Buffers[i] = static_cast<D3D11Buffer<ABI> *>(ppConstantBuffers[i])->m_pFunction;
}
}
m_pFunction->CSSetConstantBuffers(StartSlot, NumBuffers, Buffers);
}
template <abi_t ABI>
@@ -601,7 +1050,25 @@ template <abi_t ABI>
void D3D11DeviceContextX<ABI>::OMGetRenderTargets(UINT NumViews, gfx::ID3D11RenderTargetView<ABI> **ppRenderTargetViews,
gfx::ID3D11DepthStencilView<ABI> **ppDepthStencilView)
{
IMPLEMENT_STUB();
ID3D11DepthStencilView *pDepthStencilView{};
ID3D11RenderTargetView *RenderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT]{};
m_pFunction->OMGetRenderTargets(NumViews, RenderTargetViews, &pDepthStencilView);
if (ppRenderTargetViews)
{
for (UINT i = 0; i < NumViews; i++)
{
if (!RenderTargetViews[i])
ppRenderTargetViews[i] = 0;
else
ppRenderTargetViews[i] = new D3D11RenderTargetView<ABI>(RenderTargetViews[i]);
}
}
if (ppDepthStencilView && pDepthStencilView)
{
*ppDepthStencilView = new D3D11DepthStencilView<ABI>(pDepthStencilView);
}
}
template <abi_t ABI>

View File

@@ -11,14 +11,16 @@ template <abi_t ABI> HRESULT D3D11Resource<ABI>::QueryInterface(REFIID riid, voi
template <abi_t ABI> ULONG D3D11Resource<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11Resource<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
@@ -59,7 +61,7 @@ HRESULT D3D11Resource<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &guid, x
//
template <abi_t ABI> void D3D11Resource<ABI>::GetType(D3D11_RESOURCE_DIMENSION *pDimension)
{
IMPLEMENT_STUB();
m_pFunction->GetType(pDimension);
}
template <abi_t ABI> void D3D11Resource<ABI>::SetEvictionPriority(uint32_t EvictionPriority)
@@ -88,20 +90,30 @@ D3D11_DECLARE_ABI_TEMPLATES();
//
template <abi_t ABI> HRESULT D3D11Texture1D<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
if (riid == xcom::guid_of<gfx::ID3D11Texture1D>() || riid == xcom::guid_of<gfx::ID3D11Resource>())
{
*ppvObject = this;
AddRef();
return S_OK;
}
IMPLEMENT_STUB();
return E_NOTIMPL;
*ppvObject = nullptr;
return E_NOINTERFACE;
}
template <abi_t ABI> ULONG D3D11Texture1D<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11Texture1D<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
@@ -144,7 +156,7 @@ HRESULT D3D11Texture1D<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &guid,
//
template <abi_t ABI> void D3D11Texture1D<ABI>::GetType(D3D11_RESOURCE_DIMENSION *pDimension)
{
IMPLEMENT_STUB();
m_pFunction->GetType(pDimension);
}
template <abi_t ABI> void D3D11Texture1D<ABI>::SetEvictionPriority(uint32_t EvictionPriority)
@@ -168,7 +180,7 @@ template <abi_t ABI> void D3D11Texture1D<ABI>::GetDescriptor(gfx::D3D11X_DESCRIP
//
template <abi_t ABI> void D3D11Texture1D<ABI>::GetDesc(D3D11_TEXTURE1D_DESC *pDesc)
{
IMPLEMENT_STUB();
m_pFunction->GetDesc(pDesc);
}
#undef ABI_INTERFACE
@@ -181,20 +193,30 @@ D3D11_DECLARE_ABI_TEMPLATES();
//
template <abi_t ABI> HRESULT D3D11Texture2D<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
if (riid == xcom::guid_of<gfx::ID3D11Texture2D>() || riid == xcom::guid_of<gfx::ID3D11Resource>())
{
*ppvObject = this;
AddRef();
return S_OK;
}
IMPLEMENT_STUB();
return E_NOTIMPL;
*ppvObject = nullptr;
return E_NOINTERFACE;
}
template <abi_t ABI> ULONG D3D11Texture2D<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11Texture2D<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
@@ -237,7 +259,7 @@ HRESULT D3D11Texture2D<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &guid,
//
template <abi_t ABI> void D3D11Texture2D<ABI>::GetType(D3D11_RESOURCE_DIMENSION *pDimension)
{
IMPLEMENT_STUB();
m_pFunction->GetType(pDimension);
}
template <abi_t ABI> void D3D11Texture2D<ABI>::SetEvictionPriority(uint32_t EvictionPriority)
@@ -261,7 +283,7 @@ template <abi_t ABI> void D3D11Texture2D<ABI>::GetDescriptor(gfx::D3D11X_DESCRIP
//
template <abi_t ABI> void D3D11Texture2D<ABI>::GetDesc(D3D11_TEXTURE2D_DESC *pDesc)
{
IMPLEMENT_STUB();
m_pFunction->GetDesc(pDesc);
}
#undef ABI_INTERFACE
@@ -274,20 +296,30 @@ D3D11_DECLARE_ABI_TEMPLATES();
//
template <abi_t ABI> HRESULT D3D11Texture3D<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
if (riid == xcom::guid_of<gfx::ID3D11Texture3D>() || riid == xcom::guid_of<gfx::ID3D11Resource>())
{
*ppvObject = this;
AddRef();
return S_OK;
}
IMPLEMENT_STUB();
return E_NOTIMPL;
*ppvObject = nullptr;
return E_NOINTERFACE;
}
template <abi_t ABI> ULONG D3D11Texture3D<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11Texture3D<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
@@ -330,7 +362,7 @@ HRESULT D3D11Texture3D<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &guid,
//
template <abi_t ABI> void D3D11Texture3D<ABI>::GetType(D3D11_RESOURCE_DIMENSION *pDimension)
{
IMPLEMENT_STUB();
m_pFunction->GetType(pDimension);
}
template <abi_t ABI> void D3D11Texture3D<ABI>::SetEvictionPriority(uint32_t EvictionPriority)
@@ -354,7 +386,7 @@ template <abi_t ABI> void D3D11Texture3D<ABI>::GetDescriptor(gfx::D3D11X_DESCRIP
//
template <abi_t ABI> void D3D11Texture3D<ABI>::GetDesc(D3D11_TEXTURE3D_DESC *pDesc)
{
IMPLEMENT_STUB();
m_pFunction->GetDesc(pDesc);
}
#undef ABI_INTERFACE
@@ -373,14 +405,16 @@ template <abi_t ABI> HRESULT D3D11Buffer<ABI>::QueryInterface(REFIID riid, void
template <abi_t ABI> ULONG D3D11Buffer<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11Buffer<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
@@ -421,7 +455,7 @@ HRESULT D3D11Buffer<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &guid, xbo
//
template <abi_t ABI> void D3D11Buffer<ABI>::GetType(D3D11_RESOURCE_DIMENSION *pDimension)
{
IMPLEMENT_STUB();
m_pFunction->GetType(pDimension);
}
template <abi_t ABI> void D3D11Buffer<ABI>::SetEvictionPriority(uint32_t EvictionPriority)
@@ -443,9 +477,9 @@ template <abi_t ABI> void D3D11Buffer<ABI>::GetDescriptor(gfx::D3D11X_DESCRIPTOR
//
// ID3D11Buffer
//
template <abi_t ABI> void D3D11Buffer<ABI>::GetDesc(D3D11_TEXTURE1D_DESC *pDesc)
template <abi_t ABI> void D3D11Buffer<ABI>::GetDesc(D3D11_BUFFER_DESC *pDesc)
{
IMPLEMENT_STUB();
m_pFunction->GetDesc(pDesc);
}
#undef ABI_INTERFACE

View File

@@ -11,14 +11,17 @@ template <abi_t ABI> HRESULT D3D11VertexShader<ABI>::QueryInterface(REFIID riid,
template <abi_t ABI> ULONG D3D11VertexShader<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11VertexShader<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount)
delete this;
return RefCount;
}
//
@@ -31,21 +34,18 @@ template <abi_t ABI> void D3D11VertexShader<ABI>::GetDevice(gfx::ID3D11Device<AB
template <abi_t ABI> HRESULT D3D11VertexShader<ABI>::GetPrivateData(_GUID const &guid, uint32_t *pDataSize, void *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->GetPrivateData(guid, pDataSize, pData);
}
template <abi_t ABI>
HRESULT D3D11VertexShader<ABI>::SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateData(guid, DataSize, pData);
}
template <abi_t ABI> HRESULT D3D11VertexShader<ABI>::SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateDataInterface(guid, pData);
}
template <abi_t ABI>
@@ -60,7 +60,6 @@ HRESULT D3D11VertexShader<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &gui
#define ABI_INTERFACE(ABI) D3D11VertexShader<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
//
// IUnknown
//
@@ -72,14 +71,17 @@ template <abi_t ABI> HRESULT D3D11PixelShader<ABI>::QueryInterface(REFIID riid,
template <abi_t ABI> ULONG D3D11PixelShader<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11PixelShader<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount)
delete this;
return RefCount;
}
//
@@ -92,21 +94,18 @@ template <abi_t ABI> void D3D11PixelShader<ABI>::GetDevice(gfx::ID3D11Device<ABI
template <abi_t ABI> HRESULT D3D11PixelShader<ABI>::GetPrivateData(_GUID const &guid, uint32_t *pDataSize, void *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->GetPrivateData(guid, pDataSize, pData);
}
template <abi_t ABI>
HRESULT D3D11PixelShader<ABI>::SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateData(guid, DataSize, pData);
}
template <abi_t ABI> HRESULT D3D11PixelShader<ABI>::SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateDataInterface(guid, pData);
}
template <abi_t ABI>
@@ -121,7 +120,6 @@ HRESULT D3D11PixelShader<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &guid
#define ABI_INTERFACE(ABI) D3D11PixelShader<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
//
// IUnknown
//
@@ -133,14 +131,17 @@ template <abi_t ABI> HRESULT D3D11ComputeShader<ABI>::QueryInterface(REFIID riid
template <abi_t ABI> ULONG D3D11ComputeShader<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11ComputeShader<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount)
delete this;
return RefCount;
}
//
@@ -154,21 +155,18 @@ template <abi_t ABI> void D3D11ComputeShader<ABI>::GetDevice(gfx::ID3D11Device<A
template <abi_t ABI>
HRESULT D3D11ComputeShader<ABI>::GetPrivateData(_GUID const &guid, uint32_t *pDataSize, void *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->GetPrivateData(guid, pDataSize, pData);
}
template <abi_t ABI>
HRESULT D3D11ComputeShader<ABI>::SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateData(guid, DataSize, pData);
}
template <abi_t ABI> HRESULT D3D11ComputeShader<ABI>::SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateDataInterface(guid, pData);
}
template <abi_t ABI>
@@ -183,7 +181,6 @@ HRESULT D3D11ComputeShader<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &gu
#define ABI_INTERFACE(ABI) D3D11ComputeShader<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
//
// IUnknown
//
@@ -195,14 +192,17 @@ template <abi_t ABI> HRESULT D3D11GeometryShader<ABI>::QueryInterface(REFIID rii
template <abi_t ABI> ULONG D3D11GeometryShader<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11GeometryShader<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount)
delete this;
return RefCount;
}
//
@@ -216,21 +216,18 @@ template <abi_t ABI> void D3D11GeometryShader<ABI>::GetDevice(gfx::ID3D11Device<
template <abi_t ABI>
HRESULT D3D11GeometryShader<ABI>::GetPrivateData(_GUID const &guid, uint32_t *pDataSize, void *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->GetPrivateData(guid, pDataSize, pData);
}
template <abi_t ABI>
HRESULT D3D11GeometryShader<ABI>::SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateData(guid, DataSize, pData);
}
template <abi_t ABI> HRESULT D3D11GeometryShader<ABI>::SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateDataInterface(guid, pData);
}
template <abi_t ABI>
@@ -245,7 +242,6 @@ HRESULT D3D11GeometryShader<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &g
#define ABI_INTERFACE(ABI) D3D11GeometryShader<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
//
// IUnknown
//
@@ -257,14 +253,16 @@ template <abi_t ABI> HRESULT D3D11HullShader<ABI>::QueryInterface(REFIID riid, v
template <abi_t ABI> ULONG D3D11HullShader<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11HullShader<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount)
delete this;
return RefCount;
}
//
@@ -277,21 +275,18 @@ template <abi_t ABI> void D3D11HullShader<ABI>::GetDevice(gfx::ID3D11Device<ABI>
template <abi_t ABI> HRESULT D3D11HullShader<ABI>::GetPrivateData(_GUID const &guid, uint32_t *pDataSize, void *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->GetPrivateData(guid, pDataSize, pData);
}
template <abi_t ABI>
HRESULT D3D11HullShader<ABI>::SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateData(guid, DataSize, pData);
}
template <abi_t ABI> HRESULT D3D11HullShader<ABI>::SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateDataInterface(guid, pData);
}
template <abi_t ABI>
@@ -306,7 +301,6 @@ HRESULT D3D11HullShader<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &guid,
#define ABI_INTERFACE(ABI) D3D11HullShader<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
//
// IUnknown
//
@@ -318,14 +312,17 @@ template <abi_t ABI> HRESULT D3D11DomainShader<ABI>::QueryInterface(REFIID riid,
template <abi_t ABI> ULONG D3D11DomainShader<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11DomainShader<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount)
delete this;
return RefCount;
}
//
@@ -338,21 +335,18 @@ template <abi_t ABI> void D3D11DomainShader<ABI>::GetDevice(gfx::ID3D11Device<AB
template <abi_t ABI> HRESULT D3D11DomainShader<ABI>::GetPrivateData(_GUID const &guid, uint32_t *pDataSize, void *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->GetPrivateData(guid, pDataSize, pData);
}
template <abi_t ABI>
HRESULT D3D11DomainShader<ABI>::SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateData(guid, DataSize, pData);
}
template <abi_t ABI> HRESULT D3D11DomainShader<ABI>::SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateDataInterface(guid, pData);
}
template <abi_t ABI>

View File

@@ -11,14 +11,17 @@ template <abi_t ABI> HRESULT D3D11SamplerState<ABI>::QueryInterface(REFIID riid,
template <abi_t ABI> ULONG D3D11SamplerState<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11SamplerState<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount)
delete this;
return RefCount;
}
//
@@ -61,19 +64,17 @@ HRESULT D3D11SamplerState<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &gui
//
template <abi_t ABI> void D3D11SamplerState<ABI>::GetDesc(D3D11_SAMPLER_DESC *pDesc)
{
IMPLEMENT_STUB();
m_pFunction->GetDesc(pDesc);
}
template <abi_t ABI> void D3D11SamplerState<ABI>::GetDescX(gfx::D3D11X_SAMPLER_DESC *pDesc)
{
IMPLEMENT_STUB();
}
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11SamplerState<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
//
// IUnknown
//
@@ -85,14 +86,17 @@ template <abi_t ABI> HRESULT D3D11RasterizerState<ABI>::QueryInterface(REFIID ri
template <abi_t ABI> ULONG D3D11RasterizerState<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11RasterizerState<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount)
delete this;
return RefCount;
}
//
@@ -137,14 +141,13 @@ HRESULT D3D11RasterizerState<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &
//
template <abi_t ABI> void D3D11RasterizerState<ABI>::GetDesc(D3D11_RASTERIZER_DESC *pDesc)
{
IMPLEMENT_STUB();
m_pFunction->GetDesc(pDesc);
}
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11RasterizerState<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
//
// IUnknown
//
@@ -156,14 +159,17 @@ template <abi_t ABI> HRESULT D3D11BlendState<ABI>::QueryInterface(REFIID riid, v
template <abi_t ABI> ULONG D3D11BlendState<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11BlendState<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount)
delete this;
return RefCount;
}
//
@@ -206,14 +212,13 @@ HRESULT D3D11BlendState<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &guid,
//
template <abi_t ABI> void D3D11BlendState<ABI>::GetDesc(D3D11_BLEND_DESC *pDesc)
{
IMPLEMENT_STUB();
m_pFunction->GetDesc(pDesc);
}
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11BlendState<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
//
// IUnknown
//
@@ -225,14 +230,17 @@ template <abi_t ABI> HRESULT D3D11DepthStencilState<ABI>::QueryInterface(REFIID
template <abi_t ABI> ULONG D3D11DepthStencilState<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11DepthStencilState<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount)
delete this;
return RefCount;
}
//
@@ -277,14 +285,13 @@ HRESULT D3D11DepthStencilState<ABI>::SetPrivateDataInterfaceGraphics(_GUID const
//
template <abi_t ABI> void D3D11DepthStencilState<ABI>::GetDesc(D3D11_DEPTH_STENCIL_DESC *pDesc)
{
IMPLEMENT_STUB();
m_pFunction->GetDesc(pDesc);
}
template <abi_t ABI> void D3D11DepthStencilState<ABI>::GetDescX(D3D11_DEPTH_STENCIL_DESC *pDesc)
{
IMPLEMENT_STUB();
}
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11DepthStencilState<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
D3D11_DECLARE_ABI_TEMPLATES();

View File

@@ -1,4 +1,5 @@
#include "ID3D11View.h"
#include "ID3D11Resource.h"
//
// IUnknown
@@ -37,8 +38,7 @@ template <abi_t ABI> HRESULT D3D11View<ABI>::GetPrivateData(_GUID const &guid, u
template <abi_t ABI> HRESULT D3D11View<ABI>::SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateData(guid, DataSize, pData);
}
template <abi_t ABI> HRESULT D3D11View<ABI>::SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData)
@@ -66,116 +66,40 @@ template <abi_t ABI> void D3D11View<ABI>::GetResource(gfx::ID3D11Resource<ABI> *
#define ABI_INTERFACE(ABI) D3D11View<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
//
// IUnknown
//
template <abi_t ABI> HRESULT D3D11ShaderResourceView<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> ULONG D3D11ShaderResourceView<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
}
template <abi_t ABI> ULONG D3D11ShaderResourceView<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
}
//
// ID3D11DeviceChild
//
template <abi_t ABI> void D3D11ShaderResourceView<ABI>::GetDevice(gfx::ID3D11Device<ABI> **ppDevice)
{
IMPLEMENT_STUB();
}
template <abi_t ABI>
HRESULT D3D11ShaderResourceView<ABI>::GetPrivateData(_GUID const &guid, uint32_t *pDataSize, void *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT D3D11ShaderResourceView<ABI>::SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT D3D11ShaderResourceView<ABI>::SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT D3D11ShaderResourceView<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &guid,
xbox::IGraphicsUnknown<ABI> const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
//
// ID3D11View
//
template <abi_t ABI> void D3D11ShaderResourceView<ABI>::GetResource(gfx::ID3D11Resource<ABI> **ppResource)
{
IMPLEMENT_STUB();
}
//
// ID3D11ShaderResourceView
//
template <abi_t ABI> void D3D11ShaderResourceView<ABI>::GetDesc(D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc)
{
IMPLEMENT_STUB();
}
template <abi_t ABI> void D3D11ShaderResourceView<ABI>::GetFormatX(gfx::D3D11X_SRV_FORMAT* pFormatX)
{
IMPLEMENT_STUB();
}
template <abi_t ABI> int32_t D3D11ShaderResourceView<ABI>::SetFormatX(gfx::D3D11X_SRV_FORMAT const *pFormatX)
{
IMPLEMENT_STUB();
return {};
}
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11ShaderResourceView<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
//
// IUnknown
//
template <abi_t ABI> HRESULT D3D11RenderTargetView<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
if (riid == xcom::guid_of<ID3D11RenderTargetView>() || riid == xcom::guid_of<ID3D11View>())
{
*ppvObject = this;
AddRef();
return S_OK;
}
if (riid == xcom::guid_of<ID3D11DepthStencilView>())
{
*ppvObject = nullptr;
return E_NOINTERFACE;
}
IMPLEMENT_STUB();
return E_NOTIMPL;
*ppvObject = nullptr;
return E_NOINTERFACE;
}
template <abi_t ABI> ULONG D3D11RenderTargetView<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11RenderTargetView<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
@@ -196,8 +120,7 @@ HRESULT D3D11RenderTargetView<ABI>::GetPrivateData(_GUID const &guid, uint32_t *
template <abi_t ABI>
HRESULT D3D11RenderTargetView<ABI>::SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateData(guid, DataSize, pData);
}
template <abi_t ABI>
@@ -220,7 +143,36 @@ HRESULT D3D11RenderTargetView<ABI>::SetPrivateDataInterfaceGraphics(_GUID const
//
template <abi_t ABI> void D3D11RenderTargetView<ABI>::GetResource(gfx::ID3D11Resource<ABI> **ppResource)
{
IMPLEMENT_STUB();
D3D11_RENDER_TARGET_VIEW_DESC desc;
m_pFunction->GetDesc(&desc);
if (desc.ViewDimension == D3D11_RTV_DIMENSION_BUFFER)
{
ID3D11Buffer *Buffer{};
m_pFunction->GetResource(reinterpret_cast<ID3D11Resource **>(&Buffer));
*reinterpret_cast<D3D11Buffer<ABI> **>(ppResource) = new D3D11Buffer<ABI>(Buffer);
}
if (desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE1D || desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE1DARRAY)
{
ID3D11Texture1D *Tex1D{};
m_pFunction->GetResource(reinterpret_cast<ID3D11Resource **>(&Tex1D));
*reinterpret_cast<D3D11Texture1D<ABI> **>(ppResource) = new D3D11Texture1D<ABI>(Tex1D);
}
if (desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2D ||
desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2DARRAY ||
desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2DMS ||
desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY)
{
ID3D11Texture2D *Tex2D{};
m_pFunction->GetResource(reinterpret_cast<ID3D11Resource **>(&Tex2D));
*reinterpret_cast<D3D11Texture2D<ABI> **>(ppResource) = new D3D11Texture2D<ABI>(Tex2D);
}
if (desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE3D)
{
ID3D11Texture3D *Tex3D{};
m_pFunction->GetResource(reinterpret_cast<ID3D11Resource **>(&Tex3D));
*reinterpret_cast<D3D11Texture3D<ABI> **>(ppResource) = new D3D11Texture3D<ABI>(Tex3D);
}
}
//
@@ -228,33 +180,42 @@ template <abi_t ABI> void D3D11RenderTargetView<ABI>::GetResource(gfx::ID3D11Res
//
template <abi_t ABI> void D3D11RenderTargetView<ABI>::GetDesc(D3D11_RENDER_TARGET_VIEW_DESC *pDesc)
{
IMPLEMENT_STUB();
m_pFunction->GetDesc(pDesc);
}
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11RenderTargetView<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
//
// IUnknown
//
template <abi_t ABI> HRESULT D3D11DepthStencilView<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
if (riid == xcom::guid_of<ID3D11DepthStencilView>() || riid == xcom::guid_of<ID3D11View>())
{
*ppvObject = this;
AddRef();
return S_OK;
}
IMPLEMENT_STUB();
return E_NOTIMPL;
*ppvObject = nullptr;
return E_NOINTERFACE;
}
template <abi_t ABI> ULONG D3D11DepthStencilView<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11DepthStencilView<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
@@ -275,8 +236,7 @@ HRESULT D3D11DepthStencilView<ABI>::GetPrivateData(_GUID const &guid, uint32_t *
template <abi_t ABI>
HRESULT D3D11DepthStencilView<ABI>::SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateData(guid, DataSize, pData);
}
template <abi_t ABI>
@@ -314,26 +274,143 @@ template <abi_t ABI> void D3D11DepthStencilView<ABI>::GetDesc(D3D11_DEPTH_STENCI
#define ABI_INTERFACE(ABI) D3D11DepthStencilView<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
//
// IUnknown
//
template <abi_t ABI> HRESULT D3D11ShaderResourceView<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> ULONG D3D11ShaderResourceView<ABI>::AddRef()
{
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11ShaderResourceView<ABI>::Release()
{
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
// ID3D11DeviceChild
//
template <abi_t ABI> void D3D11ShaderResourceView<ABI>::GetDevice(gfx::ID3D11Device<ABI> **ppDevice)
{
IMPLEMENT_STUB();
}
template <abi_t ABI>
HRESULT D3D11ShaderResourceView<ABI>::GetPrivateData(_GUID const &guid, uint32_t *pDataSize, void *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT D3D11ShaderResourceView<ABI>::SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData)
{
return m_pFunction->SetPrivateData(guid, DataSize, pData);
}
template <abi_t ABI>
HRESULT D3D11ShaderResourceView<ABI>::SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT D3D11ShaderResourceView<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &guid,
xbox::IGraphicsUnknown<ABI> const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
//
// ID3D11View
//
template <abi_t ABI> void D3D11ShaderResourceView<ABI>::GetResource(gfx::ID3D11Resource<ABI> **ppResource)
{
if (m_pBuffer)
{
*ppResource = m_pBuffer;
return;
}
else if (m_pTexture1D)
{
*ppResource = m_pTexture1D;
return;
}
else if (m_pTexture2D)
{
*ppResource = m_pTexture2D;
return;
}
else if (m_pTexture3D)
{
*ppResource = m_pTexture3D;
return;
}
}
//
// ID3D11ShaderResourceView
//
template <abi_t ABI> void D3D11ShaderResourceView<ABI>::GetDesc(D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc)
{
m_pFunction->GetDesc(pDesc);
}
template <abi_t ABI> void D3D11ShaderResourceView<ABI>::GetFormatX(gfx::D3D11X_SRV_FORMAT *pFormat)
{
IMPLEMENT_STUB();
}
template <abi_t ABI> int32_t D3D11ShaderResourceView<ABI>::SetFormatX(gfx::D3D11X_SRV_FORMAT const *pFormat)
{
return E_NOTIMPL;
}
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11ShaderResourceView<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
//
// IUnknown
//
template <abi_t ABI> HRESULT D3D11UnorderedAccessView<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
if (riid == xcom::guid_of<ID3D11UnorderedAccessView>())
{
*ppvObject = this;
AddRef();
return S_OK;
}
IMPLEMENT_STUB();
return E_NOTIMPL;
*ppvObject = nullptr;
return E_NOINTERFACE;
}
template <abi_t ABI> ULONG D3D11UnorderedAccessView<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11UnorderedAccessView<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
@@ -354,8 +431,7 @@ HRESULT D3D11UnorderedAccessView<ABI>::GetPrivateData(_GUID const &guid, uint32_
template <abi_t ABI>
HRESULT D3D11UnorderedAccessView<ABI>::SetPrivateData(_GUID const &guid, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->SetPrivateData(guid, DataSize, pData);
}
template <abi_t ABI>
@@ -378,7 +454,26 @@ HRESULT D3D11UnorderedAccessView<ABI>::SetPrivateDataInterfaceGraphics(_GUID con
//
template <abi_t ABI> void D3D11UnorderedAccessView<ABI>::GetResource(gfx::ID3D11Resource<ABI> **ppResource)
{
IMPLEMENT_STUB();
if (m_pBuffer)
{
*ppResource = m_pBuffer;
return;
}
else if (m_pTexture1D)
{
*ppResource = m_pTexture1D;
return;
}
else if (m_pTexture2D)
{
*ppResource = m_pTexture2D;
return;
}
else if (m_pTexture3D)
{
*ppResource = m_pTexture3D;
return;
}
}
//
@@ -391,4 +486,4 @@ template <abi_t ABI> void D3D11UnorderedAccessView<ABI>::GetDesc(D3D11_UNORDERED
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11UnorderedAccessView<ABI>
D3D11_DECLARE_ABI_TEMPLATES();
D3D11_DECLARE_ABI_TEMPLATES();

View File

@@ -0,0 +1,128 @@
#include "IDXGIAdapter.h"
#include "IDXGIFactory.h"
//
// IUnknown
//
template <abi_t ABI> HRESULT DXGIAdapter1<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
if (riid == __uuidof(IDXGIAdapter) || riid == __uuidof(IDXGIAdapter1))
{
*ppvObject = this;
AddRef();
return S_OK;
}
if (riid == __uuidof(xbox::IGraphicsUnwrap))
{
*ppvObject = m_pFunction;
return S_OK;
}
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> ULONG DXGIAdapter1<ABI>::AddRef()
{
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG DXGIAdapter1<ABI>::Release()
{
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
// IDXGIObject
//
template <abi_t ABI> HRESULT DXGIAdapter1<ABI>::SetPrivateData(GUID const &Name, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIAdapter1<ABI>::SetPrivateDataInterface(GUID const &Name, IUnknown const *pUnknown)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT DXGIAdapter1<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &Name, xbox::IGraphicsUnknown<ABI> const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIAdapter1<ABI>::GetPrivateData(_GUID const &Name, UINT *pDataSize, void *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIAdapter1<ABI>::GetParent(_GUID const &riid, void **ppParent)
{
if (riid == __uuidof(IDXGIFactory))
{
IDXGIFactory *factory{};
m_pFunction->GetParent(IID_PPV_ARGS(&factory));
*ppParent = new DXGIFactory2<ABI>(static_cast<IDXGIFactory2*>(factory));
return S_OK;
}
if (riid == __uuidof(IDXGIFactory1))
{
IDXGIFactory1 *factory{};
m_pFunction->GetParent(IID_PPV_ARGS(&factory));
*ppParent = new DXGIFactory2<ABI>(static_cast<IDXGIFactory2*>(factory));
return S_OK;
}
if (riid == __uuidof(IDXGIFactory2))
{
IDXGIFactory2 *factory{};
m_pFunction->GetParent(IID_PPV_ARGS(&factory));
*ppParent = new DXGIFactory2<ABI>(static_cast<IDXGIFactory2*>(factory));
return S_OK;
}
return E_NOINTERFACE;
}
//
// IDXGIAdapter
//
template <abi_t ABI> HRESULT DXGIAdapter1<ABI>::EnumOutputs(UINT Output, IDXGIOutput **ppOutput)
{
return m_pFunction->EnumOutputs(Output, ppOutput);
}
template <abi_t ABI> HRESULT DXGIAdapter1<ABI>::GetDesc(DXGI_ADAPTER_DESC *pDesc)
{
return m_pFunction->GetDesc(pDesc);
}
template <abi_t ABI>
HRESULT DXGIAdapter1<ABI>::CheckInterfaceSupport(_GUID const &InterfaceName, LARGE_INTEGER *pUMDVersion)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
//
// IDXGIAdapter1
//
template <abi_t ABI> HRESULT DXGIAdapter1<ABI>::GetDesc1(DXGI_ADAPTER_DESC1 *pDesc)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) DXGIAdapter1<ABI>
D3D11_DECLARE_ABI_TEMPLATES();

View File

@@ -0,0 +1,155 @@
#include "IDXGIDevice.h"
#include "IDXGIAdapter.h"
//
// IUnknown
//
template <abi_t ABI> HRESULT DXGIDevice2<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> ULONG DXGIDevice2<ABI>::AddRef()
{
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG DXGIDevice2<ABI>::Release()
{
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
// IDXGIObject
//
template <abi_t ABI> HRESULT DXGIDevice2<ABI>::SetPrivateData(GUID const &Name, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIDevice2<ABI>::SetPrivateDataInterface(GUID const &Name, IUnknown const *pUnknown)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT DXGIDevice2<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &Name, xbox::IGraphicsUnknown<ABI> const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIDevice2<ABI>::GetPrivateData(_GUID const &Name, UINT *pDataSize, void *pData)
{
return m_pFunction->GetPrivateData(Name, pDataSize, pData);
}
template <abi_t ABI> HRESULT DXGIDevice2<ABI>::GetParent(_GUID const &riid, void **ppParent)
{
if (riid == __uuidof(IDXGIAdapter))
{
m_pFunction->GetParent(riid, ppParent);
*ppParent = new DXGIAdapter1<ABI>(static_cast<IDXGIAdapter1*>(*ppParent));
AddRef();
return S_OK;
}
IMPLEMENT_STUB();
return E_NOTIMPL;
}
//
// IDXGIDevice
//
template <abi_t ABI> HRESULT DXGIDevice2<ABI>::GetAdapter(gfx::IDXGIAdapter<ABI> **pAdapter)
{
::IDXGIAdapter *Adapter{};
::IDXGIAdapter1 *Adapter1{};
m_pFunction->GetAdapter(&Adapter);
Adapter->QueryInterface(IID_PPV_ARGS(&Adapter1));
Adapter->Release();
if (Adapter)
{
*pAdapter = new DXGIAdapter1<ABI>(Adapter1);
}
return S_OK;
}
template <abi_t ABI>
HRESULT DXGIDevice2<ABI>::CreateSurface(DXGI_SURFACE_DESC const *pDesc, uint32_t NumSurfaces, DXGI_USAGE Usage,
DXGI_SHARED_RESOURCE const *pSharedResource, IDXGISurface **ppSurface)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT DXGIDevice2<ABI>::QueryResourceResidency(xbox::IGraphicsUnknown<ABI> **ppResources,
DXGI_RESIDENCY *pResidencyStatus, uint32_t NumResources)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIDevice2<ABI>::SetGPUThreadPriority(int Priority)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIDevice2<ABI>::GetGPUThreadPriority(int *pPriority)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
//
// IDXGIDevice1
//
template <abi_t ABI> HRESULT DXGIDevice2<ABI>::SetMaximumFrameLatency(uint32_t MaxLatency)
{
return m_pFunction->SetMaximumFrameLatency(MaxLatency);
}
template <abi_t ABI> HRESULT DXGIDevice2<ABI>::GetMaximumFrameLatency(uint32_t *pMaxLatency)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
//
// IDXGIDevice2
//
template <abi_t ABI>
HRESULT DXGIDevice2<ABI>::OfferResources(uint32_t NumResources, IDXGIResource *const *ppResources,
DXGI_OFFER_RESOURCE_PRIORITY Priority)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT DXGIDevice2<ABI>::ReclaimResources(uint32_t NumResources, IDXGIResource *const *ppResources, bool *pDiscarded)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIDevice2<ABI>::EnqueueSetEvent(void *hEvent)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) DXGIDevice2<ABI>
D3D11_DECLARE_ABI_TEMPLATES();

View File

@@ -0,0 +1,268 @@
#include "IDXGIFactory.h"
#include "EraCoreWindow.h"
#include "ID3D11Device.h"
#include "IDXGISwapChain.h"
#include <CoreWindow.h>
#include <windows.applicationmodel.core.h>
#include <winrt/Windows.ApplicationModel.h>
#include <winrt/windows.storage.provider.h>
#include "ID3D11Runtime.h"
//
// IUnknown
//
template <abi_t ABI> HRESULT DXGIFactory2<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> ULONG DXGIFactory2<ABI>::AddRef()
{
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG DXGIFactory2<ABI>::Release()
{
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
// IDXGIObject
//
template <abi_t ABI> HRESULT DXGIFactory2<ABI>::SetPrivateData(GUID const &Name, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIFactory2<ABI>::SetPrivateDataInterface(GUID const &Name, IUnknown const *pUnknown)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT DXGIFactory2<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &Name, xbox::IGraphicsUnknown<ABI> const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIFactory2<ABI>::GetPrivateData(_GUID const &Name, UINT *pDataSize, void *pData)
{
return m_pFunction->GetPrivateData(Name, pDataSize, pData);
}
template <abi_t ABI> HRESULT DXGIFactory2<ABI>::GetParent(_GUID const &riid, void **ppParent)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
//
// IDXGIFactory
//
template <abi_t ABI> HRESULT DXGIFactory2<ABI>::EnumAdapters(UINT Adapter, gfx::IDXGIAdapter<ABI> **ppAdapter)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIFactory2<ABI>::MakeWindowAssociation(HWND WindowHandle, UINT Flags)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIFactory2<ABI>::GetWindowAssociation(HWND *pWindowHandle)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT DXGIFactory2<ABI>::CreateSwapChain(xbox::IGraphicsUnknown<ABI> *pDevice, DXGI_SWAP_CHAIN_DESC *pDesc,
gfx::IDXGISwapChain<ABI> **ppSwapChain)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT DXGIFactory2<ABI>::CreateSoftwareAdapter(HMODULE Module, gfx::IDXGIAdapter<ABI> **ppAdapter)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
//
// IDXGIFactory1
//
template <abi_t ABI> HRESULT DXGIFactory2<ABI>::EnumAdapters1(UINT Adapter, gfx::IDXGIAdapter1<ABI> **ppAdapter)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> bool DXGIFactory2<ABI>::IsCurrent()
{
IMPLEMENT_STUB();
return {};
}
//
// IDXGIFactory2
//
template <abi_t ABI> bool DXGIFactory2<ABI>::IsWindowedStereoEnabled()
{
IMPLEMENT_STUB();
return {};
}
template <abi_t ABI>
HRESULT DXGIFactory2<ABI>::CreateSwapChainForHwnd(xbox::IGraphicsUnknown<ABI> *pDevice, HWND hWnd,
DXGI_SWAP_CHAIN_DESC1 const *pDesc,
DXGI_SWAP_CHAIN_FULLSCREEN_DESC const *pFullscreenDesc,
IDXGIOutput *pRestrictToOutput,
gfx::IDXGISwapChain1<ABI> **ppSwapChain)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}
IDXGISwapChain1 *OldSwapChain{};
winrt::hstring GamePackage = winrt::Windows::ApplicationModel::Package::Current().Id().FamilyName();
template <abi_t ABI>
HRESULT DXGIFactory2<ABI>::CreateSwapChainForCoreWindow(xbox::IGraphicsUnknown<ABI> *pDevice, IUnknown *pWindow,
DXGI_SWAP_CHAIN_DESC1 *pDesc, IDXGIOutput *pRestrictToOutput,
gfx::IDXGISwapChain1<ABI> **ppSwapChain)
{
auto pDesc2 = *pDesc;
pDesc2.Scaling = DXGI_SCALING_STRETCH;
pDesc2.Flags = 0;
IUnknown *dev{};
HRESULT hr = 0;
if (pDevice)
{
pDevice->QueryInterface(__uuidof(xbox::IGraphicsUnwrap), (void **)&dev);
}
else
{
pDevice = new D3D11DeviceX<ABI>(pDev2);
pDevice->QueryInterface(__uuidof(xbox::IGraphicsUnwrap), (void **)&dev);
}
if (!pWindow)
{
ComPtr<ICoreWindowStatic> pWindowStatic;
RoGetActivationFactory(Microsoft::WRL::Wrappers::HStringReference::HStringReference(RuntimeClass_Windows_UI_Core_CoreWindow).Get(), IID_PPV_ARGS(&pWindowStatic));
ComPtr<ICoreWindow> Window;
pWindowStatic->GetForCurrentThread(&Window);
ICoreWindowInterop *interop;
Window->QueryInterface(IID_PPV_ARGS(&interop));
HWND hwnd;
interop->get_WindowHandle(&hwnd);
IDXGISwapChain1 *SwapChain{};
hr = m_pFunction->CreateSwapChainForHwnd(dev, hwnd, &pDesc2, NULL, NULL, &SwapChain);
if (SwapChain)
{
*ppSwapChain = new DXGISwapChain1<ABI>(SwapChain);
}
return hr;
}
auto Window = reinterpret_cast<CoreWindowEra*>(pWindow)->m_realWindow;
ICoreWindowInterop *interop;
Window->QueryInterface(IID_PPV_ARGS(&interop));
HWND hwnd;
interop->get_WindowHandle(&hwnd);
IDXGISwapChain1 *SwapChain{};
hr = m_pFunction->CreateSwapChainForHwnd(dev, hwnd, &pDesc2, NULL, NULL, &SwapChain);
if (SwapChain)
{
*ppSwapChain = new DXGISwapChain1<ABI>(SwapChain);
}
return hr;
}
template <abi_t ABI> HRESULT DXGIFactory2<ABI>::GetSharedResourceAdapterLuid(void *hResource, _LUID *pLuid)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT DXGIFactory2<ABI>::RegisterStereoStatusWindow(HWND WindowHandle, uint32_t wMsg, uint32_t *pdwCookie)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIFactory2<ABI>::RegisterStereoStatusEvent(void *hEvent, uint32_t *pdwCookie)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> void DXGIFactory2<ABI>::UnregisterStereoStatus(uint32_t dwCookie)
{
IMPLEMENT_STUB();
}
template <abi_t ABI>
HRESULT DXGIFactory2<ABI>::RegisterOcclusionStatusWindow(HWND WindowHandle, uint32_t wMsg, uint32_t *pdwCookie)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGIFactory2<ABI>::RegisterOcclusionStatusEvent(void *hEvent, uint32_t *pdwCookie)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> void DXGIFactory2<ABI>::UnregisterOcclusionStatus(uint32_t dwCookie)
{
IMPLEMENT_STUB();
}
template <abi_t ABI>
HRESULT DXGIFactory2<ABI>::CreateSwapChainForComposition(xbox::IGraphicsUnknown<ABI> *pDevice,
DXGI_SWAP_CHAIN_DESC1 const *pDesc,
IDXGIOutput *pRestrictToOutput,
gfx::IDXGISwapChain1<ABI> **ppSwapChain)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) DXGIFactory2<ABI>
D3D11_DECLARE_ABI_TEMPLATES();

View File

@@ -0,0 +1,228 @@
#include "IDXGISwapChain.h"
//
// IUnknown
//
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::QueryInterface(REFIID riid, void **ppvObject)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> ULONG DXGISwapChain1<ABI>::AddRef()
{
m_pFunction->AddRef();
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG DXGISwapChain1<ABI>::Release()
{
m_pFunction->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount) delete this;
return RefCount;
}
//
// IDXGIObject
//
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::SetPrivateData(GUID const &Name, uint32_t DataSize, void const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::SetPrivateDataInterface(GUID const &Name, IUnknown const *pUnknown)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT DXGISwapChain1<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &Name,
xbox::IGraphicsUnknown<ABI> const *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetPrivateData(_GUID const &Name, UINT *pDataSize, void *pData)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetParent(_GUID const &riid, void **ppParent)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
//
// IDXGIDeviceSubObject
//
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetDevice(REFIID riid, void **ppDevice)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
//
// IDXGISwapChain
//
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::Present(uint32_t SyncInterval, uint32_t Flags)
{
return m_pFunction->Present(SyncInterval, Flags);
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetBuffer(UINT Buffer, REFIID riid, void **ppSurface)
{
if (riid == xcom::guid_of<gfx::ID3D11Texture1D>())
{
::ID3D11Texture1D *tex1D{};
HRESULT hr = m_pFunction->GetBuffer(Buffer, IID_PPV_ARGS(&tex1D));
*ppSurface = new D3D11Texture1D<ABI>(tex1D);
return hr;
}
else if (riid == xcom::guid_of<gfx::ID3D11Texture2D>())
{
::ID3D11Texture2D *tex2D{};
HRESULT hr = m_pFunction->GetBuffer(Buffer, IID_PPV_ARGS(&tex2D));
*ppSurface = new D3D11Texture2D<ABI>(tex2D);
return hr;
}
else if (riid == xcom::guid_of<gfx::ID3D11Texture3D>())
{
::ID3D11Texture3D *tex3D{};
HRESULT hr = m_pFunction->GetBuffer(Buffer, IID_PPV_ARGS(&tex3D));
*ppSurface = new D3D11Texture3D<ABI>(tex3D);
return hr;
}
IMPLEMENT_STUB();
return E_NOINTERFACE;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::SetFullscreenState(bool Fullscreen, IDXGIOutput *pTarget)
{
return m_pFunction->SetFullscreenState(Fullscreen, pTarget);
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetFullscreenState(bool *pFullscreen, IDXGIOutput **ppTarget)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetDesc(DXGI_SWAP_CHAIN_DESC *pDesc)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT DXGISwapChain1<ABI>::ResizeBuffers(uint32_t BufferCount, uint32_t Width, uint32_t Height, DXGI_FORMAT NewFormat,
uint32_t SwapChainFlags)
{
return m_pFunction->ResizeBuffers(BufferCount, Width, Height, NewFormat, SwapChainFlags);
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::ResizeTarget(DXGI_MODE_DESC const *pNewTargetParameters)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetContainingOutput(IDXGIOutput **ppOutput)
{
return m_pFunction->GetContainingOutput(ppOutput);
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetFrameStatistics(DXGI_FRAME_STATISTICS *pStats)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetLastPresentCount(uint32_t *pLastPresentCount)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
//
// IDXGISwapChain1
//
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetDesc1(DXGI_SWAP_CHAIN_DESC1 *pDesc)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetFullscreenDesc(DXGI_SWAP_CHAIN_FULLSCREEN_DESC *pDesc)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetHwnd(HWND *pHwnd)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetCoreWindow(REFIID refiid, void **ppUnk)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI>
HRESULT DXGISwapChain1<ABI>::Present1(uint32_t SyncInterval, uint32_t PresentFlags,
DXGI_PRESENT_PARAMETERS const *pPresentParameters)
{
if (!pPresentParameters)
return Present(SyncInterval, PresentFlags);
else
return Present1(SyncInterval, PresentFlags, pPresentParameters);
}
template <abi_t ABI> bool DXGISwapChain1<ABI>::IsTemporaryMonoSupported()
{
IMPLEMENT_STUB();
return {};
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetRestrictToOutput(IDXGIOutput **ppRestrictToOutput)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::SetBackgroundColor(DXGI_RGBA const *pColor)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetBackgroundColor(DXGI_RGBA *pColor)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::SetRotation(DXGI_MODE_ROTATION Rotation)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
template <abi_t ABI> HRESULT DXGISwapChain1<ABI>::GetRotation(DXGI_MODE_ROTATION *pRotation)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) DXGISwapChain1<ABI>
D3D11_DECLARE_ABI_TEMPLATES();