1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 01:24:11 +01:00

[d3d11] Implement ID3D11Device3

This commit is contained in:
Philip Rebohle 2019-09-16 16:04:06 +02:00
parent b0f6655b92
commit fdf560150f
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 350 additions and 46 deletions

View File

@ -78,13 +78,15 @@ namespace dxvk {
ID3D11Buffer** ppBuffer) { ID3D11Buffer** ppBuffer) {
InitReturnPtr(ppBuffer); InitReturnPtr(ppBuffer);
if (pDesc == nullptr) if (!pDesc)
return E_INVALIDARG; return E_INVALIDARG;
if (FAILED(D3D11Buffer::ValidateBufferProperties(pDesc))) HRESULT hr = D3D11Buffer::ValidateBufferProperties(pDesc);
return E_INVALIDARG;
if (ppBuffer == nullptr) if (FAILED(hr))
return hr;
if (!ppBuffer)
return S_FALSE; return S_FALSE;
try { try {
@ -107,7 +109,7 @@ namespace dxvk {
ID3D11Texture1D** ppTexture1D) { ID3D11Texture1D** ppTexture1D) {
InitReturnPtr(ppTexture1D); InitReturnPtr(ppTexture1D);
if (pDesc == nullptr) if (!pDesc)
return E_INVALIDARG; return E_INVALIDARG;
D3D11_COMMON_TEXTURE_DESC desc; D3D11_COMMON_TEXTURE_DESC desc;
@ -124,10 +126,12 @@ namespace dxvk {
desc.MiscFlags = pDesc->MiscFlags; desc.MiscFlags = pDesc->MiscFlags;
desc.TextureLayout = D3D11_TEXTURE_LAYOUT_UNDEFINED; desc.TextureLayout = D3D11_TEXTURE_LAYOUT_UNDEFINED;
if (FAILED(D3D11CommonTexture::NormalizeTextureProperties(&desc))) HRESULT hr = D3D11CommonTexture::NormalizeTextureProperties(&desc);
return E_INVALIDARG;
if (FAILED(hr))
return hr;
if (ppTexture1D == nullptr) if (!ppTexture1D)
return S_FALSE; return S_FALSE;
try { try {
@ -148,7 +152,40 @@ namespace dxvk {
ID3D11Texture2D** ppTexture2D) { ID3D11Texture2D** ppTexture2D) {
InitReturnPtr(ppTexture2D); InitReturnPtr(ppTexture2D);
if (pDesc == nullptr) if (!pDesc)
return E_INVALIDARG;
D3D11_TEXTURE2D_DESC1 desc;
desc.Width = pDesc->Width;
desc.Height = pDesc->Height;
desc.MipLevels = pDesc->MipLevels;
desc.ArraySize = pDesc->ArraySize;
desc.Format = pDesc->Format;
desc.SampleDesc = pDesc->SampleDesc;
desc.Usage = pDesc->Usage;
desc.BindFlags = pDesc->BindFlags;
desc.CPUAccessFlags = pDesc->CPUAccessFlags;
desc.MiscFlags = pDesc->MiscFlags;
desc.TextureLayout = D3D11_TEXTURE_LAYOUT_UNDEFINED;
ID3D11Texture2D1* texture2D = nullptr;
HRESULT hr = CreateTexture2D1(&desc, pInitialData, ppTexture2D ? &texture2D : nullptr);
if (hr != S_OK)
return hr;
*ppTexture2D = texture2D;
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D11Device::CreateTexture2D1(
const D3D11_TEXTURE2D_DESC1* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture2D1** ppTexture2D) {
InitReturnPtr(ppTexture2D);
if (!pDesc)
return E_INVALIDARG; return E_INVALIDARG;
D3D11_COMMON_TEXTURE_DESC desc; D3D11_COMMON_TEXTURE_DESC desc;
@ -163,16 +200,18 @@ namespace dxvk {
desc.BindFlags = pDesc->BindFlags; desc.BindFlags = pDesc->BindFlags;
desc.CPUAccessFlags = pDesc->CPUAccessFlags; desc.CPUAccessFlags = pDesc->CPUAccessFlags;
desc.MiscFlags = pDesc->MiscFlags; desc.MiscFlags = pDesc->MiscFlags;
desc.TextureLayout = D3D11_TEXTURE_LAYOUT_UNDEFINED; desc.TextureLayout = pDesc->TextureLayout;
if (FAILED(D3D11CommonTexture::NormalizeTextureProperties(&desc))) HRESULT hr = D3D11CommonTexture::NormalizeTextureProperties(&desc);
return E_INVALIDARG;
if (FAILED(hr))
return hr;
if (ppTexture2D == nullptr) if (!ppTexture2D)
return S_FALSE; return S_FALSE;
try { try {
const Com<D3D11Texture2D> texture = new D3D11Texture2D(this, &desc); Com<D3D11Texture2D> texture = new D3D11Texture2D(this, &desc);
m_initializer->InitTexture(texture->GetCommonTexture(), pInitialData); m_initializer->InitTexture(texture->GetCommonTexture(), pInitialData);
*ppTexture2D = texture.ref(); *ppTexture2D = texture.ref();
return S_OK; return S_OK;
@ -181,7 +220,7 @@ namespace dxvk {
return E_INVALIDARG; return E_INVALIDARG;
} }
} }
HRESULT STDMETHODCALLTYPE D3D11Device::CreateTexture3D( HRESULT STDMETHODCALLTYPE D3D11Device::CreateTexture3D(
const D3D11_TEXTURE3D_DESC* pDesc, const D3D11_TEXTURE3D_DESC* pDesc,
@ -189,7 +228,39 @@ namespace dxvk {
ID3D11Texture3D** ppTexture3D) { ID3D11Texture3D** ppTexture3D) {
InitReturnPtr(ppTexture3D); InitReturnPtr(ppTexture3D);
if (pDesc == nullptr) if (!pDesc)
return E_INVALIDARG;
D3D11_TEXTURE3D_DESC1 desc;
desc.Width = pDesc->Width;
desc.Height = pDesc->Height;
desc.Depth = pDesc->Depth;
desc.MipLevels = pDesc->MipLevels;
desc.Format = pDesc->Format;
desc.Usage = pDesc->Usage;
desc.BindFlags = pDesc->BindFlags;
desc.CPUAccessFlags = pDesc->CPUAccessFlags;
desc.MiscFlags = pDesc->MiscFlags;
desc.TextureLayout = D3D11_TEXTURE_LAYOUT_UNDEFINED;
ID3D11Texture3D1* texture3D = nullptr;
HRESULT hr = CreateTexture3D1(&desc, pInitialData, ppTexture3D ? &texture3D : nullptr);
if (hr != S_OK)
return hr;
*ppTexture3D = texture3D;
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D11Device::CreateTexture3D1(
const D3D11_TEXTURE3D_DESC1* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture3D1** ppTexture3D) {
InitReturnPtr(ppTexture3D);
if (!pDesc)
return E_INVALIDARG; return E_INVALIDARG;
D3D11_COMMON_TEXTURE_DESC desc; D3D11_COMMON_TEXTURE_DESC desc;
@ -204,16 +275,18 @@ namespace dxvk {
desc.BindFlags = pDesc->BindFlags; desc.BindFlags = pDesc->BindFlags;
desc.CPUAccessFlags = pDesc->CPUAccessFlags; desc.CPUAccessFlags = pDesc->CPUAccessFlags;
desc.MiscFlags = pDesc->MiscFlags; desc.MiscFlags = pDesc->MiscFlags;
desc.TextureLayout = D3D11_TEXTURE_LAYOUT_UNDEFINED; desc.TextureLayout = pDesc->TextureLayout;
if (FAILED(D3D11CommonTexture::NormalizeTextureProperties(&desc))) HRESULT hr = D3D11CommonTexture::NormalizeTextureProperties(&desc);
return E_INVALIDARG;
if (FAILED(hr))
return hr;
if (ppTexture3D == nullptr) if (!ppTexture3D)
return S_FALSE; return S_FALSE;
try { try {
const Com<D3D11Texture3D> texture = new D3D11Texture3D(this, &desc); Com<D3D11Texture3D> texture = new D3D11Texture3D(this, &desc);
m_initializer->InitTexture(texture->GetCommonTexture(), pInitialData); m_initializer->InitTexture(texture->GetCommonTexture(), pInitialData);
*ppTexture3D = texture.ref(); *ppTexture3D = texture.ref();
return S_OK; return S_OK;
@ -230,7 +303,31 @@ namespace dxvk {
ID3D11ShaderResourceView** ppSRView) { ID3D11ShaderResourceView** ppSRView) {
InitReturnPtr(ppSRView); InitReturnPtr(ppSRView);
if (pResource == nullptr) D3D11_SHADER_RESOURCE_VIEW_DESC1 desc = pDesc
? D3D11ShaderResourceView::PromoteDesc(pDesc)
: D3D11_SHADER_RESOURCE_VIEW_DESC1();
ID3D11ShaderResourceView1* view = nullptr;
HRESULT hr = CreateShaderResourceView1(pResource,
pDesc ? &desc : nullptr,
ppSRView ? &view : nullptr);
if (hr != S_OK)
return hr;
*ppSRView = view;
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D11Device::CreateShaderResourceView1(
ID3D11Resource* pResource,
const D3D11_SHADER_RESOURCE_VIEW_DESC1* pDesc,
ID3D11ShaderResourceView1** ppSRView) {
InitReturnPtr(ppSRView);
if (!pResource)
return E_INVALIDARG; return E_INVALIDARG;
D3D11_COMMON_RESOURCE_DESC resourceDesc; D3D11_COMMON_RESOURCE_DESC resourceDesc;
@ -240,11 +337,11 @@ namespace dxvk {
// a view that covers all subresources of the image. // a view that covers all subresources of the image.
D3D11_SHADER_RESOURCE_VIEW_DESC1 desc; D3D11_SHADER_RESOURCE_VIEW_DESC1 desc;
if (pDesc == nullptr) { if (!pDesc) {
if (FAILED(D3D11ShaderResourceView::GetDescFromResource(pResource, &desc))) if (FAILED(D3D11ShaderResourceView::GetDescFromResource(pResource, &desc)))
return E_INVALIDARG; return E_INVALIDARG;
} else { } else {
desc = D3D11ShaderResourceView::PromoteDesc(pDesc); desc = *pDesc;
if (FAILED(D3D11ShaderResourceView::NormalizeDesc(pResource, &desc))) if (FAILED(D3D11ShaderResourceView::NormalizeDesc(pResource, &desc)))
return E_INVALIDARG; return E_INVALIDARG;
@ -259,7 +356,7 @@ namespace dxvk {
return E_INVALIDARG; return E_INVALIDARG;
} }
if (ppSRView == nullptr) if (!ppSRView)
return S_FALSE; return S_FALSE;
try { try {
@ -277,8 +374,32 @@ namespace dxvk {
const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc, const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc,
ID3D11UnorderedAccessView** ppUAView) { ID3D11UnorderedAccessView** ppUAView) {
InitReturnPtr(ppUAView); InitReturnPtr(ppUAView);
D3D11_UNORDERED_ACCESS_VIEW_DESC1 desc = pDesc
? D3D11UnorderedAccessView::PromoteDesc(pDesc)
: D3D11_UNORDERED_ACCESS_VIEW_DESC1();
if (pResource == nullptr) ID3D11UnorderedAccessView1* view = nullptr;
HRESULT hr = CreateUnorderedAccessView1(pResource,
pDesc ? &desc : nullptr,
ppUAView ? &view : nullptr);
if (hr != S_OK)
return hr;
*ppUAView = view;
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D11Device::CreateUnorderedAccessView1(
ID3D11Resource* pResource,
const D3D11_UNORDERED_ACCESS_VIEW_DESC1* pDesc,
ID3D11UnorderedAccessView1** ppUAView) {
InitReturnPtr(ppUAView);
if (!pResource)
return E_INVALIDARG; return E_INVALIDARG;
D3D11_COMMON_RESOURCE_DESC resourceDesc; D3D11_COMMON_RESOURCE_DESC resourceDesc;
@ -288,11 +409,11 @@ namespace dxvk {
// a view that covers all subresources of the image. // a view that covers all subresources of the image.
D3D11_UNORDERED_ACCESS_VIEW_DESC1 desc; D3D11_UNORDERED_ACCESS_VIEW_DESC1 desc;
if (pDesc == nullptr) { if (!pDesc) {
if (FAILED(D3D11UnorderedAccessView::GetDescFromResource(pResource, &desc))) if (FAILED(D3D11UnorderedAccessView::GetDescFromResource(pResource, &desc)))
return E_INVALIDARG; return E_INVALIDARG;
} else { } else {
desc = D3D11UnorderedAccessView::PromoteDesc(pDesc); desc = *pDesc;
if (FAILED(D3D11UnorderedAccessView::NormalizeDesc(pResource, &desc))) if (FAILED(D3D11UnorderedAccessView::NormalizeDesc(pResource, &desc)))
return E_INVALIDARG; return E_INVALIDARG;
@ -307,7 +428,7 @@ namespace dxvk {
return E_INVALIDARG; return E_INVALIDARG;
} }
if (ppUAView == nullptr) if (!ppUAView)
return S_FALSE; return S_FALSE;
try { try {
@ -326,7 +447,31 @@ namespace dxvk {
ID3D11RenderTargetView** ppRTView) { ID3D11RenderTargetView** ppRTView) {
InitReturnPtr(ppRTView); InitReturnPtr(ppRTView);
if (pResource == nullptr) D3D11_RENDER_TARGET_VIEW_DESC1 desc = pDesc
? D3D11RenderTargetView::PromoteDesc(pDesc)
: D3D11_RENDER_TARGET_VIEW_DESC1();
ID3D11RenderTargetView1* view = nullptr;
HRESULT hr = CreateRenderTargetView1(pResource,
pDesc ? &desc : nullptr,
ppRTView ? &view : nullptr);
if (hr != S_OK)
return hr;
*ppRTView = view;
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D11Device::CreateRenderTargetView1(
ID3D11Resource* pResource,
const D3D11_RENDER_TARGET_VIEW_DESC1* pDesc,
ID3D11RenderTargetView1** ppRTView) {
InitReturnPtr(ppRTView);
if (!pResource)
return E_INVALIDARG; return E_INVALIDARG;
// DXVK only supports render target views for image resources // DXVK only supports render target views for image resources
@ -342,11 +487,11 @@ namespace dxvk {
// will use the resource's format and all array layers. // will use the resource's format and all array layers.
D3D11_RENDER_TARGET_VIEW_DESC1 desc; D3D11_RENDER_TARGET_VIEW_DESC1 desc;
if (pDesc == nullptr) { if (!pDesc) {
if (FAILED(D3D11RenderTargetView::GetDescFromResource(pResource, &desc))) if (FAILED(D3D11RenderTargetView::GetDescFromResource(pResource, &desc)))
return E_INVALIDARG; return E_INVALIDARG;
} else { } else {
desc = D3D11RenderTargetView::PromoteDesc(pDesc); desc = *pDesc;
if (FAILED(D3D11RenderTargetView::NormalizeDesc(pResource, &desc))) if (FAILED(D3D11RenderTargetView::NormalizeDesc(pResource, &desc)))
return E_INVALIDARG; return E_INVALIDARG;
@ -361,7 +506,7 @@ namespace dxvk {
return E_INVALIDARG; return E_INVALIDARG;
} }
if (ppRTView == nullptr) if (!ppRTView)
return S_FALSE; return S_FALSE;
try { try {
@ -920,10 +1065,11 @@ namespace dxvk {
if (FAILED(D3D11RasterizerState::NormalizeDesc(&desc))) if (FAILED(D3D11RasterizerState::NormalizeDesc(&desc)))
return E_INVALIDARG; return E_INVALIDARG;
if (ppRasterizerState != nullptr) { if (!ppRasterizerState)
*ppRasterizerState = m_rsStateObjects.Create(this, desc); return S_FALSE;
return S_OK;
} return S_FALSE; *ppRasterizerState = m_rsStateObjects.Create(this, desc);
return S_OK;
} }
@ -939,10 +1085,31 @@ namespace dxvk {
if (FAILED(D3D11RasterizerState::NormalizeDesc(&desc))) if (FAILED(D3D11RasterizerState::NormalizeDesc(&desc)))
return E_INVALIDARG; return E_INVALIDARG;
if (ppRasterizerState != nullptr) { if (!ppRasterizerState)
*ppRasterizerState = m_rsStateObjects.Create(this, desc); return S_FALSE;
return S_OK;
} return S_FALSE; *ppRasterizerState = m_rsStateObjects.Create(this, desc);
return S_OK;
}
HRESULT D3D11Device::CreateRasterizerState2(
const D3D11_RASTERIZER_DESC2* pRasterizerDesc,
ID3D11RasterizerState2** ppRasterizerState) {
InitReturnPtr(ppRasterizerState);
D3D11_RASTERIZER_DESC2 desc = pRasterizerDesc
? *pRasterizerDesc
: D3D11RasterizerState::DefaultDesc();
if (FAILED(D3D11RasterizerState::NormalizeDesc(&desc)))
return E_INVALIDARG;
if (!ppRasterizerState)
return S_FALSE;
*ppRasterizerState = m_rsStateObjects.Create(this, desc);
return S_OK;
} }
@ -984,19 +1151,43 @@ namespace dxvk {
desc.Query = pQueryDesc->Query; desc.Query = pQueryDesc->Query;
desc.MiscFlags = pQueryDesc->MiscFlags; desc.MiscFlags = pQueryDesc->MiscFlags;
desc.ContextType = D3D11_CONTEXT_TYPE_ALL; desc.ContextType = D3D11_CONTEXT_TYPE_ALL;
ID3D11Query1* query = nullptr;
HRESULT hr = CreateQuery1(&desc, ppQuery ? &query : nullptr);
if (hr != S_OK)
return hr;
*ppQuery = query;
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D11Device::CreateQuery1(
const D3D11_QUERY_DESC1* pQueryDesc,
ID3D11Query1** ppQuery) {
InitReturnPtr(ppQuery);
if (!pQueryDesc)
return E_INVALIDARG;
HRESULT hr = D3D11Query::ValidateDesc(pQueryDesc);
if (FAILED(hr))
return hr;
if (!ppQuery) if (!ppQuery)
return S_FALSE; return S_FALSE;
try { try {
*ppQuery = ref(new D3D11Query(this, desc)); *ppQuery = ref(new D3D11Query(this, *pQueryDesc));
return S_OK; return S_OK;
} catch (const DxvkError& e) { } catch (const DxvkError& e) {
Logger::err(e.message()); Logger::err(e.message());
return E_INVALIDARG; return E_INVALIDARG;
} }
} }
HRESULT STDMETHODCALLTYPE D3D11Device::CreatePredicate( HRESULT STDMETHODCALLTYPE D3D11Device::CreatePredicate(
const D3D11_QUERY_DESC* pPredicateDesc, const D3D11_QUERY_DESC* pPredicateDesc,
@ -1047,6 +1238,7 @@ namespace dxvk {
return S_OK; return S_OK;
} }
HRESULT STDMETHODCALLTYPE D3D11Device::CreateDeferredContext1( HRESULT STDMETHODCALLTYPE D3D11Device::CreateDeferredContext1(
UINT ContextFlags, UINT ContextFlags,
ID3D11DeviceContext1** ppDeferredContext) { ID3D11DeviceContext1** ppDeferredContext) {
@ -1054,6 +1246,7 @@ namespace dxvk {
return S_OK; return S_OK;
} }
HRESULT STDMETHODCALLTYPE D3D11Device::CreateDeferredContext2( HRESULT STDMETHODCALLTYPE D3D11Device::CreateDeferredContext2(
UINT ContextFlags, UINT ContextFlags,
ID3D11DeviceContext2** ppDeferredContext) { ID3D11DeviceContext2** ppDeferredContext) {
@ -1061,6 +1254,15 @@ namespace dxvk {
return S_OK; return S_OK;
} }
HRESULT STDMETHODCALLTYPE D3D11Device::CreateDeferredContext3(
UINT ContextFlags,
ID3D11DeviceContext3** ppDeferredContext) {
*ppDeferredContext = ref(new D3D11DeferredContext(this, m_dxvkDevice, ContextFlags));
return S_OK;
}
HRESULT STDMETHODCALLTYPE D3D11Device::CreateDeviceContextState( HRESULT STDMETHODCALLTYPE D3D11Device::CreateDeviceContextState(
UINT Flags, UINT Flags,
const D3D_FEATURE_LEVEL* pFeatureLevels, const D3D_FEATURE_LEVEL* pFeatureLevels,
@ -1102,6 +1304,35 @@ namespace dxvk {
return S_OK; return S_OK;
} }
void STDMETHODCALLTYPE D3D11Device::ReadFromSubresource(
void* pDstData,
UINT DstRowPitch,
UINT DstDepthPitch,
ID3D11Resource* pSrcResource,
UINT SrcSubresource,
const D3D11_BOX* pSrcBox) {
static bool s_errorShown = false;
if (!std::exchange(s_errorShown, true))
Logger::err("D3D11Device::ReadFromSubresource: Not implemented");
}
void STDMETHODCALLTYPE D3D11Device::WriteToSubresource(
ID3D11Resource* pDstResource,
UINT DstSubresource,
const D3D11_BOX* pDstBox,
const void* pSrcData,
UINT SrcRowPitch,
UINT SrcDepthPitch) {
static bool s_errorShown = false;
if (!std::exchange(s_errorShown, true))
Logger::err("D3D11Device::WriteToSubresource: Not implemented");
}
HRESULT STDMETHODCALLTYPE D3D11Device::OpenSharedResource( HRESULT STDMETHODCALLTYPE D3D11Device::OpenSharedResource(
HANDLE hResource, HANDLE hResource,
REFIID ReturnedInterface, REFIID ReturnedInterface,
@ -1456,6 +1687,11 @@ namespace dxvk {
} }
void STDMETHODCALLTYPE D3D11Device::GetImmediateContext3(ID3D11DeviceContext3** ppImmediateContext) {
*ppImmediateContext = ref(m_context);
}
HRESULT STDMETHODCALLTYPE D3D11Device::SetExceptionMode(UINT RaiseFlags) { HRESULT STDMETHODCALLTYPE D3D11Device::SetExceptionMode(UINT RaiseFlags) {
Logger::err("D3D11Device::SetExceptionMode: Not implemented"); Logger::err("D3D11Device::SetExceptionMode: Not implemented");
return E_NOTIMPL; return E_NOTIMPL;
@ -2091,7 +2327,8 @@ namespace dxvk {
if (riid == __uuidof(ID3D11Device) if (riid == __uuidof(ID3D11Device)
|| riid == __uuidof(ID3D11Device1) || riid == __uuidof(ID3D11Device1)
|| riid == __uuidof(ID3D11Device2)) { || riid == __uuidof(ID3D11Device2)
|| riid == __uuidof(ID3D11Device3)) {
*ppvObject = ref(&m_d3d11Device); *ppvObject = ref(&m_d3d11Device);
return S_OK; return S_OK;
} }

View File

@ -45,7 +45,7 @@ namespace dxvk {
* Implements the ID3D11Device interfaces * Implements the ID3D11Device interfaces
* as part of a \ref D3D11DeviceContainer. * as part of a \ref D3D11DeviceContainer.
*/ */
class D3D11Device final : public ID3D11Device2 { class D3D11Device final : public ID3D11Device3 {
/// Maximum number of resource init commands per command buffer /// Maximum number of resource init commands per command buffer
constexpr static uint64_t InitCommandThreshold = 50; constexpr static uint64_t InitCommandThreshold = 50;
public: public:
@ -80,26 +80,51 @@ namespace dxvk {
const D3D11_SUBRESOURCE_DATA* pInitialData, const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture2D** ppTexture2D); ID3D11Texture2D** ppTexture2D);
HRESULT STDMETHODCALLTYPE CreateTexture2D1(
const D3D11_TEXTURE2D_DESC1* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture2D1** ppTexture2D);
HRESULT STDMETHODCALLTYPE CreateTexture3D( HRESULT STDMETHODCALLTYPE CreateTexture3D(
const D3D11_TEXTURE3D_DESC* pDesc, const D3D11_TEXTURE3D_DESC* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData, const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture3D** ppTexture3D); ID3D11Texture3D** ppTexture3D);
HRESULT STDMETHODCALLTYPE CreateTexture3D1(
const D3D11_TEXTURE3D_DESC1* pDesc,
const D3D11_SUBRESOURCE_DATA* pInitialData,
ID3D11Texture3D1** ppTexture3D);
HRESULT STDMETHODCALLTYPE CreateShaderResourceView( HRESULT STDMETHODCALLTYPE CreateShaderResourceView(
ID3D11Resource* pResource, ID3D11Resource* pResource,
const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc, const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc,
ID3D11ShaderResourceView** ppSRView); ID3D11ShaderResourceView** ppSRView);
HRESULT STDMETHODCALLTYPE CreateShaderResourceView1(
ID3D11Resource* pResource,
const D3D11_SHADER_RESOURCE_VIEW_DESC1* pDesc,
ID3D11ShaderResourceView1** ppSRView);
HRESULT STDMETHODCALLTYPE CreateUnorderedAccessView( HRESULT STDMETHODCALLTYPE CreateUnorderedAccessView(
ID3D11Resource* pResource, ID3D11Resource* pResource,
const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc, const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc,
ID3D11UnorderedAccessView** ppUAView); ID3D11UnorderedAccessView** ppUAView);
HRESULT STDMETHODCALLTYPE CreateUnorderedAccessView1(
ID3D11Resource* pResource,
const D3D11_UNORDERED_ACCESS_VIEW_DESC1* pDesc,
ID3D11UnorderedAccessView1** ppUAView);
HRESULT STDMETHODCALLTYPE CreateRenderTargetView( HRESULT STDMETHODCALLTYPE CreateRenderTargetView(
ID3D11Resource* pResource, ID3D11Resource* pResource,
const D3D11_RENDER_TARGET_VIEW_DESC* pDesc, const D3D11_RENDER_TARGET_VIEW_DESC* pDesc,
ID3D11RenderTargetView** ppRTView); ID3D11RenderTargetView** ppRTView);
HRESULT STDMETHODCALLTYPE CreateRenderTargetView1(
ID3D11Resource* pResource,
const D3D11_RENDER_TARGET_VIEW_DESC1* pDesc,
ID3D11RenderTargetView1** ppRTView);
HRESULT STDMETHODCALLTYPE CreateDepthStencilView( HRESULT STDMETHODCALLTYPE CreateDepthStencilView(
ID3D11Resource* pResource, ID3D11Resource* pResource,
const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc, const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc,
@ -182,6 +207,10 @@ namespace dxvk {
const D3D11_RASTERIZER_DESC1* pRasterizerDesc, const D3D11_RASTERIZER_DESC1* pRasterizerDesc,
ID3D11RasterizerState1** ppRasterizerState); ID3D11RasterizerState1** ppRasterizerState);
HRESULT STDMETHODCALLTYPE CreateRasterizerState2(
const D3D11_RASTERIZER_DESC2* pRasterizerDesc,
ID3D11RasterizerState2** ppRasterizerState);
HRESULT STDMETHODCALLTYPE CreateSamplerState( HRESULT STDMETHODCALLTYPE CreateSamplerState(
const D3D11_SAMPLER_DESC* pSamplerDesc, const D3D11_SAMPLER_DESC* pSamplerDesc,
ID3D11SamplerState** ppSamplerState); ID3D11SamplerState** ppSamplerState);
@ -190,6 +219,10 @@ namespace dxvk {
const D3D11_QUERY_DESC* pQueryDesc, const D3D11_QUERY_DESC* pQueryDesc,
ID3D11Query** ppQuery); ID3D11Query** ppQuery);
HRESULT STDMETHODCALLTYPE CreateQuery1(
const D3D11_QUERY_DESC1* pQueryDesc,
ID3D11Query1** ppQuery);
HRESULT STDMETHODCALLTYPE CreatePredicate( HRESULT STDMETHODCALLTYPE CreatePredicate(
const D3D11_QUERY_DESC* pPredicateDesc, const D3D11_QUERY_DESC* pPredicateDesc,
ID3D11Predicate** ppPredicate); ID3D11Predicate** ppPredicate);
@ -210,6 +243,10 @@ namespace dxvk {
UINT ContextFlags, UINT ContextFlags,
ID3D11DeviceContext2** ppDeferredContext); ID3D11DeviceContext2** ppDeferredContext);
HRESULT STDMETHODCALLTYPE CreateDeferredContext3(
UINT ContextFlags,
ID3D11DeviceContext3** ppDeferredContext);
HRESULT STDMETHODCALLTYPE CreateDeviceContextState( HRESULT STDMETHODCALLTYPE CreateDeviceContextState(
UINT Flags, UINT Flags,
const D3D_FEATURE_LEVEL* pFeatureLevels, const D3D_FEATURE_LEVEL* pFeatureLevels,
@ -218,7 +255,23 @@ namespace dxvk {
REFIID EmulatedInterface, REFIID EmulatedInterface,
D3D_FEATURE_LEVEL* pChosenFeatureLevel, D3D_FEATURE_LEVEL* pChosenFeatureLevel,
ID3DDeviceContextState** ppContextState); ID3DDeviceContextState** ppContextState);
void STDMETHODCALLTYPE ReadFromSubresource(
void* pDstData,
UINT DstRowPitch,
UINT DstDepthPitch,
ID3D11Resource* pSrcResource,
UINT SrcSubresource,
const D3D11_BOX* pSrcBox);
void STDMETHODCALLTYPE WriteToSubresource(
ID3D11Resource* pDstResource,
UINT DstSubresource,
const D3D11_BOX* pDstBox,
const void* pSrcData,
UINT SrcRowPitch,
UINT SrcDepthPitch);
HRESULT STDMETHODCALLTYPE OpenSharedResource( HRESULT STDMETHODCALLTYPE OpenSharedResource(
HANDLE hResource, HANDLE hResource,
REFIID ReturnedInterface, REFIID ReturnedInterface,
@ -298,6 +351,9 @@ namespace dxvk {
void STDMETHODCALLTYPE GetImmediateContext2( void STDMETHODCALLTYPE GetImmediateContext2(
ID3D11DeviceContext2** ppImmediateContext); ID3D11DeviceContext2** ppImmediateContext);
void STDMETHODCALLTYPE GetImmediateContext3(
ID3D11DeviceContext3** ppImmediateContext);
HRESULT STDMETHODCALLTYPE SetExceptionMode(UINT RaiseFlags); HRESULT STDMETHODCALLTYPE SetExceptionMode(UINT RaiseFlags);
UINT STDMETHODCALLTYPE GetExceptionMode(); UINT STDMETHODCALLTYPE GetExceptionMode();

View File

@ -347,5 +347,14 @@ namespace dxvk {
VkPhysicalDeviceLimits limits = adapter->deviceProperties().limits; VkPhysicalDeviceLimits limits = adapter->deviceProperties().limits;
return uint64_t(1'000'000'000.0f / limits.timestampPeriod); return uint64_t(1'000'000'000.0f / limits.timestampPeriod);
} }
HRESULT D3D11Query::ValidateDesc(const D3D11_QUERY_DESC1* pDesc) {
if (pDesc->Query >= D3D11_QUERY_PIPELINE_STATISTICS
&& pDesc->ContextType > D3D11_CONTEXT_TYPE_3D)
return E_INVALIDARG;
return S_OK;
}
} }

View File

@ -70,6 +70,8 @@ namespace dxvk {
return &m_d3d10; return &m_d3d10;
} }
static HRESULT ValidateDesc(const D3D11_QUERY_DESC1* pDesc);
static ID3D11Predicate* AsPredicate(ID3D11Query* pQuery) { static ID3D11Predicate* AsPredicate(ID3D11Query* pQuery) {
return static_cast<ID3D11Predicate*>(pQuery); return static_cast<ID3D11Predicate*>(pQuery);
} }