Forza Motorsport 5 Progress + Fixes

This commit is contained in:
Rodrigo Todescatto
2026-02-07 15:05:33 -03:00
parent ca69f197fa
commit d15e52a383
17 changed files with 1405 additions and 253 deletions

View File

@@ -16,7 +16,7 @@ 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" "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")
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)

View File

@@ -1,9 +1,64 @@
#pragma once
#include "ID3D11DeviceContext.h"
#include "d3d11_x.g.h"
#include <vector>
template <abi_t ABI> class D3D11DMAEngineContextX : public gfx::ID3D11DMAEngineContextX<ABI>
BOOL DMAFences[1024]{};
UINT DMAFenceIndex = 0;
template <abi_t ABI> struct CopyResourceCommand;
template <abi_t ABI> struct CopySubresourceRegionCommand;
template <abi_t ABI> struct DMAInsertFenceCommand;
template <abi_t ABI> struct DMAInsertWaitOnFenceCommand;
template <abi_t ABI> struct LZDecompressMemoryCommand;
template <abi_t ABI> struct FillMemoryWithValueCommand;
template <abi_t ABI> struct CopyLastErrorCodeToMemoryCommand;
template <abi_t ABI> struct DMACommands
{
public:
enum class DMACommandType
{
CopyResource,
CopySubresourceRegion,
DMAInsertFence,
DMAInsertWaitOnFence,
LZDecompressMemory,
FillMemoryWithValue,
CopyLastErrorCodeToMemory,
};
union {
CopyResourceCommand<ABI> CopyResource;
CopySubresourceRegionCommand<ABI> CopySubresourceRegion;
DMAInsertFenceCommand<ABI> DMAInsertFence;
DMAInsertWaitOnFenceCommand<ABI> DMAInsertWaitOnFence;
LZDecompressMemoryCommand<ABI> LZDecompressMemory;
FillMemoryWithValueCommand<ABI> FillMemoryWithValue;
CopyLastErrorCodeToMemoryCommand<ABI> CopyLastErrorCodeToMemory;
};
DMACommandType m_DMACommandType;
};
template <abi_t ABI> class D3D11DMAEngineContextX : public gfx::ID3D11DMAEngineContextX<ABI>, ID3D11BackgroundContext
{
public:
std::vector<DMACommands<ABI>> m_DMACommandQueue;
D3D11DeviceContextX<ABI> *m_pImmediateContext;
D3D11DMAEngineContextX()
{
AddRef();
m_pImmediateContext = new D3D11DeviceContextX<ABI>();
}
//
// IUnknown
//
@@ -19,6 +74,10 @@ template <abi_t ABI> class D3D11DMAEngineContextX : public gfx::ID3D11DMAEngineC
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;
}
//
// ID3D11DMAEngineContextX
@@ -51,8 +110,102 @@ template <abi_t ABI> class D3D11DMAEngineContextX : public gfx::ID3D11DMAEngineC
void WriteTimestampToBuffer(gfx::ID3D11Buffer<ABI> *v1, uint32_t v2);
void WriteValueBottomOfPipe(void *v1, uint32_t v2);
void InsertWaitOnMemory(void const *v1, uint32_t v2, D3D11_COMPARISON_FUNC v3, uint32_t v4, uint32_t v5);
BOOL ExecuteContext() override;
UINT m_CommandIndex = 0;
};
template <abi_t ABI> struct CopyResourceCommand
{
gfx::ID3D11Resource<ABI> *pDstResource;
gfx::ID3D11Resource<ABI> *pSrcResource;
UINT Flags;
BOOL Execute(D3D11DMAEngineContextX<ABI> *pDmaContext)
{
pDmaContext->m_pImmediateContext->CopyResource(pDstResource, pSrcResource);
return FALSE;
}
};
template <abi_t ABI> struct CopySubresourceRegionCommand
{
gfx::ID3D11Resource<ABI> *pDstResource;
UINT DstSubresource;
UINT DstX;
UINT DstY;
UINT DstZ;
gfx::ID3D11Resource<ABI> *pSrcResource;
UINT SrcSubresource;
const D3D11_BOX *pSrcBox;
UINT Flags;
BOOL Execute(D3D11DMAEngineContextX<ABI> *pDmaContext)
{
pDmaContext->m_pImmediateContext->CopySubresourceRegion(pDstResource, DstSubresource, DstX, DstY, DstZ,
pSrcResource, SrcSubresource, pSrcBox);
return FALSE;
}
};
template <abi_t ABI> struct DMAInsertFenceCommand
{
UINT Flags;
UINT64 Fence;
BOOL Execute(D3D11DMAEngineContextX<ABI> *pDmaContext)
{
return !*reinterpret_cast<BOOL volatile *>(Fence);
}
};
template <abi_t ABI> struct DMAInsertWaitOnFenceCommand
{
UINT Flags;
UINT64 Fence;
BOOL Execute(D3D11DMAEngineContextX<ABI> *pDmaContext)
{
return !*reinterpret_cast<BOOL volatile *>(Fence);
}
};
template <abi_t ABI> struct LZDecompressMemoryCommand
{
void *NextIn;
void *NextOut;
UINT AvailIn;
UINT Flags;
BOOL Execute(D3D11DMAEngineContextX<ABI> *pDmaContext)
{
//TODO: Install zlib
return FALSE;
}
};
template <abi_t ABI> struct FillMemoryWithValueCommand
{
void *pDstAddress;
UINT64 SizeBytes;
UINT FillValue;
BOOL Execute(D3D11DMAEngineContextX<ABI> *pDmaContext)
{
pDmaContext->m_pImmediateContext->FillMemoryWithValue(pDstAddress, SizeBytes, FillValue);
return FALSE;
}
};
template <abi_t ABI> struct CopyLastErrorCodeToMemoryCommand
{
void *pDstAddress;
BOOL Execute(D3D11DMAEngineContextX<ABI> *pDmaContext)
{
return FALSE;
}
};
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11DMAEngineContextX<ABI>
D3D11_DECLARE_ABI_TEMPLATES(extern);
D3D11_DECLARE_ABI_TEMPLATES(extern);

View File

@@ -1,5 +1,35 @@
#pragma once
#include "d3d11_x.g.h"
#include <map>
#include <mutex>
#include <vector>
ID3D11DeviceContext2 *g_Context = nullptr;
static std::map<UINT64, int> D3D11X_HARDWARE_TO_TOPOLOGY_MAP = {
{0x000001ffc0009e00, 0}, {0x000003ffc0009e00, 1}, {0x000005ffc0009e00, 2}, {0x000007ffc0009e00, 3},
{0x000009ffc0009e00, 4}, {0x00000dffc0009e00, 5}, {0x00000bffc0009e00, 6}, {0x000001ffc0009e00, 7},
{0x000001ffc0009e00, 8}, {0x000001ffc0009e00, 9}, {0x0000157fc0009e00, 10}, {0x0000177fc0009e00, 11},
{0x0000197fc0009e00, 12}, {0x00001b7fc0009e00, 13}, {0x00001dffc0009e00, 14}, {0x00001fffc0009e00, 15},
{0x000021ffc0009e00, 16}, {0x000023ffc0009e00, 17}, {0x000025ffc0009e00, 18}, {0x000027ffc0009e00, 19},
{0x000029ffc0009e00, 20}, {0x00002bffc0009e00, 21}, {0x00002dffc0009e00, 22}, {0x00002fffc0009e00, 23},
{0x000031ffc0009e00, 24}, {0x000033ffc0009e00, 25}, {0x000035ffc0009e00, 26}, {0x000037ffc0009e00, 27},
{0x000039ffc0009e00, 28}, {0x000001ffc0009e00, 29}, {0x000001ffc0009e00, 30}, {0x000001ffc0009e00, 31},
{0x000001ffc0009e00, 32}, {0x001013ffc0009e00, 33}, {0x0020137fc0009e00, 34}, {0x00301354c0009e00, 35},
{0x0040133fc0009e00, 36}, {0x00501332c0009e00, 37}, {0x00601329c0009e00, 38}, {0x00701323c0009e00, 39},
{0x0080131fc0009e00, 40}, {0x0090131bc0009e00, 41}, {0x00a01318c0009e00, 42}, {0x00b01316c0009e00, 43},
{0x00c01314c0009e00, 44}, {0x00d01312c0009e00, 45}, {0x00e01311c0009e00, 46}, {0x00f01310c0009e00, 47},
{0x0100130fc0009e00, 48}, {0x0110130ec0009e00, 49}, {0x0120130dc0009e00, 50}, {0x0130130cc0009e00, 51},
{0x0140130bc0009e00, 52}, {0x0150130bc0009e00, 53}, {0x0160130ac0009e00, 54}, {0x0170130ac0009e00, 55},
{0x01801309c0009e00, 56}, {0x01901309c0009e00, 57}, {0x01a01308c0009e00, 58}, {0x01b01308c0009e00, 59},
{0x01c01308c0009e00, 60}, {0x01d01307c0009e00, 61}, {0x01e01307c0009e00, 62}, {0x01f01307c0009e00, 63},
{0x02001307c0009e00, 64}};
struct ID3D11BackgroundContext : IUnknown
{
// Returns TRUE if the context has executed all of its commands
virtual BOOL ExecuteContext() = 0;
};
template <abi_t ABI> class D3D11DeviceContextX : public gfx::ID3D11DeviceContextX<ABI>
{
@@ -9,6 +39,13 @@ public:
D3D11DeviceContextX(ID3D11DeviceContext2 *pContext)
{
m_pFunction = pContext;
g_Context = m_pFunction;
InterlockedIncrement(&this->m_RefCount);
memcpy(&this->m_Function, *(void ***)this, sizeof(this->m_Function));
}
D3D11DeviceContextX()
{
m_pFunction = g_Context;
InterlockedIncrement(&this->m_RefCount);
memcpy(&this->m_Function, *(void ***)this, sizeof(this->m_Function));
}
@@ -29,15 +66,23 @@ public:
HRESULT SetPrivateDataInterface(_GUID const &guid, IUnknown const *pData);
HRESULT SetPrivateDataInterfaceGraphics(_GUID const &guid, xbox::IGraphicsUnknown<ABI> const *pData);
std::vector<ID3D11BackgroundContext*> m_BkgContexts;
std::mutex m_BkgCtxLock;
//
// ID3D11DeviceContext
//
void CheckDirtyFlags();
void ExecuteBackgroundContexts();
void AddBackgroundContext(ID3D11BackgroundContext *pContext);
void RemoveBackgroundContext(ID3D11BackgroundContext *pContext);
void VSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void PSSetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void PSSetShader(gfx::ID3D11PixelShader<ABI> *pPixelShader);
void PSSetSamplers(UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void VSSetShader(gfx::ID3D11VertexShader<ABI> *pVertexShader);
void DrawIndexed(UINT IndexCount, UINT StartIndexLocation, INT BaseVertexLocation);
void DrawIndexed(UINT64 StartIndexLocationAndIndexCount, INT BaseVertexLocation);
void Draw(UINT VertexCount, UINT StartVertexLocation);
HRESULT Map(gfx::ID3D11Resource<ABI> *pResource, UINT Subresource, D3D11_MAP MapType, UINT MapFlags,
@@ -49,8 +94,12 @@ public:
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 DrawIndexedInstanced(UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation,
INT BaseVertexLocation, UINT StartInstanceLocation);
void DrawIndexedInstanced(UINT64 StartIndexLocationAndIndexCountPerInstance,
UINT64 BaseVertexLocationAndStartInstanceLocation, UINT InstanceCount);
void DrawInstanced(UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation,
UINT StartInstanceLocation);
void DrawInstanced(UINT VertexCountPerInstance, UINT64 StartVertexLocationAndStartInstanceLocation,
UINT InstanceCount);
void GSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);

View File

@@ -1,6 +1,7 @@
#pragma once
#include "ID3D11Device.h"
#include "ID3D11DeviceContext.h"
#include "IDXGISwapChain.h"
static ID3D11Device2 *pDev2 = nullptr;
static ID3D11DeviceContext2 *pCtx2 = nullptr;
@@ -43,4 +44,25 @@ template <abi_t ABI> struct D3D11Runtime : public ID3D11Runtime
return hr;
};
};
};
struct IDXGIXPresentArrayHelper
{
virtual void PresentArray(void **ppSwapChains, UINT NumSwapChains, UINT SyncInterval) = 0;
};
template <abi_t ABI> struct DXGIXPresentArrayHelper : public IDXGIXPresentArrayHelper
{
void PresentArray(void **ppSwapChains, UINT NumSwapChains, UINT SyncInterval) override
{
for (UINT SwapChainIndex = 0; SwapChainIndex < NumSwapChains; SwapChainIndex++)
{
DXGISwapChain1<ABI> *SwapChain = static_cast<DXGISwapChain1<ABI> *>(ppSwapChains[SwapChainIndex]);
SwapChain->Present(SyncInterval, 0);
}
}
};
static IDXGIXPresentArrayHelper *g_PresentArrayHelper = nullptr;

View File

@@ -10,6 +10,8 @@
#include <dxgi1_6.h>
#include <map>
#include <mutex>
#include <algorithm>
#include <cstdint>
// We use that to know the OS version.
abi_t g_ABI{};
@@ -69,3 +71,100 @@ void GetCombaseVersion()
g_ABI.Build = build;
g_ABI.Revision = revision;
}
inline bool IsBlockCompressed(DXGI_FORMAT format)
{
switch (format)
{
case DXGI_FORMAT_BC1_TYPELESS:
case DXGI_FORMAT_BC1_UNORM:
case DXGI_FORMAT_BC1_UNORM_SRGB:
case DXGI_FORMAT_BC2_TYPELESS:
case DXGI_FORMAT_BC2_UNORM:
case DXGI_FORMAT_BC2_UNORM_SRGB:
case DXGI_FORMAT_BC3_TYPELESS:
case DXGI_FORMAT_BC3_UNORM:
case DXGI_FORMAT_BC3_UNORM_SRGB:
case DXGI_FORMAT_BC4_TYPELESS:
case DXGI_FORMAT_BC4_UNORM:
case DXGI_FORMAT_BC4_SNORM:
case DXGI_FORMAT_BC5_TYPELESS:
case DXGI_FORMAT_BC5_UNORM:
case DXGI_FORMAT_BC5_SNORM:
case DXGI_FORMAT_BC6H_TYPELESS:
case DXGI_FORMAT_BC6H_UF16:
case DXGI_FORMAT_BC6H_SF16:
case DXGI_FORMAT_BC7_TYPELESS:
case DXGI_FORMAT_BC7_UNORM:
case DXGI_FORMAT_BC7_UNORM_SRGB:
return true;
default:
return false;
}
}
inline uint32_t BytesPerBlock(DXGI_FORMAT format)
{
switch (format)
{
case DXGI_FORMAT_BC1_TYPELESS:
case DXGI_FORMAT_BC1_UNORM:
case DXGI_FORMAT_BC1_UNORM_SRGB:
case DXGI_FORMAT_BC4_TYPELESS:
case DXGI_FORMAT_BC4_UNORM:
case DXGI_FORMAT_BC4_SNORM:
return 8;
default:
return 16;
}
}
inline uint32_t BytesPerPixel(DXGI_FORMAT format)
{
switch (format)
{
case DXGI_FORMAT_R8_UNORM:
return 1;
case DXGI_FORMAT_R8G8_UNORM:
return 2;
case DXGI_FORMAT_R8G8B8A8_UNORM:
return 4;
case DXGI_FORMAT_B8G8R8A8_UNORM:
return 4;
case DXGI_FORMAT_R16_FLOAT:
return 2;
case DXGI_FORMAT_R16G16_FLOAT:
return 4;
case DXGI_FORMAT_R16G16B16A16_FLOAT:
return 8;
case DXGI_FORMAT_R32_FLOAT:
return 4;
case DXGI_FORMAT_R32G32_FLOAT:
return 8;
case DXGI_FORMAT_R32G32B32A32_FLOAT:
return 16;
default:
return 0;
}
}
inline void CalculatePitch(uint32_t Width, uint32_t Height, DXGI_FORMAT Format, uint32_t* pRowPitch, uint32_t* pSlicePitch)
{;
if (IsBlockCompressed(Format))
{
uint32_t BlocksWide = (Width + 3) / 4;
uint32_t BlocksHigh = (Height + 3) / 4;
uint32_t BlockSize = BytesPerBlock(Format);
(*pRowPitch) = BlocksWide * BlockSize;
(*pSlicePitch) = (*pRowPitch) * BlocksHigh;
}
else
{
uint32_t bpp = BytesPerPixel(Format);
(*pRowPitch) = Width * bpp;
(*pSlicePitch) = (*pRowPitch) * Height;
}
}

View File

@@ -1339,7 +1339,7 @@ enum D3D11X_IMG_NUM_FORMAT
virtual void PSSetShader(gfx::ID3D11PixelShader<ABI> *pPixelShader) = 0;
virtual void PSSetSamplers(UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> *const *ppSamplers) = 0;
virtual void VSSetShader(gfx::ID3D11VertexShader<ABI> *pVertexShader) = 0;
virtual void DrawIndexed(UINT64 StartIndexLocationAndIndexCount, INT BaseVertexLocation) = 0;
virtual void DrawIndexed(UINT IndexCount, UINT StartIndexLocation, INT BaseVertexLocation) = 0;
virtual void Draw(UINT VertexCount, UINT StartVertexLocation) = 0;
virtual HRESULT Map(gfx::ID3D11Resource<ABI> *pResource, UINT Subresource, D3D11_MAP MapType, UINT MapFlags, D3D11_MAPPED_SUBRESOURCE *pMappedResource) = 0;
virtual void Unmap(gfx::ID3D11Resource<ABI> *pResource, UINT Subresource) = 0;
@@ -1347,7 +1347,7 @@ enum D3D11X_IMG_NUM_FORMAT
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(gfx::ID3D11Buffer<ABI> *pIndexBuffer, UINT HardwareIndexFormat, UINT Offset) = 0;
virtual void DrawIndexedInstanced(UINT StartIndexLocationAndIndexCountPerInstance, UINT64 BaseVertexLocationAndStartInstanceLocation, UINT64 InstanceCount) = 0;
virtual void DrawIndexedInstanced(UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation, INT BaseVertexLocation, UINT StartInstanceLocation) = 0;
virtual void DrawInstanced(UINT VertexCountPerInstance, UINT64 StartVertexLocationAndStartInstanceLocation, UINT InstanceCount) = 0;
virtual void GSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers) = 0;
virtual void GSSetShader(gfx::ID3D11GeometryShader<ABI> *pShader) = 0;
@@ -1443,6 +1443,189 @@ enum D3D11X_IMG_NUM_FORMAT
virtual UINT GetContextFlags() = 0;
virtual HRESULT FinishCommandList(BOOL RestoreDeferredContextState, ID3D11CommandList **ppCommandList) = 0;
};
template <abi_t ABI>
requires(ABI >= abi_t{6,2,11064,0} && ABI < abi_t{6,2,11294,0})
struct ID3D11DeviceContext<ABI> : gfx::ID3D11DeviceChild<ABI>, details::ID3D11DeviceContextData<ABI>
{
virtual void VSSetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers) = 0;
virtual void PSSetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews) = 0;
virtual void PSSetShader(gfx::ID3D11PixelShader<ABI> *pPixelShader) = 0;
virtual void PSSetSamplers(UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers) = 0;
virtual void VSSetShader(gfx::ID3D11VertexShader<ABI> *pVertexShader) = 0;
virtual void DrawIndexed(UINT64 StartIndexLocationAndIndexCount, INT BaseVertexLocation) = 0;
virtual void Draw(UINT VertexCount, UINT StartVertexLocation) = 0;
virtual HRESULT Map(gfx::ID3D11Resource<ABI> *pResource, UINT Subresource, D3D11_MAP MapType, UINT MapFlags,
D3D11_MAPPED_SUBRESOURCE *pMappedResource) = 0;
virtual void Unmap(gfx::ID3D11Resource<ABI> *pResource, UINT Subresource) = 0;
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(gfx::ID3D11Buffer<ABI> *pIndexBuffer, UINT HardwareIndexFormat, UINT Offset) = 0;
virtual void DrawIndexedInstanced(UINT64 StartIndexLocationAndIndexCountPerInstance,
UINT64 BaseVertexLocationAndStartInstanceLocation, UINT 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;
virtual void GSSetShader(gfx::ID3D11GeometryShader<ABI> *pShader) = 0;
virtual void IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY PrimitiveTopology) = 0;
virtual void VSSetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews) = 0;
virtual void VSSetSamplers(UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers) = 0;
virtual void Begin(ID3D11Asynchronous *pAsync) = 0;
virtual void End(ID3D11Asynchronous *pAsync) = 0;
virtual HRESULT GetData(ID3D11Asynchronous *pAsync, void *pData, UINT DataSize, UINT GetDataFlags) = 0;
virtual void SetPredication(ID3D11Predicate *pPredicate, BOOL PredicateValue) = 0;
virtual void GSSetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews) = 0;
virtual void GSSetSamplers(UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers) = 0;
virtual void OMSetRenderTargets(UINT NumViews, gfx::ID3D11RenderTargetView<ABI> *const *ppRTVs,
gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView) = 0;
virtual void OMSetRenderTargetsAndUnorderedAccessViews(
UINT NumRTVs, gfx::ID3D11RenderTargetView<ABI> *const *ppRTVs,
gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView, UINT UAVStartSlot, UINT NumUAVs,
gfx::ID3D11UnorderedAccessView<ABI> *const *ppUnorderedAccessViews, UINT const *pUAVInitialCounts) = 0;
virtual void OMSetBlendState(gfx::ID3D11BlendState<ABI> *pBlendState, FLOAT const BlendFactor[4],
UINT SampleMask) = 0;
virtual void OMSetDepthStencilState(gfx::ID3D11DepthStencilState<ABI> *pDepthStencilState, UINT StencilRef) = 0;
virtual void SOSetTargets(UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppSOTargets,
UINT const *pOffsets) = 0;
virtual void DrawAuto() = 0;
virtual void DrawIndexedInstancedIndirect(gfx::ID3D11Buffer<ABI> *pBufferForArgs,
UINT AlignedByteOffsetForArgs) = 0;
virtual void DrawInstancedIndirect(gfx::ID3D11Buffer<ABI> *pBufferForArgs, UINT AlignedByteOffsetForArgs) = 0;
virtual void Dispatch(UINT ThreadGroupCountX, UINT ThreadGroupCountY, UINT ThreadGroupCountZ) = 0;
virtual void DispatchIndirect(gfx::ID3D11Buffer<ABI> *pBufferForArgs, UINT AlignedByteOffsetForArgs) = 0;
virtual void RSSetState(gfx::ID3D11RasterizerState<ABI> *pRasterizerState) = 0;
virtual void RSSetViewports(UINT NumViewports, D3D11_VIEWPORT const *pViewports) = 0;
virtual void RSSetScissorRects(UINT NumRects, D3D11_RECT const *pRects) = 0;
virtual void CopySubresourceRegion(gfx::ID3D11Resource<ABI> *pDstResource, UINT DstSubresource, UINT DstX,
UINT DstY, UINT DstZ, gfx::ID3D11Resource<ABI> *pSrcResource,
UINT SrcSubresource, D3D11_BOX const *pSrcBox) = 0;
virtual void CopyResource(gfx::ID3D11Resource<ABI> *pDstResource, gfx::ID3D11Resource<ABI> *pSrcResource) = 0;
virtual void UpdateSubresource(gfx::ID3D11Resource<ABI> *pDstResource, UINT DstSubresource,
D3D11_BOX const *pDstBox, void const *pSrcData, UINT SrcRowPitch,
UINT SrcDepthPitch) = 0;
virtual void CopyStructureCount(gfx::ID3D11Buffer<ABI> *pDstBuffer, UINT DstAlignedByteOffset,
gfx::ID3D11UnorderedAccessView<ABI> *pSrcView) = 0;
virtual void ClearRenderTargetView(gfx::ID3D11RenderTargetView<ABI> *pRenderTargetView,
FLOAT const ColorRGBA[4]) = 0;
virtual void ClearUnorderedAccessViewUint(gfx::ID3D11UnorderedAccessView<ABI> *pUnorderedAccessView,
UINT const Values[4]) = 0;
virtual void ClearUnorderedAccessViewFloat(gfx::ID3D11UnorderedAccessView<ABI> *pUnorderedAccessView,
FLOAT const Values[4]) = 0;
virtual void ClearDepthStencilView(gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView, UINT ClearFlags,
FLOAT Depth, UINT8 Stencil) = 0;
virtual void GenerateMips(gfx::ID3D11ShaderResourceView<ABI> *pShaderResourceView) = 0;
virtual void SetResourceMinLOD(gfx::ID3D11Resource<ABI> *pResource, FLOAT MinLOD) = 0;
virtual FLOAT GetResourceMinLOD(gfx::ID3D11Resource<ABI> *pResource) = 0;
virtual void ResolveSubresource(gfx::ID3D11Resource<ABI> *pDstResource, UINT DstSubresource,
gfx::ID3D11Resource<ABI> *pSrcResource, UINT SrcSubresource,
DXGI_FORMAT Format) = 0;
virtual void ExecuteCommandList(ID3D11CommandList *pCommandList, BOOL RestoreContextState) = 0;
virtual void HSSetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews) = 0;
virtual void HSSetShader(gfx::ID3D11HullShader<ABI> *pHullShader) = 0;
virtual void HSSetSamplers(UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers) = 0;
virtual void HSSetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers) = 0;
virtual void DSSetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews) = 0;
virtual void DSSetShader(gfx::ID3D11DomainShader<ABI> *pDomainShader) = 0;
virtual void DSSetSamplers(UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers) = 0;
virtual void DSSetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers) = 0;
virtual void CSSetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews) = 0;
virtual void CSSetUnorderedAccessViews(UINT StartSlot, UINT NumUAVs,
gfx::ID3D11UnorderedAccessView<ABI> *const *ppUnorderedAccessViews,
UINT const *pUAVInitialCounts) = 0;
virtual void CSSetShader(gfx::ID3D11ComputeShader<ABI> *pComputeShader) = 0;
virtual void CSSetSamplers(UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers) = 0;
virtual void CSSetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers) = 0;
virtual void VSGetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers) = 0;
virtual void PSGetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews) = 0;
virtual void PSGetShader(gfx::ID3D11PixelShader<ABI> **ppPixelShader, ID3D11ClassInstance **ppClassInstances,
UINT *pNumClassInstances) = 0;
virtual void PSGetSamplers(UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers) = 0;
virtual void VSGetShader(gfx::ID3D11VertexShader<ABI> **ppVertexShader, ID3D11ClassInstance **ppClassInstances,
UINT *pNumClassInstances) = 0;
virtual void PSGetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers) = 0;
virtual void IAGetInputLayout(ID3D11InputLayout **ppInputLayout) = 0;
virtual void IAGetVertexBuffers(UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppVertexBuffers,
UINT *pStrides, UINT *pOffsets) = 0;
virtual void IAGetIndexBuffer(gfx::ID3D11Buffer<ABI> **pIndexBuffer, DXGI_FORMAT *Format, UINT *Offset) = 0;
virtual void GSGetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers) = 0;
virtual void GSGetShader(gfx::ID3D11GeometryShader<ABI> **ppGeometryShader,
ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances) = 0;
virtual void IAGetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY *pTopology) = 0;
virtual void VSGetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews) = 0;
virtual void VSGetSamplers(UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers) = 0;
virtual void GetPredication(ID3D11Predicate **ppPredicate, BOOL *pPredicateValue) = 0;
virtual void GSGetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews) = 0;
virtual void GSGetSamplers(UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers) = 0;
virtual void OMGetRenderTargets(UINT NumViews, gfx::ID3D11RenderTargetView<ABI> **ppRenderTargetViews,
gfx::ID3D11DepthStencilView<ABI> **ppDepthStencilView) = 0;
virtual void OMGetRenderTargetsAndUnorderedAccessViews(
UINT NumRTVs, gfx::ID3D11RenderTargetView<ABI> **ppRenderTargetViews,
gfx::ID3D11DepthStencilView<ABI> **ppDepthStencilView, UINT UAVStartSlot, UINT NumUAVs,
gfx::ID3D11UnorderedAccessView<ABI> **ppUnorderedAccessViews) = 0;
virtual void OMGetBlendState(gfx::ID3D11BlendState<ABI> **ppBlendState, FLOAT BlendFactor[4],
UINT *pSampleMask) = 0;
virtual void OMGetDepthStencilState(gfx::ID3D11DepthStencilState<ABI> **ppDepthStencilState,
UINT *pStencilRef) = 0;
virtual void SOGetTargets(UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppSOTargets) = 0;
virtual void RSGetState(gfx::ID3D11RasterizerState<ABI> **ppRasterizerState) = 0;
virtual void RSGetViewports(UINT *pNumViewports, D3D11_VIEWPORT *pViewports) = 0;
virtual void RSGetScissorRects(UINT *pNumRects, D3D11_RECT *pRects) = 0;
virtual void HSGetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews) = 0;
virtual void HSGetShader(gfx::ID3D11HullShader<ABI> **ppHullShader, ID3D11ClassInstance **ppClassInstances,
UINT *pNumClassInstances) = 0;
virtual void HSGetSamplers(UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers) = 0;
virtual void HSGetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers) = 0;
virtual void DSGetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews) = 0;
virtual void DSGetShader(gfx::ID3D11DomainShader<ABI> **ppDomainShader, ID3D11ClassInstance **ppClassInstances,
UINT *pNumClassInstances) = 0;
virtual void DSGetSamplers(UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers) = 0;
virtual void DSGetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers) = 0;
virtual void CSGetShaderResources(UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews) = 0;
virtual void CSGetUnorderedAccessViews(UINT StartSlot, UINT NumUAVs,
gfx::ID3D11UnorderedAccessView<ABI> **ppUnorderedAccessViews) = 0;
virtual void CSGetShader(gfx::ID3D11ComputeShader<ABI> **ppComputeShader,
ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances) = 0;
virtual void CSGetSamplers(UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers) = 0;
virtual void CSGetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers) = 0;
virtual void ClearState() = 0;
virtual void Flush() = 0;
virtual D3D11_DEVICE_CONTEXT_TYPE GetType() = 0;
virtual UINT GetContextFlags() = 0;
virtual HRESULT FinishCommandList(BOOL RestoreDeferredContextState, ID3D11CommandList **ppCommandList) = 0;
};
template<abi_t ABI>
requires (ABI >= abi_t{6,2,11294,0})
@@ -1461,7 +1644,7 @@ enum D3D11X_IMG_NUM_FORMAT
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 DrawIndexedInstanced(UINT StartIndexLocationAndIndexCountPerInstance, UINT64 BaseVertexLocationAndStartInstanceLocation, UINT64 InstanceCount) = 0;
virtual void DrawIndexedInstanced(UINT64 StartIndexLocationAndIndexCountPerInstance, UINT64 BaseVertexLocationAndStartInstanceLocation, UINT 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;
virtual void GSSetShader(gfx::ID3D11GeometryShader<ABI> *pShader) = 0;
@@ -1557,117 +1740,365 @@ enum D3D11X_IMG_NUM_FORMAT
virtual HRESULT FinishCommandList(BOOL RestoreDeferredContextState, ID3D11CommandList **ppCommandList) = 0;
};
template<abi_t ABI>
struct ID3D11DeviceContextVtbl : gfx::ID3D11DeviceChildVtbl<ABI>
template <abi_t ABI> struct ID3D11DeviceContextVtbl : gfx::ID3D11DeviceChildVtbl<ABI>
{
void(*VSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void(*PSSetShaderResources)(void *, UINT StartSlot, UINT NumViews, gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void(*PSSetShader)(void *, gfx::ID3D11PixelShader<ABI> *pPixelShader);
void(*PSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void(*VSSetShader)(void *, gfx::ID3D11VertexShader<ABI> *pVertexShader);
void(*DrawIndexed)(void *, UINT64 StartIndexLocationAndIndexCount, INT BaseVertexLocation);
void(*Draw)(void *, UINT VertexCount, UINT StartVertexLocation);
HRESULT(*Map)(void *, gfx::ID3D11Resource<ABI> *pResource, UINT Subresource, D3D11_MAP MapType, UINT MapFlags, D3D11_MAPPED_SUBRESOURCE *pMappedResource);
void(*Unmap)(void *, gfx::ID3D11Resource<ABI> *pResource, UINT Subresource);
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 (*VSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void (*PSSetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void (*PSSetShader)(void *, gfx::ID3D11PixelShader<ABI> *pPixelShader);
void (*PSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void (*VSSetShader)(void *, gfx::ID3D11VertexShader<ABI> *pVertexShader);
void (*DrawIndexed)(void *, UINT IndexCount, UINT StartIndexLocation, INT BaseVertexLocation);
void (*Draw)(void *, UINT VertexCount, UINT StartVertexLocation);
HRESULT (*Map)(void *, gfx::ID3D11Resource<ABI> *pResource, UINT Subresource, D3D11_MAP MapType, UINT MapFlags,
D3D11_MAPPED_SUBRESOURCE *pMappedResource);
void (*Unmap)(void *, gfx::ID3D11Resource<ABI> *pResource, UINT Subresource);
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 *, 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);
void(*GSSetShader)(void *, gfx::ID3D11GeometryShader<ABI> *pShader);
void(*IASetPrimitiveTopology)(void *, D3D_PRIMITIVE_TOPOLOGY PrimitiveTopology);
void(*VSSetShaderResources)(void *, UINT StartSlot, UINT NumViews, gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void(*VSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void(*Begin)(void *, ID3D11Asynchronous *pAsync);
void(*End)(void *, ID3D11Asynchronous *pAsync);
HRESULT(*GetData)(void *, ID3D11Asynchronous *pAsync, void *pData, UINT DataSize, UINT GetDataFlags);
void(*SetPredication)(void *, ID3D11Predicate *pPredicate, BOOL PredicateValue);
void(*GSSetShaderResources)(void *, UINT StartSlot, UINT NumViews, gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void(*GSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void(*OMSetRenderTargets)(void *, UINT NumViews, gfx::ID3D11RenderTargetView<ABI> *const *, gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView);
void(*OMSetRenderTargetsAndUnorderedAccessViews)(void *, UINT NumRTVs, gfx::ID3D11RenderTargetView<ABI> *const *ppRenderTargetViews, gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView, UINT UAVStartSlot, UINT NumUAVs, gfx::ID3D11UnorderedAccessView<ABI> *const *ppUnorderedAccessViews, UINT const *pUAVInitialCounts);
void(*OMSetBlendState)(void *, gfx::ID3D11BlendState<ABI> *pBlendState, FLOAT const BlendFactor[4], UINT SampleMask);
void(*OMSetDepthStencilState)(void *, gfx::ID3D11DepthStencilState<ABI> *pDepthStencilState, UINT StencilRef);
void(*SOSetTargets)(void *, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppSOTargets, UINT const *pOffsets);
void(*DrawAuto)(void *);
void(*DrawIndexedInstancedIndirect)(void *, gfx::ID3D11Buffer<ABI> *pBufferForArgs, UINT AlignedByteOffsetForArgs);
void(*DrawInstancedIndirect)(void *, gfx::ID3D11Buffer<ABI> *pBufferForArgs, UINT AlignedByteOffsetForArgs);
void(*Dispatch)(void *, UINT ThreadGroupCountX, UINT ThreadGroupCountY, UINT ThreadGroupCountZ);
void(*DispatchIndirect)(void *, gfx::ID3D11Buffer<ABI> *pBufferForArgs, UINT AlignedByteOffsetForArgs);
void(*RSSetState)(void *, gfx::ID3D11RasterizerState<ABI> *pRasterizerState);
void(*RSSetViewports)(void *, UINT NumViewports, D3D11_VIEWPORT const *pViewports);
void(*RSSetScissorRects)(void *, UINT NumRects, D3D11_RECT const *pRects);
void(*CopySubresourceRegion)(void *, gfx::ID3D11Resource<ABI> *pDstResource, UINT DstSubresource, UINT DstX, UINT DstY, UINT DstZ, gfx::ID3D11Resource<ABI> *pSrcResource, UINT SrcSubresource, D3D11_BOX const *pSrcBox);
void(*CopyResource)(void *, gfx::ID3D11Resource<ABI> *pDstResource, gfx::ID3D11Resource<ABI> *pSrcResource);
void(*UpdateSubresource)(void *, gfx::ID3D11Resource<ABI> *pDstResource, UINT DstSubresource, D3D11_BOX const *pDstBox, void const *pSrcData, UINT SrcRowPitch, UINT SrcDepthPitch);
void(*CopyStructureCount)(void *, gfx::ID3D11Buffer<ABI> *pDstBuffer, UINT DstAlignedByteOffset, gfx::ID3D11UnorderedAccessView<ABI> *pSrcView);
void(*ClearRenderTargetView)(void *, gfx::ID3D11RenderTargetView<ABI> *pRenderTargetView, FLOAT const ColorRGBA[4]);
void(*ClearUnorderedAccessViewUint)(void *, gfx::ID3D11UnorderedAccessView<ABI> *pUnorderedAccessView, UINT const Values[4]);
void(*ClearUnorderedAccessViewFloat)(void *, gfx::ID3D11UnorderedAccessView<ABI> *pUnorderedAccessView, FLOAT const Values[4]);
void(*ClearDepthStencilView)(void *, gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView, UINT ClearFlags, FLOAT Depth, UINT8 Stencil);
void(*GenerateMips)(void *, gfx::ID3D11ShaderResourceView<ABI> *pShaderResourceView);
void(*SetResourceMinLOD)(void *, gfx::ID3D11Resource<ABI> *pResource, FLOAT MinLOD);
FLOAT(*GetResourceMinLOD)(void *, gfx::ID3D11Resource<ABI> *pResource);
void(*ResolveSubresource)(void *, gfx::ID3D11Resource<ABI> *pDstResource, UINT DstSubresource, gfx::ID3D11Resource<ABI> *pSrcResource, UINT SrcSubresource, DXGI_FORMAT Format);
void(*ExecuteCommandList)(void *, ID3D11CommandList *pCommandList, BOOL RestoreContextState);
void(*HSSetShaderResources)(void *, UINT StartSlot, UINT NumViews, gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void(*HSSetShader)(void *, gfx::ID3D11HullShader<ABI> *pHullShader);
void(*HSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void(*HSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void(*DSSetShaderResources)(void *, UINT StartSlot, UINT NumViews, gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void(*DSSetShader)(void *, gfx::ID3D11DomainShader<ABI> *pDomainShader);
void(*DSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void(*DSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void(*CSSetShaderResources)(void *, UINT StartSlot, UINT NumViews, gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void(*CSSetUnorderedAccessViews)(void *, UINT StartSlot, UINT NumUAVs, gfx::ID3D11UnorderedAccessView<ABI> *const *ppUnorderedAccessViews, UINT const *pUAVInitialCounts);
void(*CSSetShader)(void *, gfx::ID3D11ComputeShader<ABI> *pComputeShader);
void(*CSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void(*CSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void(*VSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void(*PSGetShaderResources)(void *, UINT StartSlot, UINT NumViews, gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void(*PSGetShader)(void *, gfx::ID3D11PixelShader<ABI> **ppPixelShader, ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void(*PSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void(*VSGetShader)(void *, gfx::ID3D11VertexShader<ABI> **ppVertexShader, ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void(*PSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void(*IAGetInputLayout)(void *, ID3D11InputLayout **ppInputLayout);
void(*IAGetVertexBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppVertexBuffers, UINT *pStrides, UINT *pOffsets);
void(*IAGetIndexBuffer)(void *, gfx::ID3D11Buffer<ABI> **pIndexBuffer, DXGI_FORMAT *Format, UINT *Offset);
void(*GSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void(*GSGetShader)(void *, gfx::ID3D11GeometryShader<ABI> **ppGeometryShader, ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void(*IAGetPrimitiveTopology)(void *, D3D11_PRIMITIVE_TOPOLOGY *pTopology);
void(*VSGetShaderResources)(void *, UINT StartSlot, UINT NumViews, gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void(*VSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void(*GetPredication)(void *, ID3D11Predicate **ppPredicate, BOOL *pPredicateValue);
void(*GSGetShaderResources)(void *, UINT StartSlot, UINT NumViews, gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void(*GSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void(*OMGetRenderTargets)(void *, UINT NumViews, gfx::ID3D11RenderTargetView<ABI> **ppRenderTargetViews, gfx::ID3D11DepthStencilView<ABI> **ppDepthStencilView);
void(*OMGetRenderTargetsAndUnorderedAccessViews)(void *, UINT NumRTVs, gfx::ID3D11RenderTargetView<ABI> **ppRenderTargetViews, gfx::ID3D11DepthStencilView<ABI> **ppDepthStencilView, UINT UAVStartSlot, UINT NumUAVs, gfx::ID3D11UnorderedAccessView<ABI> **ppUnorderedAccessViews);
void(*OMGetBlendState)(void *, gfx::ID3D11BlendState<ABI> **ppBlendState, FLOAT BlendFactor[4], UINT *pSampleMask);
void(*OMGetDepthStencilState)(void *, gfx::ID3D11DepthStencilState<ABI> **ppDepthStencilState, UINT *pStencilRef);
void(*SOGetTargets)(void *, UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppSOTargets);
void(*RSGetState)(void *, gfx::ID3D11RasterizerState<ABI> **ppRasterizerState);
void(*RSGetViewports)(void *, UINT *pNumViewports, D3D11_VIEWPORT *pViewports);
void(*RSGetScissorRects)(void *, UINT *pNumRects, D3D11_RECT *pRects);
void(*HSGetShaderResources)(void *, UINT StartSlot, UINT NumViews, gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void(*HSGetShader)(void *, gfx::ID3D11HullShader<ABI> **ppHullShader, ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void(*HSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void(*HSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void(*DSGetShaderResources)(void *, UINT StartSlot, UINT NumViews, gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void(*DSGetShader)(void *, gfx::ID3D11DomainShader<ABI> **ppDomainShader, ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void(*DSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void(*DSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void(*CSGetShaderResources)(void *, UINT StartSlot, UINT NumViews, gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void(*CSGetUnorderedAccessViews)(void *, UINT StartSlot, UINT NumUAVs, gfx::ID3D11UnorderedAccessView<ABI> **ppUnorderedAccessViews);
void(*CSGetShader)(void *, gfx::ID3D11ComputeShader<ABI> **ppComputeShader, ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void(*CSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void(*CSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void(*ClearState)(void *);
void(*Flush)(void *);
D3D11_DEVICE_CONTEXT_TYPE(*GetType)(void *);
UINT(*GetContextFlags)(void *);
HRESULT(*FinishCommandList)(void *, BOOL RestoreDeferredContextState, ID3D11CommandList **ppCommandList);
void (*DrawIndexedInstanced)(void *, UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation,
INT BaseVertexLocation, UINT StartInstanceLocation);
void (*DrawInstanced)(void *, UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation,
UINT StartInstanceLocation);
void (*GSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void (*GSSetShader)(void *, gfx::ID3D11GeometryShader<ABI> *pShader);
void (*IASetPrimitiveTopology)(void *, D3D_PRIMITIVE_TOPOLOGY PrimitiveTopology);
void (*VSSetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void (*VSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void (*Begin)(void *, ID3D11Asynchronous *pAsync);
void (*End)(void *, ID3D11Asynchronous *pAsync);
HRESULT (*GetData)(void *, ID3D11Asynchronous *pAsync, void *pData, UINT DataSize, UINT GetDataFlags);
void (*SetPredication)(void *, ID3D11Predicate *pPredicate, BOOL PredicateValue);
void (*GSSetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void (*GSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void (*OMSetRenderTargets)(void *, UINT NumViews, gfx::ID3D11RenderTargetView<ABI> *const *ppRTVs,
gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView);
void (*OMSetRenderTargetsAndUnorderedAccessViews)(
void *, UINT NumRTVs, gfx::ID3D11RenderTargetView<ABI> *const *ppRTVs,
gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView, UINT UAVStartSlot, UINT NumUAVs,
gfx::ID3D11UnorderedAccessView<ABI> *const *ppUnorderedAccessViews, UINT const *pUAVInitialCounts);
void (*OMSetBlendState)(void *, gfx::ID3D11BlendState<ABI> *pBlendState, FLOAT const BlendFactor[4],
UINT SampleMask);
void (*OMSetDepthStencilState)(void *, gfx::ID3D11DepthStencilState<ABI> *pDepthStencilState, UINT StencilRef);
void (*SOSetTargets)(void *, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppSOTargets, UINT const *pOffsets);
void (*DrawAuto)(void *);
void (*DrawIndexedInstancedIndirect)(void *, gfx::ID3D11Buffer<ABI> *pBufferForArgs,
UINT AlignedByteOffsetForArgs);
void (*DrawInstancedIndirect)(void *, gfx::ID3D11Buffer<ABI> *pBufferForArgs, UINT AlignedByteOffsetForArgs);
void (*Dispatch)(void *, UINT ThreadGroupCountX, UINT ThreadGroupCountY, UINT ThreadGroupCountZ);
void (*DispatchIndirect)(void *, gfx::ID3D11Buffer<ABI> *pBufferForArgs, UINT AlignedByteOffsetForArgs);
void (*RSSetState)(void *, gfx::ID3D11RasterizerState<ABI> *pRasterizerState);
void (*RSSetViewports)(void *, UINT NumViewports, D3D11_VIEWPORT const *pViewports);
void (*RSSetScissorRects)(void *, UINT NumRects, D3D11_RECT const *pRects);
void (*CopySubresourceRegion)(void *, gfx::ID3D11Resource<ABI> *pDstResource, UINT DstSubresource, UINT DstX,
UINT DstY, UINT DstZ, gfx::ID3D11Resource<ABI> *pSrcResource, UINT SrcSubresource,
D3D11_BOX const *pSrcBox);
void (*CopyResource)(void *, gfx::ID3D11Resource<ABI> *pDstResource, gfx::ID3D11Resource<ABI> *pSrcResource);
void (*UpdateSubresource)(void *, gfx::ID3D11Resource<ABI> *pDstResource, UINT DstSubresource,
D3D11_BOX const *pDstBox, void const *pSrcData, UINT SrcRowPitch, UINT SrcDepthPitch);
void (*CopyStructureCount)(void *, gfx::ID3D11Buffer<ABI> *pDstBuffer, UINT DstAlignedByteOffset,
gfx::ID3D11UnorderedAccessView<ABI> *pSrcView);
void (*ClearRenderTargetView)(void *, gfx::ID3D11RenderTargetView<ABI> *pRenderTargetView,
FLOAT const ColorRGBA[4]);
void (*ClearUnorderedAccessViewUint)(void *, gfx::ID3D11UnorderedAccessView<ABI> *pUnorderedAccessView,
UINT const Values[4]);
void (*ClearUnorderedAccessViewFloat)(void *, gfx::ID3D11UnorderedAccessView<ABI> *pUnorderedAccessView,
FLOAT const Values[4]);
void (*ClearDepthStencilView)(void *, gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView, UINT ClearFlags,
FLOAT Depth, UINT8 Stencil);
void (*GenerateMips)(void *, gfx::ID3D11ShaderResourceView<ABI> *pShaderResourceView);
void (*SetResourceMinLOD)(void *, gfx::ID3D11Resource<ABI> *pResource, FLOAT MinLOD);
FLOAT (*GetResourceMinLOD)(void *, gfx::ID3D11Resource<ABI> *pResource);
void (*ResolveSubresource)(void *, gfx::ID3D11Resource<ABI> *pDstResource, UINT DstSubresource,
gfx::ID3D11Resource<ABI> *pSrcResource, UINT SrcSubresource, DXGI_FORMAT Format);
void (*ExecuteCommandList)(void *, ID3D11CommandList *pCommandList, BOOL RestoreContextState);
void (*HSSetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void (*HSSetShader)(void *, gfx::ID3D11HullShader<ABI> *pHullShader);
void (*HSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void (*HSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void (*DSSetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void (*DSSetShader)(void *, gfx::ID3D11DomainShader<ABI> *pDomainShader);
void (*DSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void (*DSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void (*CSSetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void (*CSSetUnorderedAccessViews)(void *, UINT StartSlot, UINT NumUAVs,
gfx::ID3D11UnorderedAccessView<ABI> *const *ppUnorderedAccessViews,
UINT const *pUAVInitialCounts);
void (*CSSetShader)(void *, gfx::ID3D11ComputeShader<ABI> *pComputeShader);
void (*CSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void (*CSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void (*VSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void (*PSGetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void (*PSGetShader)(void *, gfx::ID3D11PixelShader<ABI> **ppPixelShader, ID3D11ClassInstance **ppClassInstances,
UINT *pNumClassInstances);
void (*PSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void (*VSGetShader)(void *, gfx::ID3D11VertexShader<ABI> **ppVertexShader,
ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void (*PSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void (*IAGetInputLayout)(void *, ID3D11InputLayout **ppInputLayout);
void (*IAGetVertexBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppVertexBuffers,
UINT *pStrides, UINT *pOffsets);
void (*IAGetIndexBuffer)(void *, gfx::ID3D11Buffer<ABI> **pIndexBuffer, DXGI_FORMAT *Format, UINT *Offset);
void (*GSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void (*GSGetShader)(void *, gfx::ID3D11GeometryShader<ABI> **ppGeometryShader,
ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void (*IAGetPrimitiveTopology)(void *, D3D11_PRIMITIVE_TOPOLOGY *pTopology);
void (*VSGetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void (*VSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void (*GetPredication)(void *, ID3D11Predicate **ppPredicate, BOOL *pPredicateValue);
void (*GSGetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void (*GSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void (*OMGetRenderTargets)(void *, UINT NumViews, gfx::ID3D11RenderTargetView<ABI> **ppRenderTargetViews,
gfx::ID3D11DepthStencilView<ABI> **ppDepthStencilView);
void (*OMGetRenderTargetsAndUnorderedAccessViews)(void *, UINT NumRTVs,
gfx::ID3D11RenderTargetView<ABI> **ppRenderTargetViews,
gfx::ID3D11DepthStencilView<ABI> **ppDepthStencilView,
UINT UAVStartSlot, UINT NumUAVs,
gfx::ID3D11UnorderedAccessView<ABI> **ppUnorderedAccessViews);
void (*OMGetBlendState)(void *, gfx::ID3D11BlendState<ABI> **ppBlendState, FLOAT BlendFactor[4],
UINT *pSampleMask);
void (*OMGetDepthStencilState)(void *, gfx::ID3D11DepthStencilState<ABI> **ppDepthStencilState,
UINT *pStencilRef);
void (*SOGetTargets)(void *, UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppSOTargets);
void (*RSGetState)(void *, gfx::ID3D11RasterizerState<ABI> **ppRasterizerState);
void (*RSGetViewports)(void *, UINT *pNumViewports, D3D11_VIEWPORT *pViewports);
void (*RSGetScissorRects)(void *, UINT *pNumRects, D3D11_RECT *pRects);
void (*HSGetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void (*HSGetShader)(void *, gfx::ID3D11HullShader<ABI> **ppHullShader, ID3D11ClassInstance **ppClassInstances,
UINT *pNumClassInstances);
void (*HSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void (*HSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void (*DSGetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void (*DSGetShader)(void *, gfx::ID3D11DomainShader<ABI> **ppDomainShader,
ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void (*DSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void (*DSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void (*CSGetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void (*CSGetUnorderedAccessViews)(void *, UINT StartSlot, UINT NumUAVs,
gfx::ID3D11UnorderedAccessView<ABI> **ppUnorderedAccessViews);
void (*CSGetShader)(void *, gfx::ID3D11ComputeShader<ABI> **ppComputeShader,
ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void (*CSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void (*CSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void (*ClearState)(void *);
void (*Flush)(void *);
D3D11_DEVICE_CONTEXT_TYPE (*GetType)(void *);
UINT (*GetContextFlags)(void *);
HRESULT (*FinishCommandList)(void *, BOOL RestoreDeferredContextState,
ID3D11CommandList **ppCommandList);
};
template <abi_t ABI>
requires(ABI >= abi_t{6,2,11064,0} && ABI < abi_t{6,2,11294,0})
struct ID3D11DeviceContextVtbl<ABI> : gfx::ID3D11DeviceChildVtbl<ABI>
{
void (*VSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void (*PSSetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void (*PSSetShader)(void *, gfx::ID3D11PixelShader<ABI> *pPixelShader);
void (*PSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void (*VSSetShader)(void *, gfx::ID3D11VertexShader<ABI> *pVertexShader);
void (*DrawIndexed)(void *, UINT64 StartIndexLocationAndIndexCount, INT BaseVertexLocation);
void (*Draw)(void *, UINT VertexCount, UINT StartVertexLocation);
HRESULT (*Map)(void *, gfx::ID3D11Resource<ABI> *pResource, UINT Subresource, D3D11_MAP MapType, UINT MapFlags,
D3D11_MAPPED_SUBRESOURCE *pMappedResource);
void (*Unmap)(void *, gfx::ID3D11Resource<ABI> *pResource, UINT Subresource);
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 *, gfx::ID3D11Buffer<ABI> *pIndexBuffer, UINT HardwareIndexFormat, UINT Offset);
void (*DrawIndexedInstanced)(void *, UINT64 StartIndexLocationAndIndexCountPerInstance,
UINT64 BaseVertexLocationAndStartInstanceLocation, UINT InstanceCount);
void (*DrawInstanced)(void *, UINT VertexCountPerInstance, UINT64 StartVertexLocationAndStartInstanceLocation,
UINT InstanceCount);
void (*GSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void (*GSSetShader)(void *, gfx::ID3D11GeometryShader<ABI> *pShader);
void (*IASetPrimitiveTopology)(void *, D3D_PRIMITIVE_TOPOLOGY PrimitiveTopology);
void (*VSSetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void (*VSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void (*Begin)(void *, ID3D11Asynchronous *pAsync);
void (*End)(void *, ID3D11Asynchronous *pAsync);
HRESULT (*GetData)(void *, ID3D11Asynchronous *pAsync, void *pData, UINT DataSize, UINT GetDataFlags);
void (*SetPredication)(void *, ID3D11Predicate *pPredicate, BOOL PredicateValue);
void (*GSSetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void (*GSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void (*OMSetRenderTargets)(void *, UINT NumViews, gfx::ID3D11RenderTargetView<ABI> *const *ppRTVs,
gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView);
void (*OMSetRenderTargetsAndUnorderedAccessViews)(
void *, UINT NumRTVs, gfx::ID3D11RenderTargetView<ABI> *const *ppRTVs,
gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView, UINT UAVStartSlot, UINT NumUAVs,
gfx::ID3D11UnorderedAccessView<ABI> *const *ppUnorderedAccessViews, UINT const *pUAVInitialCounts);
void (*OMSetBlendState)(void *, gfx::ID3D11BlendState<ABI> *pBlendState, FLOAT const BlendFactor[4],
UINT SampleMask);
void (*OMSetDepthStencilState)(void *, gfx::ID3D11DepthStencilState<ABI> *pDepthStencilState, UINT StencilRef);
void (*SOSetTargets)(void *, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppSOTargets, UINT const *pOffsets);
void (*DrawAuto)(void *);
void (*DrawIndexedInstancedIndirect)(void *, gfx::ID3D11Buffer<ABI> *pBufferForArgs,
UINT AlignedByteOffsetForArgs);
void (*DrawInstancedIndirect)(void *, gfx::ID3D11Buffer<ABI> *pBufferForArgs, UINT AlignedByteOffsetForArgs);
void (*Dispatch)(void *, UINT ThreadGroupCountX, UINT ThreadGroupCountY, UINT ThreadGroupCountZ);
void (*DispatchIndirect)(void *, gfx::ID3D11Buffer<ABI> *pBufferForArgs, UINT AlignedByteOffsetForArgs);
void (*RSSetState)(void *, gfx::ID3D11RasterizerState<ABI> *pRasterizerState);
void (*RSSetViewports)(void *, UINT NumViewports, D3D11_VIEWPORT const *pViewports);
void (*RSSetScissorRects)(void *, UINT NumRects, D3D11_RECT const *pRects);
void (*CopySubresourceRegion)(void *, gfx::ID3D11Resource<ABI> *pDstResource, UINT DstSubresource, UINT DstX,
UINT DstY, UINT DstZ, gfx::ID3D11Resource<ABI> *pSrcResource, UINT SrcSubresource,
D3D11_BOX const *pSrcBox);
void (*CopyResource)(void *, gfx::ID3D11Resource<ABI> *pDstResource, gfx::ID3D11Resource<ABI> *pSrcResource);
void (*UpdateSubresource)(void *, gfx::ID3D11Resource<ABI> *pDstResource, UINT DstSubresource,
D3D11_BOX const *pDstBox, void const *pSrcData, UINT SrcRowPitch, UINT SrcDepthPitch);
void (*CopyStructureCount)(void *, gfx::ID3D11Buffer<ABI> *pDstBuffer, UINT DstAlignedByteOffset,
gfx::ID3D11UnorderedAccessView<ABI> *pSrcView);
void (*ClearRenderTargetView)(void *, gfx::ID3D11RenderTargetView<ABI> *pRenderTargetView,
FLOAT const ColorRGBA[4]);
void (*ClearUnorderedAccessViewUint)(void *, gfx::ID3D11UnorderedAccessView<ABI> *pUnorderedAccessView,
UINT const Values[4]);
void (*ClearUnorderedAccessViewFloat)(void *, gfx::ID3D11UnorderedAccessView<ABI> *pUnorderedAccessView,
FLOAT const Values[4]);
void (*ClearDepthStencilView)(void *, gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView, UINT ClearFlags,
FLOAT Depth, UINT8 Stencil);
void (*GenerateMips)(void *, gfx::ID3D11ShaderResourceView<ABI> *pShaderResourceView);
void (*SetResourceMinLOD)(void *, gfx::ID3D11Resource<ABI> *pResource, FLOAT MinLOD);
FLOAT (*GetResourceMinLOD)(void *, gfx::ID3D11Resource<ABI> *pResource);
void (*ResolveSubresource)(void *, gfx::ID3D11Resource<ABI> *pDstResource, UINT DstSubresource,
gfx::ID3D11Resource<ABI> *pSrcResource, UINT SrcSubresource, DXGI_FORMAT Format);
void (*ExecuteCommandList)(void *, ID3D11CommandList *pCommandList, BOOL RestoreContextState);
void (*HSSetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void (*HSSetShader)(void *, gfx::ID3D11HullShader<ABI> *pHullShader);
void (*HSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void (*HSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void (*DSSetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void (*DSSetShader)(void *, gfx::ID3D11DomainShader<ABI> *pDomainShader);
void (*DSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void (*DSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void (*CSSetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> *const *ppShaderResourceViews);
void (*CSSetUnorderedAccessViews)(void *, UINT StartSlot, UINT NumUAVs,
gfx::ID3D11UnorderedAccessView<ABI> *const *ppUnorderedAccessViews,
UINT const *pUAVInitialCounts);
void (*CSSetShader)(void *, gfx::ID3D11ComputeShader<ABI> *pComputeShader);
void (*CSSetSamplers)(void *, UINT StartSlot, UINT NumSamplers,
gfx::ID3D11SamplerState<ABI> *const *ppSamplers);
void (*CSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void (*VSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void (*PSGetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void (*PSGetShader)(void *, gfx::ID3D11PixelShader<ABI> **ppPixelShader, ID3D11ClassInstance **ppClassInstances,
UINT *pNumClassInstances);
void (*PSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void (*VSGetShader)(void *, gfx::ID3D11VertexShader<ABI> **ppVertexShader,
ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void (*PSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void (*IAGetInputLayout)(void *, ID3D11InputLayout **ppInputLayout);
void (*IAGetVertexBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppVertexBuffers,
UINT *pStrides, UINT *pOffsets);
void (*IAGetIndexBuffer)(void *, gfx::ID3D11Buffer<ABI> **pIndexBuffer, DXGI_FORMAT *Format, UINT *Offset);
void (*GSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void (*GSGetShader)(void *, gfx::ID3D11GeometryShader<ABI> **ppGeometryShader,
ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void (*IAGetPrimitiveTopology)(void *, D3D11_PRIMITIVE_TOPOLOGY *pTopology);
void (*VSGetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void (*VSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void (*GetPredication)(void *, ID3D11Predicate **ppPredicate, BOOL *pPredicateValue);
void (*GSGetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void (*GSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void (*OMGetRenderTargets)(void *, UINT NumViews, gfx::ID3D11RenderTargetView<ABI> **ppRenderTargetViews,
gfx::ID3D11DepthStencilView<ABI> **ppDepthStencilView);
void (*OMGetRenderTargetsAndUnorderedAccessViews)(void *, UINT NumRTVs,
gfx::ID3D11RenderTargetView<ABI> **ppRenderTargetViews,
gfx::ID3D11DepthStencilView<ABI> **ppDepthStencilView,
UINT UAVStartSlot, UINT NumUAVs,
gfx::ID3D11UnorderedAccessView<ABI> **ppUnorderedAccessViews);
void (*OMGetBlendState)(void *, gfx::ID3D11BlendState<ABI> **ppBlendState, FLOAT BlendFactor[4],
UINT *pSampleMask);
void (*OMGetDepthStencilState)(void *, gfx::ID3D11DepthStencilState<ABI> **ppDepthStencilState,
UINT *pStencilRef);
void (*SOGetTargets)(void *, UINT NumBuffers, gfx::ID3D11Buffer<ABI> **ppSOTargets);
void (*RSGetState)(void *, gfx::ID3D11RasterizerState<ABI> **ppRasterizerState);
void (*RSGetViewports)(void *, UINT *pNumViewports, D3D11_VIEWPORT *pViewports);
void (*RSGetScissorRects)(void *, UINT *pNumRects, D3D11_RECT *pRects);
void (*HSGetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void (*HSGetShader)(void *, gfx::ID3D11HullShader<ABI> **ppHullShader, ID3D11ClassInstance **ppClassInstances,
UINT *pNumClassInstances);
void (*HSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void (*HSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void (*DSGetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void (*DSGetShader)(void *, gfx::ID3D11DomainShader<ABI> **ppDomainShader,
ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void (*DSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void (*DSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void (*CSGetShaderResources)(void *, UINT StartSlot, UINT NumViews,
gfx::ID3D11ShaderResourceView<ABI> **ppShaderResourceViews);
void (*CSGetUnorderedAccessViews)(void *, UINT StartSlot, UINT NumUAVs,
gfx::ID3D11UnorderedAccessView<ABI> **ppUnorderedAccessViews);
void (*CSGetShader)(void *, gfx::ID3D11ComputeShader<ABI> **ppComputeShader,
ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances);
void (*CSGetSamplers)(void *, UINT StartSlot, UINT NumSamplers, gfx::ID3D11SamplerState<ABI> **ppSamplers);
void (*CSGetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> **ppConstantBuffers);
void (*ClearState)(void *);
void (*Flush)(void *);
D3D11_DEVICE_CONTEXT_TYPE (*GetType)(void *);
UINT (*GetContextFlags)(void *);
HRESULT (*FinishCommandList)(void *, BOOL RestoreDeferredContextState, ID3D11CommandList **ppCommandList);
};
template<abi_t ABI>
@@ -1687,7 +2118,7 @@ enum D3D11X_IMG_NUM_FORMAT
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(*DrawIndexedInstanced)(void *, UINT StartIndexLocationAndIndexCountPerInstance, UINT64 BaseVertexLocationAndStartInstanceLocation, UINT64 InstanceCount);
void(*DrawIndexedInstanced)(void *, UINT64 StartIndexLocationAndIndexCountPerInstance, UINT64 BaseVertexLocationAndStartInstanceLocation, UINT InstanceCount);
void(*DrawInstanced)(void *, UINT VertexCountPerInstance, UINT64 StartVertexLocationAndStartInstanceLocation, UINT InstanceCount);
void(*GSSetConstantBuffers)(void *, UINT StartSlot, UINT NumBuffers, gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers);
void(*GSSetShader)(void *, gfx::ID3D11GeometryShader<ABI> *pShader);

View File

@@ -11,14 +11,16 @@ template <abi_t ABI> HRESULT D3D11DMAEngineContextX<ABI>::QueryInterface(REFIID
template <abi_t ABI> ULONG D3D11DMAEngineContextX<ABI>::AddRef()
{
IMPLEMENT_STUB();
return {};
return InterlockedIncrement(&this->m_RefCount);
}
template <abi_t ABI> ULONG D3D11DMAEngineContextX<ABI>::Release()
{
IMPLEMENT_STUB();
return {};
m_pImmediateContext->Release();
ULONG RefCount = InterlockedDecrement(&this->m_RefCount);
if (!RefCount)
delete this;
return RefCount;
}
//
@@ -63,22 +65,39 @@ HRESULT D3D11DMAEngineContextX<ABI>::SetPrivateDataInterfaceGraphics(_GUID const
//
template <abi_t ABI> D3D11_DEVICE_CONTEXT_TYPE D3D11DMAEngineContextX<ABI>::GetType()
{
IMPLEMENT_STUB();
return {};
return (D3D11_DEVICE_CONTEXT_TYPE)0x2;
}
template <abi_t ABI>
void D3D11DMAEngineContextX<ABI>::CopyResource(gfx::ID3D11Resource<ABI> *v1, gfx::ID3D11Resource<ABI> *v2, uint32_t v3)
void D3D11DMAEngineContextX<ABI>::CopyResource(gfx::ID3D11Resource<ABI> *pDstResource,
gfx::ID3D11Resource<ABI> *pSrcResource, uint32_t v3)
{
IMPLEMENT_STUB();
DMACommands<ABI> Command{};
Command.m_DMACommandType = DMACommands<ABI>::DMACommandType::CopySubresourceRegion;
Command.CopyResource.pDstResource = pDstResource;
Command.CopyResource.pSrcResource = pSrcResource;
Command.CopyResource.Flags = v3;
m_DMACommandQueue.push_back(Command);
}
template <abi_t ABI>
void D3D11DMAEngineContextX<ABI>::CopySubresourceRegion(gfx::ID3D11Resource<ABI> *v1, uint32_t v2, uint32_t v3,
uint32_t v4, uint32_t v5, gfx::ID3D11Resource<ABI> *v6,
uint32_t v7, D3D11_BOX const *v8, uint32_t v9)
void D3D11DMAEngineContextX<ABI>::CopySubresourceRegion(gfx::ID3D11Resource<ABI> *pDstResource, uint32_t DstSubresource,
uint32_t DstX, uint32_t DstY, uint32_t DstZ,
gfx::ID3D11Resource<ABI> *pSrcResource, uint32_t SrcSubresource,
D3D11_BOX const *pSrcBox, uint32_t v9)
{
IMPLEMENT_STUB();
DMACommands<ABI> Command{};
Command.m_DMACommandType = DMACommands<ABI>::DMACommandType::CopySubresourceRegion;
Command.CopySubresourceRegion.pDstResource = pDstResource;
Command.CopySubresourceRegion.DstSubresource = DstSubresource;
Command.CopySubresourceRegion.DstX = DstX;
Command.CopySubresourceRegion.DstY = DstY;
Command.CopySubresourceRegion.DstZ = DstZ;
Command.CopySubresourceRegion.pSrcResource = pSrcResource;
Command.CopySubresourceRegion.SrcSubresource = SrcSubresource;
Command.CopySubresourceRegion.pSrcBox = pSrcBox;
Command.CopySubresourceRegion.Flags = v9;
m_DMACommandQueue.push_back(Command);
}
template <abi_t ABI>
@@ -86,7 +105,6 @@ HRESULT D3D11DMAEngineContextX<ABI>::LZDecompressBuffer(gfx::ID3D11Buffer<ABI> *
gfx::ID3D11Buffer<ABI> *v3, uint32_t v4, uint32_t v5,
uint32_t v6)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
@@ -95,7 +113,6 @@ HRESULT D3D11DMAEngineContextX<ABI>::LZDecompressTexture(gfx::ID3D11Resource<ABI
uint32_t v4, uint32_t v5, gfx::ID3D11Buffer<ABI> *v6,
uint32_t v7)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
}
@@ -125,24 +142,46 @@ HRESULT D3D11DMAEngineContextX<ABI>::JPEGDecode(gfx::ID3D11Resource<ABI> *v1, ui
template <abi_t ABI> uint64_t D3D11DMAEngineContextX<ABI>::InsertFence(uint32_t v1)
{
IMPLEMENT_STUB();
return {};
DMACommands<ABI> Command{};
Command.m_DMACommandType = DMACommands<ABI>::DMACommandType::DMAInsertFence; // Signal fence command
Command.DMAInsertFence.Flags = v1;
if (DMAFenceIndex >= 1024)
{
DMAFenceIndex = 0;
}
UINT FenceIndex = DMAFenceIndex;
DMAFences[FenceIndex] = TRUE;
DMAFenceIndex++;
Command.DMAInsertFence.Fence = (UINT64)&DMAFences[FenceIndex];
m_DMACommandQueue.push_back(Command);
return (UINT64)&DMAFences[FenceIndex];
}
template <abi_t ABI> void D3D11DMAEngineContextX<ABI>::InsertWaitOnFence(uint32_t v1, uint64_t v2)
{
IMPLEMENT_STUB();
DMACommands<ABI> Command{};
Command.m_DMACommandType = DMACommands<ABI>::DMACommandType::DMAInsertWaitOnFence;
Command.DMAInsertWaitOnFence.Flags = v1;
Command.DMAInsertWaitOnFence.Fence = v2;
m_DMACommandQueue.push_back(Command);
}
template <abi_t ABI> HRESULT D3D11DMAEngineContextX<ABI>::Submit()
{
IMPLEMENT_STUB();
return E_NOTIMPL;
m_pImmediateContext->AddBackgroundContext(this);
return S_OK;
}
template <abi_t ABI> void D3D11DMAEngineContextX<ABI>::CopyLastErrorCodeToMemory(void *v1)
{
IMPLEMENT_STUB();
DMACommands<ABI> Command{};
Command.m_DMACommandType = DMACommands<ABI>::DMACommandType::CopyLastErrorCodeToMemory;
Command.CopyLastErrorCodeToMemory.pDstAddress = v1;
m_DMACommandQueue.push_back(Command);
}
template <abi_t ABI>
@@ -158,7 +197,12 @@ template <abi_t ABI> void D3D11DMAEngineContextX<ABI>::CopyMemoryToMemory(void *
template <abi_t ABI> void D3D11DMAEngineContextX<ABI>::FillMemoryWithValue(void *v1, uint64_t v2, uint32_t v3)
{
IMPLEMENT_STUB();
DMACommands<ABI> Command{};
Command.m_DMACommandType = DMACommands<ABI>::DMACommandType::FillMemoryWithValue;
Command.FillMemoryWithValue.pDstAddress = v1;
Command.FillMemoryWithValue.SizeBytes = v2;
Command.FillMemoryWithValue.FillValue = v3;
m_DMACommandQueue.push_back(Command);
}
template <abi_t ABI> void D3D11DMAEngineContextX<ABI>::FillResourceWithValue(gfx::ID3D11Resource<ABI> *v1, uint32_t v2)
@@ -169,8 +213,14 @@ template <abi_t ABI> void D3D11DMAEngineContextX<ABI>::FillResourceWithValue(gfx
template <abi_t ABI>
HRESULT D3D11DMAEngineContextX<ABI>::LZDecompressMemory(void *v1, void *v2, uint32_t v3, uint32_t v4)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
DMACommands<ABI> Command{};
Command.m_DMACommandType = DMACommands<ABI>::DMACommandType::LZDecompressMemory;
Command.LZDecompressMemory.NextIn = v1;
Command.LZDecompressMemory.NextOut = v2;
Command.LZDecompressMemory.AvailIn = v3;
Command.LZDecompressMemory.Flags = v4;
m_DMACommandQueue.push_back(Command);
return S_OK;
}
template <abi_t ABI> HRESULT D3D11DMAEngineContextX<ABI>::LZCompressMemory(void *v1, void *v2, uint32_t v3, uint32_t v4)
@@ -201,6 +251,51 @@ void D3D11DMAEngineContextX<ABI>::InsertWaitOnMemory(void const *v1, uint32_t v2
IMPLEMENT_STUB();
}
template <abi_t ABI> BOOL D3D11DMAEngineContextX<ABI>::ExecuteContext()
{
while (m_CommandIndex < m_DMACommandQueue.size())
{
auto &Cmd = m_DMACommandQueue[m_CommandIndex];
BOOL Wait = TRUE;
switch (Cmd.m_DMACommandType)
{
case DMACommands<ABI>::DMACommandType::LZDecompressMemory:
Wait = Cmd.LZDecompressMemory.Execute(this);
break;
case DMACommands<ABI>::DMACommandType::DMAInsertFence:
Wait = Cmd.DMAInsertFence.Execute(this);
break;
case DMACommands<ABI>::DMACommandType::DMAInsertWaitOnFence:
Wait = Cmd.DMAInsertWaitOnFence.Execute(this);
break;
case DMACommands<ABI>::DMACommandType::CopyResource:
Wait = Cmd.CopyResource.Execute(this);
break;
case DMACommands<ABI>::DMACommandType::CopySubresourceRegion:
Wait = Cmd.CopySubresourceRegion.Execute(this);
break;
case DMACommands<ABI>::DMACommandType::FillMemoryWithValue:
Wait = Cmd.FillMemoryWithValue.Execute(this);
break;
case DMACommands<ABI>::DMACommandType::CopyLastErrorCodeToMemory:
Wait = Cmd.CopyLastErrorCodeToMemory.Execute(this);
break;
}
// If the command told us to wait, return 'FALSE' to
// indicate that we still have more commands to execute.
if (Wait)
return FALSE;
m_CommandIndex++;
}
m_DMACommandQueue.clear();
m_CommandIndex = 0;
return TRUE;
}
#undef ABI_INTERFACE
#define ABI_INTERFACE(ABI) D3D11DMAEngineContextX<ABI>
D3D11_DECLARE_ABI_TEMPLATES();

View File

@@ -6,6 +6,8 @@
#include "ID3D11Shader.h"
#include "ID3D11DeviceContext.h"
#include "ID3D11Runtime.h"
#include "ID3D11DMAEngineContext.h"
#include "d3d11.x.h"
//
// IUnknown
@@ -787,8 +789,8 @@ template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreateDmaEngineContext(gfx::D3D11_DMA_ENGINE_CONTEXT_DESC const *pDmaEngineContextDesc,
gfx::ID3D11DMAEngineContextX<ABI> **ppDmaDeviceContext)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
*ppDmaDeviceContext = new D3D11DMAEngineContextX<ABI>();
return S_OK;
}
template <abi_t ABI> BOOL D3D11DeviceX<ABI>::IsFencePending(UINT64 Fence)
@@ -807,32 +809,147 @@ template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreatePlacementBuffer(D3D11_BUFFER_DESC const *pDesc, void *pVirtualAddress,
gfx::ID3D11Buffer<ABI> **ppBuffer)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
D3D11_SUBRESOURCE_DATA initialData{};
initialData.pSysMem = pVirtualAddress;
initialData.SysMemPitch = 0;
initialData.SysMemSlicePitch = 0;
auto pDesc2 = *pDesc;
if (pDesc2.Usage == D3D11_USAGE_IMMUTABLE)
{
pDesc2.Usage = D3D11_USAGE_DEFAULT;
}
HRESULT hr = CreateBuffer(&pDesc2, &initialData, ppBuffer);
(*ppBuffer)->m_pAllocationStart = pVirtualAddress;
return hr;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreatePlacementTexture1D(D3D11_TEXTURE1D_DESC const *pDesc, UINT TileModeIndex, UINT Pitch,
void *pVirtualAddress, gfx::ID3D11Texture1D<ABI> **ppTexture1D)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
std::vector<D3D11_SUBRESOURCE_DATA> initialData(pDesc->ArraySize);
UINT RowPitch = 0;
UINT SlicePitch = 0;
auto pDesc2 = *pDesc;
pDesc2.MipLevels = 1;
if (pDesc2.Usage == D3D11_USAGE_IMMUTABLE)
{
pDesc2.Usage = D3D11_USAGE_DEFAULT;
}
for (int i = 0; i < initialData.size(); i++)
{
initialData[i].pSysMem = pVirtualAddress;
CalculatePitch(pDesc2.Width, 1, pDesc2.Format, &RowPitch, &SlicePitch);
initialData[i].SysMemPitch = RowPitch;
initialData[i].SysMemSlicePitch = SlicePitch;
}
MEMORY_BASIC_INFORMATION mbi{};
if (!VirtualQuery(pVirtualAddress, &mbi, sizeof(mbi)) || mbi.RegionSize < SlicePitch ||
(mbi.State & MEM_COMMIT) != MEM_COMMIT || (mbi.Protect & (PAGE_READWRITE | PAGE_READONLY)) == 0)
{
HRESULT hr = CreateTexture1D(&pDesc2, 0, ppTexture1D);
(*ppTexture1D)->m_pAllocationStart = pVirtualAddress;
initialData.clear();
return hr;
}
else
{
HRESULT hr = CreateTexture1D(&pDesc2, initialData.data(), ppTexture1D);
(*ppTexture1D)->m_pAllocationStart = pVirtualAddress;
initialData.clear();
return hr;
}
return S_OK;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreatePlacementTexture2D(D3D11_TEXTURE2D_DESC const *pDesc, UINT TileModeIndex, UINT Pitch,
void *pVirtualAddress, gfx::ID3D11Texture2D<ABI> **ppTexture2D)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
std::vector<D3D11_SUBRESOURCE_DATA> initialData(pDesc->ArraySize);
UINT RowPitch = 0;
UINT SlicePitch = 0;
auto pDesc2 = *pDesc;
pDesc2.MipLevels = 1;
if (pDesc2.Usage == D3D11_USAGE_IMMUTABLE)
{
pDesc2.Usage = D3D11_USAGE_DEFAULT;
}
for (int i = 0; i < initialData.size(); i++)
{
initialData[i].pSysMem = pVirtualAddress;
CalculatePitch(pDesc2.Width, pDesc2.Height, pDesc2.Format, &RowPitch, &SlicePitch);
initialData[i].SysMemPitch = RowPitch;
initialData[i].SysMemSlicePitch = SlicePitch;
}
MEMORY_BASIC_INFORMATION mbi{};
if (!VirtualQuery(pVirtualAddress, &mbi, sizeof(mbi)) || mbi.RegionSize < SlicePitch ||
(mbi.State & MEM_COMMIT) != MEM_COMMIT || (mbi.Protect & (PAGE_READWRITE | PAGE_READONLY)) == 0)
{
HRESULT hr = CreateTexture2D(&pDesc2, 0, ppTexture2D);
(*ppTexture2D)->m_pAllocationStart = pVirtualAddress;
initialData.clear();
return hr;
}
else
{
HRESULT hr = CreateTexture2D(&pDesc2, initialData.data(), ppTexture2D);
(*ppTexture2D)->m_pAllocationStart = pVirtualAddress;
initialData.clear();
return hr;
}
return S_OK;
}
template <abi_t ABI>
HRESULT D3D11DeviceX<ABI>::CreatePlacementTexture3D(D3D11_TEXTURE3D_DESC const *pDesc, UINT TileModeIndex, UINT Pitch,
void *pVirtualAddress, gfx::ID3D11Texture3D<ABI> **ppTexture3D)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
std::vector<D3D11_SUBRESOURCE_DATA> initialData(1);
UINT RowPitch = 0;
UINT SlicePitch = 0;
auto pDesc2 = *pDesc;
pDesc2.MipLevels = 1;
if (pDesc2.Usage == D3D11_USAGE_IMMUTABLE)
{
pDesc2.Usage = D3D11_USAGE_DEFAULT;
}
for (int i = 0; i < initialData.size(); i++)
{
initialData[i].pSysMem = pVirtualAddress;
CalculatePitch(pDesc2.Width, pDesc2.Height, pDesc2.Format, &RowPitch, &SlicePitch);
initialData[i].SysMemPitch = RowPitch;
initialData[i].SysMemSlicePitch = SlicePitch;
}
MEMORY_BASIC_INFORMATION mbi{};
if (!VirtualQuery(pVirtualAddress, &mbi, sizeof(mbi)) || mbi.RegionSize < SlicePitch ||
(mbi.State & MEM_COMMIT) != MEM_COMMIT || (mbi.Protect & (PAGE_READWRITE | PAGE_READONLY)) == 0)
{
HRESULT hr = CreateTexture3D(&pDesc2, 0, ppTexture3D);
(*ppTexture3D)->m_pAllocationStart = pVirtualAddress;
initialData.clear();
return hr;
}
else
{
HRESULT hr = CreateTexture3D(&pDesc2, initialData.data(), ppTexture3D);
(*ppTexture3D)->m_pAllocationStart = pVirtualAddress;
initialData.clear();
return hr;
}
return S_OK;
}
template <abi_t ABI> void D3D11DeviceX<ABI>::GetTimestamps(UINT64 *pGpuTimestamp, UINT64 *pCpuRdtscTimestamp)

View File

@@ -4,6 +4,7 @@
#include "ID3D11Resource.h"
#include "ID3D11Shader.h"
#include "ID3D11State.h"
#include "d3d11.x.h"
//
// IUnknown
@@ -48,7 +49,13 @@ template <abi_t ABI> ULONG D3D11DeviceContextX<ABI>::Release()
//
template <abi_t ABI> void D3D11DeviceContextX<ABI>::GetDevice(gfx::ID3D11Device<ABI> **ppDevice)
{
IMPLEMENT_STUB();
ID3D11Device *pDevice = nullptr;
ID3D11Device2 *pDevice2 = nullptr;
m_pFunction->GetDevice(&pDevice);
if (pDevice) pDevice->QueryInterface(IID_PPV_ARGS(&pDevice2));
*ppDevice = new D3D11DeviceX<ABI>(pDevice2);
}
template <abi_t ABI>
@@ -82,6 +89,88 @@ HRESULT D3D11DeviceContextX<ABI>::SetPrivateDataInterfaceGraphics(_GUID const &g
//
// ID3D11DeviceContext
//
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::CheckDirtyFlags()
{
if constexpr (requires { this->m_ShaderUserDataManagerDraw; })
{
// Topology
if (this->m_ShaderUserDataManagerDraw.m_DirtyFlags & 0x46)
{
this->m_ShaderUserDataManagerDraw.m_DirtyFlags &= ~0x46;
int topology = D3D11X_HARDWARE_TO_TOPOLOGY_MAP.at(this->m_ShaderUserDataManagerDraw.m_Topology);
m_pFunction->IASetPrimitiveTopology(static_cast<D3D11_PRIMITIVE_TOPOLOGY>(topology));
}
// Input Layout
if (this->m_ShaderUserDataManagerDraw.m_DirtyFlags & 0x89)
{
this->m_ShaderUserDataManagerDraw.m_DirtyFlags &= ~0x89;
m_pFunction->IASetInputLayout(this->m_ShaderUserDataManagerDraw.m_pInputLayout);
}
// VS
if (this->m_ShaderUserDataManagerDraw.m_DirtyFlags & 0x91)
{
this->m_ShaderUserDataManagerDraw.m_DirtyFlags &= ~0x91;
VSSetShader(this->m_ShaderUserDataManagerDraw.m_pVs);
}
// PS
if (this->m_ShaderUserDataManagerDraw.m_DirtyFlags & 0x121)
{
this->m_ShaderUserDataManagerDraw.m_DirtyFlags &= ~0x121;
PSSetShader(this->m_ShaderUserDataManagerDraw.m_pPs);
}
}
ExecuteBackgroundContexts();
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::ExecuteBackgroundContexts()
{
std::lock_guard lock(m_BkgCtxLock);
for (auto it = m_BkgContexts.begin(); it != m_BkgContexts.end();)
{
if ((*it)->ExecuteContext())
{
// This background context has finished executing, so we can remove
// it from the array. If it starts executing again it will be re-added.
it = m_BkgContexts.erase(it);
}
else
{
it++;
}
}
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::AddBackgroundContext(ID3D11BackgroundContext *pContext)
{
std::lock_guard lock(m_BkgCtxLock);
for (auto it : m_BkgContexts)
{
if (it == pContext)
{
// Context already exists
return;
}
}
m_BkgContexts.push_back(pContext);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::RemoveBackgroundContext(ID3D11BackgroundContext *pContext)
{
std::lock_guard lock(m_BkgCtxLock);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::VSSetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers)
@@ -160,15 +249,26 @@ template <abi_t ABI> void D3D11DeviceContextX<ABI>::VSSetShader(gfx::ID3D11Verte
m_pFunction->VSSetShader(Shader, nullptr, 0);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::DrawIndexed(UINT IndexCount, UINT StartIndexLocation, INT BaseVertexLocation)
{
CheckDirtyFlags();
m_pFunction->DrawIndexed(IndexCount, StartIndexLocation, BaseVertexLocation);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::DrawIndexed(UINT64 StartIndexLocationAndIndexCount, INT BaseVertexLocation)
{
IMPLEMENT_STUB();
CheckDirtyFlags();
UINT StartIndexLocation = StartIndexLocationAndIndexCount & 0xFFFFFFFF;
UINT IndexCount = (StartIndexLocationAndIndexCount >> 32) & 0xFFFFFFFF;
m_pFunction->DrawIndexed(IndexCount, StartIndexLocation, BaseVertexLocation);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::Draw(UINT VertexCount, UINT StartVertexLocation)
{
IMPLEMENT_STUB();
CheckDirtyFlags();
m_pFunction->Draw(VertexCount, StartVertexLocation);
}
template <abi_t ABI>
@@ -297,6 +397,48 @@ void D3D11DeviceContextX<ABI>::IASetIndexBuffer(gfx::ID3D11Buffer<ABI> *pIndexBu
m_pFunction->IASetIndexBuffer(Buffer, (DXGI_FORMAT)HardwareIndexFormat, Offset);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::DrawIndexedInstanced(UINT IndexCountPerInstance, UINT InstanceCount,
UINT StartIndexLocation, INT BaseVertexLocation,
UINT StartInstanceLocation)
{
CheckDirtyFlags();
m_pFunction->DrawIndexedInstanced(IndexCountPerInstance, InstanceCount, StartIndexLocation, BaseVertexLocation,
StartInstanceLocation);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::DrawIndexedInstanced(UINT64 StartIndexLocationAndIndexCountPerInstance,
UINT64 BaseVertexLocationAndStartInstanceLocation,
UINT InstanceCount)
{
CheckDirtyFlags();
UINT StartInstanceLocation = (BaseVertexLocationAndStartInstanceLocation >> 32) & 0xFFFFFFFF;
UINT BaseVertexLocation = BaseVertexLocationAndStartInstanceLocation & 0xFFFFFFFF;
UINT IndexCountPerInstance = (StartIndexLocationAndIndexCountPerInstance >> 32) & 0xFFFFFFFF;
UINT StartIndexLocation = StartIndexLocationAndIndexCountPerInstance & 0xFFFFFFFF;
m_pFunction->DrawIndexedInstanced(IndexCountPerInstance, InstanceCount, StartIndexLocation, BaseVertexLocation,
StartInstanceLocation);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::DrawInstanced(UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation,
UINT StartInstanceLocation)
{
CheckDirtyFlags();
m_pFunction->DrawInstanced(VertexCountPerInstance, InstanceCount, StartVertexLocation, StartInstanceLocation);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::DrawInstanced(UINT VertexCountPerInstance,
UINT64 StartVertexLocationAndStartInstanceLocation, UINT InstanceCount)
{
CheckDirtyFlags();
UINT StartInstanceLocation = (StartVertexLocationAndStartInstanceLocation >> 32) & 0xFFFFFFFF;
UINT StartVertexLocation = StartVertexLocationAndStartInstanceLocation & 0xFFFFFFFF;
m_pFunction->DrawInstanced(VertexCountPerInstance, InstanceCount, StartVertexLocation, StartInstanceLocation);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::IASetIndexBuffer(UINT HardwareIndexFormat, gfx::ID3D11Buffer<ABI> *pIndexBuffer,
UINT Offset)
@@ -313,21 +455,6 @@ void D3D11DeviceContextX<ABI>::IASetIndexBuffer(UINT HardwareIndexFormat, gfx::I
m_pFunction->IASetIndexBuffer(Buffer, Format, Offset);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::DrawIndexedInstanced(UINT StartIndexLocationAndIndexCountPerInstance,
UINT64 BaseVertexLocationAndStartInstanceLocation,
UINT64 InstanceCount)
{
IMPLEMENT_STUB();
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::DrawInstanced(UINT VertexCountPerInstance,
UINT64 StartVertexLocationAndStartInstanceLocation, UINT InstanceCount)
{
IMPLEMENT_STUB();
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::GSSetConstantBuffers(UINT StartSlot, UINT NumBuffers,
gfx::ID3D11Buffer<ABI> *const *ppConstantBuffers)
@@ -359,7 +486,7 @@ template <abi_t ABI> void D3D11DeviceContextX<ABI>::GSSetShader(gfx::ID3D11Geome
template <abi_t ABI> void D3D11DeviceContextX<ABI>::IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY PrimitiveTopology)
{
IMPLEMENT_STUB();
m_pFunction->IASetPrimitiveTopology(PrimitiveTopology);
}
template <abi_t ABI>
@@ -593,7 +720,14 @@ void D3D11DeviceContextX<ABI>::DispatchIndirect(gfx::ID3D11Buffer<ABI> *pBufferF
template <abi_t ABI> void D3D11DeviceContextX<ABI>::RSSetState(gfx::ID3D11RasterizerState<ABI> *pRasterizerState)
{
IMPLEMENT_STUB();
ID3D11RasterizerState *pState = nullptr;
if (pRasterizerState)
{
pState = static_cast<D3D11RasterizerState<ABI>*>(pRasterizerState)->m_pFunction;
}
m_pFunction->RSSetState(pState);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::RSSetViewports(UINT NumViewports, D3D11_VIEWPORT const *pViewports)
@@ -603,7 +737,7 @@ template <abi_t ABI> void D3D11DeviceContextX<ABI>::RSSetViewports(UINT NumViewp
template <abi_t ABI> void D3D11DeviceContextX<ABI>::RSSetScissorRects(UINT NumRects, D3D11_RECT const *pRects)
{
IMPLEMENT_STUB();
m_pFunction->RSSetScissorRects(NumRects, pRects);
}
template <abi_t ABI>
@@ -671,28 +805,40 @@ template <abi_t ABI>
void D3D11DeviceContextX<ABI>::ClearRenderTargetView(gfx::ID3D11RenderTargetView<ABI> *pRenderTargetView,
FLOAT const ColorRGBA[4])
{
IMPLEMENT_STUB();
if (pRenderTargetView)
{
m_pFunction->ClearRenderTargetView(static_cast<D3D11RenderTargetView<ABI>*>(pRenderTargetView)->m_pFunction, ColorRGBA);
}
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::ClearUnorderedAccessViewUint(gfx::ID3D11UnorderedAccessView<ABI> *pUnorderedAccessView,
UINT const Values[4])
{
IMPLEMENT_STUB();
if (pUnorderedAccessView)
{
m_pFunction->ClearUnorderedAccessViewUint(static_cast<D3D11UnorderedAccessView<ABI> *>(pUnorderedAccessView)->m_pFunction, Values);
}
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::ClearUnorderedAccessViewFloat(gfx::ID3D11UnorderedAccessView<ABI> *pUnorderedAccessView,
FLOAT const Values[4])
{
IMPLEMENT_STUB();
if (pUnorderedAccessView)
{
m_pFunction->ClearUnorderedAccessViewFloat(static_cast<D3D11UnorderedAccessView<ABI> *>(pUnorderedAccessView)->m_pFunction, Values);
}
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::ClearDepthStencilView(gfx::ID3D11DepthStencilView<ABI> *pDepthStencilView,
UINT ClearFlags, FLOAT Depth, UINT8 Stencil)
{
IMPLEMENT_STUB();
if (pDepthStencilView)
{
m_pFunction->ClearDepthStencilView(static_cast<D3D11DepthStencilView<ABI>*>(pDepthStencilView)->m_pFunction, ClearFlags, Depth, Stencil);
}
}
template <abi_t ABI>
@@ -723,7 +869,7 @@ void D3D11DeviceContextX<ABI>::ResolveSubresource(gfx::ID3D11Resource<ABI> *pDst
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::ExecuteCommandList(ID3D11CommandList *pCommandList, BOOL RestoreContextState)
{
IMPLEMENT_STUB();
m_pFunction->ExecuteCommandList(pCommandList, RestoreContextState);
}
template <abi_t ABI>
@@ -1207,31 +1353,28 @@ void D3D11DeviceContextX<ABI>::CSGetConstantBuffers(UINT StartSlot, UINT NumBuff
template <abi_t ABI> void D3D11DeviceContextX<ABI>::ClearState()
{
IMPLEMENT_STUB();
m_pFunction->ClearState();
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::Flush()
{
IMPLEMENT_STUB();
m_pFunction->Flush();
}
template <abi_t ABI> D3D11_DEVICE_CONTEXT_TYPE D3D11DeviceContextX<ABI>::GetType()
{
IMPLEMENT_STUB();
return {};
return m_pFunction->GetType();
}
template <abi_t ABI> UINT D3D11DeviceContextX<ABI>::GetContextFlags()
{
IMPLEMENT_STUB();
return {};
return m_pFunction->GetContextFlags();
}
template <abi_t ABI>
HRESULT D3D11DeviceContextX<ABI>::FinishCommandList(BOOL RestoreDeferredContextState, ID3D11CommandList **ppCommandList)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
return m_pFunction->FinishCommandList(RestoreDeferredContextState, ppCommandList);
}
//
@@ -1525,13 +1668,19 @@ template <abi_t ABI> void D3D11DeviceContextX<ABI>::InsertWaitUntilIdle(UINT Fla
template <abi_t ABI> UINT64 D3D11DeviceContextX<ABI>::InsertFence(UINT Flags)
{
IMPLEMENT_STUB();
return {};
ExecuteBackgroundContexts();
return (UINT64)&m_Fence;
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::InsertWaitOnFence(UINT Flags, UINT64 Fence)
{
IMPLEMENT_STUB();
if (Fence)
{
while (!*reinterpret_cast<BOOL volatile *>(Fence))
{
ExecuteBackgroundContexts();
}
}
}
template <abi_t ABI>
@@ -1565,121 +1714,124 @@ template <abi_t ABI> void D3D11DeviceContextX<ABI>::RemapVertexBufferInheritance
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::PSSetFastConstantBuffer(UINT Slot, gfx::ID3D11Buffer<ABI> *pConstantBuffer)
{
IMPLEMENT_STUB();
PSSetConstantBuffers(Slot, 1, &pConstantBuffer);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::PSSetFastShaderResource(UINT Slot,
gfx::ID3D11ShaderResourceView<ABI> *pShaderResourceView)
{
IMPLEMENT_STUB();
PSSetShaderResources(Slot, 1, &pShaderResourceView);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::PSSetFastSampler(UINT Slot, gfx::ID3D11SamplerState<ABI> *pSampler)
{
IMPLEMENT_STUB();
PSSetSamplers(Slot, 1, &pSampler);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::VSSetFastConstantBuffer(UINT Slot, gfx::ID3D11Buffer<ABI> *pConstantBuffer)
{
IMPLEMENT_STUB();
VSSetConstantBuffers(Slot, 1, &pConstantBuffer);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::VSSetFastShaderResource(UINT Slot,
gfx::ID3D11ShaderResourceView<ABI> *pShaderResourceView)
{
IMPLEMENT_STUB();
VSSetShaderResources(Slot, 1, &pShaderResourceView);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::VSSetFastSampler(UINT Slot, gfx::ID3D11SamplerState<ABI> *pSampler)
{
IMPLEMENT_STUB();
VSSetSamplers(Slot, 1, &pSampler);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::GSSetFastConstantBuffer(UINT Slot, gfx::ID3D11Buffer<ABI> *pConstantBuffer)
{
IMPLEMENT_STUB();
GSSetConstantBuffers(Slot, 1, &pConstantBuffer);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::GSSetFastShaderResource(UINT Slot,
gfx::ID3D11ShaderResourceView<ABI> *pShaderResourceView)
{
IMPLEMENT_STUB();
GSSetShaderResources(Slot, 1, &pShaderResourceView);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::GSSetFastSampler(UINT Slot, gfx::ID3D11SamplerState<ABI> *pSampler)
{
IMPLEMENT_STUB();
GSSetSamplers(Slot, 1, &pSampler);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::CSSetFastConstantBuffer(UINT Slot, gfx::ID3D11Buffer<ABI> *pConstantBuffer)
{
IMPLEMENT_STUB();
CSSetConstantBuffers(Slot, 1, &pConstantBuffer);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::CSSetFastShaderResource(UINT Slot,
gfx::ID3D11ShaderResourceView<ABI> *pShaderResourceView)
{
IMPLEMENT_STUB();
CSSetShaderResources(Slot, 1, &pShaderResourceView);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::CSSetFastSampler(UINT Slot, gfx::ID3D11SamplerState<ABI> *pSampler)
{
IMPLEMENT_STUB();
CSSetSamplers(Slot, 1, &pSampler);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::HSSetFastConstantBuffer(UINT Slot, gfx::ID3D11Buffer<ABI> *pConstantBuffer)
{
IMPLEMENT_STUB();
HSSetConstantBuffers(Slot, 1, &pConstantBuffer);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::HSSetFastShaderResource(UINT Slot,
gfx::ID3D11ShaderResourceView<ABI> *pShaderResourceView)
{
IMPLEMENT_STUB();
HSSetShaderResources(Slot, 1, &pShaderResourceView);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::HSSetFastSampler(UINT Slot, gfx::ID3D11SamplerState<ABI> *pSampler)
{
IMPLEMENT_STUB();
HSSetSamplers(Slot, 1, &pSampler);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::DSSetFastConstantBuffer(UINT Slot, gfx::ID3D11Buffer<ABI> *pConstantBuffer)
{
IMPLEMENT_STUB();
DSSetConstantBuffers(Slot, 1, &pConstantBuffer);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::DSSetFastShaderResource(UINT Slot,
gfx::ID3D11ShaderResourceView<ABI> *pShaderResourceView)
{
IMPLEMENT_STUB();
DSSetShaderResources(Slot, 1, &pShaderResourceView);
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::DSSetFastSampler(UINT Slot, gfx::ID3D11SamplerState<ABI> *pSampler)
{
IMPLEMENT_STUB();
DSSetSamplers(Slot, 1, &pSampler);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::IASetFastVertexBuffer(UINT Slot, gfx::ID3D11Buffer<ABI> *pVertexBuffer, UINT Stride)
{
IMPLEMENT_STUB();
UINT Offset = 0;
IASetVertexBuffers(Slot, 1, &pVertexBuffer, &Stride, &Offset);
}
template <abi_t ABI>
void D3D11DeviceContextX<ABI>::IASetFastIndexBuffer(UINT HardwareIndexFormat, gfx::ID3D11Buffer<ABI> *pIndexBuffer)
{
IMPLEMENT_STUB();
HardwareIndexFormat = HardwareIndexFormat != 0 ? DXGI_FORMAT_R32_UINT : DXGI_FORMAT_R16_UINT;
IASetIndexBuffer(pIndexBuffer, HardwareIndexFormat, 0);
}
template <abi_t ABI>
@@ -1802,12 +1954,12 @@ void D3D11DeviceContextX<ABI>::HSGetLastUsedTessellationParameters(
template <abi_t ABI> void D3D11DeviceContextX<ABI>::CSEnableAutomaticGpuFlush(BOOL Enable)
{
IMPLEMENT_STUB();
}
template <abi_t ABI> void D3D11DeviceContextX<ABI>::GpuSendPipelinedEvent(gfx::D3D11X_GPU_PIPELINED_EVENT Event)
{
IMPLEMENT_STUB();
}
template <abi_t ABI> HRESULT D3D11DeviceContextX<ABI>::Suspend(UINT Flags)

View File

@@ -160,6 +160,14 @@ HRESULT DXGIFactory2<ABI>::CreateSwapChainForCoreWindow(xbox::IGraphicsUnknown<A
IUnknown *dev{};
HRESULT hr = 0;
if (pDesc->SwapEffect == DXGI_SWAP_EFFECT_DISCARD || pDesc->SwapEffect == DXGI_SWAP_EFFECT_SEQUENTIAL)
{
if (pDesc->SwapEffect == DXGI_SWAP_EFFECT_DISCARD)
pDesc2.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
else if (pDesc->SwapEffect == DXGI_SWAP_EFFECT_SEQUENTIAL)
pDesc2.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
}
if (pDevice)
{
pDevice->QueryInterface(__uuidof(xbox::IGraphicsUnwrap), (void **)&dev);

View File

@@ -130,17 +130,17 @@ struct DXGIX_PRESENTARRAY_PARAMETERS
UINT Flags;
};
void PresentArray(UINT NumSwapChains, void **SwapChains, UINT SyncInterval)
{
// TODO
}
EXTERN_C HRESULT __stdcall DXGIXPresentArray(UINT SyncInterval, UINT PresentImmediateThreshold, UINT Flags,
UINT NumSwapChains, void **ppSwapChains,
const DXGIX_PRESENTARRAY_PARAMETERS *pPresentParameters)
{
IMPLEMENT_STUB();
return E_NOTIMPL;
if (!g_PresentArrayHelper)
{
d3d11CreateInstance<DXGIXPresentArrayHelper>(g_ABI, (void **)&g_PresentArrayHelper);
}
g_PresentArrayHelper->PresentArray(ppSwapChains, NumSwapChains, SyncInterval);
return S_OK;
}
EXTERN_C HRESULT __stdcall DXGIXSetVLineNotification(UINT VLineCounter, UINT VLineNum, HANDLE hEvent)

View File

@@ -61,4 +61,14 @@ inline BOOL IsXboxAddress(const PVOID Address)
HRESULT(STDMETHODCALLTYPE *TrueGetForCurrentThread)(ICoreWindowStatic *staticWindow, CoreWindow **window);
HRESULT STDMETHODCALLTYPE EraGetForCurrentThread(ICoreWindowStatic *pThis, CoreWindow **ppWindow);
HRESULT STDMETHODCALLTYPE EraGetForCurrentThread(ICoreWindowStatic *pThis, CoreWindow **ppWindow);
typedef HWND(WINAPI *PCreateWindowInBandEx)(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle,
int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu,
HINSTANCE hInstance, LPVOID lpParam, DWORD dwBand, DWORD dwTypeFlags);
static PCreateWindowInBandEx TrueCreateWindowInBandEx = 0;
HWND WINAPI EraCreateWindowInBandEx(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int x,
int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance,
LPVOID lpParam, DWORD dwBand, DWORD dwTypeFlags);

View File

@@ -148,6 +148,20 @@ HRESULT __stdcall EraGetForCurrentThread(ICoreWindowStatic *pThis, CoreWindow **
return hr;
}
HWND __stdcall EraCreateWindowInBandEx(DWORD dwExStyle, LPCWSTR lpClassName, LPCWSTR lpWindowName, DWORD dwStyle, int x,
int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu,
HINSTANCE hInstance, LPVOID lpParam, DWORD dwBand, DWORD dwTypeFlags)
{
if (dwExStyle & WS_EX_NOREDIRECTIONBITMAP)
{
dwExStyle &= ~WS_EX_NOREDIRECTIONBITMAP;
}
return TrueCreateWindowInBandEx(dwExStyle, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent,
hMenu, hInstance, lpParam, dwBand, dwTypeFlags);
}
inline HRESULT WINAPI EraRoGetActivationFactory(HSTRING classId, REFIID iid, void **factory)
{

View File

@@ -5,12 +5,31 @@ static DWORD ReasonForCall = 0;
void KernelxInitialize(HINSTANCE hinstDLL)
{
if (!GetConsoleWindow())
{
AllocConsole();
FILE *f;
freopen_s(&f, "CONOUT$", "w", stdout);
freopen_s(&f, "CONOUT$", "w", stderr);
freopen_s(&f, "CONIN$", "r", stdin);
SetConsoleTitleW(L"WinDurango");
}
if (ReasonForCall == DLL_PROCESS_ATTACH || ReasonForCall == DLL_THREAD_ATTACH)
{
XWinePatchImport(GetModuleHandleW(nullptr), GetRuntimeModule(),
"?GetActivationFactoryByPCWSTR@@YAJPEAXAEAVGuid@Platform@@PEAPEAX@Z",
GetActivationFactoryRedirect);
}
HMODULE User32 = LoadLibraryA("user32.dll");
if (User32)
{
FARPROC CreateWindowInBandEx = GetProcAddress(User32, "CreateWindowInBandEx");
TrueCreateWindowInBandEx = reinterpret_cast<PCreateWindowInBandEx>(CreateWindowInBandEx);
DetourAttach(&reinterpret_cast<PVOID &>(TrueCreateWindowInBandEx), EraCreateWindowInBandEx);
}
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)

View File

@@ -131,29 +131,19 @@ namespace winrt::Windows::Xbox::Input::implementation
p_wd->log.Log("WinDurango::WinRT::Windows::Xbox::Input", "Creating static a_gamepads");
for (size_t i = 0; i < 4; i++)
for (DWORD gamepad = 0; gamepad < XUSER_MAX_COUNT; gamepad++)
{
XINPUT_STATE state{};
DWORD result = XInputGetState(0, &state);
if (result == ERROR_SUCCESS)
XINPUT_CAPABILITIES capabilities;
if (XInputGetCapabilities(gamepad, XINPUT_FLAG_GAMEPAD, &capabilities) == ERROR_SUCCESS)
{
p_wd->log.Log("WinDurango::WinRT::Windows::Xbox::Input", "Creating gamepad");
winrt::Windows::Xbox::Input::Gamepad gamepad = winrt::make<Gamepad>(i, true);
a_gamepads.Append(gamepad);
winrt::Windows::Xbox::Input::Gamepad NewGamepad = winrt::make<Gamepad>(gamepad, true);
a_gamepads.Append(NewGamepad);
continue;
}
}
}
if (a_gamepads.Size() == 0)
{
p_wd->log.Log("WinDurango::WinRT::Windows::Xbox::Input", "Creating Virtual gamepad");
winrt::Windows::Xbox::Input::Gamepad gamepad = winrt::make<Gamepad>(0, false);
a_gamepads.Append(gamepad);
}
// I think I need to add mouse capture here
return a_gamepads.GetView();
}

View File

@@ -20,13 +20,11 @@ namespace winrt::Windows::Xbox::Management::Deployment::implementation
}
winrt::Windows::Xbox::Management::Deployment::PackageTransferManager PackageTransferManager::Current()
{
p_wd->log.Warn("WinDurango::WinRT::Windows::Xbox::Management::Deployment", "Unimplemented: Current");
throw hresult_not_implemented();
return winrt::make<PackageTransferManager>();
}
winrt::Windows::Xbox::Management::Deployment::PackageTransferManager PackageTransferManager::Create(winrt::Windows::ApplicationModel::Package const& unk)
winrt::Windows::Xbox::Management::Deployment::PackageTransferManager PackageTransferManager::Create(winrt::Windows::ApplicationModel::Package const &package)
{
p_wd->log.Warn("WinDurango::WinRT::Windows::Xbox::Management::Deployment", "Unimplemented: Create");
throw hresult_not_implemented();
return winrt::make<PackageTransferManager>();
}
winrt::Windows::Xbox::Management::Deployment::ChunkSpecifiers PackageTransferManager::AvailableChunkSpecifiers()
{
@@ -51,7 +49,7 @@ namespace winrt::Windows::Xbox::Management::Deployment::implementation
winrt::Windows::Foundation::IAsyncAction PackageTransferManager::RemoveChunkSpecifiersAsync(winrt::Windows::Xbox::Management::Deployment::ChunkSpecifiers unk)
{
p_wd->log.Warn("WinDurango::WinRT::Windows::Xbox::Management::Deployment", "Unimplemented: RemoveChunkSpecifiersAsync");
throw hresult_not_implemented();
return {};
}
winrt::Windows::Xbox::Management::Deployment::PackageTransferType PackageTransferManager::TransferType()
{
@@ -63,20 +61,17 @@ namespace winrt::Windows::Xbox::Management::Deployment::implementation
p_wd->log.Warn("WinDurango::WinRT::Windows::Xbox::Management::Deployment", "Unimplemented: UpdateInstallOrder");
throw hresult_not_implemented();
}
bool PackageTransferManager::IsChunkInstalled(uint32_t unk)
bool PackageTransferManager::IsChunkInstalled(uint32_t chunkId)
{
p_wd->log.Warn("WinDurango::WinRT::Windows::Xbox::Management::Deployment", "Unimplemented: IsChunkInstalled");
throw hresult_not_implemented();
return true;
}
bool PackageTransferManager::AreChunksInstalled(winrt::Windows::Foundation::Collections::IIterable<uint32_t> const& unk)
bool PackageTransferManager::AreChunksInstalled(winrt::Windows::Foundation::Collections::IIterable<uint32_t> const &chunkIds)
{
p_wd->log.Warn("WinDurango::WinRT::Windows::Xbox::Management::Deployment", "Unimplemented: AreChunksInstalled");
throw hresult_not_implemented();
return true;
}
uint32_t PackageTransferManager::FindChunkFromFile(hstring const& unk)
{
p_wd->log.Warn("WinDurango::WinRT::Windows::Xbox::Management::Deployment", "Unimplemented: FindChunkFromFile");
throw hresult_not_implemented();
return 0;
}
winrt::Windows::Xbox::Management::Deployment::PackageTransferStatus PackageTransferManager::TransferStatus()
{

View File

@@ -19,13 +19,11 @@ namespace winrt::Windows::Xbox::Management::Deployment::implementation
}
winrt::Windows::Xbox::Management::Deployment::PackageTransferWatcher PackageTransferWatcher::Create(winrt::Windows::ApplicationModel::Package const& unk, winrt::Windows::Foundation::Collections::IIterable<uint32_t> const& unka)
{
p_wd->log.Warn("WinDurango::WinRT::Windows::Xbox::Management::Deployment", "Unimplemented: Create");
throw hresult_not_implemented();
return winrt::make<PackageTransferWatcher>();
}
winrt::Windows::Xbox::Management::Deployment::PackageTransferWatcher PackageTransferWatcher::Create(winrt::Windows::ApplicationModel::Package const& unk)
{
p_wd->log.Warn("WinDurango::WinRT::Windows::Xbox::Management::Deployment", "Unimplemented: Create(Package)");
throw hresult_not_implemented();
return winrt::make<PackageTransferWatcher>();
}
winrt::Windows::Xbox::Management::Deployment::PackageTransferStatus PackageTransferWatcher::TransferStatus()
{