Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,194 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description: Definition of the reference counted base class for all
// DXGL interface implementations
#include "RenderDll_precompiled.h"
#include "CCryDXMETALBase.hpp"
#include "../Implementation/GLCommon.hpp"
CCryDXGLBase::CCryDXGLBase()
: m_uRefCount(1)
{
DXGL_INITIALIZE_INTERFACE(Unknown);
}
CCryDXGLBase::~CCryDXGLBase()
{
}
////////////////////////////////////////////////////////////////////////////////
// Implementation of IUnknown
////////////////////////////////////////////////////////////////////////////////
#if DXGL_FULL_EMULATION
SAggregateNode& CCryDXGLBase::GetAggregateHead()
{
return m_kAggregateHead;
}
#else
HRESULT CCryDXGLBase::QueryInterface(REFIID riid, void** ppvObject)
{
return E_NOINTERFACE;
}
#endif
ULONG CCryDXGLBase::AddRef(void)
{
return ++m_uRefCount;
}
ULONG CCryDXGLBase::Release(void)
{
--m_uRefCount;
if (m_uRefCount == 0)
{
delete this;
return 0;
}
return m_uRefCount;
}
////////////////////////////////////////////////////////////////////////////////
// CCryDXGLPrivateDataContainer
////////////////////////////////////////////////////////////////////////////////
struct CCryDXGLPrivateDataContainer::SPrivateData
{
union
{
uint8* m_pBuffer;
IUnknown* m_pInterface;
};
uint32 m_uSize;
bool m_bInterface;
SPrivateData(const void* pData, uint32 uSize)
{
m_pBuffer = new uint8[uSize];
m_uSize = uSize;
m_bInterface = false;
memcpy(m_pBuffer, pData, uSize);
}
SPrivateData(IUnknown* pInterface)
{
pInterface->AddRef();
m_pInterface = pInterface;
m_uSize = sizeof(IUnknown*);
m_bInterface = true;
}
~SPrivateData()
{
if (m_bInterface)
{
m_pInterface->Release();
}
else
{
delete [] m_pBuffer;
}
}
};
CCryDXGLPrivateDataContainer::CCryDXGLPrivateDataContainer()
{
}
CCryDXGLPrivateDataContainer::~CCryDXGLPrivateDataContainer()
{
TPrivateDataMap::iterator kPrivateIter(m_kPrivateDataMap.begin());
TPrivateDataMap::iterator kPrivateEnd(m_kPrivateDataMap.end());
for (; kPrivateIter != kPrivateEnd; ++kPrivateIter)
{
delete kPrivateIter->second;
}
}
HRESULT CCryDXGLPrivateDataContainer::GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData)
{
if (pData == NULL)
{
if (*pDataSize != 0)
{
return E_FAIL;
}
RemovePrivateData(guid);
}
else
{
CRY_ASSERT(pDataSize != NULL);
TPrivateDataMap::const_iterator kFound(m_kPrivateDataMap.find(guid));
if (kFound == m_kPrivateDataMap.end() || *pDataSize < kFound->second->m_uSize)
{
return E_FAIL;
}
if (kFound->second->m_bInterface)
{
kFound->second->m_pInterface->AddRef();
*static_cast<IUnknown**>(pData) = kFound->second->m_pInterface;
}
else
{
memcpy(pData, kFound->second->m_pBuffer, kFound->second->m_uSize);
}
*pDataSize = kFound->second->m_uSize;
}
return S_OK;
}
HRESULT CCryDXGLPrivateDataContainer::SetPrivateData(REFGUID guid, UINT DataSize, const void* pData)
{
RemovePrivateData(guid);
m_kPrivateDataMap.insert(TPrivateDataMap::value_type(guid, new SPrivateData(pData, DataSize)));
return S_OK;
}
HRESULT CCryDXGLPrivateDataContainer::SetPrivateDataInterface(REFGUID guid, const IUnknown* pData)
{
RemovePrivateData(guid);
m_kPrivateDataMap.insert(TPrivateDataMap::value_type(guid, new SPrivateData(const_cast<IUnknown*>(pData)))); // The specification requires that IUnknown::AddRef, Release are called on pData thus the const cast
return S_OK;
}
void CCryDXGLPrivateDataContainer::RemovePrivateData(REFGUID guid)
{
TPrivateDataMap::iterator kFound(m_kPrivateDataMap.find(guid));
if (kFound != m_kPrivateDataMap.end())
{
delete kFound->second;
m_kPrivateDataMap.erase(kFound);
}
}
size_t CCryDXGLPrivateDataContainer::SGuidHashCompare::operator()(const GUID& kGuid) const
{
return (size_t)NCryMetal::GetCRC32(reinterpret_cast<const char*>(&kGuid), sizeof(kGuid), 0xFFFFFFFF);
}
bool CCryDXGLPrivateDataContainer::SGuidHashCompare::operator()(const GUID& kLeft, const GUID& kRight) const
{
return memcmp(&kLeft, &kRight, sizeof(kLeft)) == 0;
}
@@ -0,0 +1,95 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the reference counted base class for all
// DXGL interface implementations
#ifndef __CRYMETALGLBASE__
#define __CRYMETALGLBASE__
#include "../Definitions/CryDXMETALGuid.hpp"
#include "../Definitions/ICryDXMETALUnknown.hpp"
template <typename Interface>
struct SingleInterface
{
template <typename Object>
static bool Query(Object* pThis, REFIID riid, void** ppvObject)
{
if (riid == __uuidof(Interface))
{
*reinterpret_cast<Interface**>(ppvObject) = static_cast<Interface*>(pThis);
static_cast<Interface*>(pThis)->AddRef();
return true;
}
return false;
}
};
#include "DXEmulation.hpp"
////////////////////////////////////////////////////////////////////////////
// Definition of basic types
////////////////////////////////////////////////////////////////////////////
class CCryDXGLBase
#if !DXGL_FULL_EMULATION
: public IUnknown
#endif //!DXGL_FULL_EMULATION
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLBase, Unknown)
CCryDXGLBase();
virtual ~CCryDXGLBase();
#if DXGL_FULL_EMULATION
SAggregateNode& GetAggregateHead();
#else
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
#endif //!DXGL_FULL_EMULATION
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
protected:
uint32 m_uRefCount;
#if DXGL_FULL_EMULATION
SAggregateNode m_kAggregateHead;
#endif //DXGL_FULL_EMULATION
};
class CCryDXGLPrivateDataContainer
{
public:
CCryDXGLPrivateDataContainer();
~CCryDXGLPrivateDataContainer();
HRESULT GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData);
HRESULT SetPrivateData(REFGUID guid, UINT DataSize, const void* pData);
HRESULT SetPrivateDataInterface(REFGUID guid, const IUnknown* pData);
protected:
void RemovePrivateData(REFGUID guid);
protected:
struct SPrivateData;
struct SGuidHashCompare
{
size_t operator()(const GUID& kGuid) const;
bool operator()(const GUID& kLeft, const GUID& kRight) const;
};
typedef AZStd::unordered_map<GUID, SPrivateData*, SGuidHashCompare, SGuidHashCompare> TPrivateDataMap;
TPrivateDataMap m_kPrivateDataMap;
};
#endif //__CRYMETALGLBASE__
@@ -0,0 +1,54 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11BlendState
#include "RenderDll_precompiled.h"
#include "CCryDXMETALBlendState.hpp"
#include "CCryDXMETALDevice.hpp"
#include "../Implementation/GLState.hpp"
#include "../Implementation/MetalDevice.hpp"
CCryDXGLBlendState::CCryDXGLBlendState(const D3D11_BLEND_DESC& kDesc, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_kDesc(kDesc)
, m_pGLState(new NCryMetal::SBlendState)
{
DXGL_INITIALIZE_INTERFACE(D3D11BlendState)
}
CCryDXGLBlendState::~CCryDXGLBlendState()
{
delete m_pGLState;
}
bool CCryDXGLBlendState::Initialize(CCryDXGLDevice* pDevice)
{
return NCryMetal::InitializeBlendState(m_kDesc, *m_pGLState, pDevice->GetGLDevice());
}
bool CCryDXGLBlendState::Apply(NCryMetal::CContext* pContext)
{
return pContext->SetBlendState(*m_pGLState);
}
////////////////////////////////////////////////////////////////////////////////
// Implementation of ID3D11BlendState
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLBlendState::GetDesc(D3D11_BLEND_DESC* pDesc)
{
(*pDesc) = m_kDesc;
}
@@ -0,0 +1,48 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11BlendState
#ifndef __CRYMETALGLBLENDSTATE__
#define __CRYMETALGLBLENDSTATE__
#include "CCryDXMETALDeviceChild.hpp"
namespace NCryMetal
{
struct SBlendState;
class CContext;
}
class CCryDXGLBlendState
: public CCryDXGLDeviceChild
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLBlendState, D3D11BlendState)
CCryDXGLBlendState(const D3D11_BLEND_DESC& kDesc, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLBlendState();
bool Initialize(CCryDXGLDevice* pDevice);
bool Apply(NCryMetal::CContext* pContext);
// Implementation of ID3D11BlendState
void GetDesc(D3D11_BLEND_DESC* pDesc);
protected:
D3D11_BLEND_DESC m_kDesc;
NCryMetal::SBlendState* m_pGLState;
};
#endif //__CRYMETALGLBLENDSTATE__
@@ -0,0 +1,78 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D10Blob
#include "RenderDll_precompiled.h"
#include "CCryDXMETALBlob.hpp"
CCryDXGLBlob::CCryDXGLBlob(size_t uBufferSize)
: m_uBufferSize(uBufferSize)
#if defined(DXGL_BLOB_INTEROPERABILITY)
, m_uRefCount(1)
#endif //defined(DXGL_BLOB_INTEROPERABILITY)
{
DXGL_INITIALIZE_INTERFACE(D3D10Blob)
m_pBuffer = new uint8[m_uBufferSize];
}
CCryDXGLBlob::~CCryDXGLBlob()
{
delete [] m_pBuffer;
}
#if defined(DXGL_BLOB_INTEROPERABILITY)
////////////////////////////////////////////////////////////////////////////////
// IUnknown implementation
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLBlob::QueryInterface(REFIID riid, void** ppvObject)
{
return E_NOINTERFACE;
}
ULONG CCryDXGLBlob::AddRef(void)
{
return ++m_uRefCount;
}
ULONG CCryDXGLBlob::Release(void)
{
--m_uRefCount;
if (m_uRefCount == 0)
{
delete this;
return 0;
}
return m_uRefCount;
}
#endif //defined(DXGL_BLOB_INTEROPERABILITY)
////////////////////////////////////////////////////////////////////////////////
// ID3D10Blob implementation
////////////////////////////////////////////////////////////////////////////////
LPVOID CCryDXGLBlob::GetBufferPointer()
{
return m_pBuffer;
}
SIZE_T CCryDXGLBlob::GetBufferSize()
{
return m_uBufferSize;
}
@@ -0,0 +1,57 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D10Blob
#ifndef __CRYMETALGLBLOB__
#define __CRYMETALGLBLOB__
#include "CCryDXMETALBase.hpp"
#if defined(DXGL_BLOB_INTEROPERABILITY) && !DXGL_FULL_EMULATION
class CCryDXGLBlob
: public ID3D10Blob
#else
class CCryDXGLBlob
: public CCryDXGLBase
#endif
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLBlob, D3D10Blob)
CCryDXGLBlob(size_t uBufferSize);
virtual ~CCryDXGLBlob();
#if defined(DXGL_BLOB_INTEROPERABILITY)
//IUnknown implementation
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
#endif //defined(DXGL_BLOB_INTEROPERABILITY)
// ID3D10Blob implementation
LPVOID STDMETHODCALLTYPE GetBufferPointer();
SIZE_T STDMETHODCALLTYPE GetBufferSize();
protected:
#if defined(DXGL_BLOB_INTEROPERABILITY)
uint32 m_uRefCount;
#endif //defined(DXGL_BLOB_INTEROPERABILITY)
uint8 * m_pBuffer;
size_t m_uBufferSize;
};
#endif //__CRYMETALGLBLOB__
@@ -0,0 +1,46 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11Buffer
#include "RenderDll_precompiled.h"
#include "CCryDXMETALBuffer.hpp"
#include "CCryDXMETALDeviceContext.hpp"
#include "../Implementation/GLResource.hpp"
CCryDXGLBuffer::CCryDXGLBuffer(const D3D11_BUFFER_DESC& kDesc, NCryMetal::SBuffer* pGLBuffer, CCryDXGLDevice* pDevice)
: CCryDXGLResource(D3D11_RESOURCE_DIMENSION_BUFFER, pGLBuffer, pDevice)
, m_kDesc(kDesc)
{
DXGL_INITIALIZE_INTERFACE(D3D11Buffer)
}
CCryDXGLBuffer::~CCryDXGLBuffer()
{
}
NCryMetal::SBuffer* CCryDXGLBuffer::GetGLBuffer()
{
return static_cast<NCryMetal::SBuffer*>(m_spGLResource.get());
}
////////////////////////////////////////////////////////////////////////////////
// ID3D11Buffer implementation
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLBuffer::GetDesc(D3D11_BUFFER_DESC* pDesc)
{
(*pDesc) = m_kDesc;
}
@@ -0,0 +1,44 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11Buffer
#ifndef __CRYMETALGLBUFFER__
#define __CRYMETALGLBUFFER__
#include "CCryDXMETALResource.hpp"
namespace NCryMetal
{
struct SBuffer;
}
class CCryDXGLBuffer
: public CCryDXGLResource
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLBuffer, D3D11Buffer)
CCryDXGLBuffer(const D3D11_BUFFER_DESC& kDesc, NCryMetal::SBuffer* pGLBuffer, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLBuffer();
// ID3D11Buffer implementation
void GetDesc(D3D11_BUFFER_DESC* pDesc);
NCryMetal::SBuffer* GetGLBuffer();
private:
D3D11_BUFFER_DESC m_kDesc;
};
#endif //__CRYMETALGLBUFFER__
@@ -0,0 +1,65 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11DepthStencilState
#include "RenderDll_precompiled.h"
#include "CCryDXMETALDepthStencilState.hpp"
#include "CCryDXMETALDevice.hpp"
#include "../Implementation/GLState.hpp"
#include "../Implementation/MetalDevice.hpp"
CCryDXGLDepthStencilState::CCryDXGLDepthStencilState(const D3D11_DEPTH_STENCIL_DESC& kDesc, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_kDesc(kDesc)
// Confetti BEGIN: Igor Lobanchikov
, m_MetalDepthStencilState(0)
// Confetti End: Igor Lobanchikov
{
DXGL_INITIALIZE_INTERFACE(D3D11DepthStencilState)
}
CCryDXGLDepthStencilState::~CCryDXGLDepthStencilState()
{
// Confetti BEGIN: Igor Lobanchikov
if (m_MetalDepthStencilState)
{
[m_MetalDepthStencilState release];
}
// Confetti End: Igor Lobanchikov
}
bool CCryDXGLDepthStencilState::Initialize(CCryDXGLDevice* pDevice)
{
// Confetti BEGIN: Igor Lobanchikov
return NCryMetal::InitializeDepthStencilState(m_kDesc, m_MetalDepthStencilState, pDevice->GetGLDevice());
// Confetti End: Igor Lobanchikov
}
bool CCryDXGLDepthStencilState::Apply(uint32 uStencilReference, NCryMetal::CContext* pContext)
{
// Confetti BEGIN: Igor Lobanchikov
return pContext->SetDepthStencilState(m_MetalDepthStencilState, uStencilReference);
// Confetti End: Igor Lobanchikov
}
////////////////////////////////////////////////////////////////////////////////
// Implementation of ID3D11DepthStencilState
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLDepthStencilState::GetDesc(D3D11_DEPTH_STENCIL_DESC* pDesc)
{
(*pDesc) = m_kDesc;
}
@@ -0,0 +1,50 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description: Declaration of the DXGL wrapper for ID3D11DepthStencilState
#ifndef __CRYMETALGLDEPTHSTENCILSTATE__
#define __CRYMETALGLDEPTHSTENCILSTATE__
#include "CCryDXMETALDeviceChild.hpp"
@protocol MTLDepthStencilState;
namespace NCryMetal
{
class CContext;
}
class CCryDXGLDepthStencilState
: public CCryDXGLDeviceChild
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLDepthStencilState, D3D11DepthStencilState)
CCryDXGLDepthStencilState(const D3D11_DEPTH_STENCIL_DESC& kDesc, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLDepthStencilState();
bool Initialize(CCryDXGLDevice* pDevice);
bool Apply(uint32 uStencilReference, NCryMetal::CContext* pContext);
// Implementation of ID3D11DepthStencilState
void GetDesc(D3D11_DEPTH_STENCIL_DESC* pDesc);
protected:
D3D11_DEPTH_STENCIL_DESC m_kDesc;
id<MTLDepthStencilState> m_MetalDepthStencilState;
};
#endif //__CRYMETALGLDEPTHSTENCILSTATE__
@@ -0,0 +1,56 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11DepthStencilView
#include "RenderDll_precompiled.h"
#include "CCryDXMETALDepthStencilView.hpp"
#include "CCryDXMETALDevice.hpp"
#include "CCryDXMETALResource.hpp"
#include "../Implementation/MetalDevice.hpp"
#include "../Implementation/GLResource.hpp"
CCryDXGLDepthStencilView::CCryDXGLDepthStencilView(CCryDXGLResource* pResource, const D3D11_DEPTH_STENCIL_VIEW_DESC& kDesc, CCryDXGLDevice* pDevice)
: CCryDXGLView(pResource, pDevice)
, m_kDesc(kDesc)
{
DXGL_INITIALIZE_INTERFACE(D3D11DepthStencilView)
}
CCryDXGLDepthStencilView::~CCryDXGLDepthStencilView()
{
}
bool CCryDXGLDepthStencilView::Initialize(NCryMetal::CDevice* pDevice)
{
D3D11_RESOURCE_DIMENSION eDimension;
m_spResource->GetType(&eDimension);
m_spGLView = NCryMetal::CreateDepthStencilView(m_spResource->GetGLResource(), eDimension, m_kDesc, pDevice);
return m_spGLView != NULL;
}
NCryMetal::SOutputMergerView* CCryDXGLDepthStencilView::GetGLView()
{
return m_spGLView;
}
////////////////////////////////////////////////////////////////
// Implementation of ID3D11DepthStencilView
////////////////////////////////////////////////////////////////
void CCryDXGLDepthStencilView::GetDesc(D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc)
{
*pDesc = m_kDesc;
}
@@ -0,0 +1,47 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11DepthStencilView
#ifndef __CRYMETALGLDEPTHSTENCILVIEW__
#define __CRYMETALGLDEPTHSTENCILVIEW__
#include "CCryDXMETALView.hpp"
namespace NCryMetal
{
struct SOutputMergerView;
class CContext;
}
class CCryDXGLDepthStencilView
: public CCryDXGLView
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLDepthStencilView, D3D11DepthStencilView)
CCryDXGLDepthStencilView(CCryDXGLResource* pResource, const D3D11_DEPTH_STENCIL_VIEW_DESC& kDesc, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLDepthStencilView();
bool Initialize(NCryMetal::CDevice* pDevice);
NCryMetal::SOutputMergerView* GetGLView();
// Implementation of ID3D11DepthStencilView
void GetDesc(D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc);
protected:
D3D11_DEPTH_STENCIL_VIEW_DESC m_kDesc;
_smart_ptr<NCryMetal::SOutputMergerView> m_spGLView;
};
#endif //__CRYMETALGLDEPTHSTENCILVIEW__
@@ -0,0 +1,909 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11Device
#include "RenderDll_precompiled.h"
#include "CCryDXMETALBlendState.hpp"
#include "CCryDXMETALBuffer.hpp"
#include "CCryDXMETALDepthStencilState.hpp"
#include "CCryDXMETALDepthStencilView.hpp"
#include "CCryDXMETALDevice.hpp"
#include "CCryDXMETALDeviceContext.hpp"
#include "CCryDXMETALDevice.hpp"
#include "CCryDXMETALInputLayout.hpp"
#include "CCryDXMETALQuery.hpp"
#include "CCryDXMETALRasterizerState.hpp"
#include "CCryDXMETALRenderTargetView.hpp"
#include "CCryDXMETALSamplerState.hpp"
#include "CCryDXMETALSwapChain.hpp"
#include "CCryDXMETALShader.hpp"
#include "CCryDXMETALShaderResourceView.hpp"
#include "CCryDXMETALTexture1D.hpp"
#include "CCryDXMETALTexture2D.hpp"
#include "CCryDXMETALTexture3D.hpp"
#include "CCryDXMETALUnorderedAccessView.hpp"
#include "../Implementation/MetalDevice.hpp"
#include "../Implementation/GLFormat.hpp"
#include "../Implementation/GLResource.hpp"
#include "../Implementation/GLShader.hpp"
CCryDXGLDevice::CCryDXGLDevice(CCryDXGLGIAdapter* pAdapter, D3D_FEATURE_LEVEL eFeatureLevel)
: m_spAdapter(pAdapter)
, m_eFeatureLevel(eFeatureLevel)
{
DXGL_INITIALIZE_INTERFACE(DXGIDevice)
DXGL_INITIALIZE_INTERFACE(D3D11Device)
CCryDXGLDeviceContext * pImmediateContext(new CCryDXGLDeviceContext());
m_spImmediateContext = pImmediateContext;
pImmediateContext->Release();
}
CCryDXGLDevice::~CCryDXGLDevice()
{
m_spImmediateContext->Shutdown();
}
#if !DXGL_FULL_EMULATION
HRESULT CCryDXGLDevice::QueryInterface(REFIID riid, void** ppvObject)
{
if (SingleInterface<ID3D11Device>::Query(this, riid, ppvObject) ||
SingleInterface<CCryDXGLDevice>::Query(this, riid, ppvObject))
{
return S_OK;
}
#if DXGL_VIRTUAL_DEVICE_AND_CONTEXT
return E_NOINTERFACE;
#else
return CCryDXGLBase::QueryInterface(riid, ppvObject);
#endif
}
#endif //!DXGL_FULL_EMULATION
bool CCryDXGLDevice::Initialize(const DXGI_SWAP_CHAIN_DESC* pDesc, IDXGISwapChain** ppSwapChain)
{
if (!pDesc || !ppSwapChain || !m_spAdapter || !m_spAdapter->GetGLAdapter())
{
return false;
}
m_spGLDevice = new NCryMetal::CDevice();
if (!m_spGLDevice->Initialize(pDesc->OutputWindow))
{
return false;
}
CCryDXGLSwapChain* pDXGLSwapChain(new CCryDXGLSwapChain(this, *pDesc));
CCryDXGLSwapChain::ToInterface(ppSwapChain, pDXGLSwapChain);
if (!pDXGLSwapChain->Initialize())
{
return false;
}
return m_spImmediateContext->Initialize(this);
}
NCryMetal::CDevice* CCryDXGLDevice::GetGLDevice()
{
return m_spGLDevice;
}
////////////////////////////////////////////////////////////////////////////////
// IDXGIObject overrides
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLDevice::GetParent(REFIID riid, void** ppParent)
{
IUnknown* pAdapterInterface;
CCryDXGLBase::ToInterface(&pAdapterInterface, m_spAdapter);
if (pAdapterInterface->QueryInterface(riid, ppParent) == S_OK && ppParent != NULL)
{
return S_OK;
}
#if DXGL_VIRTUAL_DEVICE_AND_CONTEXT && !DXGL_FULL_EMULATION
return E_FAIL;
#else
return CCryDXGLGIObject::GetParent(riid, ppParent);
#endif
}
////////////////////////////////////////////////////////////////////////////////
// IDXGIDevice implementation
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLDevice::GetAdapter(IDXGIAdapter** pAdapter)
{
if (m_spAdapter == NULL)
{
return E_FAIL;
}
CCryDXGLGIAdapter::ToInterface(pAdapter, m_spAdapter);
return S_OK;
}
HRESULT CCryDXGLDevice::CreateSurface(const DXGI_SURFACE_DESC* pDesc, UINT NumSurfaces, DXGI_USAGE Usage, const DXGI_SHARED_RESOURCE* pSharedResource, IDXGISurface** ppSurface)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLDevice::QueryResourceResidency(IUnknown* const* ppResources, DXGI_RESIDENCY* pResidencyStatus, UINT NumResources)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLDevice::SetGPUThreadPriority(INT Priority)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLDevice::GetGPUThreadPriority(INT* pPriority)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
////////////////////////////////////////////////////////////////////////////////
// ID3D11Device implementation
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLDevice::CreateBuffer(const D3D11_BUFFER_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Buffer** ppBuffer)
{
if (ppBuffer == NULL)
{
// In this case the method should perform parameter validation and return the result
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
NCryMetal::SBufferPtr spGLBuffer(NCryMetal::CreateBuffer(*pDesc, pInitialData, m_spGLDevice));
if (spGLBuffer == NULL)
{
return E_FAIL;
}
CCryDXGLBuffer::ToInterface(ppBuffer, new CCryDXGLBuffer(*pDesc, spGLBuffer, this));
return S_OK;
}
HRESULT CCryDXGLDevice::CreateTexture1D(const D3D11_TEXTURE1D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Texture1D** ppTexture1D)
{
if (ppTexture1D == NULL)
{
// In this case the method should perform parameter validation and return the result
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
NCryMetal::STexturePtr spGLTexture(NCryMetal::CreateTexture1D(*pDesc, pInitialData, m_spGLDevice));
if (spGLTexture == NULL)
{
return E_FAIL;
}
CCryDXGLTexture1D::ToInterface(ppTexture1D, new CCryDXGLTexture1D(*pDesc, spGLTexture, this));
return S_OK;
}
HRESULT CCryDXGLDevice::CreateTexture2D(const D3D11_TEXTURE2D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Texture2D** ppTexture2D)
{
if (ppTexture2D == NULL)
{
// In this case the method should perform parameter validation and return the result
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
NCryMetal::STexturePtr spGLTexture(NCryMetal::CreateTexture2D(*pDesc, pInitialData, m_spGLDevice));
if (spGLTexture == NULL)
{
return E_FAIL;
}
CCryDXGLTexture2D::ToInterface(ppTexture2D, new CCryDXGLTexture2D(*pDesc, spGLTexture, this));
return S_OK;
}
HRESULT CCryDXGLDevice::CreateTexture3D(const D3D11_TEXTURE3D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Texture3D** ppTexture3D)
{
if (ppTexture3D == NULL)
{
// In this case the method should perform parameter validation and return the result
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
NCryMetal::STexturePtr spGLTexture(NCryMetal::CreateTexture3D(*pDesc, pInitialData, m_spGLDevice));
if (spGLTexture == NULL)
{
return E_FAIL;
}
CCryDXGLTexture3D::ToInterface(ppTexture3D, new CCryDXGLTexture3D(*pDesc, spGLTexture, this));
return S_OK;
}
bool GetStandardViewDesc(CCryDXGLTexture1D* pTexture, D3D11_SHADER_RESOURCE_VIEW_DESC& kStandardDesc)
{
D3D11_TEXTURE1D_DESC kTextureDesc;
pTexture->GetDesc(&kTextureDesc);
kStandardDesc.Format = kTextureDesc.Format;
if (kTextureDesc.ArraySize > 0)
{
kStandardDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE1DARRAY;
kStandardDesc.Texture1DArray.MostDetailedMip = 0;
kStandardDesc.Texture1DArray.MipLevels = -1;
kStandardDesc.Texture1DArray.FirstArraySlice = 0;
kStandardDesc.Texture1DArray.ArraySize = kTextureDesc.ArraySize;
}
else
{
kStandardDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE1D;
kStandardDesc.Texture1D.MostDetailedMip = 0;
kStandardDesc.Texture1DArray.MipLevels = -1;
}
pTexture->Release();
return true;
}
bool GetStandardViewDesc(CCryDXGLTexture2D* pTexture, D3D11_SHADER_RESOURCE_VIEW_DESC& kStandardDesc)
{
D3D11_TEXTURE2D_DESC kTextureDesc;
pTexture->GetDesc(&kTextureDesc);
kStandardDesc.Format = kTextureDesc.Format;
if (kTextureDesc.ArraySize > 1)
{
if (kTextureDesc.SampleDesc.Count > 1)
{
kStandardDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY;
kStandardDesc.Texture2DMSArray.FirstArraySlice = 0;
kStandardDesc.Texture2DMSArray.ArraySize = kTextureDesc.ArraySize;
}
else
{
kStandardDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
kStandardDesc.Texture2DArray.MostDetailedMip = 0;
kStandardDesc.Texture2DArray.MipLevels = -1;
kStandardDesc.Texture2DArray.FirstArraySlice = 0;
kStandardDesc.Texture2DArray.ArraySize = kTextureDesc.ArraySize;
}
}
else if (kTextureDesc.SampleDesc.Count > 1)
{
kStandardDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DMS;
}
else
{
kStandardDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
kStandardDesc.Texture2D.MostDetailedMip = 0;
kStandardDesc.Texture2D.MipLevels = -1;
}
pTexture->Release();
return true;
}
bool GetStandardViewDesc(CCryDXGLTexture3D* pTexture, D3D11_SHADER_RESOURCE_VIEW_DESC& kStandardDesc)
{
D3D11_TEXTURE3D_DESC kTextureDesc;
pTexture->GetDesc(&kTextureDesc);
kStandardDesc.Format = kTextureDesc.Format;
kStandardDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D;
kStandardDesc.Texture3D.MostDetailedMip = 0;
kStandardDesc.Texture3D.MipLevels = -1;
pTexture->Release();
return true;
}
bool GetStandardViewDesc(CCryDXGLBuffer* pBuffer, D3D11_SHADER_RESOURCE_VIEW_DESC& kStandardDesc)
{
D3D11_BUFFER_DESC kBufferDesc;
pBuffer->GetDesc(&kBufferDesc);
bool bSuccess((kBufferDesc.MiscFlags | D3D11_RESOURCE_MISC_BUFFER_STRUCTURED) != 0);
if (bSuccess)
{
kStandardDesc.Format = DXGI_FORMAT_UNKNOWN;
kStandardDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
kStandardDesc.Buffer.FirstElement = 0;
kStandardDesc.Buffer.NumElements = kBufferDesc.StructureByteStride;
}
else
{
DXGL_ERROR("Default shader resource view for a buffer requires element size specification");
}
pBuffer->Release();
return bSuccess;
}
bool GetStandardViewDesc(CCryDXGLTexture1D* pTexture, D3D11_RENDER_TARGET_VIEW_DESC& kStandardDesc)
{
D3D11_TEXTURE1D_DESC kTextureDesc;
pTexture->GetDesc(&kTextureDesc);
kStandardDesc.Format = kTextureDesc.Format;
if (kTextureDesc.ArraySize > 0)
{
kStandardDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE1DARRAY;
kStandardDesc.Texture1DArray.MipSlice = 0;
kStandardDesc.Texture1DArray.FirstArraySlice = 0;
kStandardDesc.Texture1DArray.ArraySize = kTextureDesc.ArraySize;
}
else
{
kStandardDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE1D;
kStandardDesc.Texture1D.MipSlice = 0;
}
pTexture->Release();
return true;
}
bool GetStandardViewDesc(CCryDXGLTexture2D* pTexture, D3D11_RENDER_TARGET_VIEW_DESC& kStandardDesc)
{
D3D11_TEXTURE2D_DESC kTextureDesc;
pTexture->GetDesc(&kTextureDesc);
kStandardDesc.Format = kTextureDesc.Format;
if (kTextureDesc.ArraySize > 1)
{
if (kTextureDesc.SampleDesc.Count > 1)
{
kStandardDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY;
kStandardDesc.Texture2DMSArray.FirstArraySlice = 0;
kStandardDesc.Texture2DMSArray.ArraySize = kTextureDesc.ArraySize;
}
else
{
kStandardDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
kStandardDesc.Texture2DArray.MipSlice = 0;
kStandardDesc.Texture2DArray.FirstArraySlice = 0;
kStandardDesc.Texture2DArray.ArraySize = kTextureDesc.ArraySize;
}
}
else if (kTextureDesc.SampleDesc.Count > 1)
{
kStandardDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS;
}
else
{
kStandardDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
kStandardDesc.Texture2D.MipSlice = 0;
}
pTexture->Release();
return true;
}
bool GetStandardViewDesc(CCryDXGLTexture3D* pTexture, D3D11_RENDER_TARGET_VIEW_DESC& kStandardDesc)
{
D3D11_TEXTURE3D_DESC kTextureDesc;
pTexture->GetDesc(&kTextureDesc);
kStandardDesc.Format = kTextureDesc.Format;
kStandardDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
kStandardDesc.Texture3D.MipSlice = 0;
kStandardDesc.Texture3D.FirstWSlice = 0;
kStandardDesc.Texture3D.WSize = -1;
pTexture->Release();
return true;
}
bool GetStandardViewDesc(CCryDXGLBuffer* pBuffer, D3D11_RENDER_TARGET_VIEW_DESC& kStandardDesc)
{
D3D11_BUFFER_DESC kBufferDesc;
pBuffer->GetDesc(&kBufferDesc);
bool bSuccess((kBufferDesc.MiscFlags | D3D11_RESOURCE_MISC_BUFFER_STRUCTURED) != 0);
if (bSuccess)
{
kStandardDesc.Format = DXGI_FORMAT_UNKNOWN;
kStandardDesc.ViewDimension = D3D11_RTV_DIMENSION_BUFFER;
kStandardDesc.Buffer.FirstElement = 0;
kStandardDesc.Buffer.NumElements = kBufferDesc.StructureByteStride;
}
else
{
DXGL_ERROR("Default render target view for a buffer requires element size specification");
}
pBuffer->Release();
return bSuccess;
}
bool GetStandardViewDesc(CCryDXGLTexture1D* pTexture, D3D11_DEPTH_STENCIL_VIEW_DESC& kStandardDesc)
{
D3D11_TEXTURE1D_DESC kTextureDesc;
pTexture->GetDesc(&kTextureDesc);
kStandardDesc.Format = kTextureDesc.Format;
kStandardDesc.Flags = 0;
if (kTextureDesc.ArraySize > 0)
{
kStandardDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE1DARRAY;
kStandardDesc.Texture1DArray.MipSlice = 0;
kStandardDesc.Texture1DArray.FirstArraySlice = 0;
kStandardDesc.Texture1DArray.ArraySize = kTextureDesc.ArraySize;
}
else
{
kStandardDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE1D;
kStandardDesc.Texture1D.MipSlice = 0;
}
pTexture->Release();
return true;
}
bool GetStandardViewDesc(CCryDXGLTexture2D* pTexture, D3D11_DEPTH_STENCIL_VIEW_DESC& kStandardDesc)
{
D3D11_TEXTURE2D_DESC kTextureDesc;
pTexture->GetDesc(&kTextureDesc);
kStandardDesc.Format = kTextureDesc.Format;
kStandardDesc.Flags = 0;
if (kTextureDesc.ArraySize > 0)
{
if (kTextureDesc.SampleDesc.Count > 1)
{
kStandardDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY;
kStandardDesc.Texture2DMSArray.FirstArraySlice = 0;
kStandardDesc.Texture2DMSArray.ArraySize = kTextureDesc.ArraySize;
}
else
{
kStandardDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
kStandardDesc.Texture2DArray.MipSlice = 0;
kStandardDesc.Texture2DArray.FirstArraySlice = 0;
kStandardDesc.Texture2DArray.ArraySize = kTextureDesc.ArraySize;
}
}
else if (kTextureDesc.SampleDesc.Count > 1)
{
kStandardDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DMS;
}
else
{
kStandardDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
kStandardDesc.Texture2D.MipSlice = 0;
}
pTexture->Release();
return true;
}
bool GetStandardViewDesc(CCryDXGLTexture3D* pTexture, D3D11_DEPTH_STENCIL_VIEW_DESC&)
{
DXGL_ERROR("Cannot bind a depth stencil view to a 3D texture");
pTexture->Release();
return false;
}
bool GetStandardViewDesc(CCryDXGLBuffer* pBuffer, D3D11_DEPTH_STENCIL_VIEW_DESC&)
{
DXGL_ERROR("Cannot bind a depth stencil view to a buffer");
pBuffer->Release();
return false;
}
template <typename ViewDesc>
bool GetStandardViewDesc(ID3D11Resource* pResource, ViewDesc& kStandardDesc)
{
memset(&kStandardDesc, 0, sizeof(kStandardDesc));
void* pvData(NULL);
if (!FAILED(pResource->QueryInterface(__uuidof(ID3D11Texture1D), &pvData)) && pvData != NULL)
{
return GetStandardViewDesc(CCryDXGLTexture1D::FromInterface(reinterpret_cast<ID3D11Texture1D*>(pvData)), kStandardDesc);
}
if (!FAILED(pResource->QueryInterface(__uuidof(ID3D11Texture2D), &pvData)) && pvData != NULL)
{
return GetStandardViewDesc(CCryDXGLTexture2D::FromInterface(reinterpret_cast<ID3D11Texture2D*>(pvData)), kStandardDesc);
}
if (!FAILED(pResource->QueryInterface(__uuidof(ID3D11Texture3D), &pvData)) && pvData != NULL)
{
return GetStandardViewDesc(CCryDXGLTexture3D::FromInterface(reinterpret_cast<ID3D11Texture3D*>(pvData)), kStandardDesc);
}
if (!FAILED(pResource->QueryInterface(__uuidof(ID3D11Buffer), &pvData)) && pvData != NULL)
{
return GetStandardViewDesc(CCryDXGLBuffer::FromInterface(reinterpret_cast<ID3D11Buffer*>(pvData)), kStandardDesc);
}
DXGL_ERROR("Unknown resource type for standard view description");
return false;
}
HRESULT CCryDXGLDevice::CreateShaderResourceView(ID3D11Resource* pResource, const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc, ID3D11ShaderResourceView** ppSRView)
{
D3D11_SHADER_RESOURCE_VIEW_DESC kStandardDesc;
if (pDesc == NULL)
{
if (!GetStandardViewDesc(pResource, kStandardDesc))
{
return E_INVALIDARG;
}
pDesc = &kStandardDesc;
}
CRY_ASSERT(pDesc != NULL);
CCryDXGLShaderResourceView* pSRView(new CCryDXGLShaderResourceView(CCryDXGLResource::FromInterface(pResource), *pDesc, this));
if (pSRView->Initialize(m_spGLDevice))
{
CCryDXGLShaderResourceView::ToInterface(ppSRView, pSRView);
return S_OK;
}
pSRView->Release();
return E_FAIL;
}
HRESULT CCryDXGLDevice::CreateUnorderedAccessView(ID3D11Resource* pResource, const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc, ID3D11UnorderedAccessView** ppUAView)
{
CCryDXGLUnorderedAccessView::ToInterface(ppUAView, new CCryDXGLUnorderedAccessView(CCryDXGLResource::FromInterface(pResource), *pDesc, this));
return S_OK;
}
HRESULT CCryDXGLDevice::CreateRenderTargetView(ID3D11Resource* pResource, const D3D11_RENDER_TARGET_VIEW_DESC* pDesc, ID3D11RenderTargetView** ppRTView)
{
D3D11_RENDER_TARGET_VIEW_DESC kStandardDesc;
if (pDesc == NULL)
{
if (!GetStandardViewDesc(pResource, kStandardDesc))
{
return E_INVALIDARG;
}
pDesc = &kStandardDesc;
}
CRY_ASSERT(pDesc != NULL);
CCryDXGLRenderTargetView* pRTView(new CCryDXGLRenderTargetView(CCryDXGLResource::FromInterface(pResource), *pDesc, this));
if (pRTView->Initialize(m_spGLDevice))
{
CCryDXGLRenderTargetView::ToInterface(ppRTView, pRTView);
return S_OK;
}
pRTView->Release();
return E_FAIL;
}
HRESULT CCryDXGLDevice::CreateDepthStencilView(ID3D11Resource* pResource, const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc, ID3D11DepthStencilView** ppDepthStencilView)
{
D3D11_DEPTH_STENCIL_VIEW_DESC kStandardDesc;
if (pDesc == NULL)
{
if (!GetStandardViewDesc(pResource, kStandardDesc))
{
return E_INVALIDARG;
}
pDesc = &kStandardDesc;
}
CRY_ASSERT(pDesc != NULL);
CCryDXGLDepthStencilView* pDSView(new CCryDXGLDepthStencilView(CCryDXGLResource::FromInterface(pResource), *pDesc, this));
if (pDSView->Initialize(m_spGLDevice))
{
CCryDXGLDepthStencilView::ToInterface(ppDepthStencilView, pDSView);
return S_OK;
}
pDSView->Release();
return E_FAIL;
}
HRESULT CCryDXGLDevice::CreateInputLayout(const D3D11_INPUT_ELEMENT_DESC* pInputElementDescs, UINT NumElements, const void* pShaderBytecodeWithInputSignature, SIZE_T BytecodeLength, ID3D11InputLayout** ppInputLayout)
{
NCryMetal::TShaderReflection kShaderReflection;
if (!InitializeShaderReflection(&kShaderReflection, pShaderBytecodeWithInputSignature))
{
return 0;
}
_smart_ptr<NCryMetal::SInputLayout> spGLInputLayout(NCryMetal::CreateInputLayout(pInputElementDescs, NumElements, kShaderReflection));
if (spGLInputLayout == NULL)
{
return E_FAIL;
}
CCryDXGLInputLayout::ToInterface(ppInputLayout, new CCryDXGLInputLayout(spGLInputLayout, this));
return S_OK;
}
_smart_ptr<NCryMetal::SShader> CreateGLShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, NCryMetal::EShaderType eType, NCryMetal::CDevice* pDevice)
{
if (pClassLinkage != NULL)
{
DXGL_ERROR("Class linkage not supported");
return NULL;
}
_smart_ptr<NCryMetal::SShader> spGLShader(new NCryMetal::SShader());
spGLShader->m_eType = eType;
if (!NCryMetal::InitializeShader(spGLShader, pShaderBytecode, BytecodeLength, pDevice->GetMetalDevice()))
{
return NULL;
}
return spGLShader;
}
template <typename DXGLShader, typename D3DShader>
HRESULT CreateShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, D3DShader** ppShader, NCryMetal::EShaderType eType, CCryDXGLDevice* pDevice)
{
_smart_ptr<NCryMetal::SShader> spGLShader(CreateGLShader(pShaderBytecode, BytecodeLength, pClassLinkage, eType, pDevice->GetGLDevice()));
if (spGLShader == NULL)
{
return E_FAIL;
}
DXGLShader::ToInterface(ppShader, new DXGLShader(spGLShader, pDevice));
return S_OK;
}
HRESULT CCryDXGLDevice::CreateVertexShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11VertexShader** ppVertexShader)
{
return CreateShader<CCryDXGLVertexShader, ID3D11VertexShader>(pShaderBytecode, BytecodeLength, pClassLinkage, ppVertexShader, NCryMetal::eST_Vertex, this);
}
HRESULT CCryDXGLDevice::CreateGeometryShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11GeometryShader** ppGeometryShader)
{
DXGL_ERROR("Geometry shaders are not supported by this GL implementation.");
return E_FAIL;
}
HRESULT CCryDXGLDevice::CreateGeometryShaderWithStreamOutput(const void* pShaderBytecode, SIZE_T BytecodeLength, const D3D11_SO_DECLARATION_ENTRY* pSODeclaration, UINT NumEntries, const UINT* pBufferStrides, UINT NumStrides, UINT RasterizedStream, ID3D11ClassLinkage* pClassLinkage, ID3D11GeometryShader** ppGeometryShader)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLDevice::CreatePixelShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11PixelShader** ppPixelShader)
{
return CreateShader<CCryDXGLPixelShader, ID3D11PixelShader>(pShaderBytecode, BytecodeLength, pClassLinkage, ppPixelShader, NCryMetal::eST_Fragment, this);
}
HRESULT CCryDXGLDevice::CreateHullShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11HullShader** ppHullShader)
{
DXGL_ERROR("Hull shaders are not supported by this GL implementation.");
return E_FAIL;
}
HRESULT CCryDXGLDevice::CreateDomainShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11DomainShader** ppDomainShader)
{
DXGL_ERROR("Domain shaders are not supported by this GL implementation.");
return E_FAIL;
}
HRESULT CCryDXGLDevice::CreateComputeShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11ComputeShader** ppComputeShader)
{
#if DXGL_SUPPORT_COMPUTE
return CreateShader<CCryDXGLComputeShader, ID3D11ComputeShader>(pShaderBytecode, BytecodeLength, pClassLinkage, ppComputeShader, NCryMetal::eST_Compute, this);
#else
DXGL_ERROR("Compute shaders are not supported by this GL implementation.");
return E_FAIL;
#endif
}
HRESULT CCryDXGLDevice::CreateClassLinkage(ID3D11ClassLinkage** ppLinkage)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLDevice::CreateBlendState(const D3D11_BLEND_DESC* pBlendStateDesc, ID3D11BlendState** ppBlendState)
{
CCryDXGLBlendState* pState(new CCryDXGLBlendState(*pBlendStateDesc, this));
if (!pState->Initialize(this))
{
pState->Release();
return E_FAIL;
}
CCryDXGLBlendState::ToInterface(ppBlendState, pState);
return S_OK;
}
HRESULT CCryDXGLDevice::CreateDepthStencilState(const D3D11_DEPTH_STENCIL_DESC* pDepthStencilDesc, ID3D11DepthStencilState** ppDepthStencilState)
{
CCryDXGLDepthStencilState* pState(new CCryDXGLDepthStencilState(*pDepthStencilDesc, this));
if (!pState->Initialize(this))
{
pState->Release();
return E_FAIL;
}
CCryDXGLDepthStencilState::ToInterface(ppDepthStencilState, pState);
return S_OK;
}
HRESULT CCryDXGLDevice::CreateRasterizerState(const D3D11_RASTERIZER_DESC* pRasterizerDesc, ID3D11RasterizerState** ppRasterizerState)
{
CCryDXGLRasterizerState* pState(new CCryDXGLRasterizerState(*pRasterizerDesc, this));
if (!pState->Initialize(this))
{
pState->Release();
return E_FAIL;
}
CCryDXGLRasterizerState::ToInterface(ppRasterizerState, pState);
return S_OK;
}
HRESULT CCryDXGLDevice::CreateSamplerState(const D3D11_SAMPLER_DESC* pSamplerDesc, ID3D11SamplerState** ppSamplerState)
{
CCryDXGLSamplerState* pState(new CCryDXGLSamplerState(*pSamplerDesc, this));
if (!pState->Initialize(this))
{
pState->Release();
return E_FAIL;
}
CCryDXGLSamplerState::ToInterface(ppSamplerState, pState);
return S_OK;
}
HRESULT CCryDXGLDevice::CreateQuery(const D3D11_QUERY_DESC* pQueryDesc, ID3D11Query** ppQuery)
{
NCryMetal::SQueryPtr spGLQuery(NCryMetal::CreateQuery(*pQueryDesc, m_spGLDevice));
if (spGLQuery == NULL)
{
return E_FAIL;
}
CCryDXGLQuery::ToInterface(ppQuery, new CCryDXGLQuery(*pQueryDesc, spGLQuery, this));
return S_OK;
}
HRESULT CCryDXGLDevice::CreatePredicate(const D3D11_QUERY_DESC* pPredicateDesc, ID3D11Predicate** ppPredicate)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLDevice::CreateCounter(const D3D11_COUNTER_DESC* pCounterDesc, ID3D11Counter** ppCounter)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLDevice::CreateDeferredContext(UINT ContextFlags, ID3D11DeviceContext** ppDeferredContext)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLDevice::OpenSharedResource(HANDLE hResource, REFIID ReturnedInterface, void** ppResource)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLDevice::CheckFormatSupport(DXGI_FORMAT Format, UINT* pFormatSupport)
{
NCryMetal::EGIFormat eGIFormat(NCryMetal::GetGIFormat(Format));
if (eGIFormat == NCryMetal::eGIF_NUM)
{
DXGL_ERROR("Unknown DXGI format");
return E_FAIL;
}
(*pFormatSupport) = m_spAdapter->GetGLAdapter()->m_giFormatSupport[eGIFormat];
return S_OK;
}
HRESULT CCryDXGLDevice::CheckMultisampleQualityLevels(DXGI_FORMAT Format, UINT SampleCount, UINT* pNumQualityLevels)
{
NCryMetal::EGIFormat eGIFormat(NCryMetal::GetGIFormat(Format));
if (eGIFormat != NCryMetal::eGIF_NUM && (SampleCount <= m_spAdapter->GetGLAdapter()->m_maxSamples))
{
*pNumQualityLevels = 1;
}
else
{
*pNumQualityLevels = 0;
}
DXGL_TODO("Check if there's a way to query for specific quality levels");
return S_OK;
}
void CCryDXGLDevice::CheckCounterInfo(D3D11_COUNTER_INFO* pCounterInfo)
{
DXGL_NOT_IMPLEMENTED
}
HRESULT CCryDXGLDevice::CheckCounter(const D3D11_COUNTER_DESC* pDesc, D3D11_COUNTER_TYPE* pType, UINT* pActiveCounters, LPSTR szName, UINT* pNameLength, LPSTR szUnits, UINT* pUnitsLength, LPSTR szDescription, UINT* pDescriptionLength)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLDevice::CheckFeatureSupport(D3D11_FEATURE Feature, void* pFeatureSupportData, UINT FeatureSupportDataSize)
{
switch (Feature)
{
case D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS:
{
D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS* pData(static_cast<D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS*>(pFeatureSupportData));
bool bComputeShaderSupported(m_spAdapter->GetGLAdapter()->m_features.Get(NCryMetal::eF_ComputeShader));
pData->ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x = bComputeShaderSupported ? TRUE : FALSE;
return S_OK;
}
break;
default:
DXGL_TODO("Add supported 11.1 features")
return E_FAIL;
}
}
HRESULT CCryDXGLDevice::GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData)
{
return m_kPrivateDataContainer.GetPrivateData(guid, pDataSize, pData);
}
HRESULT CCryDXGLDevice::SetPrivateData(REFGUID guid, UINT DataSize, const void* pData)
{
return m_kPrivateDataContainer.SetPrivateData(guid, DataSize, pData);
}
HRESULT CCryDXGLDevice::SetPrivateDataInterface(REFGUID guid, const IUnknown* pData)
{
return m_kPrivateDataContainer.SetPrivateDataInterface(guid, pData);
}
D3D_FEATURE_LEVEL CCryDXGLDevice::GetFeatureLevel(void)
{
DXGL_NOT_IMPLEMENTED
return D3D_FEATURE_LEVEL_11_0;
}
UINT CCryDXGLDevice::GetCreationFlags(void)
{
DXGL_NOT_IMPLEMENTED
return 0;
}
HRESULT CCryDXGLDevice::GetDeviceRemovedReason(void)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
void CCryDXGLDevice::GetImmediateContext(ID3D11DeviceContext** ppImmediateContext)
{
m_spImmediateContext->AddRef();
CCryDXGLDeviceContext::ToInterface(ppImmediateContext, m_spImmediateContext);
}
HRESULT CCryDXGLDevice::SetExceptionMode(UINT RaiseFlags)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
UINT CCryDXGLDevice::GetExceptionMode(void)
{
DXGL_NOT_IMPLEMENTED
return 0;
}
@@ -0,0 +1,113 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11Device
#ifndef __CRYMETALGLDEVICE__
#define __CRYMETALGLDEVICE__
#include "CCryDXMETALGIObject.hpp"
namespace NCryMetal
{
class CDevice;
struct SDummyContext;
}
class CCryDXGLGIAdapter;
class CCryDXGLDeviceContext;
class CCryDXGLDevice
#if DXGL_VIRTUAL_DEVICE_AND_CONTEXT && !DXGL_FULL_EMULATION
: public ID3D11Device
#else
: public CCryDXGLGIObject
#endif
{
public:
#if DXGL_FULL_EMULATION
DXGL_IMPLEMENT_INTERFACE(CCryDXGLDevice, DXGIDevice)
#endif //DXGL_FULL_EMULATION
DXGL_IMPLEMENT_INTERFACE(CCryDXGLDevice, D3D11Device)
CCryDXGLDevice(CCryDXGLGIAdapter* pAdapter, D3D_FEATURE_LEVEL eFeatureLevel);
virtual ~CCryDXGLDevice();
bool Initialize(const DXGI_SWAP_CHAIN_DESC* pDesc, IDXGISwapChain** ppSwapChain);
NCryMetal::CDevice* GetGLDevice();
// IDXGIObject overrides
HRESULT GetParent(REFIID riid, void** ppParent);
// IDXGIDevice implementation
HRESULT STDMETHODCALLTYPE GetAdapter(IDXGIAdapter** pAdapter);
HRESULT STDMETHODCALLTYPE CreateSurface(const DXGI_SURFACE_DESC* pDesc, UINT NumSurfaces, DXGI_USAGE Usage, const DXGI_SHARED_RESOURCE* pSharedResource, IDXGISurface** ppSurface);
HRESULT STDMETHODCALLTYPE QueryResourceResidency(IUnknown* const* ppResources, DXGI_RESIDENCY* pResidencyStatus, UINT NumResources);
HRESULT STDMETHODCALLTYPE SetGPUThreadPriority(INT Priority);
HRESULT STDMETHODCALLTYPE GetGPUThreadPriority(INT* pPriority);
// ID3D11Device implementation
HRESULT STDMETHODCALLTYPE CreateBuffer(const D3D11_BUFFER_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Buffer** ppBuffer);
HRESULT STDMETHODCALLTYPE CreateTexture1D(const D3D11_TEXTURE1D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Texture1D** ppTexture1D);
HRESULT STDMETHODCALLTYPE CreateTexture2D(const D3D11_TEXTURE2D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Texture2D** ppTexture2D);
HRESULT STDMETHODCALLTYPE CreateTexture3D(const D3D11_TEXTURE3D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Texture3D** ppTexture3D);
HRESULT STDMETHODCALLTYPE CreateShaderResourceView(ID3D11Resource* pResource, const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc, ID3D11ShaderResourceView** ppSRView);
HRESULT STDMETHODCALLTYPE CreateUnorderedAccessView(ID3D11Resource* pResource, const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc, ID3D11UnorderedAccessView** ppUAView);
HRESULT STDMETHODCALLTYPE CreateRenderTargetView(ID3D11Resource* pResource, const D3D11_RENDER_TARGET_VIEW_DESC* pDesc, ID3D11RenderTargetView** ppRTView);
HRESULT STDMETHODCALLTYPE CreateDepthStencilView(ID3D11Resource* pResource, const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc, ID3D11DepthStencilView** ppDepthStencilView);
HRESULT STDMETHODCALLTYPE CreateInputLayout(const D3D11_INPUT_ELEMENT_DESC* pInputElementDescs, UINT NumElements, const void* pShaderBytecodeWithInputSignature, SIZE_T BytecodeLength, ID3D11InputLayout** ppInputLayout);
HRESULT STDMETHODCALLTYPE CreateVertexShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11VertexShader** ppVertexShader);
HRESULT STDMETHODCALLTYPE CreateGeometryShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11GeometryShader** ppGeometryShader);
HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput(const void* pShaderBytecode, SIZE_T BytecodeLength, const D3D11_SO_DECLARATION_ENTRY* pSODeclaration, UINT NumEntries, const UINT* pBufferStrides, UINT NumStrides, UINT RasterizedStream, ID3D11ClassLinkage* pClassLinkage, ID3D11GeometryShader** ppGeometryShader);
HRESULT STDMETHODCALLTYPE CreatePixelShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11PixelShader** ppPixelShader);
HRESULT STDMETHODCALLTYPE CreateHullShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11HullShader** ppHullShader);
HRESULT STDMETHODCALLTYPE CreateDomainShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11DomainShader** ppDomainShader);
HRESULT STDMETHODCALLTYPE CreateComputeShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11ComputeShader** ppComputeShader);
HRESULT STDMETHODCALLTYPE CreateClassLinkage(ID3D11ClassLinkage** ppLinkage);
HRESULT STDMETHODCALLTYPE CreateBlendState(const D3D11_BLEND_DESC* pBlendStateDesc, ID3D11BlendState** ppBlendState);
HRESULT STDMETHODCALLTYPE CreateDepthStencilState(const D3D11_DEPTH_STENCIL_DESC* pDepthStencilDesc, ID3D11DepthStencilState** ppDepthStencilState);
HRESULT STDMETHODCALLTYPE CreateRasterizerState(const D3D11_RASTERIZER_DESC* pRasterizerDesc, ID3D11RasterizerState** ppRasterizerState);
HRESULT STDMETHODCALLTYPE CreateSamplerState(const D3D11_SAMPLER_DESC* pSamplerDesc, ID3D11SamplerState** ppSamplerState);
HRESULT STDMETHODCALLTYPE CreateQuery(const D3D11_QUERY_DESC* pQueryDesc, ID3D11Query** ppQuery);
HRESULT STDMETHODCALLTYPE CreatePredicate(const D3D11_QUERY_DESC* pPredicateDesc, ID3D11Predicate** ppPredicate);
HRESULT STDMETHODCALLTYPE CreateCounter(const D3D11_COUNTER_DESC* pCounterDesc, ID3D11Counter** ppCounter);
HRESULT STDMETHODCALLTYPE CreateDeferredContext(UINT ContextFlags, ID3D11DeviceContext** ppDeferredContext);
HRESULT STDMETHODCALLTYPE OpenSharedResource(HANDLE hResource, REFIID ReturnedInterface, void** ppResource);
HRESULT STDMETHODCALLTYPE CheckFormatSupport(DXGI_FORMAT Format, UINT* pFormatSupport);
HRESULT STDMETHODCALLTYPE CheckMultisampleQualityLevels(DXGI_FORMAT Format, UINT SampleCount, UINT* pNumQualityLevels);
void STDMETHODCALLTYPE CheckCounterInfo(D3D11_COUNTER_INFO* pCounterInfo);
HRESULT STDMETHODCALLTYPE CheckCounter(const D3D11_COUNTER_DESC* pDesc, D3D11_COUNTER_TYPE* pType, UINT* pActiveCounters, LPSTR szName, UINT* pNameLength, LPSTR szUnits, UINT* pUnitsLength, LPSTR szDescription, UINT* pDescriptionLength);
HRESULT STDMETHODCALLTYPE CheckFeatureSupport(D3D11_FEATURE Feature, void* pFeatureSupportData, UINT FeatureSupportDataSize);
HRESULT STDMETHODCALLTYPE GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData);
HRESULT STDMETHODCALLTYPE SetPrivateData(REFGUID guid, UINT DataSize, const void* pData);
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(REFGUID guid, const IUnknown* pData);
D3D_FEATURE_LEVEL STDMETHODCALLTYPE GetFeatureLevel(void);
UINT STDMETHODCALLTYPE GetCreationFlags(void);
HRESULT STDMETHODCALLTYPE GetDeviceRemovedReason(void);
void STDMETHODCALLTYPE GetImmediateContext(ID3D11DeviceContext** ppImmediateContext);
HRESULT STDMETHODCALLTYPE SetExceptionMode(UINT RaiseFlags);
UINT STDMETHODCALLTYPE GetExceptionMode(void);
#if !DXGL_FULL_EMULATION
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
#endif //!DXGL_FULL_EMULATION
protected:
CCryDXGLPrivateDataContainer m_kPrivateDataContainer;
_smart_ptr<CCryDXGLGIAdapter> m_spAdapter;
_smart_ptr<NCryMetal::CDevice> m_spGLDevice;
_smart_ptr<CCryDXGLDeviceContext> m_spImmediateContext;
D3D_FEATURE_LEVEL m_eFeatureLevel;
};
#endif //__CRYMETALGLDEVICE__
@@ -0,0 +1,77 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description: Definition of the DXGL wrapper for ID3D11DeviceChild
#include "RenderDll_precompiled.h"
#include "CCryDXMETALDeviceChild.hpp"
#include "CCryDXMETALDevice.hpp"
CCryDXGLDeviceChild::CCryDXGLDeviceChild(CCryDXGLDevice* pDevice)
: m_pDevice(pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11DeviceChild)
if (m_pDevice != NULL)
{
m_pDevice->AddRef();
}
}
CCryDXGLDeviceChild::~CCryDXGLDeviceChild()
{
if (m_pDevice != NULL)
{
m_pDevice->Release();
}
}
void CCryDXGLDeviceChild::SetDevice(CCryDXGLDevice* pDevice)
{
if (m_pDevice != pDevice)
{
if (m_pDevice != NULL)
{
m_pDevice->Release();
}
m_pDevice = pDevice;
if (pDevice != NULL)
{
m_pDevice->AddRef();
}
}
}
////////////////////////////////////////////////////////////////////////////////
// ID3D11DeviceChild implementation
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLDeviceChild::GetDevice(ID3D11Device** ppDevice)
{
CCryDXGLDevice::ToInterface(ppDevice, m_pDevice);
}
HRESULT CCryDXGLDeviceChild::GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData)
{
return m_kPrivateDataContainer.GetPrivateData(guid, pDataSize, pData);
}
HRESULT CCryDXGLDeviceChild::SetPrivateData(REFGUID guid, UINT DataSize, const void* pData)
{
return m_kPrivateDataContainer.SetPrivateData(guid, DataSize, pData);
}
HRESULT CCryDXGLDeviceChild::SetPrivateDataInterface(REFGUID guid, const IUnknown* pData)
{
return m_kPrivateDataContainer.SetPrivateDataInterface(guid, pData);
}
@@ -0,0 +1,63 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11DeviceChild
#ifndef __CRYMETALGLDEVICECHILD__
#define __CRYMETALGLDEVICECHILD__
#include "CCryDXMETALBase.hpp"
class CCryDXGLDevice;
class CCryDXGLDeviceChild
: public CCryDXGLBase
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLDeviceChild, D3D11DeviceChild)
CCryDXGLDeviceChild(CCryDXGLDevice* pDevice = NULL);
virtual ~CCryDXGLDeviceChild();
void SetDevice(CCryDXGLDevice* pDevice);
// ID3D11DeviceChild implementation
void STDMETHODCALLTYPE GetDevice(ID3D11Device** ppDevice);
HRESULT STDMETHODCALLTYPE GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData);
HRESULT STDMETHODCALLTYPE SetPrivateData(REFGUID guid, UINT DataSize, const void* pData);
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(REFGUID guid, const IUnknown* pData);
#if !DXGL_FULL_EMULATION
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject)
{
if (SingleInterface<CCryDXGLDeviceChild>::Query(this, riid, ppvObject))
{
return S_OK;
}
return CCryDXGLBase::QueryInterface(riid, ppvObject);
}
#endif //!DXGL_FULL_EMULATION
protected:
CCryDXGLDevice* m_pDevice;
CCryDXGLPrivateDataContainer m_kPrivateDataContainer;
};
#if !DXGL_FULL_EMULATION
struct ID3D11Counter
: CCryDXGLDeviceChild {};
struct ID3D11ClassLinkage
: CCryDXGLDeviceChild {};
#endif //!DXGL_FULL_EMULATION
#endif //__CRYMETALGLDEVICECHILD__
@@ -0,0 +1,228 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11DeviceContext
#ifndef __CRYMETALGLDEVICECONTEXT__
#define __CRYMETALGLDEVICECONTEXT__
#include "CCryDXMETALDeviceChild.hpp"
namespace NCryMetal
{
class CContext;
}
class CCryDXGLBlendState;
class CCryDXGLBuffer;
class CCryDXGLDepthStencilState;
class CCryDXGLDepthStencilView;
class CCryDXGLInputLayout;
class CCryDXGLQuery;
class CCryDXGLRasterizerState;
class CCryDXGLRenderTargetView;
class CCryDXGLSamplerState;
class CCryDXGLShader;
class CCryDXGLShaderResourceView;
class CCryDXGLUnorderedAccessView;
class CCryDXGLDeviceContext
#if DXGL_VIRTUAL_DEVICE_AND_CONTEXT && !DXGL_FULL_EMULATION
: public ID3D11DeviceContext
#else
: public CCryDXGLDeviceChild
#endif
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLDeviceContext, D3D11DeviceContext)
CCryDXGLDeviceContext();
virtual ~CCryDXGLDeviceContext();
bool Initialize(CCryDXGLDevice* pDevice);
void Shutdown();
NCryMetal::CContext* GetMetalContext();
// ID3D11DeviceContext implementation
void STDMETHODCALLTYPE VSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers);
void STDMETHODCALLTYPE PSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews);
void STDMETHODCALLTYPE PSSetShader(ID3D11PixelShader* pPixelShader, ID3D11ClassInstance* const* ppClassInstances, UINT NumClassInstances);
void STDMETHODCALLTYPE PSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState* const* ppSamplers);
void STDMETHODCALLTYPE VSSetShader(ID3D11VertexShader* pVertexShader, ID3D11ClassInstance* const* ppClassInstances, UINT NumClassInstances);
void STDMETHODCALLTYPE DrawIndexed(UINT IndexCount, UINT StartIndexLocation, INT BaseVertexLocation);
void STDMETHODCALLTYPE Draw(UINT VertexCount, UINT StartVertexLocation);
HRESULT STDMETHODCALLTYPE Map(ID3D11Resource* pResource, UINT Subresource, D3D11_MAP MapType, UINT MapFlags, D3D11_MAPPED_SUBRESOURCE* pMappedResource);
void STDMETHODCALLTYPE Unmap(ID3D11Resource* pResource, UINT Subresource);
void STDMETHODCALLTYPE PSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers);
void STDMETHODCALLTYPE IASetInputLayout(ID3D11InputLayout* pInputLayout);
void STDMETHODCALLTYPE IASetVertexBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppVertexBuffers, const UINT* pStrides, const UINT* pOffsets);
void STDMETHODCALLTYPE IASetIndexBuffer(ID3D11Buffer* pIndexBuffer, DXGI_FORMAT Format, UINT Offset);
void STDMETHODCALLTYPE DrawIndexedInstanced(UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation, INT BaseVertexLocation, UINT StartInstanceLocation);
void STDMETHODCALLTYPE DrawInstanced(UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation, UINT StartInstanceLocation);
void STDMETHODCALLTYPE GSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers);
void STDMETHODCALLTYPE GSSetShader(ID3D11GeometryShader* pShader, ID3D11ClassInstance* const* ppClassInstances, UINT NumClassInstances);
void STDMETHODCALLTYPE IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY Topology);
void STDMETHODCALLTYPE VSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews);
void STDMETHODCALLTYPE VSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState* const* ppSamplers);
void STDMETHODCALLTYPE Begin(ID3D11Asynchronous* pAsync);
void STDMETHODCALLTYPE End(ID3D11Asynchronous* pAsync);
HRESULT STDMETHODCALLTYPE GetData(ID3D11Asynchronous* pAsync, void* pData, UINT DataSize, UINT GetDataFlags);
void STDMETHODCALLTYPE SetPredication(ID3D11Predicate* pPredicate, BOOL PredicateValue);
void STDMETHODCALLTYPE GSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews);
void STDMETHODCALLTYPE GSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState* const* ppSamplers);
void STDMETHODCALLTYPE OMSetRenderTargets(UINT NumViews, ID3D11RenderTargetView* const* ppRenderTargetViews, ID3D11DepthStencilView* pDepthStencilView);
void STDMETHODCALLTYPE OMSetRenderTargetsAndUnorderedAccessViews(UINT NumRTVs, ID3D11RenderTargetView* const* ppRenderTargetViews, ID3D11DepthStencilView* pDepthStencilView, UINT UAVStartSlot, UINT NumUAVs, ID3D11UnorderedAccessView* const* ppUnorderedAccessViews, const UINT* pUAVInitialCounts);
void STDMETHODCALLTYPE OMSetBlendState(ID3D11BlendState* pBlendState, const FLOAT BlendFactor[ 4 ], UINT SampleMask);
void STDMETHODCALLTYPE OMSetDepthStencilState(ID3D11DepthStencilState* pDepthStencilState, UINT StencilRef);
void STDMETHODCALLTYPE SOSetTargets(UINT NumBuffers, ID3D11Buffer* const* ppSOTargets, const UINT* pOffsets);
void STDMETHODCALLTYPE DrawAuto(void);
void STDMETHODCALLTYPE DrawIndexedInstancedIndirect(ID3D11Buffer* pBufferForArgs, UINT AlignedByteOffsetForArgs);
void STDMETHODCALLTYPE DrawInstancedIndirect(ID3D11Buffer* pBufferForArgs, UINT AlignedByteOffsetForArgs);
void STDMETHODCALLTYPE Dispatch(UINT ThreadGroupCountX, UINT ThreadGroupCountY, UINT ThreadGroupCountZ);
void STDMETHODCALLTYPE DispatchIndirect(ID3D11Buffer* pBufferForArgs, UINT AlignedByteOffsetForArgs);
void STDMETHODCALLTYPE RSSetState(ID3D11RasterizerState* pRasterizerState);
void STDMETHODCALLTYPE RSSetViewports(UINT NumViewports, const D3D11_VIEWPORT* pViewports);
void STDMETHODCALLTYPE RSSetScissorRects(UINT NumRects, const D3D11_RECT* pRects);
void STDMETHODCALLTYPE CopySubresourceRegion(ID3D11Resource* pDstResource, UINT DstSubresource, UINT DstX, UINT DstY, UINT DstZ, ID3D11Resource* pSrcResource, UINT SrcSubresource, const D3D11_BOX* pSrcBox);
void STDMETHODCALLTYPE CopyResource(ID3D11Resource* pDstResource, ID3D11Resource* pSrcResource);
void STDMETHODCALLTYPE UpdateSubresource(ID3D11Resource* pDstResource, UINT DstSubresource, const D3D11_BOX* pDstBox, const void* pSrcData, UINT SrcRowPitch, UINT SrcDepthPitch);
void STDMETHODCALLTYPE CopyStructureCount(ID3D11Buffer* pDstBuffer, UINT DstAlignedByteOffset, ID3D11UnorderedAccessView* pSrcView);
void STDMETHODCALLTYPE ClearRenderTargetView(ID3D11RenderTargetView* pRenderTargetView, const FLOAT ColorRGBA[ 4 ]);
void STDMETHODCALLTYPE ClearUnorderedAccessViewUint(ID3D11UnorderedAccessView* pUnorderedAccessView, const UINT Values[ 4 ]);
void STDMETHODCALLTYPE ClearUnorderedAccessViewFloat(ID3D11UnorderedAccessView* pUnorderedAccessView, const FLOAT Values[ 4 ]);
void STDMETHODCALLTYPE ClearDepthStencilView(ID3D11DepthStencilView* pDepthStencilView, UINT ClearFlags, FLOAT Depth, UINT8 Stencil);
void STDMETHODCALLTYPE GenerateMips(ID3D11ShaderResourceView* pShaderResourceView);
void STDMETHODCALLTYPE SetResourceMinLOD(ID3D11Resource* pResource, FLOAT MinLOD);
FLOAT STDMETHODCALLTYPE GetResourceMinLOD(ID3D11Resource* pResource);
void STDMETHODCALLTYPE ResolveSubresource(ID3D11Resource* pDstResource, UINT DstSubresource, ID3D11Resource* pSrcResource, UINT SrcSubresource, DXGI_FORMAT Format);
void STDMETHODCALLTYPE ExecuteCommandList(ID3D11CommandList* pCommandList, BOOL RestoreContextState);
void STDMETHODCALLTYPE HSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews);
void STDMETHODCALLTYPE HSSetShader(ID3D11HullShader* pHullShader, ID3D11ClassInstance* const* ppClassInstances, UINT NumClassInstances);
void STDMETHODCALLTYPE HSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState* const* ppSamplers);
void STDMETHODCALLTYPE HSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers);
void STDMETHODCALLTYPE DSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews);
void STDMETHODCALLTYPE DSSetShader(ID3D11DomainShader* pDomainShader, ID3D11ClassInstance* const* ppClassInstances, UINT NumClassInstances);
void STDMETHODCALLTYPE DSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState* const* ppSamplers);
void STDMETHODCALLTYPE DSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers);
void STDMETHODCALLTYPE CSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews);
void STDMETHODCALLTYPE CSSetUnorderedAccessViews(UINT StartSlot, UINT NumUAVs, ID3D11UnorderedAccessView* const* ppUnorderedAccessViews, const UINT* pUAVInitialCounts);
void STDMETHODCALLTYPE CSSetShader(ID3D11ComputeShader* pComputeShader, ID3D11ClassInstance* const* ppClassInstances, UINT NumClassInstances);
void STDMETHODCALLTYPE CSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState* const* ppSamplers);
void STDMETHODCALLTYPE CSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers);
void STDMETHODCALLTYPE VSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers);
void STDMETHODCALLTYPE PSGetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews);
void STDMETHODCALLTYPE PSGetShader(ID3D11PixelShader** ppPixelShader, ID3D11ClassInstance** ppClassInstances, UINT* pNumClassInstances);
void STDMETHODCALLTYPE PSGetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState** ppSamplers);
void STDMETHODCALLTYPE VSGetShader(ID3D11VertexShader** ppVertexShader, ID3D11ClassInstance** ppClassInstances, UINT* pNumClassInstances);
void STDMETHODCALLTYPE PSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers);
void STDMETHODCALLTYPE IAGetInputLayout(ID3D11InputLayout** ppInputLayout);
void STDMETHODCALLTYPE IAGetVertexBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppVertexBuffers, UINT* pStrides, UINT* pOffsets);
void STDMETHODCALLTYPE IAGetIndexBuffer(ID3D11Buffer** pIndexBuffer, DXGI_FORMAT* Format, UINT* Offset);
void STDMETHODCALLTYPE GSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers);
void STDMETHODCALLTYPE GSGetShader(ID3D11GeometryShader** ppGeometryShader, ID3D11ClassInstance** ppClassInstances, UINT* pNumClassInstances);
void STDMETHODCALLTYPE IAGetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY* pTopology);
void STDMETHODCALLTYPE VSGetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews);
void STDMETHODCALLTYPE VSGetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState** ppSamplers);
void STDMETHODCALLTYPE GetPredication(ID3D11Predicate** ppPredicate, BOOL* pPredicateValue);
void STDMETHODCALLTYPE GSGetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews);
void STDMETHODCALLTYPE GSGetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState** ppSamplers);
void STDMETHODCALLTYPE OMGetRenderTargets(UINT NumViews, ID3D11RenderTargetView** ppRenderTargetViews, ID3D11DepthStencilView** ppDepthStencilView);
void STDMETHODCALLTYPE OMGetRenderTargetsAndUnorderedAccessViews(UINT NumRTVs, ID3D11RenderTargetView** ppRenderTargetViews, ID3D11DepthStencilView** ppDepthStencilView, UINT UAVStartSlot, UINT NumUAVs, ID3D11UnorderedAccessView** ppUnorderedAccessViews);
void STDMETHODCALLTYPE OMGetBlendState(ID3D11BlendState * *ppBlendState, FLOAT BlendFactor[ 4 ], UINT * pSampleMask);
void STDMETHODCALLTYPE OMGetDepthStencilState(ID3D11DepthStencilState** ppDepthStencilState, UINT* pStencilRef);
void STDMETHODCALLTYPE SOGetTargets(UINT NumBuffers, ID3D11Buffer** ppSOTargets);
void STDMETHODCALLTYPE RSGetState(ID3D11RasterizerState** ppRasterizerState);
void STDMETHODCALLTYPE RSGetViewports(UINT* pNumViewports, D3D11_VIEWPORT* pViewports);
void STDMETHODCALLTYPE RSGetScissorRects(UINT* pNumRects, D3D11_RECT* pRects);
void STDMETHODCALLTYPE HSGetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews);
void STDMETHODCALLTYPE HSGetShader(ID3D11HullShader** ppHullShader, ID3D11ClassInstance** ppClassInstances, UINT* pNumClassInstances);
void STDMETHODCALLTYPE HSGetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState** ppSamplers);
void STDMETHODCALLTYPE HSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers);
void STDMETHODCALLTYPE DSGetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews);
void STDMETHODCALLTYPE DSGetShader(ID3D11DomainShader** ppDomainShader, ID3D11ClassInstance** ppClassInstances, UINT* pNumClassInstances);
void STDMETHODCALLTYPE DSGetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState** ppSamplers);
void STDMETHODCALLTYPE DSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers);
void STDMETHODCALLTYPE CSGetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews);
void STDMETHODCALLTYPE CSGetUnorderedAccessViews(UINT StartSlot, UINT NumUAVs, ID3D11UnorderedAccessView** ppUnorderedAccessViews);
void STDMETHODCALLTYPE CSGetShader(ID3D11ComputeShader** ppComputeShader, ID3D11ClassInstance** ppClassInstances, UINT* pNumClassInstances);
void STDMETHODCALLTYPE CSGetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState** ppSamplers);
void STDMETHODCALLTYPE CSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers);
void STDMETHODCALLTYPE ClearState(void);
void STDMETHODCALLTYPE Flush(void);
D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE GetType(void);
UINT STDMETHODCALLTYPE GetContextFlags(void);
HRESULT STDMETHODCALLTYPE FinishCommandList(BOOL RestoreDeferredContextState, ID3D11CommandList** ppCommandList);
protected:
static _smart_ptr<CCryDXGLBlendState> CreateDefaultBlendState(CCryDXGLDevice* pDevice);
static _smart_ptr<CCryDXGLDepthStencilState> CreateDefaultDepthStencilState(CCryDXGLDevice* pDevice);
static _smart_ptr<CCryDXGLRasterizerState> CreateDefaultRasterizerState(CCryDXGLDevice* pDevice);
static _smart_ptr<CCryDXGLSamplerState> CreateDefaultSamplerState(CCryDXGLDevice* pDevice);
struct SStage
{
_smart_ptr<CCryDXGLShader> m_spShader;
_smart_ptr<CCryDXGLSamplerState> m_aspSamplerStates[D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT];
_smart_ptr<CCryDXGLShaderResourceView> m_aspShaderResourceViews[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT];
_smart_ptr<CCryDXGLBuffer> m_aspConstantBuffers[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT];
};
void SetShaderResources(uint32 uStage, UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews);
void SetShader(uint32 uStage, CCryDXGLShader* pShader, ID3D11ClassInstance* const* ppClassInstances, UINT NumClassInstances);
void SetSamplers(uint32 uStage, UINT StartSlot, UINT NumSamplers, ID3D11SamplerState* const* ppSamplers);
void SetConstantBuffers(uint32 uStage, UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers);
void GetShaderResources(uint32 uStage, UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews);
void GetShader(uint32 uStage, CCryDXGLShader** pShader, ID3D11ClassInstance** ppClassInstances, UINT* NumClassInstances);
void GetSamplers(uint32 uStage, UINT StartSlot, UINT NumSamplers, ID3D11SamplerState** ppSamplers);
void GetConstantBuffers(uint32 uStage, UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers);
protected:
NCryMetal::CContext* m_pContext;
_smart_ptr<CCryDXGLBlendState> m_spBlendState;
_smart_ptr<CCryDXGLDepthStencilState> m_spDepthStencilState;
_smart_ptr<CCryDXGLRasterizerState> m_spRasterizerState;
uint32 m_uStencilRef;
float m_auBlendFactor[4];
uint32 m_uSampleMask;
std::vector<SStage> m_kStages;
_smart_ptr<CCryDXGLBuffer> m_aspVertexBuffers[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
uint32 m_auVertexBufferStrides[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
uint32 m_auVertexBufferOffsets[D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
_smart_ptr<CCryDXGLInputLayout> m_spInputLayout;
_smart_ptr<CCryDXGLBuffer> m_spIndexBuffer;
DXGI_FORMAT m_eIndexBufferFormat;
uint32 m_uIndexBufferOffset;
D3D11_PRIMITIVE_TOPOLOGY m_ePrimitiveTopology;
_smart_ptr<CCryDXGLRenderTargetView> m_aspRenderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT];
_smart_ptr<CCryDXGLDepthStencilView> m_spDepthStencilView;
_smart_ptr<CCryDXGLUnorderedAccessView> m_aspCSUnorderedAccessViews[D3D11_1_UAV_SLOT_COUNT];
uint32 m_uNumViewports;
D3D11_VIEWPORT m_akViewports[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
uint32 m_uNumScissorRects;
D3D11_RECT m_akScissorRects[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
_smart_ptr<CCryDXGLQuery> m_spPredicate;
bool m_bPredicateValue;
_smart_ptr<CCryDXGLBuffer> m_aspStreamOutputBuffers[D3D11_SO_BUFFER_SLOT_COUNT];
uint32 m_auStreamOutputBufferOffsets[D3D11_SO_BUFFER_SLOT_COUNT];
_smart_ptr<CCryDXGLBlendState> m_spDefaultBlendState;
_smart_ptr<CCryDXGLDepthStencilState> m_spDefaultDepthStencilState;
_smart_ptr<CCryDXGLRasterizerState> m_spDefaultRasterizerState;
_smart_ptr<CCryDXGLSamplerState> m_spDefaultSamplerState;
};
#endif //__CRYMETALGLDEVICECONTEXT__
@@ -0,0 +1,135 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for IDXGIAdapter
#include "RenderDll_precompiled.h"
#include "CCryDXMETALDevice.hpp"
#include "CCryDXMETALGIFactory.hpp"
#include "CCryDXMETALGIOutput.hpp"
#include "../Implementation/MetalDevice.hpp"
CCryDXGLGIAdapter::CCryDXGLGIAdapter(CCryDXGLGIFactory* pFactory, NCryMetal::SAdapter* pGLAdapter)
: m_spGLAdapter(pGLAdapter)
, m_spFactory(pFactory)
{
DXGL_INITIALIZE_INTERFACE(DXGIAdapter)
DXGL_INITIALIZE_INTERFACE(DXGIAdapter1)
}
CCryDXGLGIAdapter::~CCryDXGLGIAdapter()
{
}
bool CCryDXGLGIAdapter::Initialize()
{
size_t uNumChars(mbstowcs(m_kDesc.Description, m_spGLAdapter->m_description.c_str(), DXGL_ARRAY_SIZE(m_kDesc.Description)));
memcpy(m_kDesc1.Description, m_kDesc.Description, sizeof(m_kDesc1.Description));
_smart_ptr<CCryDXGLGIOutput> spOutput(new CCryDXGLGIOutput());
if (!spOutput->Initialize())
{
return false;
}
m_kOutputs.push_back(spOutput);
DXGL_TODO("Detect from available extensions")
m_eSupportedFeatureLevel = D3D_FEATURE_LEVEL_11_0;
m_kDesc1.DedicatedVideoMemory = m_spGLAdapter->m_vramBytes;
return true;
}
D3D_FEATURE_LEVEL CCryDXGLGIAdapter::GetSupportedFeatureLevel()
{
return m_eSupportedFeatureLevel;
}
NCryMetal::SAdapter* CCryDXGLGIAdapter::GetGLAdapter()
{
return m_spGLAdapter.get();
}
////////////////////////////////////////////////////////////////////////////////
// IDXGIObject overrides
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLGIAdapter::GetParent(REFIID riid, void** ppParent)
{
IUnknown* pFactoryInterface;
CCryDXGLBase::ToInterface(&pFactoryInterface, m_spFactory);
if (pFactoryInterface->QueryInterface(riid, ppParent) == S_OK && ppParent != NULL)
{
return S_OK;
}
return CCryDXGLGIObject::GetParent(riid, ppParent);
}
////////////////////////////////////////////////////////////////////////////////
// IDXGIAdapter implementation
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLGIAdapter::EnumOutputs(UINT Output, IDXGIOutput** ppOutput)
{
if (Output >= m_kOutputs.size())
{
ppOutput = NULL;
return DXGI_ERROR_NOT_FOUND;
}
CCryDXGLGIOutput::ToInterface(ppOutput, m_kOutputs.at(Output));
(*ppOutput)->AddRef();
return S_OK;
}
HRESULT CCryDXGLGIAdapter::GetDesc(DXGI_ADAPTER_DESC* pDesc)
{
*pDesc = m_kDesc;
return S_OK;
}
HRESULT CCryDXGLGIAdapter::CheckInterfaceSupport(REFGUID InterfaceName, LARGE_INTEGER* pUMDVersion)
{
if (InterfaceName == __uuidof(ID3D10Device)
|| InterfaceName == __uuidof(ID3D11Device)
#if !DXGL_FULL_EMULATION
|| InterfaceName == __uuidof(CCryDXGLDevice)
#endif //!DXGL_FULL_EMULATION
)
{
if (pUMDVersion != NULL)
{
DXGL_TODO("Put useful data here");
pUMDVersion->HighPart = 0;
pUMDVersion->LowPart = 0;
}
return S_OK;
}
return E_FAIL;
}
////////////////////////////////////////////////////////////////////////////////
// IDXGIAdapter1 implementation
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLGIAdapter::GetDesc1(DXGI_ADAPTER_DESC1* pDesc)
{
*pDesc = m_kDesc1;
return S_OK;
}
@@ -0,0 +1,66 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for IDXGIAdapter
#ifndef __CRYMETALGLGIADAPTER__
#define __CRYMETALGLGIADAPTER__
#include "CCryDXMETALGIObject.hpp"
namespace NCryMetal
{
struct SAdapter;
}
class CCryDXGLGIFactory;
class CCryDXGLGIOutput;
class CCryDXGLGIAdapter
: public CCryDXGLGIObject
{
public:
#if DXGL_FULL_EMULATION
DXGL_IMPLEMENT_INTERFACE(CCryDXGLGIAdapter, DXGIAdapter)
#endif //DXGL_FULL_EMULATION
DXGL_IMPLEMENT_INTERFACE(CCryDXGLGIAdapter, DXGIAdapter1)
CCryDXGLGIAdapter(CCryDXGLGIFactory* pFactory, NCryMetal::SAdapter* pGLAdapter);
virtual ~CCryDXGLGIAdapter();
bool Initialize();
D3D_FEATURE_LEVEL GetSupportedFeatureLevel();
NCryMetal::SAdapter* GetGLAdapter();
// IDXGIObject overrides
HRESULT GetParent(REFIID riid, void** ppParent);
// IDXGIAdapter implementation
HRESULT EnumOutputs(UINT Output, IDXGIOutput** ppOutput);
HRESULT GetDesc(DXGI_ADAPTER_DESC* pDesc);
HRESULT CheckInterfaceSupport(REFGUID InterfaceName, LARGE_INTEGER* pUMDVersion);
// IDXGIAdapter1 implementation
HRESULT GetDesc1(DXGI_ADAPTER_DESC1* pDesc);
protected:
std::vector<_smart_ptr<CCryDXGLGIOutput> > m_kOutputs;
_smart_ptr<CCryDXGLGIFactory> m_spFactory;
_smart_ptr<NCryMetal::SAdapter> m_spGLAdapter;
DXGI_ADAPTER_DESC m_kDesc;
DXGI_ADAPTER_DESC1 m_kDesc1;
D3D_FEATURE_LEVEL m_eSupportedFeatureLevel;
};
#endif //__CRYMETALGLGIADAPTER__
@@ -0,0 +1,134 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for IDXGIFactory
#include "RenderDll_precompiled.h"
#include "CCryDXMETALDevice.hpp"
#include "CCryDXMETALGIFactory.hpp"
#include "CCryDXMETALSwapChain.hpp"
#include "../Interfaces/CCryDXMETALDevice.hpp"
#include "../Implementation/MetalDevice.hpp"
CCryDXGLGIFactory::CCryDXGLGIFactory()
{
DXGL_INITIALIZE_INTERFACE(DXGIFactory)
DXGL_INITIALIZE_INTERFACE(DXGIFactory1)
}
CCryDXGLGIFactory::~CCryDXGLGIFactory()
{
}
bool CCryDXGLGIFactory::Initialize()
{
std::vector<NCryMetal::SAdapterPtr> kAdapters;
if (!NCryMetal::DetectAdapters(kAdapters))
{
return false;
}
uint32 uAdapter;
for (uAdapter = 0; uAdapter < kAdapters.size(); ++uAdapter)
{
_smart_ptr<CCryDXGLGIAdapter> spAdapter(new CCryDXGLGIAdapter(this, kAdapters.at(uAdapter).get()));
if (!spAdapter->Initialize())
{
return false;
}
m_kAdapters.push_back(spAdapter);
}
return true;
}
template <typename AdapterInterface>
HRESULT EnumAdaptersInternal(UINT Adapter, AdapterInterface** ppAdapter, const std::vector<_smart_ptr<CCryDXGLGIAdapter> >& kAdapters)
{
if (Adapter < kAdapters.size())
{
CCryDXGLGIAdapter::ToInterface(ppAdapter, kAdapters.at(Adapter));
return S_OK;
}
*ppAdapter = NULL;
return DXGI_ERROR_NOT_FOUND;
}
////////////////////////////////////////////////////////////////////////////////
// IDXGIFactory implementation
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLGIFactory::EnumAdapters(UINT Adapter, IDXGIAdapter** ppAdapter)
{
return EnumAdaptersInternal(Adapter, ppAdapter, m_kAdapters);
}
HRESULT CCryDXGLGIFactory::MakeWindowAssociation(HWND WindowHandle, UINT Flags)
{
DXGL_TODO("Implement ALT+ENTER handling in OpenGL if required")
Flags;
m_hWindowHandle = WindowHandle;
return S_OK;
}
HRESULT CCryDXGLGIFactory::GetWindowAssociation(HWND* pWindowHandle)
{
*pWindowHandle = m_hWindowHandle;
return S_OK;
}
HRESULT CCryDXGLGIFactory::CreateSwapChain(IUnknown* pDevice, DXGI_SWAP_CHAIN_DESC* pDesc, IDXGISwapChain** ppSwapChain)
{
void* pvD3D11Device;
if (FAILED(pDevice->QueryInterface(__uuidof(ID3D11Device), &pvD3D11Device)) || pvD3D11Device == NULL)
{
DXGL_ERROR("CCryDXGLGIFactory::CreateSwapChain - device type is not compatible with swap chain creation");
return E_FAIL;
}
CCryDXGLDevice* pDXGLDevice(CCryDXGLDevice::FromInterface(static_cast<ID3D11Device*>(pvD3D11Device)));
_smart_ptr<CCryDXGLSwapChain> spSwapChain(new CCryDXGLSwapChain(pDXGLDevice, *pDesc));
if (!spSwapChain->Initialize())
{
return false;
}
CCryDXGLSwapChain::ToInterface(ppSwapChain, spSwapChain);
spSwapChain->AddRef();
return S_OK;
}
HRESULT CCryDXGLGIFactory::CreateSoftwareAdapter(HMODULE Module, IDXGIAdapter** ppAdapter)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
////////////////////////////////////////////////////////////////////////////////
// IDXGIFactory1 implementation
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLGIFactory::EnumAdapters1(UINT Adapter, IDXGIAdapter1** ppAdapter)
{
return EnumAdaptersInternal(Adapter, ppAdapter, m_kAdapters);
}
BOOL CCryDXGLGIFactory::IsCurrent()
{
DXGL_NOT_IMPLEMENTED
return false;
}
@@ -0,0 +1,55 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for IDXGIFactory
#ifndef __CRYMETALGLGIFACTORY__
#define __CRYMETALGLGIFACTORY__
#include "CCryDXMETALGIObject.hpp"
class CCryDXGLGIAdapter;
class CCryDXGLGIFactory
: public CCryDXGLGIObject
{
public:
#if DXGL_FULL_EMULATION
DXGL_IMPLEMENT_INTERFACE(CCryDXGLGIFactory, DXGIFactory)
#endif //DXGL_FULL_EMULATION
DXGL_IMPLEMENT_INTERFACE(CCryDXGLGIFactory, DXGIFactory1)
CCryDXGLGIFactory();
~CCryDXGLGIFactory();
bool Initialize();
// IDXGIFactory implementation
HRESULT STDMETHODCALLTYPE EnumAdapters(UINT Adapter, IDXGIAdapter** ppAdapter);
HRESULT STDMETHODCALLTYPE MakeWindowAssociation(HWND WindowHandle, UINT Flags);
HRESULT STDMETHODCALLTYPE GetWindowAssociation(HWND* pWindowHandle);
HRESULT STDMETHODCALLTYPE CreateSwapChain(IUnknown* pDevice, DXGI_SWAP_CHAIN_DESC* pDesc, IDXGISwapChain** ppSwapChain);
HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter(HMODULE Module, IDXGIAdapter** ppAdapter);
// IDXGIFactory1 implementation
HRESULT STDMETHODCALLTYPE EnumAdapters1(UINT Adapter, IDXGIAdapter1** ppAdapter);
BOOL STDMETHODCALLTYPE IsCurrent();
protected:
typedef std::vector<_smart_ptr<CCryDXGLGIAdapter> > Adapters;
protected:
// The adapters available on this system
Adapters m_kAdapters;
HWND m_hWindowHandle;
};
#endif //__CRYMETALGLGIFACTORY__
@@ -0,0 +1,56 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for IDXGIObject
#include "RenderDll_precompiled.h"
#include "CCryDXMETALGIObject.hpp"
#include "../Implementation/GLCommon.hpp"
CCryDXGLGIObject::CCryDXGLGIObject()
{
DXGL_INITIALIZE_INTERFACE(DXGIObject)
}
CCryDXGLGIObject::~CCryDXGLGIObject()
{
}
////////////////////////////////////////////////////////////////////////////////
// IDXGIObject implementation
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLGIObject::SetPrivateData(REFGUID Name, UINT DataSize, const void* pData)
{
return m_kPrivateDataContainer.SetPrivateData(Name, DataSize, pData);
}
HRESULT CCryDXGLGIObject::SetPrivateDataInterface(REFGUID Name, const IUnknown* pUnknown)
{
return m_kPrivateDataContainer.SetPrivateDataInterface(Name, pUnknown);
}
HRESULT CCryDXGLGIObject::GetPrivateData(REFGUID Name, UINT* pDataSize, void* pData)
{
return m_kPrivateDataContainer.GetPrivateData(Name, pDataSize, pData);
}
HRESULT CCryDXGLGIObject::GetParent(REFIID riid, void** ppParent)
{
DXGL_TODO("Implement if required")
* ppParent = NULL;
return E_FAIL;
}
@@ -0,0 +1,53 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for IDXGIObject
#ifndef __CRYMETALGLGIOBJECT__
#define __CRYMETALGLGIOBJECT__
#include "CCryDXMETALBase.hpp"
class CCryDXGLGIObject
: public CCryDXGLBase
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLGIObject, DXGIObject)
CCryDXGLGIObject();
virtual ~CCryDXGLGIObject();
// IDXGIObject implementation
HRESULT SetPrivateData(REFGUID Name, UINT DataSize, const void* pData);
HRESULT SetPrivateDataInterface(REFGUID Name, const IUnknown* pUnknown);
HRESULT GetPrivateData(REFGUID Name, UINT* pDataSize, void* pData);
HRESULT GetParent(REFIID riid, void** ppParent);
#if !DXGL_FULL_EMULATION
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject)
{
if (SingleInterface<CCryDXGLGIObject>::Query(this, riid, ppvObject))
{
return S_OK;
}
return CCryDXGLBase::QueryInterface(riid, ppvObject);
}
#endif //!DXGL_FULL_EMULATION
protected:
CCryDXGLPrivateDataContainer m_kPrivateDataContainer;
};
#endif //__CRYMETALGLGIOBJECT__
@@ -0,0 +1,111 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for IDXGIOutput
#include "RenderDll_precompiled.h"
#include "CCryDXMETALGIOutput.hpp"
#include "../Implementation/MetalDevice.hpp"
CCryDXGLGIOutput::CCryDXGLGIOutput()
{
DXGL_INITIALIZE_INTERFACE(DXGIOutput)
}
CCryDXGLGIOutput::~CCryDXGLGIOutput()
{
}
bool CCryDXGLGIOutput::Initialize()
{
ZeroMemory(&m_OutputDesc, sizeof(m_OutputDesc));
mbstowcs(m_OutputDesc.DeviceName, "Metal Device", DXGL_ARRAY_SIZE(m_OutputDesc.DeviceName));
return true;
}
////////////////////////////////////////////////////////////////////////////////
// IDXGIOutput implementation
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLGIOutput::GetDesc(DXGI_OUTPUT_DESC* pDesc)
{
*pDesc = m_OutputDesc;
return S_OK;
}
HRESULT CCryDXGLGIOutput::GetDisplayModeList(DXGI_FORMAT EnumFormat, UINT Flags, UINT* pNumModes, DXGI_MODE_DESC* pDesc)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLGIOutput::FindClosestMatchingMode(const DXGI_MODE_DESC* pModeToMatch, DXGI_MODE_DESC* pClosestMatch, IUnknown* pConcernedDevice)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLGIOutput::WaitForVBlank(void)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLGIOutput::TakeOwnership(IUnknown* pDevice, BOOL Exclusive)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
void CCryDXGLGIOutput::ReleaseOwnership(void)
{
DXGL_NOT_IMPLEMENTED
}
HRESULT CCryDXGLGIOutput::GetGammaControlCapabilities(DXGI_GAMMA_CONTROL_CAPABILITIES* pGammaCaps)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLGIOutput::SetGammaControl(const DXGI_GAMMA_CONTROL* pArray)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLGIOutput::GetGammaControl(DXGI_GAMMA_CONTROL* pArray)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLGIOutput::SetDisplaySurface(IDXGISurface* pScanoutSurface)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLGIOutput::GetDisplaySurfaceData(IDXGISurface* pDestination)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLGIOutput::GetFrameStatistics(DXGI_FRAME_STATISTICS* pStats)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
@@ -0,0 +1,51 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for IDXGIOutput
#ifndef __CRYMETALGLGIOUTPUT__
#define __CRYMETALGLGIOUTPUT__
#include "CCryDXMETALGIObject.hpp"
class CCryDXGLGIOutput
: public CCryDXGLGIObject
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLGIOutput, DXGIOutput)
CCryDXGLGIOutput();
virtual ~CCryDXGLGIOutput();
bool Initialize();
// IDXGIOutput implementation
HRESULT GetDesc(DXGI_OUTPUT_DESC* pDesc);
HRESULT GetDisplayModeList(DXGI_FORMAT EnumFormat, UINT Flags, UINT* pNumModes, DXGI_MODE_DESC* pDesc);
HRESULT FindClosestMatchingMode(const DXGI_MODE_DESC* pModeToMatch, DXGI_MODE_DESC* pClosestMatch, IUnknown* pConcernedDevice);
HRESULT WaitForVBlank(void);
HRESULT TakeOwnership(IUnknown* pDevice, BOOL Exclusive);
void ReleaseOwnership(void);
HRESULT GetGammaControlCapabilities(DXGI_GAMMA_CONTROL_CAPABILITIES* pGammaCaps);
HRESULT SetGammaControl(const DXGI_GAMMA_CONTROL* pArray);
HRESULT GetGammaControl(DXGI_GAMMA_CONTROL* pArray);
HRESULT SetDisplaySurface(IDXGISurface* pScanoutSurface);
HRESULT GetDisplaySurfaceData(IDXGISurface* pDestination);
HRESULT GetFrameStatistics(DXGI_FRAME_STATISTICS* pStats);
protected:
DXGI_OUTPUT_DESC m_OutputDesc;
};
#endif //__CRYMETALGLGIOUTPUT__
@@ -0,0 +1,36 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11InputLayout
#include "RenderDll_precompiled.h"
#include "CCryDXMETALInputLayout.hpp"
#include "../Implementation/GLShader.hpp"
CCryDXGLInputLayout::CCryDXGLInputLayout(NCryMetal::SInputLayout* pGLLayout, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_spGLLayout(pGLLayout)
{
DXGL_INITIALIZE_INTERFACE(D3D11InputLayout)
}
CCryDXGLInputLayout::~CCryDXGLInputLayout()
{
}
NCryMetal::SInputLayout* CCryDXGLInputLayout::GetGLLayout()
{
return m_spGLLayout;
}
@@ -0,0 +1,41 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11InputLayout
#ifndef __CRYMETALGLINPUTLAYOUT__
#define __CRYMETALGLINPUTLAYOUT__
#include "CCryDXMETALDeviceChild.hpp"
namespace NCryMetal
{
struct SInputLayout;
}
class CCryDXGLInputLayout
: public CCryDXGLDeviceChild
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLInputLayout, D3D11InputLayout)
CCryDXGLInputLayout(NCryMetal::SInputLayout* pGLLayout, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLInputLayout();
NCryMetal::SInputLayout* GetGLLayout();
private:
_smart_ptr<NCryMetal::SInputLayout> m_spGLLayout;
};
#endif //__CRYMETALGLINPUTLAYOUT__
@@ -0,0 +1,58 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11Query
#include "RenderDll_precompiled.h"
#include "CCryDXMETALQuery.hpp"
#include "../Implementation/GLResource.hpp"
CCryDXGLQuery::CCryDXGLQuery(const D3D11_QUERY_DESC& kDesc, NCryMetal::SQuery* pGLQuery, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_kDesc(kDesc)
, m_spGLQuery(pGLQuery)
{
DXGL_INITIALIZE_INTERFACE(D3D11Asynchronous)
DXGL_INITIALIZE_INTERFACE(D3D11Query)
}
CCryDXGLQuery::~CCryDXGLQuery()
{
}
NCryMetal::SQuery* CCryDXGLQuery::GetGLQuery()
{
return m_spGLQuery;
}
////////////////////////////////////////////////////////////////////////////////
// ID3D11Asynchronous implementation
////////////////////////////////////////////////////////////////////////////////
UINT CCryDXGLQuery::GetDataSize(void)
{
return m_spGLQuery->GetDataSize();
}
////////////////////////////////////////////////////////////////////////////////
// ID3D11Query implementation
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLQuery::GetDesc(D3D11_QUERY_DESC* pDesc)
{
(*pDesc) = m_kDesc;
}
@@ -0,0 +1,62 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11Query
#ifndef __CRYMETALGLQUERY__
#define __CRYMETALGLQUERY__
#include "CCryDXMETALDeviceChild.hpp"
namespace NCryMetal
{
struct SQuery;
}
class CCryDXGLQuery
: public CCryDXGLDeviceChild
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLQuery, D3D11Query)
#if DXGL_FULL_EMULATION
DXGL_IMPLEMENT_INTERFACE(CCryDXGLQuery, D3D11Asynchronous)
#endif //DXGL_FULL_EMULATION
CCryDXGLQuery(const D3D11_QUERY_DESC& kDesc, NCryMetal::SQuery* pGLQuery, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLQuery();
NCryMetal::SQuery* GetGLQuery();
// ID3D11Asynchronous implementation
UINT GetDataSize(void);
// ID3D11Query implementation
void GetDesc(D3D11_QUERY_DESC* pDesc);
#if !DXGL_FULL_EMULATION
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject)
{
if (SingleInterface<CCryDXGLQuery>::Query(this, riid, ppvObject))
{
return S_OK;
}
return CCryDXGLDeviceChild::QueryInterface(riid, ppvObject);
}
#endif //!DXGL_FULL_EMULATION
private:
D3D11_QUERY_DESC m_kDesc;
_smart_ptr<NCryMetal::SQuery> m_spGLQuery;
};
#endif //__CRYMETALGLQUERY__
@@ -0,0 +1,55 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11RasterizerState
#include "RenderDll_precompiled.h"
#include "CCryDXMETALRasterizerState.hpp"
#include "CCryDXMETALDevice.hpp"
#include "../Implementation/GLState.hpp"
#include "../Implementation/MetalDevice.hpp"
CCryDXGLRasterizerState::CCryDXGLRasterizerState(const D3D11_RASTERIZER_DESC& kDesc, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_kDesc(kDesc)
, m_pGLState(new NCryMetal::SRasterizerState)
{
DXGL_INITIALIZE_INTERFACE(D3D11RasterizerState)
}
CCryDXGLRasterizerState::~CCryDXGLRasterizerState()
{
delete m_pGLState;
}
bool CCryDXGLRasterizerState::Initialize(CCryDXGLDevice* pDevice)
{
return NCryMetal::InitializeRasterizerState(m_kDesc, *m_pGLState, pDevice->GetGLDevice());
}
bool CCryDXGLRasterizerState::Apply(NCryMetal::CContext* pContext)
{
return pContext->SetRasterizerState(*m_pGLState);
}
////////////////////////////////////////////////////////////////////////////////
// Implementation of ID3D11RasterizerState
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLRasterizerState::GetDesc(D3D11_RASTERIZER_DESC* pDesc)
{
(*pDesc) = m_kDesc;
}
@@ -0,0 +1,47 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11RasterizerState
#ifndef __CRYMETALGLRASTERIZERSTATE__
#define __CRYMETALGLRASTERIZERSTATE__
#include "CCryDXMETALDeviceChild.hpp"
namespace NCryMetal
{
struct SRasterizerState;
class CContext;
};
class CCryDXGLRasterizerState
: public CCryDXGLDeviceChild
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLRasterizerState, D3D11RasterizerState)
CCryDXGLRasterizerState(const D3D11_RASTERIZER_DESC& kDesc, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLRasterizerState();
bool Initialize(CCryDXGLDevice* pDevice);
bool Apply(NCryMetal::CContext* pContext);
// Implementation of ID3D11RasterizerState
void GetDesc(D3D11_RASTERIZER_DESC* pDesc);
protected:
D3D11_RASTERIZER_DESC m_kDesc;
NCryMetal::SRasterizerState* m_pGLState;
};
#endif //__CRYMETALGLRASTERIZERSTATE__
@@ -0,0 +1,57 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11RenderTargetView
#include "RenderDll_precompiled.h"
#include "CCryDXMETALDevice.hpp"
#include "CCryDXMETALRenderTargetView.hpp"
#include "CCryDXMETALResource.hpp"
#include "../Implementation/MetalDevice.hpp"
#include "../Implementation/GLResource.hpp"
CCryDXGLRenderTargetView::CCryDXGLRenderTargetView(CCryDXGLResource* pResource, const D3D11_RENDER_TARGET_VIEW_DESC& kDesc, CCryDXGLDevice* pDevice)
: CCryDXGLView(pResource, pDevice)
, m_kDesc(kDesc)
{
DXGL_INITIALIZE_INTERFACE(D3D11RenderTargetView)
}
CCryDXGLRenderTargetView::~CCryDXGLRenderTargetView()
{
}
bool CCryDXGLRenderTargetView::Initialize(NCryMetal::CDevice* pDevice)
{
D3D11_RESOURCE_DIMENSION eDimension;
m_spResource->GetType(&eDimension);
m_spGLView = NCryMetal::CreateRenderTargetView(m_spResource->GetGLResource(), eDimension, m_kDesc, pDevice);
return m_spGLView != NULL;
}
NCryMetal::SOutputMergerView* CCryDXGLRenderTargetView::GetGLView()
{
return m_spGLView;
}
////////////////////////////////////////////////////////////////
// Implementation of ID3D11RenderTargetView
////////////////////////////////////////////////////////////////
void CCryDXGLRenderTargetView::GetDesc(D3D11_RENDER_TARGET_VIEW_DESC* pDesc)
{
(*pDesc) = m_kDesc;
}
@@ -0,0 +1,47 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11RenderTargetView
#ifndef __CRYMETALGLRENDERTARGETVIEW__
#define __CRYMETALGLRENDERTARGETVIEW__
#include "CCryDXMETALView.hpp"
namespace NCryMetal
{
struct SOutputMergerView;
class CContext;
}
class CCryDXGLRenderTargetView
: public CCryDXGLView
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLRenderTargetView, D3D11RenderTargetView)
CCryDXGLRenderTargetView(CCryDXGLResource* pResource, const D3D11_RENDER_TARGET_VIEW_DESC& kDesc, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLRenderTargetView();
bool Initialize(NCryMetal::CDevice* pDevice);
NCryMetal::SOutputMergerView* GetGLView();
// Implementation of ID3D11RenderTargetView
void GetDesc(D3D11_RENDER_TARGET_VIEW_DESC* pDesc);
private:
D3D11_RENDER_TARGET_VIEW_DESC m_kDesc;
_smart_ptr<NCryMetal::SOutputMergerView> m_spGLView;
};
#endif //__CRYMETALGLRENDERTARGETVIEW__
@@ -0,0 +1,57 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11Resource
#include "RenderDll_precompiled.h"
#include "CCryDXMETALResource.hpp"
#include "../Implementation/GLResource.hpp"
CCryDXGLResource::CCryDXGLResource(D3D11_RESOURCE_DIMENSION eDimension, NCryMetal::SResource* pGLResource, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_spGLResource(pGLResource)
, m_eDimension(eDimension)
{
DXGL_INITIALIZE_INTERFACE(D3D11Resource)
}
CCryDXGLResource::~CCryDXGLResource()
{
}
NCryMetal::SResource* CCryDXGLResource::GetGLResource()
{
return m_spGLResource;
}
////////////////////////////////////////////////////////////////////////////////
// Implementation of ID3D11Resource
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLResource::GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension)
{
*pResourceDimension = m_eDimension;
}
void CCryDXGLResource::SetEvictionPriority(UINT EvictionPriority)
{
DXGL_NOT_IMPLEMENTED
}
UINT CCryDXGLResource::GetEvictionPriority(void)
{
DXGL_NOT_IMPLEMENTED
return 0;
}
@@ -0,0 +1,60 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11Resource
#ifndef __CRYMETALGLRESOURCE__
#define __CRYMETALGLRESOURCE__
#include "CCryDXMETALDeviceChild.hpp"
namespace NCryMetal
{
class CDevice;
struct SResource;
};
class CCryDXGLResource
: public CCryDXGLDeviceChild
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLResource, D3D11Resource)
virtual ~CCryDXGLResource();
NCryMetal::SResource* GetGLResource();
// Implementation of ID3D11Resource
void GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension);
void SetEvictionPriority(UINT EvictionPriority);
UINT GetEvictionPriority(void);
#if !DXGL_FULL_EMULATION
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject)
{
if (SingleInterface<CCryDXGLResource>::Query(this, riid, ppvObject))
{
return S_OK;
}
return CCryDXGLDeviceChild::QueryInterface(riid, ppvObject);
}
#endif //!DXGL_FULL_EMULATION
protected:
CCryDXGLResource(D3D11_RESOURCE_DIMENSION eDimension, NCryMetal::SResource* pResource, CCryDXGLDevice* pDevice);
protected:
_smart_ptr<NCryMetal::SResource> m_spGLResource;
D3D11_RESOURCE_DIMENSION m_eDimension;
};
#endif //__CRYMETALGLRESOURCE__
@@ -0,0 +1,80 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11SamplerState
#include "RenderDll_precompiled.h"
#include "CCryDXMETALSamplerState.hpp"
#include "CCryDXMETALDevice.hpp"
#include "../Implementation/GLState.hpp"
#include "../Implementation/MetalDevice.hpp"
CCryDXGLSamplerState::CCryDXGLSamplerState(const D3D11_SAMPLER_DESC& kDesc, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_kDesc(kDesc)
, m_MetalSamplerState(nil)
, m_MetalSamplerDescriptor(nil)
{
DXGL_INITIALIZE_INTERFACE(D3D11SamplerState)
}
CCryDXGLSamplerState::~CCryDXGLSamplerState()
{
if (m_MetalSamplerDescriptor)
{
[m_MetalSamplerDescriptor release];
m_MetalSamplerDescriptor = nil;
}
if (m_MetalSamplerState)
{
[m_MetalSamplerState release];
m_MetalSamplerState = nil;
}
}
bool CCryDXGLSamplerState::Initialize(CCryDXGLDevice* pDevice)
{
m_pDevice = pDevice;
m_MetalSamplerDescriptor = [[MTLSamplerDescriptor alloc] init];
return NCryMetal::InitializeSamplerState(m_kDesc, m_MetalSamplerState, m_MetalSamplerDescriptor, pDevice->GetGLDevice());
}
void CCryDXGLSamplerState::Apply(uint32 uStage, uint32 uSlot, NCryMetal::CContext* pContext)
{
pContext->SetSampler(m_MetalSamplerState, uStage, uSlot);
}
void CCryDXGLSamplerState::SetLodMinClamp(float lodMinClamp)
{
//You can either release the MTLSamplerDescriptor object or modify its property values and reuse it to create more MTLSamplerState objects.
//The descriptor's properties are only used during object creation; once created the behavior of a sampler state object is fixed and cannot be changed.
//Hence we delete the old sampler state and create a new one if any property needs to be changed.
if (m_MetalSamplerState)
{
[m_MetalSamplerState release];
m_MetalSamplerState = nil;
}
NCryMetal::SetLodMinClamp(m_MetalSamplerState, m_MetalSamplerDescriptor, lodMinClamp, m_pDevice->GetGLDevice());
}
////////////////////////////////////////////////////////////////
// Implementation of ID3D11SamplerState
////////////////////////////////////////////////////////////////
void CCryDXGLSamplerState::GetDesc(D3D11_SAMPLER_DESC* pDesc)
{
(*pDesc) = m_kDesc;
}
@@ -0,0 +1,54 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11SamplerState
#ifndef __CRYMETALGLSAMPLERSTATE__
#define __CRYMETALGLSAMPLERSTATE__
#include "CCryDXMETALDeviceChild.hpp"
@protocol MTLSamplerState;
#import <Metal/MTLSampler.h>
namespace NCryMetal
{
struct SSamplerState;
class CContext;
}
class CCryDXGLSamplerState
: public CCryDXGLDeviceChild
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLSamplerState, D3D11SamplerState)
CCryDXGLSamplerState(const D3D11_SAMPLER_DESC& kDesc, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLSamplerState();
bool Initialize(CCryDXGLDevice* pDevice);
void Apply(uint32 uStage, uint32 uSlot, NCryMetal::CContext* pContext);
void SetLodMinClamp(float lodMinClamp);
void GetDesc(D3D11_SAMPLER_DESC* pDesc);
protected:
D3D11_SAMPLER_DESC m_kDesc;
id<MTLSamplerState> m_MetalSamplerState;
MTLSamplerDescriptor* m_MetalSamplerDescriptor;
CCryDXGLDevice* m_pDevice;
};
#endif //__CRYMETALGLSAMPLERSTATE__
@@ -0,0 +1,34 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for D3D11 shader interfaces
#include "RenderDll_precompiled.h"
#include "CCryDXMETALShader.hpp"
#include "../Implementation/GLShader.hpp"
CCryDXGLShader::CCryDXGLShader(NCryMetal::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_spGLShader(pGLShader)
{
}
CCryDXGLShader::~CCryDXGLShader()
{
}
NCryMetal::SShader* CCryDXGLShader::GetGLShader()
{
return m_spGLShader.get();
}
@@ -0,0 +1,117 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for D3D11 shader interfaces
#ifndef __CRYMETALGLSHADER__
#define __CRYMETALGLSHADER__
#include "CCryDXMETALDeviceChild.hpp"
namespace NCryMetal
{
struct SShader;
}
class CCryDXGLShader
: public CCryDXGLDeviceChild
{
public:
CCryDXGLShader(NCryMetal::SShader* pGLShader, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLShader();
NCryMetal::SShader* GetGLShader();
private:
_smart_ptr<NCryMetal::SShader> m_spGLShader;
};
class CCryDXGLVertexShader
: public CCryDXGLShader
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLVertexShader, D3D11VertexShader)
CCryDXGLVertexShader(NCryMetal::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLShader(pGLShader, pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11VertexShader)
}
};
class CCryDXGLHullShader
: public CCryDXGLShader
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLHullShader, D3D11HullShader)
CCryDXGLHullShader(NCryMetal::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLShader(pGLShader, pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11HullShader)
}
};
class CCryDXGLDomainShader
: public CCryDXGLShader
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLDomainShader, D3D11DomainShader)
CCryDXGLDomainShader(NCryMetal::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLShader(pGLShader, pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11DomainShader)
}
};
class CCryDXGLGeometryShader
: public CCryDXGLShader
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLGeometryShader, D3D11GeometryShader)
CCryDXGLGeometryShader(NCryMetal::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLShader(pGLShader, pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11GeometryShader)
}
};
class CCryDXGLPixelShader
: public CCryDXGLShader
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLPixelShader, D3D11PixelShader)
CCryDXGLPixelShader(NCryMetal::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLShader(pGLShader, pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11PixelShader)
}
};
class CCryDXGLComputeShader
: public CCryDXGLShader
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLComputeShader, D3D11ComputeShader)
CCryDXGLComputeShader(NCryMetal::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLShader(pGLShader, pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11ComputeShader)
}
};
#endif //__CRYMETALGLSHADER__
@@ -0,0 +1,428 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrappers for D3D11 shader
// reflection interfaces
#include "RenderDll_precompiled.h"
#include "CCryDXMETALDeviceContext.hpp"
#include "../Implementation/GLShader.hpp"
////////////////////////////////////////////////////////////////////////////////
// CCryDXGLShaderReflectionVariable
////////////////////////////////////////////////////////////////////////////////
struct CCryDXGLShaderReflectionVariable::Impl
{
NCryMetal::SShaderReflectionVariable* m_pVariable;
};
CCryDXGLShaderReflectionVariable::CCryDXGLShaderReflectionVariable()
: m_pImpl(new Impl())
{
DXGL_INITIALIZE_INTERFACE(D3D11ShaderReflectionVariable)
DXGL_INITIALIZE_INTERFACE(D3D11ShaderReflectionType)
}
CCryDXGLShaderReflectionVariable::~CCryDXGLShaderReflectionVariable()
{
delete m_pImpl;
}
bool CCryDXGLShaderReflectionVariable::Initialize(void* pvData)
{
m_pImpl->m_pVariable = static_cast<NCryMetal::SShaderReflectionVariable*>(pvData);
return true;
}
#define _REFLECTION_IMPL m_pImpl->m_pVariable
HRESULT CCryDXGLShaderReflectionVariable::GetDesc(D3D11_SHADER_VARIABLE_DESC* pDesc)
{
(*pDesc) = _REFLECTION_IMPL->m_kDesc;
return S_OK;
}
ID3D11ShaderReflectionType* CCryDXGLShaderReflectionVariable::GetType()
{
ID3D11ShaderReflectionType* pType;
ToInterface(&pType, this);
return pType;
}
ID3D11ShaderReflectionConstantBuffer* CCryDXGLShaderReflectionVariable::GetBuffer()
{
DXGL_NOT_IMPLEMENTED
return NULL;
}
UINT CCryDXGLShaderReflectionVariable::GetInterfaceSlot(UINT uArrayIndex)
{
DXGL_NOT_IMPLEMENTED
return 0;
}
HRESULT CCryDXGLShaderReflectionVariable::GetDesc(D3D11_SHADER_TYPE_DESC* pDesc)
{
(*pDesc) = _REFLECTION_IMPL->m_kType;
return S_OK;
}
ID3D11ShaderReflectionType* CCryDXGLShaderReflectionVariable::GetMemberTypeByIndex(UINT Index)
{
DXGL_NOT_IMPLEMENTED
return NULL;
}
ID3D11ShaderReflectionType* CCryDXGLShaderReflectionVariable::GetMemberTypeByName(LPCSTR Name)
{
DXGL_NOT_IMPLEMENTED
return NULL;
}
LPCSTR CCryDXGLShaderReflectionVariable::GetMemberTypeName(UINT Index)
{
DXGL_NOT_IMPLEMENTED
return NULL;
}
HRESULT CCryDXGLShaderReflectionVariable::IsEqual(ID3D11ShaderReflectionType* pType)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
ID3D11ShaderReflectionType* CCryDXGLShaderReflectionVariable::GetSubType()
{
DXGL_NOT_IMPLEMENTED
return NULL;
}
ID3D11ShaderReflectionType* CCryDXGLShaderReflectionVariable::GetBaseClass()
{
DXGL_NOT_IMPLEMENTED
return NULL;
}
UINT CCryDXGLShaderReflectionVariable::GetNumInterfaces()
{
DXGL_NOT_IMPLEMENTED
return 0;
}
ID3D11ShaderReflectionType* CCryDXGLShaderReflectionVariable::GetInterfaceByIndex(UINT uIndex)
{
DXGL_NOT_IMPLEMENTED
return NULL;
}
HRESULT CCryDXGLShaderReflectionVariable::IsOfType(ID3D11ShaderReflectionType* pType)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
HRESULT CCryDXGLShaderReflectionVariable::ImplementsInterface(ID3D11ShaderReflectionType* pBase)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
#undef _REFLECTION_IMPL
////////////////////////////////////////////////////////////////////////////////
// CCryDXGLShaderReflectionConstBuffer
////////////////////////////////////////////////////////////////////////////////
struct CCryDXGLShaderReflectionConstBuffer::Impl
{
typedef std::vector<_smart_ptr<CCryDXGLShaderReflectionVariable> > TVariables;
TVariables m_kVariables;
NCryMetal::SShaderReflectionConstBuffer* m_pConstBuffer;
};
CCryDXGLShaderReflectionConstBuffer::CCryDXGLShaderReflectionConstBuffer()
: m_pImpl(new Impl())
{
DXGL_INITIALIZE_INTERFACE(D3D11ShaderReflectionConstantBuffer)
}
CCryDXGLShaderReflectionConstBuffer::~CCryDXGLShaderReflectionConstBuffer()
{
delete m_pImpl;
}
bool CCryDXGLShaderReflectionConstBuffer::Initialize(void* pvData)
{
m_pImpl->m_pConstBuffer = static_cast<NCryMetal::SShaderReflectionConstBuffer*>(pvData);
NCryMetal::SShaderReflectionConstBuffer::TVariables::iterator kVarIter(m_pImpl->m_pConstBuffer->m_kVariables.begin());
const NCryMetal::SShaderReflectionConstBuffer::TVariables::iterator kVarEnd(m_pImpl->m_pConstBuffer->m_kVariables.end());
while (kVarIter != kVarEnd)
{
_smart_ptr<CCryDXGLShaderReflectionVariable> spVariable(new CCryDXGLShaderReflectionVariable());
m_pImpl->m_kVariables.push_back(spVariable);
if (!spVariable->Initialize(static_cast<void*>(&*kVarIter)))
{
return false;
}
++kVarIter;
}
return true;
}
#define _REFLECTION_IMPL m_pImpl->m_pConstBuffer
HRESULT CCryDXGLShaderReflectionConstBuffer::GetDesc(D3D11_SHADER_BUFFER_DESC* pDesc)
{
(*pDesc) = _REFLECTION_IMPL->m_kDesc;
return S_OK;
}
ID3D11ShaderReflectionVariable* CCryDXGLShaderReflectionConstBuffer::GetVariableByIndex(UINT Index)
{
if (Index >= m_pImpl->m_kVariables.size())
{
return NULL;
}
ID3D11ShaderReflectionVariable* pVariable;
CCryDXGLShaderReflectionVariable::ToInterface(&pVariable, m_pImpl->m_kVariables.at(Index));
return pVariable;
}
ID3D11ShaderReflectionVariable* CCryDXGLShaderReflectionConstBuffer::GetVariableByName(LPCSTR Name)
{
Impl::TVariables::const_iterator kVarIter(m_pImpl->m_kVariables.begin());
const Impl::TVariables::const_iterator kVarEnd(m_pImpl->m_kVariables.end());
for (; kVarIter != kVarEnd; ++kVarIter)
{
D3D11_SHADER_VARIABLE_DESC kDesc;
if (FAILED((*kVarIter)->GetDesc(&kDesc)))
{
return NULL;
}
if (strcmp(kDesc.Name, Name) == 0)
{
ID3D11ShaderReflectionVariable* pVariable;
CCryDXGLShaderReflectionVariable::ToInterface(&pVariable, kVarIter->get());
return pVariable;
}
}
return NULL;
}
#undef _REFLECTION_IMPL
////////////////////////////////////////////////////////////////////////////////
// CCryDXGLShaderReflection
////////////////////////////////////////////////////////////////////////////////
struct CCryDXGLShaderReflection::Impl
{
struct SResource
{
NCryMetal::SShaderReflectionResource* m_pResource;
};
struct SParameter
{
NCryMetal::SShaderReflectionParameter* m_pParameter;
};
typedef std::vector<_smart_ptr<CCryDXGLShaderReflectionConstBuffer> > TConstantBuffers;
TConstantBuffers m_kConstantBuffers;
NCryMetal::SShaderReflection m_kReflection;
};
CCryDXGLShaderReflection::CCryDXGLShaderReflection()
: m_pImpl(new Impl())
{
DXGL_INITIALIZE_INTERFACE(D3D11ShaderReflection)
}
CCryDXGLShaderReflection::~CCryDXGLShaderReflection()
{
delete m_pImpl;
}
bool CCryDXGLShaderReflection::Initialize(const void* pvData)
{
if (!InitializeShaderReflection(&m_pImpl->m_kReflection, pvData))
{
return false;
}
NCryMetal::SShaderReflection::TConstantBuffers::iterator kConstBufferIter(m_pImpl->m_kReflection.m_kConstantBuffers.begin());
const NCryMetal::SShaderReflection::TConstantBuffers::iterator kConstBufferEnd(m_pImpl->m_kReflection.m_kConstantBuffers.end());
while (kConstBufferIter != kConstBufferEnd)
{
_smart_ptr<CCryDXGLShaderReflectionConstBuffer> spConstBuffer(new CCryDXGLShaderReflectionConstBuffer());
if (!spConstBuffer->Initialize(static_cast<void*>(&*kConstBufferIter)))
{
return false;
}
m_pImpl->m_kConstantBuffers.push_back(spConstBuffer);
++kConstBufferIter;
}
return true;
}
#define _REFLECTION_IMPL (&m_pImpl->m_kReflection)
HRESULT CCryDXGLShaderReflection::GetDesc(D3D11_SHADER_DESC* pDesc)
{
(*pDesc) = _REFLECTION_IMPL->m_kDesc;
return S_OK;
}
ID3D11ShaderReflectionConstantBuffer* CCryDXGLShaderReflection::GetConstantBufferByIndex(UINT Index)
{
if (Index >= m_pImpl->m_kConstantBuffers.size())
{
return NULL;
}
ID3D11ShaderReflectionConstantBuffer* pConstantBuffer;
CCryDXGLShaderReflectionConstBuffer::ToInterface(&pConstantBuffer, m_pImpl->m_kConstantBuffers.at(Index));
return pConstantBuffer;
}
ID3D11ShaderReflectionConstantBuffer* CCryDXGLShaderReflection::GetConstantBufferByName(LPCSTR Name)
{
Impl::TConstantBuffers::const_iterator kCBIter(m_pImpl->m_kConstantBuffers.begin());
const Impl::TConstantBuffers::const_iterator kCBEnd(m_pImpl->m_kConstantBuffers.end());
for (; kCBIter != kCBEnd; ++kCBIter)
{
D3D11_SHADER_BUFFER_DESC kDesc;
if (FAILED((*kCBIter)->GetDesc(&kDesc)))
{
return NULL;
}
if (strcmp(kDesc.Name, Name) == 0)
{
ID3D11ShaderReflectionConstantBuffer* pConstantBuffer;
CCryDXGLShaderReflectionConstBuffer::ToInterface(&pConstantBuffer, kCBIter->get());
return pConstantBuffer;
}
}
return NULL;
}
HRESULT CCryDXGLShaderReflection::GetResourceBindingDesc(UINT ResourceIndex, D3D11_SHADER_INPUT_BIND_DESC* pDesc)
{
if (ResourceIndex >= _REFLECTION_IMPL->m_kResources.size())
{
return E_FAIL;
}
*pDesc = _REFLECTION_IMPL->m_kResources[ResourceIndex].m_kDesc;
return S_OK;
}
HRESULT CCryDXGLShaderReflection::GetInputParameterDesc(UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc)
{
if (ParameterIndex >= _REFLECTION_IMPL->m_kInputs.size())
{
return E_FAIL;
}
*pDesc = _REFLECTION_IMPL->m_kInputs[ParameterIndex].m_kDesc;
return S_OK;
}
HRESULT CCryDXGLShaderReflection::GetOutputParameterDesc(UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc)
{
if (ParameterIndex >= _REFLECTION_IMPL->m_kOutputs.size())
{
return E_FAIL;
}
*pDesc = _REFLECTION_IMPL->m_kOutputs[ParameterIndex].m_kDesc;
return S_OK;
}
HRESULT CCryDXGLShaderReflection::GetPatchConstantParameterDesc(UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
ID3D11ShaderReflectionVariable* CCryDXGLShaderReflection::GetVariableByName(LPCSTR Name)
{
DXGL_NOT_IMPLEMENTED
return NULL;
}
HRESULT CCryDXGLShaderReflection::GetResourceBindingDescByName(LPCSTR Name, D3D11_SHADER_INPUT_BIND_DESC* pDesc)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
UINT CCryDXGLShaderReflection::GetMovInstructionCount()
{
DXGL_NOT_IMPLEMENTED
return 0;
}
UINT CCryDXGLShaderReflection::GetMovcInstructionCount()
{
DXGL_NOT_IMPLEMENTED
return 0;
}
UINT CCryDXGLShaderReflection::GetConversionInstructionCount()
{
DXGL_NOT_IMPLEMENTED
return 0;
}
UINT CCryDXGLShaderReflection::GetBitwiseInstructionCount()
{
DXGL_NOT_IMPLEMENTED
return 0;
}
D3D_PRIMITIVE CCryDXGLShaderReflection::GetGSInputPrimitive()
{
DXGL_NOT_IMPLEMENTED
return D3D_PRIMITIVE_TRIANGLE;
}
BOOL CCryDXGLShaderReflection::IsSampleFrequencyShader()
{
DXGL_NOT_IMPLEMENTED
return FALSE;
}
UINT CCryDXGLShaderReflection::GetNumInterfaceSlots()
{
DXGL_NOT_IMPLEMENTED
return 0;
}
HRESULT CCryDXGLShaderReflection::GetMinFeatureLevel(enum D3D_FEATURE_LEVEL* pLevel)
{
DXGL_NOT_IMPLEMENTED
return E_FAIL;
}
UINT CCryDXGLShaderReflection::GetThreadGroupSize(UINT* pSizeX, UINT* pSizeY, UINT* pSizeZ)
{
DXGL_NOT_IMPLEMENTED
return 0;
}
#undef _REFLECTION_IMPL
@@ -0,0 +1,130 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrappers for D3D11 shader
// reflection interfaces
#ifndef __CRYMETALGLSHADERREFLECTION__
#define __CRYMETALGLSHADERREFLECTION__
#include "CCryDXMETALBase.hpp"
////////////////////////////////////////////////////////////////////////////////
// CCryDXGLShaderReflectionVariable
////////////////////////////////////////////////////////////////////////////////
class CCryDXGLShaderReflectionVariable
: public CCryDXGLBase
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLShaderReflectionVariable, D3D11ShaderReflectionVariable)
#if DXGL_FULL_EMULATION
DXGL_IMPLEMENT_INTERFACE(CCryDXGLShaderReflectionVariable, D3D11ShaderReflectionType)
#endif //DXGL_FULL_EMULATION
CCryDXGLShaderReflectionVariable();
virtual ~CCryDXGLShaderReflectionVariable();
bool Initialize(void* pvData);
// Implementation of ID3D11ShaderReflectionVariable
HRESULT GetDesc(D3D11_SHADER_VARIABLE_DESC* pDesc);
ID3D11ShaderReflectionType* GetType();
ID3D11ShaderReflectionConstantBuffer* GetBuffer();
UINT GetInterfaceSlot(UINT uArrayIndex);
// Implementation of ID3D11ShaderReflectionType
HRESULT GetDesc(D3D11_SHADER_TYPE_DESC* pDesc);
ID3D11ShaderReflectionType* GetMemberTypeByIndex(UINT Index);
ID3D11ShaderReflectionType* GetMemberTypeByName(LPCSTR Name);
LPCSTR GetMemberTypeName(UINT Index);
HRESULT IsEqual(ID3D11ShaderReflectionType* pType);
ID3D11ShaderReflectionType* GetSubType();
ID3D11ShaderReflectionType* GetBaseClass();
UINT GetNumInterfaces();
ID3D11ShaderReflectionType* GetInterfaceByIndex(UINT uIndex);
HRESULT IsOfType(ID3D11ShaderReflectionType* pType);
HRESULT ImplementsInterface(ID3D11ShaderReflectionType* pBase);
struct Impl;
Impl* m_pImpl;
};
////////////////////////////////////////////////////////////////////////////////
// CCryDXGLShaderReflectionConstBuffer
////////////////////////////////////////////////////////////////////////////////
class CCryDXGLShaderReflectionConstBuffer
: public CCryDXGLBase
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLShaderReflectionConstBuffer, D3D11ShaderReflectionConstantBuffer)
CCryDXGLShaderReflectionConstBuffer();
virtual ~CCryDXGLShaderReflectionConstBuffer();
bool Initialize(void* pvData);
// Implementation of ID3D11ShaderReflectionConstantBuffer
HRESULT GetDesc(D3D11_SHADER_BUFFER_DESC* pDesc);
ID3D11ShaderReflectionVariable* GetVariableByIndex(UINT Index);
ID3D11ShaderReflectionVariable* GetVariableByName(LPCSTR Name);
struct Impl;
Impl* m_pImpl;
};
////////////////////////////////////////////////////////////////////////////////
// CCryDXGLShaderReflection
////////////////////////////////////////////////////////////////////////////////
class CCryDXGLShaderReflection
: public CCryDXGLBase
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLShaderReflection, D3D11ShaderReflection)
CCryDXGLShaderReflection();
virtual ~CCryDXGLShaderReflection();
bool Initialize(const void* pvData);
// Implementation of ID3D11ShaderReflection
HRESULT GetDesc(D3D11_SHADER_DESC* pDesc);
ID3D11ShaderReflectionConstantBuffer* GetConstantBufferByIndex(UINT Index);
ID3D11ShaderReflectionConstantBuffer* GetConstantBufferByName(LPCSTR Name);
HRESULT GetResourceBindingDesc(UINT ResourceIndex, D3D11_SHADER_INPUT_BIND_DESC* pDesc);
HRESULT GetInputParameterDesc(UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc);
HRESULT GetOutputParameterDesc(UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc);
HRESULT GetPatchConstantParameterDesc(UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc);
ID3D11ShaderReflectionVariable* GetVariableByName(LPCSTR Name);
HRESULT GetResourceBindingDescByName(LPCSTR Name, D3D11_SHADER_INPUT_BIND_DESC* pDesc);
UINT GetMovInstructionCount();
UINT GetMovcInstructionCount();
UINT GetConversionInstructionCount();
UINT GetBitwiseInstructionCount();
D3D_PRIMITIVE GetGSInputPrimitive();
BOOL IsSampleFrequencyShader();
UINT GetNumInterfaceSlots();
HRESULT GetMinFeatureLevel(enum D3D_FEATURE_LEVEL* pLevel);
UINT GetThreadGroupSize(UINT* pSizeX, UINT* pSizeY, UINT* pSizeZ);
struct Impl;
Impl* m_pImpl;
};
#endif //__CRYMETALGLSHADERREFLECTION__
@@ -0,0 +1,57 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11ShaderResourceView
#include "RenderDll_precompiled.h"
#include "CCryDXMETALShaderResourceView.hpp"
#include "CCryDXMETALDevice.hpp"
#include "CCryDXMETALResource.hpp"
#include "../Implementation/GLResource.hpp"
#include "../Implementation/MetalDevice.hpp"
CCryDXGLShaderResourceView::CCryDXGLShaderResourceView(CCryDXGLResource* pResource, const D3D11_SHADER_RESOURCE_VIEW_DESC& kDesc, CCryDXGLDevice* pDevice)
: CCryDXGLView(pResource, pDevice)
, m_kDesc(kDesc)
{
DXGL_INITIALIZE_INTERFACE(D3D11ShaderResourceView)
}
CCryDXGLShaderResourceView::~CCryDXGLShaderResourceView()
{
}
bool CCryDXGLShaderResourceView::Initialize(NCryMetal::CDevice* pDevice)
{
D3D11_RESOURCE_DIMENSION eDimension;
m_spResource->GetType(&eDimension);
m_spGLView = NCryMetal::CreateShaderResourceView(m_spResource->GetGLResource(), eDimension, m_kDesc, pDevice);
return m_spGLView != NULL;
}
NCryMetal::SShaderResourceView* CCryDXGLShaderResourceView::GetGLView()
{
return m_spGLView;
}
////////////////////////////////////////////////////////////////////////////////
// Implementation of ID3D11ShaderResourceView
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLShaderResourceView::GetDesc(D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc)
{
*pDesc = m_kDesc;
}
@@ -0,0 +1,47 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11ShaderResourceView
#ifndef __CRYMETALGLSHADERRESOURCEVIEW__
#define __CRYMETALGLSHADERRESOURCEVIEW__
#include "CCryDXMETALView.hpp"
namespace NCryMetal
{
struct SShaderResourceView;
class CContext;
}
class CCryDXGLShaderResourceView
: public CCryDXGLView
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLShaderResourceView, D3D11ShaderResourceView)
CCryDXGLShaderResourceView(CCryDXGLResource* pResource, const D3D11_SHADER_RESOURCE_VIEW_DESC& kDesc, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLShaderResourceView();
bool Initialize(NCryMetal::CDevice* pDevice);
NCryMetal::SShaderResourceView* GetGLView();
// Implementation of ID3D11ShaderResourceView
void GetDesc(D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc);
protected:
D3D11_SHADER_RESOURCE_VIEW_DESC m_kDesc;
_smart_ptr<NCryMetal::SShaderResourceView> m_spGLView;
};
#endif //__CRYMETALGLSHADERRESOURCEVIEW__
@@ -0,0 +1,358 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for IDXGISwapChain
#include "RenderDll_precompiled.h"
#include "CCryDXMETALDevice.hpp"
#include "CCryDXMETALGIOutput.hpp"
#include "CCryDXMETALSwapChain.hpp"
#include "CCryDXMETALTexture2D.hpp"
#include "../Implementation/MetalDevice.hpp"
#include "../Implementation/METALContext.hpp"
#include "../Implementation/GLResource.hpp"
#if defined(AZ_PLATFORM_MAC)
#include <AppKit/AppKit.h>
#else
#include <UIKit/UIKit.h>
#endif
#include <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
// Confetti END: Igor Lobanchikov
CCryDXGLSwapChain::CCryDXGLSwapChain(CCryDXGLDevice* pDevice, const DXGI_SWAP_CHAIN_DESC& kDesc)
: m_spDevice(pDevice)
, m_spBackBufferTexture(nullptr)
, m_spExposedBackBufferTexture(nullptr)
, m_Drawable(nullptr)
, m_currentView(nullptr)
// Confetti BEGIN: Igor Lobanchikov
, m_pAutoreleasePool(0)
// Confetti End: Igor Lobanchikov
{
DXGL_INITIALIZE_INTERFACE(DXGIDeviceSubObject)
DXGL_INITIALIZE_INTERFACE(DXGISwapChain)
m_kDesc = kDesc;
CreateDrawableView();
}
CCryDXGLSwapChain::~CCryDXGLSwapChain()
{
}
bool CCryDXGLSwapChain::Initialize()
{
return UpdateTexture(true);
}
bool CCryDXGLSwapChain::CreateDrawableView()
{
if (m_currentView != nullptr)
{
return false;
}
AZ_Assert(m_kDesc.OutputWindow != nullptr, "OutputWindow in the swap chain description is null. We are going to crash.");
if ([(id)m_kDesc.OutputWindow isKindOfClass:[NativeWindowType class]])
{
NativeWindowType* mainWindow = reinterpret_cast<NativeWindowType*>(m_kDesc.OutputWindow);
// Use the window's view as our own since the METALDevice class created
// it and not an outside tool like the editor
#if defined(AZ_PLATFORM_MAC)
m_currentView = reinterpret_cast<MetalView*>([mainWindow.contentViewController view]);
#else
m_currentView = reinterpret_cast<MetalView*>([mainWindow.rootViewController view]);
#endif
}
else
{
NativeViewType* superView = reinterpret_cast<NativeViewType*>(m_kDesc.OutputWindow);
NCryMetal::CDevice* pDevice(m_spDevice->GetGLDevice());
// Use the superView bounds because we want the MetalView to appear at the origin of the
// superView
m_currentView = [[MetalView alloc] initWithFrame: [superView bounds]
scale: 1.0f
device: pDevice->GetMetalDevice()];
[superView addSubview: m_currentView];
}
return true;
}
bool CCryDXGLSwapChain::UpdateTexture(bool bSetPixelFormat)
{
// Igor: Propagate actual texture resolution back from the RT to swap chan
// Check ho GL ES 3.0 does this
if (m_Drawable)
{
m_kDesc.BufferDesc.Width = min(m_kDesc.BufferDesc.Width, (UINT)m_Drawable.texture.width);
m_kDesc.BufferDesc.Height = min(m_kDesc.BufferDesc.Height, (UINT)m_Drawable.texture.height);
}
// Create a dummy texture that represents the default back buffer
D3D11_TEXTURE2D_DESC kBackBufferDesc;
kBackBufferDesc.Width = m_kDesc.BufferDesc.Width;
kBackBufferDesc.Height = m_kDesc.BufferDesc.Height;
kBackBufferDesc.MipLevels = 1;
kBackBufferDesc.ArraySize = 1;
kBackBufferDesc.Format = m_kDesc.BufferDesc.Format;
kBackBufferDesc.SampleDesc = m_kDesc.SampleDesc;
kBackBufferDesc.Usage = D3D11_USAGE_DEFAULT;
kBackBufferDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
kBackBufferDesc.CPUAccessFlags = 0;
kBackBufferDesc.MiscFlags = 0;
NCryMetal::SDefaultFrameBufferTexturePtr spBackBufferTex(NCryMetal::CreateBackBufferTexture(kBackBufferDesc));
m_spBackBufferTexture = new CCryDXGLTexture2D(kBackBufferDesc, spBackBufferTex, m_spDevice);
m_spBackBufferTexture->GetGLTexture()->m_bBackBuffer = true;
if (m_Drawable)
{
m_spBackBufferTexture->GetGLTexture()->m_Texture = m_Drawable.texture;
}
else
{
m_spBackBufferTexture->GetGLTexture()->m_Texture = nil;
}
// Igor: this code is left here as a note about possible optimization.
// At the moment it is not clear if keeping this code is optimization
// or we will still need to copy data around at the different place at the
// same or higher cost.
/*
if ( m_Drawable &&
((m_kDesc.BufferDesc.Width == m_Drawable.texture.width) &&
(m_kDesc.BufferDesc.Height == m_Drawable.texture.height)))
m_spExposedBackBufferTexture = m_spBackBufferTexture;
else
*/
{
// We need to release the existing texture before creating a new one.
SAFE_RELEASE(m_spExposedBackBufferTexture);
NCryMetal::STexturePtr spGLTexture(NCryMetal::CreateTexture2D(kBackBufferDesc, NULL, m_spDevice->GetGLDevice()));
m_spExposedBackBufferTexture = new CCryDXGLTexture2D(kBackBufferDesc, spGLTexture, m_spDevice);
}
return true;
}
////////////////////////////////////////////////////////////////////////////////
// IDXGISwapChain implementation
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLSwapChain::Present(UINT SyncInterval, UINT Flags)
{
NCryMetal::CDevice* pDevice(m_spDevice->GetGLDevice());
ID3D11DeviceContext* pContext;
m_spDevice->GetImmediateContext(&pContext);
// This forces clear if someone cleared RT but haven't not rendered anything before present.
CCryDXGLDeviceContext::FromInterface(pContext)->GetMetalContext()->FlushFrameBufferState();
//Just commit the main CB and get another commandbuffer to do the final upscale. This will help the
//gpu get started on the neext frame early and reduce latency.
CCryDXGLDeviceContext::FromInterface(pContext)->GetMetalContext()->Flush(nil, 0);
if (!m_Drawable)
{
m_Drawable = [m_currentView.metalLayer nextDrawable];
if (m_Drawable)
{
m_spBackBufferTexture->GetGLTexture()->m_Texture = m_Drawable.texture;
[m_Drawable retain];
}
else
{
m_spBackBufferTexture->GetGLTexture()->m_Texture = nil;
}
}
//This assert is kept here as a reminder that m_Drawable can be NULL
CRY_ASSERT(m_Drawable);
// This essentially upscales virtual back buffer to the actual one.
if (m_Drawable && m_spExposedBackBufferTexture != m_spBackBufferTexture)
{
NCryMetal::CContext::CopyFilterType filterType = NCryMetal::CContext::POINT;
if (1 == CRenderer::CV_r_UpscalingQuality)
{
filterType = NCryMetal::CContext::BILINEAR;
}
else if (2 == CRenderer::CV_r_UpscalingQuality)
{
filterType = NCryMetal::CContext::BICUBIC;
}
else if (3 == CRenderer::CV_r_UpscalingQuality)
{
filterType = NCryMetal::CContext::LANCZOS;
}
bool bRes = CCryDXGLDeviceContext::FromInterface(pContext)->GetMetalContext()->
TrySlowCopySubresource(m_spBackBufferTexture->GetGLTexture(), 0, 0, 0, 0,
m_spExposedBackBufferTexture->GetGLTexture(), 0, 0, filterType);
// Make sure copy actually happens.
CRY_ASSERT(bRes);
}
float syncInterval = 0.0f;
static ICVar* vSyncCVar = gEnv && gEnv->pConsole ? gEnv->pConsole->GetCVar("r_Vsync"): nullptr;
static ICVar* sysMaxFPSCVar = gEnv && gEnv->pConsole ? gEnv->pConsole->GetCVar("sys_MaxFPS") : nullptr;
if (sysMaxFPSCVar && vSyncCVar)
{
const int32 maxFPS = sysMaxFPSCVar->GetIVal();
uint32 vSync = vSyncCVar->GetIVal();
if (maxFPS > 0 && vSync != 0)
{
syncInterval = 1.0f/maxFPS;
}
}
// This commits command buffer.
CCryDXGLDeviceContext::FromInterface(pContext)->GetMetalContext()->Flush(m_Drawable, syncInterval);
pContext->Release();
[m_Drawable release];
m_Drawable = nil;
{
ID3D11DeviceContext* pContext;
m_spDevice->GetImmediateContext(&pContext);
// Create a new command buffer here. Can't do this on flush because need to do present, then insertDebugCaptureBoundary first.
// Although it is perfectly ok to flush then create a new command buffer, then do present and mark the end of frame,
// XCode frame capture won't work at all in this case.
CCryDXGLDeviceContext::FromInterface(pContext)->GetMetalContext()->InitMetalFrameResources();
pContext->Release();
}
FlushAutoreleasePool();
return pDevice->Present();
}
HRESULT CCryDXGLSwapChain::GetBuffer(UINT Buffer, REFIID riid, void** ppSurface)
{
if (Buffer == 0 && riid == __uuidof(ID3D11Texture2D))
{
m_spExposedBackBufferTexture->AddRef();
CCryDXGLTexture2D::ToInterface(reinterpret_cast<ID3D11Texture2D**>(ppSurface), m_spExposedBackBufferTexture.get());
return S_OK;
}
DXGL_TODO("Support more than one swap chain buffer if required");
return E_FAIL;
}
HRESULT CCryDXGLSwapChain::SetFullscreenState(BOOL Fullscreen, IDXGIOutput* pTarget)
{
DXGL_NOT_IMPLEMENTED;
return E_FAIL;
}
HRESULT CCryDXGLSwapChain::GetFullscreenState(BOOL* pFullscreen, IDXGIOutput** ppTarget)
{
DXGL_NOT_IMPLEMENTED;
return E_FAIL;
}
HRESULT CCryDXGLSwapChain::GetDesc(DXGI_SWAP_CHAIN_DESC* pDesc)
{
(*pDesc) = m_kDesc;
return S_OK;
}
HRESULT CCryDXGLSwapChain::ResizeBuffers(UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT Format, UINT SwapChainFlags)
{
// MS Documentation states that a buffer count of 0 means to use the same
// number of existing buffers
BufferCount = BufferCount == 0 ? m_kDesc.BufferCount : BufferCount;
if (
Format == m_kDesc.BufferDesc.Format &&
Width == m_kDesc.BufferDesc.Width &&
Height == m_kDesc.BufferDesc.Height &&
BufferCount == m_kDesc.BufferCount &&
SwapChainFlags == m_kDesc.Flags)
{
return S_OK; // Nothing to do
}
if (BufferCount == m_kDesc.BufferCount)
{
m_kDesc.BufferDesc.Format = Format;
m_kDesc.BufferDesc.Width = Width;
m_kDesc.BufferDesc.Height = Height;
m_kDesc.Flags = SwapChainFlags;
if (UpdateTexture(false))
{
CGSize drawableSize = CGSizeMake(Width, Height);
[m_currentView setFrameSize: drawableSize];
return S_OK;
}
}
return E_FAIL;
}
HRESULT CCryDXGLSwapChain::ResizeTarget(const DXGI_MODE_DESC* pNewTargetParameters)
{
DXGL_NOT_IMPLEMENTED;
return E_FAIL;
}
HRESULT CCryDXGLSwapChain::GetContainingOutput(IDXGIOutput** ppOutput)
{
DXGL_NOT_IMPLEMENTED;
return E_FAIL;
}
HRESULT CCryDXGLSwapChain::GetFrameStatistics(DXGI_FRAME_STATISTICS* pStats)
{
DXGL_NOT_IMPLEMENTED;
return E_FAIL;
}
HRESULT CCryDXGLSwapChain::GetLastPresentCount(UINT* pLastPresentCount)
{
DXGL_NOT_IMPLEMENTED;
return E_FAIL;
}
void CCryDXGLSwapChain::FlushAutoreleasePool()
{
if (m_pAutoreleasePool)
{
[(NSAutoreleasePool*)m_pAutoreleasePool release];
m_pAutoreleasePool = nullptr;
}
}
void CCryDXGLSwapChain::TryCreateAutoreleasePool()
{
if (!m_pAutoreleasePool)
{
m_pAutoreleasePool = [[NSAutoreleasePool alloc] init];
}
}
@@ -0,0 +1,84 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for IDXGISwapChain
#ifndef __CRYMETALGLSWAPCHAIN__
#define __CRYMETALGLSWAPCHAIN__
#include "CCryDXMETALBase.hpp"
#include "CCryDXMETALGIObject.hpp"
@protocol CAMetalDrawable;
namespace NCryMetal
{
class CDeviceContextProxy;
}
class CCryDXGLDevice;
class CCryDXGLTexture2D;
@class MetalView;
class CCryDXGLSwapChain
: public CCryDXGLGIObject
{
public:
#if DXGL_FULL_EMULATION
DXGL_IMPLEMENT_INTERFACE(CCryDXGLSwapChain, DXGIDeviceSubObject)
#endif //DXGL_FULL_EMULATION
DXGL_IMPLEMENT_INTERFACE(CCryDXGLSwapChain, DXGISwapChain)
CCryDXGLSwapChain(CCryDXGLDevice* pDevice, const DXGI_SWAP_CHAIN_DESC& kDesc);
~CCryDXGLSwapChain();
bool Initialize();
// IDXGISwapChain implementation
HRESULT STDMETHODCALLTYPE Present(UINT SyncInterval, UINT Flags);
HRESULT STDMETHODCALLTYPE GetBuffer(UINT Buffer, REFIID riid, void** ppSurface);
HRESULT STDMETHODCALLTYPE SetFullscreenState(BOOL Fullscreen, IDXGIOutput* pTarget);
HRESULT STDMETHODCALLTYPE GetFullscreenState(BOOL* pFullscreen, IDXGIOutput** ppTarget);
HRESULT STDMETHODCALLTYPE GetDesc(DXGI_SWAP_CHAIN_DESC* pDesc);
HRESULT STDMETHODCALLTYPE ResizeBuffers(UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags);
HRESULT STDMETHODCALLTYPE ResizeTarget(const DXGI_MODE_DESC* pNewTargetParameters);
HRESULT STDMETHODCALLTYPE GetContainingOutput(IDXGIOutput** ppOutput);
HRESULT STDMETHODCALLTYPE GetFrameStatistics(DXGI_FRAME_STATISTICS* pStats);
HRESULT STDMETHODCALLTYPE GetLastPresentCount(UINT* pLastPresentCount);
// IDXGIDeviceSubObject implementation
HRESULT STDMETHODCALLTYPE GetDevice(REFIID riid, void** ppDevice) { return E_NOTIMPL; }
void TryCreateAutoreleasePool();
void FlushAutoreleasePool();
protected:
bool CreateDrawableView();
bool UpdateTexture(bool bSetPixelFormat);
protected:
_smart_ptr<CCryDXGLDevice> m_spDevice;
_smart_ptr<CCryDXGLTexture2D> m_spBackBufferTexture;
_smart_ptr<CCryDXGLTexture2D> m_spExposedBackBufferTexture;
DXGI_SWAP_CHAIN_DESC m_kDesc;
MetalView* m_currentView;
id<CAMetalDrawable> m_Drawable;
void* m_pAutoreleasePool;
};
#endif //__CRYMETALGLSWAPCHAIN__
@@ -0,0 +1,47 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11SwitchToRef
#include "RenderDll_precompiled.h"
#include "CCryDXMETALSwitchToRef.hpp"
#include "../Implementation/GLCommon.hpp"
CCryDXGLSwitchToRef::CCryDXGLSwitchToRef(CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11SwitchToRef)
}
CCryDXGLSwitchToRef::~CCryDXGLSwitchToRef()
{
}
////////////////////////////////////////////////////////////////////////////////
// ID3D11SwitchToRef implementation
////////////////////////////////////////////////////////////////////////////////\
// //
BOOL CCryDXGLSwitchToRef::SetUseRef(BOOL UseRef)
{
DXGL_NOT_IMPLEMENTED
return false;
}
BOOL CCryDXGLSwitchToRef::GetUseRef()
{
DXGL_NOT_IMPLEMENTED
return false;
}
@@ -0,0 +1,36 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11SwitchToRef
#ifndef __CRYMETALGLSWITCHTOREF__
#define __CRYMETALGLSWITCHTOREF__
#include "CCryDXMETALDeviceChild.hpp"
class CCryDXGLSwitchToRef
: public CCryDXGLDeviceChild
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLSwitchToRef, D3D11SwitchToRef)
CCryDXGLSwitchToRef(CCryDXGLDevice* pDevice);
virtual ~CCryDXGLSwitchToRef();
// ID3D11SwitchToRef implementation
BOOL SetUseRef(BOOL UseRef);
BOOL GetUseRef();
};
#endif //__CRYMETALGLSWITCHTOREF__
@@ -0,0 +1,40 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11Texture1D
#include "RenderDll_precompiled.h"
#include "CCryDXMETALTexture1D.hpp"
CCryDXGLTexture1D::CCryDXGLTexture1D(const D3D11_TEXTURE1D_DESC& kDesc, NCryMetal::STexture* pGLTexture, CCryDXGLDevice* pDevice)
: CCryDXGLTextureBase(D3D11_RESOURCE_DIMENSION_TEXTURE1D, pGLTexture, pDevice)
, m_kDesc(kDesc)
{
DXGL_INITIALIZE_INTERFACE(D3D11Texture1D)
}
CCryDXGLTexture1D::~CCryDXGLTexture1D()
{
}
////////////////////////////////////////////////////////////////////////////////
// Implementation of ID3D11Texture1D
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLTexture1D::GetDesc(D3D11_TEXTURE1D_DESC* pDesc)
{
*pDesc = m_kDesc;
}
@@ -0,0 +1,49 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11Texture1D
#ifndef __CRYMETALGLTEXTURE1D__
#define __CRYMETALGLTEXTURE1D__
#include "CCryDXMETALTextureBase.hpp"
class CCryDXGLTexture1D
: public CCryDXGLTextureBase
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLTexture1D, D3D11Texture1D)
CCryDXGLTexture1D(const D3D11_TEXTURE1D_DESC& kDesc, NCryMetal::STexture* pGLTexture, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLTexture1D();
// Implementation of ID3D11Texture1D
void GetDesc(D3D11_TEXTURE1D_DESC* pDesc);
#if !DXGL_FULL_EMULATION
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject)
{
if (SingleInterface<CCryDXGLTexture1D>::Query(this, riid, ppvObject))
{
return S_OK;
}
return CCryDXGLTextureBase::QueryInterface(riid, ppvObject);
}
#endif //!DXGL_FULL_EMULATION
private:
D3D11_TEXTURE1D_DESC m_kDesc;
};
#endif //__CRYMETALGLTEXTURE1D__
@@ -0,0 +1,40 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11Texture2D
#include "RenderDll_precompiled.h"
#include "CCryDXMETALTexture2D.hpp"
CCryDXGLTexture2D::CCryDXGLTexture2D(const D3D11_TEXTURE2D_DESC& kDesc, NCryMetal::STexture* pGLTexture, CCryDXGLDevice* pDevice)
: CCryDXGLTextureBase(D3D11_RESOURCE_DIMENSION_TEXTURE2D, pGLTexture, pDevice)
, m_kDesc(kDesc)
{
DXGL_INITIALIZE_INTERFACE(D3D11Texture2D)
}
CCryDXGLTexture2D::~CCryDXGLTexture2D()
{
}
////////////////////////////////////////////////////////////////////////////////
// Implementation of ID3D11Texture2D
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLTexture2D::GetDesc(D3D11_TEXTURE2D_DESC* pDesc)
{
*pDesc = m_kDesc;
}
@@ -0,0 +1,51 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11Texture2D
#ifndef __CRYMETALGLTEXTURE2D__
#define __CRYMETALGLTEXTURE2D__
#include "CCryDXMETALTextureBase.hpp"
class CCryDXGLTexture2D
: public CCryDXGLTextureBase
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLTexture2D, D3D11Texture2D)
CCryDXGLTexture2D(const D3D11_TEXTURE2D_DESC& kDesc, NCryMetal::STexture* pGLTexture, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLTexture2D();
bool Initialize(const D3D11_SUBRESOURCE_DATA* pInitialData);
// Implementation of ID3D11Texture2D
void GetDesc(D3D11_TEXTURE2D_DESC* pDesc);
#if !DXGL_FULL_EMULATION
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject)
{
if (SingleInterface<CCryDXGLTexture2D>::Query(this, riid, ppvObject))
{
return S_OK;
}
return CCryDXGLTextureBase::QueryInterface(riid, ppvObject);
}
#endif //!DXGL_FULL_EMULATION
private:
D3D11_TEXTURE2D_DESC m_kDesc;
};
#endif //__CRYMETALGLTEXTURE2D__
@@ -0,0 +1,40 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11Texture3D
#include "RenderDll_precompiled.h"
#include "CCryDXMETALTexture3D.hpp"
CCryDXGLTexture3D::CCryDXGLTexture3D(const D3D11_TEXTURE3D_DESC& kDesc, NCryMetal::STexture* pGLTexture, CCryDXGLDevice* pDevice)
: CCryDXGLTextureBase(D3D11_RESOURCE_DIMENSION_TEXTURE3D, pGLTexture, pDevice)
, m_kDesc(kDesc)
{
DXGL_INITIALIZE_INTERFACE(D3D11Texture3D)
}
CCryDXGLTexture3D::~CCryDXGLTexture3D()
{
}
////////////////////////////////////////////////////////////////////////////////
// Implementation of ID3D11Texture3D
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLTexture3D::GetDesc(D3D11_TEXTURE3D_DESC* pDesc)
{
*pDesc = m_kDesc;
}
@@ -0,0 +1,49 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11Texture3D
#ifndef __CRYMETALGLTEXTURE3D__
#define __CRYMETALGLTEXTURE3D__
#include "CCryDXMETALTextureBase.hpp"
class CCryDXGLTexture3D
: public CCryDXGLTextureBase
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLTexture3D, D3D11Texture3D)
CCryDXGLTexture3D(const D3D11_TEXTURE3D_DESC& kDesc, NCryMetal::STexture* pGLTexture, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLTexture3D();
// Implementation of ID3D11Texture3D
void GetDesc(D3D11_TEXTURE3D_DESC* pDesc);
#if !DXGL_FULL_EMULATION
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject)
{
if (SingleInterface<CCryDXGLTexture3D>::Query(this, riid, ppvObject))
{
return S_OK;
}
return CCryDXGLTextureBase::QueryInterface(riid, ppvObject);
}
#endif //!DXGL_FULL_EMULATION
private:
D3D11_TEXTURE3D_DESC m_kDesc;
};
#endif //__CRYMETALGLTEXTURE3D__
@@ -0,0 +1,34 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL common base class for textures
#include "RenderDll_precompiled.h"
#include "CCryDXMETALTextureBase.hpp"
#include "../Implementation/GLResource.hpp"
CCryDXGLTextureBase::CCryDXGLTextureBase(D3D11_RESOURCE_DIMENSION eDimension, NCryMetal::STexture* pGLTexture, CCryDXGLDevice* pDevice)
: CCryDXGLResource(eDimension, pGLTexture, pDevice)
{
}
CCryDXGLTextureBase::~CCryDXGLTextureBase()
{
}
NCryMetal::STexture* CCryDXGLTextureBase::GetGLTexture()
{
return static_cast<NCryMetal::STexture*>(m_spGLResource.get());
}
@@ -0,0 +1,37 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL common base class for textures
#ifndef __CRYMETALGLTEXTUREBASE__
#define __CRYMETALGLTEXTUREBASE__
#include "CCryDXMETALResource.hpp"
namespace NCryMetal
{
struct STexture;
};
class CCryDXGLTextureBase
: public CCryDXGLResource
{
public:
CCryDXGLTextureBase(D3D11_RESOURCE_DIMENSION eDimension, NCryMetal::STexture* pGLTexture, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLTextureBase();
NCryMetal::STexture* GetGLTexture();
};
#endif //__CRYMETALGLTEXTUREBASE__
@@ -0,0 +1,49 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11UnorderedAccessView
#include "RenderDll_precompiled.h"
#include "CCryDXMETALUnorderedAccessView.hpp"
#include "../Implementation/GLResource.hpp"
CCryDXGLUnorderedAccessView::CCryDXGLUnorderedAccessView(CCryDXGLResource* pResource, const D3D11_UNORDERED_ACCESS_VIEW_DESC& kDesc, CCryDXGLDevice* pDevice)
: CCryDXGLView(pResource, pDevice)
, m_kDesc(kDesc)
{
DXGL_INITIALIZE_INTERFACE(D3D11UnorderedAccessView)
}
CCryDXGLUnorderedAccessView::~CCryDXGLUnorderedAccessView()
{
}
NCryMetal::SBuffer* CCryDXGLUnorderedAccessView::GetGLBuffer()
{
return static_cast<NCryMetal::SBuffer*>(m_spResource->GetGLResource());
}
NCryMetal::STexture* CCryDXGLUnorderedAccessView::GetGLTexture()
{
return static_cast<NCryMetal::STexture*>(m_spResource->GetGLResource());
}
////////////////////////////////////////////////////////////////
// Implementation of ID3D11UnorderedAccessView
////////////////////////////////////////////////////////////////
void CCryDXGLUnorderedAccessView::GetDesc(D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc)
{
*pDesc = m_kDesc;
}
@@ -0,0 +1,43 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description: Declaration of the DXGL wrapper for ID3D11UnorderedAccessView
#ifndef __CRYMETALGLUNORDEREDACCESSVIEW__
#define __CRYMETALGLUNORDEREDACCESSVIEW__
#include "CCryDXMETALView.hpp"
namespace NCryMetal
{
struct SBuffer;
struct STexture;
}
class CCryDXGLUnorderedAccessView
: public CCryDXGLView
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLUnorderedAccessView, D3D11UnorderedAccessView)
CCryDXGLUnorderedAccessView(CCryDXGLResource* pResource, const D3D11_UNORDERED_ACCESS_VIEW_DESC& kDesc, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLUnorderedAccessView();
NCryMetal::SBuffer* GetGLBuffer();
NCryMetal::STexture* GetGLTexture();
// Implementation of ID3D11UnorderedAccessView
void GetDesc(D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc);
protected:
D3D11_UNORDERED_ACCESS_VIEW_DESC m_kDesc;
};
#endif //__CRYMETALGLUNORDEREDACCESSVIEW__
@@ -0,0 +1,45 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Definition of the DXGL wrapper for ID3D11View
#include "RenderDll_precompiled.h"
#include "CCryDXMETALView.hpp"
#include "CCryDXMETALResource.hpp"
#include "../Implementation/GLResource.hpp"
CCryDXGLView::CCryDXGLView(CCryDXGLResource* pResource, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_spResource(pResource)
{
DXGL_INITIALIZE_INTERFACE(D3D11View)
}
CCryDXGLView::~CCryDXGLView()
{
}
////////////////////////////////////////////////////////////////////////////////
// Implementation of ID3D11View
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLView::GetResource(ID3D11Resource** ppResource)
{
if (m_spResource != NULL)
{
m_spResource->AddRef();
}
CCryDXGLResource::ToInterface(ppResource, m_spResource);
}
@@ -0,0 +1,51 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Declaration of the DXGL wrapper for ID3D11View
#ifndef __CRYMETALGLVIEW__
#define __CRYMETALGLVIEW__
#include "CCryDXMETALDeviceChild.hpp"
class CCryDXGLResource;
class CCryDXGLView
: public CCryDXGLDeviceChild
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLView, D3D11View)
virtual ~CCryDXGLView();
// Implementation of ID3D11View
void GetResource(ID3D11Resource** ppResource);
#if !DXGL_FULL_EMULATION
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject)
{
if (SingleInterface<CCryDXGLView>::Query(this, riid, ppvObject))
{
return S_OK;
}
return CCryDXGLDeviceChild::QueryInterface(riid, ppvObject);
}
#endif //!DXGL_FULL_EMULATION
protected:
CCryDXGLView(CCryDXGLResource* pResource, CCryDXGLDevice* pDevice);
_smart_ptr<CCryDXGLResource> m_spResource;
};
#endif //__CRYMETALGLVIEW__
@@ -0,0 +1,804 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Interface wrappers used for full DirectX emulation.
#ifndef __DXEmulation__
#define __DXEmulation__
#if DXGL_FULL_EMULATION
template <typename Interface>
struct SingleInheritance
{
typedef void TBase;
};
#define SINGLE_INHERITANCE(_Derived, _Base) template <> \
struct SingleInheritance<_Derived> { typedef _Base TBase; };
template <typename Interface>
struct SingleInheritanceInterface
{
template <typename Object>
static bool Query(Object* pThis, REFIID riid, void** ppvObject)
{
if (SingleInterface<Interface>::template Query<Object>(pThis, riid, ppvObject))
{
return true;
}
return SingleInheritanceInterface<typename SingleInheritance<Interface>::TBase>::template Query<Object>(pThis, riid, ppvObject);
}
};
template <>
struct SingleInheritanceInterface<void>
{
template <typename Object>
static bool Query(Object* pThis, REFIID riid, void** ppvObject)
{
*ppvObject = NULL;
return false;
}
};
SINGLE_INHERITANCE(IUnknown, void)
SINGLE_INHERITANCE(ID3D10Blob, IUnknown)
SINGLE_INHERITANCE(ID3D11DeviceChild, IUnknown)
SINGLE_INHERITANCE(ID3D11DepthStencilState, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11BlendState, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11RasterizerState, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11Resource, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11Buffer, ID3D11Resource)
SINGLE_INHERITANCE(ID3D11Texture1D, ID3D11Resource)
SINGLE_INHERITANCE(ID3D11Texture2D, ID3D11Resource)
SINGLE_INHERITANCE(ID3D11Texture3D, ID3D11Resource)
SINGLE_INHERITANCE(ID3D11View, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11ShaderResourceView, ID3D11View)
SINGLE_INHERITANCE(ID3D11RenderTargetView, ID3D11View)
SINGLE_INHERITANCE(ID3D11DepthStencilView, ID3D11View)
SINGLE_INHERITANCE(ID3D11UnorderedAccessView, ID3D11View)
SINGLE_INHERITANCE(ID3D11VertexShader, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11HullShader, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11DomainShader, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11GeometryShader, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11PixelShader, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11ComputeShader, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11InputLayout, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11SamplerState, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11Asynchronous, ID3D11DeviceChild)
SINGLE_INHERITANCE(ID3D11Query, ID3D11Asynchronous)
SINGLE_INHERITANCE(ID3D11ShaderReflectionType, void)
SINGLE_INHERITANCE(ID3D11ShaderReflectionVariable, void)
SINGLE_INHERITANCE(ID3D11ShaderReflectionConstantBuffer, void)
SINGLE_INHERITANCE(ID3D11ShaderReflection, IUnknown)
SINGLE_INHERITANCE(IDXGIObject, IUnknown)
SINGLE_INHERITANCE(IDXGIDeviceSubObject, IDXGIObject)
SINGLE_INHERITANCE(IDXGIOutput, IDXGIObject)
SINGLE_INHERITANCE(IDXGIAdapter, IDXGIObject)
SINGLE_INHERITANCE(IDXGIAdapter1, IDXGIAdapter)
SINGLE_INHERITANCE(IDXGIFactory, IDXGIObject)
SINGLE_INHERITANCE(IDXGIFactory1, IDXGIFactory)
SINGLE_INHERITANCE(IDXGIDevice, IDXGIObject)
SINGLE_INHERITANCE(IDXGISwapChain, IDXGIDeviceSubObject)
SINGLE_INHERITANCE(ID3D11SwitchToRef, IUnknown)
SINGLE_INHERITANCE(ID3D11Device, IUnknown)
SINGLE_INHERITANCE(ID3D11DeviceContext, ID3D11DeviceChild)
struct SAggregateNode
{
SAggregateNode* m_pNext;
SAggregateNode()
: m_pNext(NULL)
{
}
void Insert(SAggregateNode* pHead)
{
m_pNext = pHead->m_pNext;
pHead->m_pNext = this;
}
virtual bool QueryInterfaceInternal(REFIID riid, void** ppvObject)
{
return false;
};
};
#define DXGL_WRAPPER_ROOT_NO_COM(_Interface) \
typedef Impl TImpl; \
TImpl* m_pImpl; \
void InitializeWrapper(TImpl * pImpl) \
{ \
m_pImpl = pImpl; \
pImpl->m_pVirtual ## _Interface ## Wrapper = this; \
}
#define DXGL_WRAPPER_ROOT(_Interface) \
typedef Impl TImpl; \
TImpl* m_pImpl; \
void InitializeWrapper(TImpl * pImpl) \
{ \
m_pImpl = pImpl; \
Insert(&pImpl->GetAggregateHead()); \
pImpl->m_pVirtual ## _Interface ## Wrapper = this; \
}
#define DXGL_WRAPPER_DERIVED(_Interface, _Parent) \
void InitializeWrapper(typename _Parent<Impl, Base>::TImpl * pImpl) \
{ \
_Parent<Impl, Base>::InitializeWrapper(pImpl); \
pImpl->m_pVirtual ## _Interface ## Wrapper = this; \
}
namespace NDXGLWrappers
{
template <typename Impl, typename Base>
struct SUnknown
: Base
, SAggregateNode
{
DXGL_WRAPPER_ROOT(Unknown)
SUnknown()
: m_pImpl(NULL) {}
virtual ~SUnknown(){}
ULONG STDMETHODCALLTYPE AddRef(){return m_pImpl->AddRef(); }
ULONG STDMETHODCALLTYPE Release(){return m_pImpl->Release(); }
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject)
{
if (SingleInheritanceInterface<Base>::Query(this, riid, ppvObject))
{
return S_OK;
}
SAggregateNode* pNode(m_pImpl->GetAggregateHead().m_pNext);
while (pNode != NULL)
{
if (pNode->QueryInterfaceInternal(riid, ppvObject))
{
return S_OK;
}
pNode = pNode->m_pNext;
}
return E_NOINTERFACE;
}
bool QueryInterfaceInternal(REFIID riid, void** ppvObject)
{
return SingleInheritanceInterface<Base>::Query(this, riid, ppvObject);
}
};
template <typename Impl, typename Base>
struct SD3D10Blob
: SUnknown<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D10Blob, SUnknown)
SD3D10Blob(){}
LPVOID STDMETHODCALLTYPE GetBufferPointer(){return this->m_pImpl->GetBufferPointer(); }
SIZE_T STDMETHODCALLTYPE GetBufferSize(){return this->m_pImpl->GetBufferSize(); }
};
template <typename Impl, typename Base>
struct SD3D11DeviceChild
: SUnknown<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11DeviceChild, SUnknown)
SD3D11DeviceChild(){}
void STDMETHODCALLTYPE GetDevice(ID3D11Device** ppDevice){this->m_pImpl->GetDevice(ppDevice); }
HRESULT STDMETHODCALLTYPE GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData){return this->m_pImpl->GetPrivateData(guid, pDataSize, pData); }
HRESULT STDMETHODCALLTYPE SetPrivateData(REFGUID guid, UINT DataSize, const void* pData){return this->m_pImpl->SetPrivateData(guid, DataSize, pData); }
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(REFGUID guid, const IUnknown* pData){return this->m_pImpl->SetPrivateDataInterface(guid, pData); }
};
template <typename Impl, typename Base>
struct SD3D11DepthStencilState
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11DepthStencilState, SD3D11DeviceChild)
SD3D11DepthStencilState(){}
void STDMETHODCALLTYPE GetDesc(D3D11_DEPTH_STENCIL_DESC* pDesc){this->m_pImpl->GetDesc(pDesc); }
};
template <typename Impl, typename Base>
struct SD3D11BlendState
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11BlendState, SD3D11DeviceChild)
SD3D11BlendState(){}
virtual void STDMETHODCALLTYPE GetDesc(D3D11_BLEND_DESC* pDesc){this->m_pImpl->GetDesc(pDesc); }
};
template <typename Impl, typename Base>
struct SD3D11RasterizerState
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11RasterizerState, SD3D11DeviceChild)
SD3D11RasterizerState(){}
void STDMETHODCALLTYPE GetDesc(D3D11_RASTERIZER_DESC* pDesc){this->m_pImpl->GetDesc(pDesc); }
};
template <typename Impl, typename Base>
struct SD3D11Resource
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11Resource, SD3D11DeviceChild)
SD3D11Resource(){}
void STDMETHODCALLTYPE GetType(D3D11_RESOURCE_DIMENSION* pResourceDimension){this->m_pImpl->GetType(pResourceDimension); }
void STDMETHODCALLTYPE SetEvictionPriority(UINT EvictionPriority){this->m_pImpl->SetEvictionPriority(EvictionPriority); }
UINT STDMETHODCALLTYPE GetEvictionPriority(){return this->m_pImpl->GetEvictionPriority(); }
};
template <typename Impl, typename Base>
struct SD3D11Buffer
: SD3D11Resource<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11Buffer, SD3D11Resource)
SD3D11Buffer(){}
void STDMETHODCALLTYPE GetDesc(D3D11_BUFFER_DESC* pDesc){this->m_pImpl->GetDesc(pDesc); }
};
template <typename Impl, typename Base>
struct SD3D11Texture1D
: SD3D11Resource<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11Texture1D, SD3D11Resource)
SD3D11Texture1D(){}
void STDMETHODCALLTYPE GetDesc(D3D11_TEXTURE1D_DESC* pDesc){this->m_pImpl->GetDesc(pDesc); }
};
template <typename Impl, typename Base>
struct SD3D11Texture2D
: SD3D11Resource<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11Texture2D, SD3D11Resource)
SD3D11Texture2D(){}
void STDMETHODCALLTYPE GetDesc(D3D11_TEXTURE2D_DESC* pDesc){this->m_pImpl->GetDesc(pDesc); }
};
template <typename Impl, typename Base>
struct SD3D11Texture3D
: SD3D11Resource<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11Texture3D, SD3D11Resource)
SD3D11Texture3D(){}
void STDMETHODCALLTYPE GetDesc(D3D11_TEXTURE3D_DESC* pDesc){this->m_pImpl->GetDesc(pDesc); }
};
template <typename Impl, typename Base>
struct SD3D11View
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11View, SD3D11DeviceChild)
SD3D11View(){}
void STDMETHODCALLTYPE GetResource(ID3D11Resource** ppResource){this->m_pImpl->GetResource(ppResource); }
};
template <typename Impl, typename Base>
struct SD3D11ShaderResourceView
: SD3D11View<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11ShaderResourceView, SD3D11View)
SD3D11ShaderResourceView(){}
void STDMETHODCALLTYPE GetDesc(D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc){this->m_pImpl->GetDesc(pDesc); }
};
template <typename Impl, typename Base>
struct SD3D11RenderTargetView
: SD3D11View<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11RenderTargetView, SD3D11View)
SD3D11RenderTargetView(){}
void STDMETHODCALLTYPE GetDesc(D3D11_RENDER_TARGET_VIEW_DESC* pDesc){this->m_pImpl->GetDesc(pDesc); }
};
template <typename Impl, typename Base>
struct SD3D11DepthStencilView
: SD3D11View<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11DepthStencilView, SD3D11View)
SD3D11DepthStencilView(){}
void STDMETHODCALLTYPE GetDesc(D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc){this->m_pImpl->GetDesc(pDesc); }
};
template <typename Impl, typename Base>
struct SD3D11UnorderedAccessView
: SD3D11View<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11UnorderedAccessView, SD3D11View)
SD3D11UnorderedAccessView(){}
void STDMETHODCALLTYPE GetDesc(D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc){this->m_pImpl->GetDesc(pDesc); }
};
template <typename Impl, typename Base>
struct SD3D11VertexShader
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11VertexShader, SD3D11DeviceChild) SD3D11VertexShader()
{
}
};
template <typename Impl, typename Base>
struct SD3D11HullShader
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11HullShader, SD3D11DeviceChild) SD3D11HullShader()
{
}
};
template <typename Impl, typename Base>
struct SD3D11DomainShader
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11DomainShader, SD3D11DeviceChild) SD3D11DomainShader()
{
}
};
template <typename Impl, typename Base>
struct SD3D11GeometryShader
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11GeometryShader, SD3D11DeviceChild) SD3D11GeometryShader()
{
}
};
template <typename Impl, typename Base>
struct SD3D11PixelShader
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11PixelShader, SD3D11DeviceChild) SD3D11PixelShader()
{
}
};
template <typename Impl, typename Base>
struct SD3D11ComputeShader
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11ComputeShader, SD3D11DeviceChild) SD3D11ComputeShader()
{
}
};
template <typename Impl, typename Base>
struct SD3D11InputLayout
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11InputLayout, SD3D11DeviceChild) SD3D11InputLayout()
{
}
};
template <typename Impl, typename Base>
struct SD3D11SamplerState
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11SamplerState, SD3D11DeviceChild)
SD3D11SamplerState(){}
void STDMETHODCALLTYPE GetDesc(D3D11_SAMPLER_DESC* pDesc){this->m_pImpl->GetDesc(pDesc); }
};
template <typename Impl, typename Base>
struct SD3D11Asynchronous
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11Asynchronous, SD3D11DeviceChild)
SD3D11Asynchronous(){}
UINT STDMETHODCALLTYPE GetDataSize(){return this->m_pImpl->GetDataSize(); }
};
template <typename Impl, typename Base>
struct SD3D11Query
: SD3D11Asynchronous<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11Query, SD3D11Asynchronous)
SD3D11Query(){}
void STDMETHODCALLTYPE GetDesc(D3D11_QUERY_DESC* pDesc){this->m_pImpl->GetDesc(pDesc); }
};
template <typename Impl, typename Base>
struct SD3D11ShaderReflectionType
: Base
{
DXGL_WRAPPER_ROOT_NO_COM(D3D11ShaderReflectionType)
SD3D11ShaderReflectionType()
: m_pImpl(NULL){}
~SD3D11ShaderReflectionType(){}
HRESULT STDMETHODCALLTYPE GetDesc(D3D11_SHADER_TYPE_DESC* pDesc){return this->m_pImpl->GetDesc(pDesc); }
ID3D11ShaderReflectionType* STDMETHODCALLTYPE GetMemberTypeByIndex(UINT Index){return this->m_pImpl->GetMemberTypeByIndex(Index); }
ID3D11ShaderReflectionType* STDMETHODCALLTYPE GetMemberTypeByName(LPCSTR Name){return this->m_pImpl->GetMemberTypeByName(Name); }
LPCSTR STDMETHODCALLTYPE GetMemberTypeName(UINT Index){return this->m_pImpl->GetMemberTypeName(Index); }
HRESULT STDMETHODCALLTYPE IsEqual(ID3D11ShaderReflectionType* pType){return this->m_pImpl->IsEqual(pType); }
ID3D11ShaderReflectionType* STDMETHODCALLTYPE GetSubType(){return this->m_pImpl->GetSubType(); }
ID3D11ShaderReflectionType* STDMETHODCALLTYPE GetBaseClass(){return this->m_pImpl->GetBaseClass(); }
UINT STDMETHODCALLTYPE GetNumInterfaces(){return this->m_pImpl->GetNumInterfaces(); }
ID3D11ShaderReflectionType* STDMETHODCALLTYPE GetInterfaceByIndex(UINT uIndex){return this->m_pImpl->GetInterfaceByIndex(uIndex); }
HRESULT STDMETHODCALLTYPE IsOfType(ID3D11ShaderReflectionType* pType){return this->m_pImpl->IsOfType(pType); }
HRESULT STDMETHODCALLTYPE ImplementsInterface(ID3D11ShaderReflectionType* pBase){return this->m_pImpl->ImplementsInterface(pBase); }
};
template <typename Impl, typename Base>
struct SD3D11ShaderReflectionVariable
: Base
{
DXGL_WRAPPER_ROOT_NO_COM(D3D11ShaderReflectionVariable)
SD3D11ShaderReflectionVariable()
: m_pImpl(NULL){}
~SD3D11ShaderReflectionVariable(){}
HRESULT STDMETHODCALLTYPE GetDesc(D3D11_SHADER_VARIABLE_DESC* pDesc){return this->m_pImpl->GetDesc(pDesc); }
ID3D11ShaderReflectionType* STDMETHODCALLTYPE GetType(){return this->m_pImpl->GetType(); }
ID3D11ShaderReflectionConstantBuffer* STDMETHODCALLTYPE GetBuffer(){return this->m_pImpl->GetBuffer(); }
UINT STDMETHODCALLTYPE GetInterfaceSlot(UINT uArrayIndex){return this->m_pImpl->GetInterfaceSlot(uArrayIndex); }
};
template <typename Impl, typename Base>
struct SD3D11ShaderReflectionConstantBuffer
: Base
{
DXGL_WRAPPER_ROOT_NO_COM(D3D11ShaderReflectionConstantBuffer)
SD3D11ShaderReflectionConstantBuffer()
: m_pImpl(NULL){}
~SD3D11ShaderReflectionConstantBuffer(){}
HRESULT STDMETHODCALLTYPE GetDesc(D3D11_SHADER_BUFFER_DESC* pDesc){return this->m_pImpl->GetDesc(pDesc); }
ID3D11ShaderReflectionVariable* STDMETHODCALLTYPE GetVariableByIndex(UINT Index){return this->m_pImpl->GetVariableByIndex(Index); }
ID3D11ShaderReflectionVariable* STDMETHODCALLTYPE GetVariableByName(LPCSTR Name){return this->m_pImpl->GetVariableByName(Name); }
};
template <typename Impl, typename Base>
struct SD3D11ShaderReflection
: SUnknown<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11ShaderReflection, SUnknown)
SD3D11ShaderReflection(){}
HRESULT STDMETHODCALLTYPE GetDesc(D3D11_SHADER_DESC* pDesc){return this->m_pImpl->GetDesc(pDesc); }
ID3D11ShaderReflectionConstantBuffer* STDMETHODCALLTYPE GetConstantBufferByIndex(UINT Index){return this->m_pImpl->GetConstantBufferByIndex(Index); }
ID3D11ShaderReflectionConstantBuffer* STDMETHODCALLTYPE GetConstantBufferByName(LPCSTR Name){return this->m_pImpl->GetConstantBufferByName(Name); }
HRESULT STDMETHODCALLTYPE GetResourceBindingDesc(UINT ResourceIndex, D3D11_SHADER_INPUT_BIND_DESC* pDesc){return this->m_pImpl->GetResourceBindingDesc(ResourceIndex, pDesc); }
HRESULT STDMETHODCALLTYPE GetInputParameterDesc(UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc){return this->m_pImpl->GetInputParameterDesc(ParameterIndex, pDesc); }
HRESULT STDMETHODCALLTYPE GetOutputParameterDesc(UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc){return this->m_pImpl->GetOutputParameterDesc(ParameterIndex, pDesc); }
HRESULT STDMETHODCALLTYPE GetPatchConstantParameterDesc(UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc){return this->m_pImpl->GetPatchConstantParameterDesc(ParameterIndex, pDesc); }
ID3D11ShaderReflectionVariable* STDMETHODCALLTYPE GetVariableByName(LPCSTR Name){return this->m_pImpl->GetVariableByName(Name); }
HRESULT STDMETHODCALLTYPE GetResourceBindingDescByName(LPCSTR Name, D3D11_SHADER_INPUT_BIND_DESC* pDesc){return this->m_pImpl->GetResourceBindingDescByName(Name, pDesc); }
UINT STDMETHODCALLTYPE GetMovInstructionCount(){return this->m_pImpl->GetMovInstructionCount(); }
UINT STDMETHODCALLTYPE GetMovcInstructionCount(){return this->m_pImpl->GetMovcInstructionCount(); }
UINT STDMETHODCALLTYPE GetConversionInstructionCount(){return this->m_pImpl->GetConversionInstructionCount(); }
UINT STDMETHODCALLTYPE GetBitwiseInstructionCount(){return this->m_pImpl->GetBitwiseInstructionCount(); }
D3D_PRIMITIVE STDMETHODCALLTYPE GetGSInputPrimitive(){return this->m_pImpl->GetGSInputPrimitive(); }
BOOL STDMETHODCALLTYPE IsSampleFrequencyShader(){return this->m_pImpl->IsSampleFrequencyShader(); }
UINT STDMETHODCALLTYPE GetNumInterfaceSlots(){return this->m_pImpl->GetNumInterfaceSlots(); }
HRESULT STDMETHODCALLTYPE GetMinFeatureLevel(D3D_FEATURE_LEVEL* pLevel){return this->m_pImpl->GetMinFeatureLevel(pLevel); }
};
template <typename Impl, typename Base>
struct SDXGIObject
: SUnknown<Impl, Base>
{
DXGL_WRAPPER_DERIVED(DXGIObject, SUnknown)
SDXGIObject(){}
HRESULT STDMETHODCALLTYPE SetPrivateData(REFGUID Name, UINT DataSize, const void* pData){return this->m_pImpl->SetPrivateData(Name, DataSize, pData); }
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(REFGUID Name, const IUnknown* pUnknown){return this->m_pImpl->SetPrivateDataInterface(Name, pUnknown); }
HRESULT STDMETHODCALLTYPE GetPrivateData(REFGUID Name, UINT* pDataSize, void* pData){return this->m_pImpl->GetPrivateData(Name, pDataSize, pData); }
HRESULT STDMETHODCALLTYPE GetParent(REFIID riid, void** ppParent){return this->m_pImpl->GetParent(riid, ppParent); }
};
template <typename Impl, typename Base>
struct SDXGIDeviceSubObject
: SDXGIObject<Impl, Base>
{
DXGL_WRAPPER_DERIVED(DXGIDeviceSubObject, SDXGIObject)
SDXGIDeviceSubObject(){}
HRESULT STDMETHODCALLTYPE GetDevice(REFIID riid, void** ppDevice){return this->m_pImpl->GetDevice(riid, ppDevice); }
};
template <typename Impl, typename Base>
struct SDXGIOutput
: SDXGIObject<Impl, Base>
{
DXGL_WRAPPER_DERIVED(DXGIOutput, SDXGIObject)
SDXGIOutput(){}
HRESULT STDMETHODCALLTYPE GetDesc(DXGI_OUTPUT_DESC* pDesc){return this->m_pImpl->GetDesc(pDesc); }
HRESULT STDMETHODCALLTYPE GetDisplayModeList(DXGI_FORMAT EnumFormat, UINT Flags, UINT* pNumModes, DXGI_MODE_DESC* pDesc){return this->m_pImpl->GetDisplayModeList(EnumFormat, Flags, pNumModes, pDesc); }
HRESULT STDMETHODCALLTYPE FindClosestMatchingMode(const DXGI_MODE_DESC* pModeToMatch, DXGI_MODE_DESC* pClosestMatch, IUnknown* pConcernedDevice){return this->m_pImpl->FindClosestMatchingMode(pModeToMatch, pClosestMatch, pConcernedDevice); }
HRESULT STDMETHODCALLTYPE WaitForVBlank(){return this->m_pImpl->WaitForVBlank(); }
HRESULT STDMETHODCALLTYPE TakeOwnership(IUnknown* pDevice, BOOL Exclusive){return this->m_pImpl->TakeOwnership(pDevice, Exclusive); }
void STDMETHODCALLTYPE ReleaseOwnership(){this->m_pImpl->ReleaseOwnership(); }
HRESULT STDMETHODCALLTYPE GetGammaControlCapabilities(DXGI_GAMMA_CONTROL_CAPABILITIES* pGammaCaps){return this->m_pImpl->GetGammaControlCapabilities(pGammaCaps); }
HRESULT STDMETHODCALLTYPE SetGammaControl(const DXGI_GAMMA_CONTROL* pArray){return this->m_pImpl->SetGammaControl(pArray); }
HRESULT STDMETHODCALLTYPE GetGammaControl(DXGI_GAMMA_CONTROL* pArray){return this->m_pImpl->GetGammaControl(pArray); }
HRESULT STDMETHODCALLTYPE SetDisplaySurface(IDXGISurface* pScanoutSurface){return this->m_pImpl->SetDisplaySurface(pScanoutSurface); }
HRESULT STDMETHODCALLTYPE GetDisplaySurfaceData(IDXGISurface* pDestination){return this->m_pImpl->GetDisplaySurfaceData(pDestination); }
HRESULT STDMETHODCALLTYPE GetFrameStatistics(DXGI_FRAME_STATISTICS* pStats){return this->m_pImpl->GetFrameStatistics(pStats); }
};
template <typename Impl, typename Base>
struct SDXGIAdapter
: SDXGIObject<Impl, Base>
{
DXGL_WRAPPER_DERIVED(DXGIAdapter, SDXGIObject)
SDXGIAdapter(){}
HRESULT STDMETHODCALLTYPE EnumOutputs(UINT Output, IDXGIOutput** ppOutput){return this->m_pImpl->EnumOutputs(Output, ppOutput); }
HRESULT STDMETHODCALLTYPE GetDesc(DXGI_ADAPTER_DESC* pDesc){return this->m_pImpl->GetDesc(pDesc); }
HRESULT STDMETHODCALLTYPE CheckInterfaceSupport(REFGUID InterfaceName, LARGE_INTEGER* pUMDVersion){return this->m_pImpl->CheckInterfaceSupport(InterfaceName, pUMDVersion); }
};
template <typename Impl, typename Base>
struct SDXGIAdapter1
: SDXGIAdapter<Impl, Base>
{
DXGL_WRAPPER_DERIVED(DXGIAdapter1, SDXGIAdapter)
SDXGIAdapter1(){}
HRESULT STDMETHODCALLTYPE GetDesc1(DXGI_ADAPTER_DESC1* pDesc){return this->m_pImpl->GetDesc1(pDesc); }
};
template <typename Impl, typename Base>
struct SDXGIFactory
: SDXGIObject<Impl, Base>
{
DXGL_WRAPPER_DERIVED(DXGIFactory, SDXGIObject)
SDXGIFactory(){}
HRESULT STDMETHODCALLTYPE EnumAdapters(UINT Adapter, IDXGIAdapter** ppAdapter){return this->m_pImpl->EnumAdapters(Adapter, ppAdapter); }
HRESULT STDMETHODCALLTYPE MakeWindowAssociation(HWND WindowHandle, UINT Flags){return this->m_pImpl->MakeWindowAssociation(WindowHandle, Flags); }
HRESULT STDMETHODCALLTYPE GetWindowAssociation(HWND* pWindowHandle){return this->m_pImpl->GetWindowAssociation(pWindowHandle); }
HRESULT STDMETHODCALLTYPE CreateSwapChain(IUnknown* pDevice, DXGI_SWAP_CHAIN_DESC* pDesc, IDXGISwapChain** ppSwapChain){return this->m_pImpl->CreateSwapChain(pDevice, pDesc, ppSwapChain); }
HRESULT STDMETHODCALLTYPE CreateSoftwareAdapter(HMODULE Module, IDXGIAdapter** ppAdapter){return this->m_pImpl->CreateSoftwareAdapter(Module, ppAdapter); }
};
template <typename Impl, typename Base>
struct SDXGIFactory1
: SDXGIFactory<Impl, Base>
{
DXGL_WRAPPER_DERIVED(DXGIFactory1, SDXGIFactory)
SDXGIFactory1(){}
HRESULT STDMETHODCALLTYPE EnumAdapters1(UINT Adapter, IDXGIAdapter1** ppAdapter){return this->m_pImpl->EnumAdapters1(Adapter, ppAdapter); }
BOOL STDMETHODCALLTYPE IsCurrent(void){return this->m_pImpl->IsCurrent(); }
};
template <typename Impl, typename Base>
struct SDXGIDevice
: SDXGIObject<Impl, Base>
{
DXGL_WRAPPER_DERIVED(DXGIDevice, SDXGIObject)
SDXGIDevice(){}
HRESULT STDMETHODCALLTYPE GetAdapter(IDXGIAdapter** pAdapter){return this->m_pImpl->GetAdapter(pAdapter); }
HRESULT STDMETHODCALLTYPE CreateSurface(const DXGI_SURFACE_DESC* pDesc, UINT NumSurfaces, DXGI_USAGE Usage, const DXGI_SHARED_RESOURCE* pSharedResource, IDXGISurface** ppSurface){return this->m_pImpl->CreateSurface(pDesc, NumSurfaces, Usage, pSharedResource, ppSurface); }
HRESULT STDMETHODCALLTYPE QueryResourceResidency(IUnknown* const* ppResources, DXGI_RESIDENCY* pResidencyStatus, UINT NumResources){return this->m_pImpl->QueryResourceResidency(ppResources, pResidencyStatus, NumResources); }
HRESULT STDMETHODCALLTYPE SetGPUThreadPriority(INT Priority){return this->m_pImpl->SetGPUThreadPriority(Priority); }
HRESULT STDMETHODCALLTYPE GetGPUThreadPriority(INT* pPriority){return this->m_pImpl->GetGPUThreadPriority(pPriority); }
};
template <typename Impl, typename Base>
struct SDXGISwapChain
: SDXGIDeviceSubObject<Impl, Base>
{
DXGL_WRAPPER_DERIVED(DXGISwapChain, SDXGIDeviceSubObject)
SDXGISwapChain(){}
HRESULT STDMETHODCALLTYPE Present(UINT SyncInterval, UINT Flags){return this->m_pImpl->Present(SyncInterval, Flags); }
HRESULT STDMETHODCALLTYPE GetBuffer(UINT Buffer, REFIID riid, void** ppSurface){return this->m_pImpl->GetBuffer(Buffer, riid, ppSurface); }
HRESULT STDMETHODCALLTYPE SetFullscreenState(BOOL Fullscreen, IDXGIOutput* pTarget){return this->m_pImpl->SetFullscreenState(Fullscreen, pTarget); }
HRESULT STDMETHODCALLTYPE GetFullscreenState(BOOL* pFullscreen, IDXGIOutput** ppTarget){return this->m_pImpl->GetFullscreenState(pFullscreen, ppTarget); }
HRESULT STDMETHODCALLTYPE GetDesc(DXGI_SWAP_CHAIN_DESC* pDesc){return this->m_pImpl->GetDesc(pDesc); }
HRESULT STDMETHODCALLTYPE ResizeBuffers(UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags){return this->m_pImpl->ResizeBuffers(BufferCount, Width, Height, NewFormat, SwapChainFlags); }
HRESULT STDMETHODCALLTYPE ResizeTarget(const DXGI_MODE_DESC* pNewTargetParameters){return this->m_pImpl->ResizeTarget(pNewTargetParameters); }
HRESULT STDMETHODCALLTYPE GetContainingOutput(IDXGIOutput** ppOutput){return this->m_pImpl->GetContainingOutput(ppOutput); }
HRESULT STDMETHODCALLTYPE GetFrameStatistics(DXGI_FRAME_STATISTICS* pStats){return this->m_pImpl->GetFrameStatistics(pStats); }
HRESULT STDMETHODCALLTYPE GetLastPresentCount(UINT* pLastPresentCount){return this->m_pImpl->GetLastPresentCount(pLastPresentCount); }
};
template <typename Impl, typename Base>
struct SD3D11SwitchToRef
: public SUnknown<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11SwitchToRef, SUnknown)
SD3D11SwitchToRef(){}
BOOL STDMETHODCALLTYPE SetUseRef(BOOL UseRef){return this->m_pImpl->SetUseRef(UseRef); }
BOOL STDMETHODCALLTYPE GetUseRef(){return this->m_pImpl->GetUseRef(); }
};
template <typename Impl, typename Base>
struct SD3D11Device
: public SUnknown<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11Device, SUnknown)
HRESULT STDMETHODCALLTYPE CreateBuffer(const D3D11_BUFFER_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Buffer** ppBuffer){return this->m_pImpl->CreateBuffer(pDesc, pInitialData, ppBuffer); }
HRESULT STDMETHODCALLTYPE CreateTexture1D(const D3D11_TEXTURE1D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Texture1D** ppTexture1D){return this->m_pImpl->CreateTexture1D(pDesc, pInitialData, ppTexture1D); }
HRESULT STDMETHODCALLTYPE CreateTexture2D(const D3D11_TEXTURE2D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Texture2D** ppTexture2D){return this->m_pImpl->CreateTexture2D(pDesc, pInitialData, ppTexture2D); }
HRESULT STDMETHODCALLTYPE CreateTexture3D(const D3D11_TEXTURE3D_DESC* pDesc, const D3D11_SUBRESOURCE_DATA* pInitialData, ID3D11Texture3D** ppTexture3D){return this->m_pImpl->CreateTexture3D(pDesc, pInitialData, ppTexture3D); }
HRESULT STDMETHODCALLTYPE CreateShaderResourceView(ID3D11Resource* pResource, const D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc, ID3D11ShaderResourceView** ppSRView){return this->m_pImpl->CreateShaderResourceView(pResource, pDesc, ppSRView); }
HRESULT STDMETHODCALLTYPE CreateUnorderedAccessView(ID3D11Resource* pResource, const D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc, ID3D11UnorderedAccessView** ppUAView){return this->m_pImpl->CreateUnorderedAccessView(pResource, pDesc, ppUAView); }
HRESULT STDMETHODCALLTYPE CreateRenderTargetView(ID3D11Resource* pResource, const D3D11_RENDER_TARGET_VIEW_DESC* pDesc, ID3D11RenderTargetView** ppRTView){return this->m_pImpl->CreateRenderTargetView(pResource, pDesc, ppRTView); }
HRESULT STDMETHODCALLTYPE CreateDepthStencilView(ID3D11Resource* pResource, const D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc, ID3D11DepthStencilView** ppDepthStencilView){return this->m_pImpl->CreateDepthStencilView(pResource, pDesc, ppDepthStencilView); }
HRESULT STDMETHODCALLTYPE CreateInputLayout(const D3D11_INPUT_ELEMENT_DESC* pInputElementDescs, UINT NumElements, const void* pShaderBytecodeWithInputSignature, SIZE_T BytecodeLength, ID3D11InputLayout** ppInputLayout){return this->m_pImpl->CreateInputLayout(pInputElementDescs, NumElements, pShaderBytecodeWithInputSignature, BytecodeLength, ppInputLayout); }
HRESULT STDMETHODCALLTYPE CreateVertexShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11VertexShader** ppVertexShader){return this->m_pImpl->CreateVertexShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppVertexShader); }
HRESULT STDMETHODCALLTYPE CreateGeometryShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11GeometryShader** ppGeometryShader){return this->m_pImpl->CreateGeometryShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppGeometryShader); }
HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput(const void* pShaderBytecode, SIZE_T BytecodeLength, const D3D11_SO_DECLARATION_ENTRY* pSODeclaration, UINT NumEntries, const UINT* pBufferStrides, UINT NumStrides, UINT RasterizedStream, ID3D11ClassLinkage* pClassLinkage, ID3D11GeometryShader** ppGeometryShader){return this->m_pImpl->CreateGeometryShaderWithStreamOutput(pShaderBytecode, BytecodeLength, pSODeclaration, NumEntries, pBufferStrides, NumStrides, RasterizedStream, pClassLinkage, ppGeometryShader); }
HRESULT STDMETHODCALLTYPE CreatePixelShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11PixelShader** ppPixelShader){return this->m_pImpl->CreatePixelShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppPixelShader); }
HRESULT STDMETHODCALLTYPE CreateHullShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11HullShader** ppHullShader){return this->m_pImpl->CreateHullShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppHullShader); }
HRESULT STDMETHODCALLTYPE CreateDomainShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11DomainShader** ppDomainShader){return this->m_pImpl->CreateDomainShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppDomainShader); }
HRESULT STDMETHODCALLTYPE CreateComputeShader(const void* pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage* pClassLinkage, ID3D11ComputeShader** ppComputeShader){return this->m_pImpl->CreateComputeShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppComputeShader); }
HRESULT STDMETHODCALLTYPE CreateClassLinkage(ID3D11ClassLinkage** ppLinkage){return this->m_pImpl->CreateClassLinkage(ppLinkage); }
HRESULT STDMETHODCALLTYPE CreateBlendState(const D3D11_BLEND_DESC* pBlendStateDesc, ID3D11BlendState** ppBlendState){return this->m_pImpl->CreateBlendState(pBlendStateDesc, ppBlendState); }
HRESULT STDMETHODCALLTYPE CreateDepthStencilState(const D3D11_DEPTH_STENCIL_DESC* pDepthStencilDesc, ID3D11DepthStencilState** ppDepthStencilState){return this->m_pImpl->CreateDepthStencilState(pDepthStencilDesc, ppDepthStencilState); }
HRESULT STDMETHODCALLTYPE CreateRasterizerState(const D3D11_RASTERIZER_DESC* pRasterizerDesc, ID3D11RasterizerState** ppRasterizerState){return this->m_pImpl->CreateRasterizerState(pRasterizerDesc, ppRasterizerState); }
HRESULT STDMETHODCALLTYPE CreateSamplerState(const D3D11_SAMPLER_DESC* pSamplerDesc, ID3D11SamplerState** ppSamplerState){return this->m_pImpl->CreateSamplerState(pSamplerDesc, ppSamplerState); }
HRESULT STDMETHODCALLTYPE CreateQuery(const D3D11_QUERY_DESC* pQueryDesc, ID3D11Query** ppQuery){return this->m_pImpl->CreateQuery(pQueryDesc, ppQuery); }
HRESULT STDMETHODCALLTYPE CreatePredicate(const D3D11_QUERY_DESC* pPredicateDesc, ID3D11Predicate** ppPredicate){return this->m_pImpl->CreatePredicate(pPredicateDesc, ppPredicate); }
HRESULT STDMETHODCALLTYPE CreateCounter(const D3D11_COUNTER_DESC* pCounterDesc, ID3D11Counter** ppCounter){return this->m_pImpl->CreateCounter(pCounterDesc, ppCounter); }
HRESULT STDMETHODCALLTYPE CreateDeferredContext(UINT ContextFlags, ID3D11DeviceContext** ppDeferredContext){return this->m_pImpl->CreateDeferredContext(ContextFlags, ppDeferredContext); }
HRESULT STDMETHODCALLTYPE OpenSharedResource(HANDLE hResource, REFIID ReturnedInterface, void** ppResource){return this->m_pImpl->OpenSharedResource(hResource, ReturnedInterface, ppResource); }
HRESULT STDMETHODCALLTYPE CheckFormatSupport(DXGI_FORMAT Format, UINT* pFormatSupport){return this->m_pImpl->CheckFormatSupport(Format, pFormatSupport); }
HRESULT STDMETHODCALLTYPE CheckMultisampleQualityLevels(DXGI_FORMAT Format, UINT SampleCount, UINT* pNumQualityLevels){return this->m_pImpl->CheckMultisampleQualityLevels(Format, SampleCount, pNumQualityLevels); }
void STDMETHODCALLTYPE CheckCounterInfo(D3D11_COUNTER_INFO* pCounterInfo){this->m_pImpl->CheckCounterInfo(pCounterInfo); }
HRESULT STDMETHODCALLTYPE CheckCounter(const D3D11_COUNTER_DESC* pDesc, D3D11_COUNTER_TYPE* pType, UINT* pActiveCounters, LPSTR szName, UINT* pNameLength, LPSTR szUnits, UINT* pUnitsLength, LPSTR szDescription, UINT* pDescriptionLength){return this->m_pImpl->CheckCounter(pDesc, pType, pActiveCounters, szName, pNameLength, szUnits, pUnitsLength, szDescription, pDescriptionLength); }
HRESULT STDMETHODCALLTYPE CheckFeatureSupport(D3D11_FEATURE Feature, void* pFeatureSupportData, UINT FeatureSupportDataSize) {return this->m_pImpl->CheckFeatureSupport(Feature, pFeatureSupportData, FeatureSupportDataSize); }
HRESULT STDMETHODCALLTYPE GetPrivateData(REFGUID guid, UINT* pDataSize, void* pData){return this->m_pImpl->GetPrivateData(guid, pDataSize, pData); }
HRESULT STDMETHODCALLTYPE SetPrivateData(REFGUID guid, UINT DataSize, const void* pData){return this->m_pImpl->SetPrivateData(guid, DataSize, pData); }
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(REFGUID guid, const IUnknown* pData){return this->m_pImpl->SetPrivateDataInterface(guid, pData); }
D3D_FEATURE_LEVEL STDMETHODCALLTYPE GetFeatureLevel(void){return this->m_pImpl->GetFeatureLevel(); }
UINT STDMETHODCALLTYPE GetCreationFlags(void){return this->m_pImpl->GetCreationFlags(); }
HRESULT STDMETHODCALLTYPE GetDeviceRemovedReason(void){return this->m_pImpl->GetDeviceRemovedReason(); }
void STDMETHODCALLTYPE GetImmediateContext(ID3D11DeviceContext** ppImmediateContext){this->m_pImpl->GetImmediateContext(ppImmediateContext); }
HRESULT STDMETHODCALLTYPE SetExceptionMode(UINT RaiseFlags){return this->m_pImpl->SetExceptionMode(RaiseFlags); }
UINT STDMETHODCALLTYPE GetExceptionMode(void){return this->m_pImpl->GetExceptionMode(); }
};
template <typename Impl, typename Base>
struct SD3D11DeviceContext
: SD3D11DeviceChild<Impl, Base>
{
DXGL_WRAPPER_DERIVED(D3D11DeviceContext, SD3D11DeviceChild)
void STDMETHODCALLTYPE VSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers){this->m_pImpl->VSSetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); }
void STDMETHODCALLTYPE PSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews){this->m_pImpl->PSSetShaderResources(StartSlot, NumViews, ppShaderResourceViews); }
void STDMETHODCALLTYPE PSSetShader(ID3D11PixelShader* pPixelShader, ID3D11ClassInstance* const* ppClassInstances, UINT NumClassInstances){this->m_pImpl->PSSetShader(pPixelShader, ppClassInstances, NumClassInstances); }
void STDMETHODCALLTYPE PSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState* const* ppSamplers){this->m_pImpl->PSSetSamplers(StartSlot, NumSamplers, ppSamplers); }
void STDMETHODCALLTYPE VSSetShader(ID3D11VertexShader* pVertexShader, ID3D11ClassInstance* const* ppClassInstances, UINT NumClassInstances){this->m_pImpl->VSSetShader(pVertexShader, ppClassInstances, NumClassInstances); }
void STDMETHODCALLTYPE DrawIndexed(UINT IndexCount, UINT StartIndexLocation, INT BaseVertexLocation){this->m_pImpl->DrawIndexed(IndexCount, StartIndexLocation, BaseVertexLocation); }
void STDMETHODCALLTYPE Draw(UINT VertexCount, UINT StartVertexLocation){this->m_pImpl->Draw(VertexCount, StartVertexLocation); }
HRESULT STDMETHODCALLTYPE Map(ID3D11Resource* pResource, UINT Subresource, D3D11_MAP MapType, UINT MapFlags, D3D11_MAPPED_SUBRESOURCE* pMappedResource){return this->m_pImpl->Map(pResource, Subresource, MapType, MapFlags, pMappedResource); }
void STDMETHODCALLTYPE Unmap(ID3D11Resource* pResource, UINT Subresource){this->m_pImpl->Unmap(pResource, Subresource); }
void STDMETHODCALLTYPE PSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers){this->m_pImpl->PSSetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); }
void STDMETHODCALLTYPE IASetInputLayout(ID3D11InputLayout* pInputLayout){this->m_pImpl->IASetInputLayout(pInputLayout); }
void STDMETHODCALLTYPE IASetVertexBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppVertexBuffers, const UINT* pStrides, const UINT* pOffsets){this->m_pImpl->IASetVertexBuffers(StartSlot, NumBuffers, ppVertexBuffers, pStrides, pOffsets); }
void STDMETHODCALLTYPE IASetIndexBuffer(ID3D11Buffer* pIndexBuffer, DXGI_FORMAT Format, UINT Offset){this->m_pImpl->IASetIndexBuffer(pIndexBuffer, Format, Offset); }
void STDMETHODCALLTYPE DrawIndexedInstanced(UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation, INT BaseVertexLocation, UINT StartInstanceLocation){this->m_pImpl->DrawIndexedInstanced(IndexCountPerInstance, InstanceCount, StartIndexLocation, BaseVertexLocation, StartInstanceLocation); }
void STDMETHODCALLTYPE DrawInstanced(UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation, UINT StartInstanceLocation){this->m_pImpl->DrawInstanced(VertexCountPerInstance, InstanceCount, StartVertexLocation, StartInstanceLocation); }
void STDMETHODCALLTYPE GSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers){this->m_pImpl->GSSetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); }
void STDMETHODCALLTYPE GSSetShader(ID3D11GeometryShader* pShader, ID3D11ClassInstance* const* ppClassInstances, UINT NumClassInstances){this->m_pImpl->GSSetShader(pShader, ppClassInstances, NumClassInstances); }
void STDMETHODCALLTYPE IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY Topology){this->m_pImpl->IASetPrimitiveTopology(Topology); }
void STDMETHODCALLTYPE VSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews){this->m_pImpl->VSSetShaderResources(StartSlot, NumViews, ppShaderResourceViews); }
void STDMETHODCALLTYPE VSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState* const* ppSamplers){this->m_pImpl->VSSetSamplers(StartSlot, NumSamplers, ppSamplers); }
void STDMETHODCALLTYPE Begin(ID3D11Asynchronous* pAsync){this->m_pImpl->Begin(pAsync); }
void STDMETHODCALLTYPE End(ID3D11Asynchronous* pAsync){this->m_pImpl->End(pAsync); }
HRESULT STDMETHODCALLTYPE GetData(ID3D11Asynchronous* pAsync, void* pData, UINT DataSize, UINT GetDataFlags){return this->m_pImpl->GetData(pAsync, pData, DataSize, GetDataFlags); }
void STDMETHODCALLTYPE SetPredication(ID3D11Predicate* pPredicate, BOOL PredicateValue){this->m_pImpl->SetPredication(pPredicate, PredicateValue); }
void STDMETHODCALLTYPE GSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews){this->m_pImpl->GSSetShaderResources(StartSlot, NumViews, ppShaderResourceViews); }
void STDMETHODCALLTYPE GSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState* const* ppSamplers){this->m_pImpl->GSSetSamplers(StartSlot, NumSamplers, ppSamplers); }
void STDMETHODCALLTYPE OMSetRenderTargets(UINT NumViews, ID3D11RenderTargetView* const* ppRenderTargetViews, ID3D11DepthStencilView* pDepthStencilView){this->m_pImpl->OMSetRenderTargets(NumViews, ppRenderTargetViews, pDepthStencilView); }
void STDMETHODCALLTYPE OMSetRenderTargetsAndUnorderedAccessViews(UINT NumRTVs, ID3D11RenderTargetView* const* ppRenderTargetViews, ID3D11DepthStencilView* pDepthStencilView, UINT UAVStartSlot, UINT NumUAVs, ID3D11UnorderedAccessView* const* ppUnorderedAccessViews, const UINT* pUAVInitialCounts){this->m_pImpl->OMSetRenderTargetsAndUnorderedAccessViews(NumRTVs, ppRenderTargetViews, pDepthStencilView, UAVStartSlot, NumUAVs, ppUnorderedAccessViews, pUAVInitialCounts); }
void STDMETHODCALLTYPE OMSetBlendState(ID3D11BlendState* pBlendState, const FLOAT BlendFactor[ 4 ], UINT SampleMask){this->m_pImpl->OMSetBlendState(pBlendState, BlendFactor, SampleMask); }
void STDMETHODCALLTYPE OMSetDepthStencilState(ID3D11DepthStencilState* pDepthStencilState, UINT StencilRef){this->m_pImpl->OMSetDepthStencilState(pDepthStencilState, StencilRef); }
void STDMETHODCALLTYPE SOSetTargets(UINT NumBuffers, ID3D11Buffer* const* ppSOTargets, const UINT* pOffsets){this->m_pImpl->SOSetTargets(NumBuffers, ppSOTargets, pOffsets); }
void STDMETHODCALLTYPE DrawAuto(void){this->m_pImpl->DrawAuto(); }
void STDMETHODCALLTYPE DrawIndexedInstancedIndirect(ID3D11Buffer* pBufferForArgs, UINT AlignedByteOffsetForArgs){this->m_pImpl->DrawIndexedInstancedIndirect(pBufferForArgs, AlignedByteOffsetForArgs); }
void STDMETHODCALLTYPE DrawInstancedIndirect(ID3D11Buffer* pBufferForArgs, UINT AlignedByteOffsetForArgs){this->m_pImpl->DrawInstancedIndirect(pBufferForArgs, AlignedByteOffsetForArgs); }
void STDMETHODCALLTYPE Dispatch(UINT ThreadGroupCountX, UINT ThreadGroupCountY, UINT ThreadGroupCountZ){this->m_pImpl->Dispatch(ThreadGroupCountX, ThreadGroupCountY, ThreadGroupCountZ); }
void STDMETHODCALLTYPE DispatchIndirect(ID3D11Buffer* pBufferForArgs, UINT AlignedByteOffsetForArgs){this->m_pImpl->DispatchIndirect(pBufferForArgs, AlignedByteOffsetForArgs); }
void STDMETHODCALLTYPE RSSetState(ID3D11RasterizerState* pRasterizerState){this->m_pImpl->RSSetState(pRasterizerState); }
void STDMETHODCALLTYPE RSSetViewports(UINT NumViewports, const D3D11_VIEWPORT* pViewports){this->m_pImpl->RSSetViewports(NumViewports, pViewports); }
void STDMETHODCALLTYPE RSSetScissorRects(UINT NumRects, const D3D11_RECT* pRects){this->m_pImpl->RSSetScissorRects(NumRects, pRects); }
void STDMETHODCALLTYPE CopySubresourceRegion(ID3D11Resource* pDstResource, UINT DstSubresource, UINT DstX, UINT DstY, UINT DstZ, ID3D11Resource* pSrcResource, UINT SrcSubresource, const D3D11_BOX* pSrcBox){this->m_pImpl->CopySubresourceRegion(pDstResource, DstSubresource, DstX, DstY, DstZ, pSrcResource, SrcSubresource, pSrcBox); }
void STDMETHODCALLTYPE CopyResource(ID3D11Resource* pDstResource, ID3D11Resource* pSrcResource){this->m_pImpl->CopyResource(pDstResource, pSrcResource); }
void STDMETHODCALLTYPE UpdateSubresource(ID3D11Resource* pDstResource, UINT DstSubresource, const D3D11_BOX* pDstBox, const void* pSrcData, UINT SrcRowPitch, UINT SrcDepthPitch){this->m_pImpl->UpdateSubresource(pDstResource, DstSubresource, pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch); }
void STDMETHODCALLTYPE CopyStructureCount(ID3D11Buffer* pDstBuffer, UINT DstAlignedByteOffset, ID3D11UnorderedAccessView* pSrcView){this->m_pImpl->CopyStructureCount(pDstBuffer, DstAlignedByteOffset, pSrcView); }
void STDMETHODCALLTYPE ClearRenderTargetView(ID3D11RenderTargetView* pRenderTargetView, const FLOAT ColorRGBA[ 4 ]){this->m_pImpl->ClearRenderTargetView(pRenderTargetView, ColorRGBA); }
void STDMETHODCALLTYPE ClearUnorderedAccessViewUint(ID3D11UnorderedAccessView* pUnorderedAccessView, const UINT Values[ 4 ]){this->m_pImpl->ClearUnorderedAccessViewUint(pUnorderedAccessView, Values); }
void STDMETHODCALLTYPE ClearUnorderedAccessViewFloat(ID3D11UnorderedAccessView* pUnorderedAccessView, const FLOAT Values[ 4 ]){this->m_pImpl->ClearUnorderedAccessViewFloat(pUnorderedAccessView, Values); }
void STDMETHODCALLTYPE ClearDepthStencilView(ID3D11DepthStencilView* pDepthStencilView, UINT ClearFlags, FLOAT Depth, UINT8 Stencil){this->m_pImpl->ClearDepthStencilView(pDepthStencilView, ClearFlags, Depth, Stencil); }
void STDMETHODCALLTYPE GenerateMips(ID3D11ShaderResourceView* pShaderResourceView){this->m_pImpl->GenerateMips(pShaderResourceView); }
void STDMETHODCALLTYPE SetResourceMinLOD(ID3D11Resource* pResource, FLOAT MinLOD){this->m_pImpl->SetResourceMinLOD(pResource, MinLOD); }
FLOAT STDMETHODCALLTYPE GetResourceMinLOD(ID3D11Resource* pResource){return this->m_pImpl->GetResourceMinLOD(pResource); }
void STDMETHODCALLTYPE ResolveSubresource(ID3D11Resource* pDstResource, UINT DstSubresource, ID3D11Resource* pSrcResource, UINT SrcSubresource, DXGI_FORMAT Format){this->m_pImpl->ResolveSubresource(pDstResource, DstSubresource, pSrcResource, SrcSubresource, Format); }
void STDMETHODCALLTYPE ExecuteCommandList(ID3D11CommandList* pCommandList, BOOL RestoreContextState){this->m_pImpl->ExecuteCommandList(pCommandList, RestoreContextState); }
void STDMETHODCALLTYPE HSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews){this->m_pImpl->HSSetShaderResources(StartSlot, NumViews, ppShaderResourceViews); }
void STDMETHODCALLTYPE HSSetShader(ID3D11HullShader* pHullShader, ID3D11ClassInstance* const* ppClassInstances, UINT NumClassInstances){this->m_pImpl->HSSetShader(pHullShader, ppClassInstances, NumClassInstances); }
void STDMETHODCALLTYPE HSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState* const* ppSamplers){this->m_pImpl->HSSetSamplers(StartSlot, NumSamplers, ppSamplers); }
void STDMETHODCALLTYPE HSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers){this->m_pImpl->HSSetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); }
void STDMETHODCALLTYPE DSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews){this->m_pImpl->DSSetShaderResources(StartSlot, NumViews, ppShaderResourceViews); }
void STDMETHODCALLTYPE DSSetShader(ID3D11DomainShader* pDomainShader, ID3D11ClassInstance* const* ppClassInstances, UINT NumClassInstances){this->m_pImpl->DSSetShader(pDomainShader, ppClassInstances, NumClassInstances); }
void STDMETHODCALLTYPE DSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState* const* ppSamplers){this->m_pImpl->DSSetSamplers(StartSlot, NumSamplers, ppSamplers); }
void STDMETHODCALLTYPE DSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers){this->m_pImpl->DSSetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); }
void STDMETHODCALLTYPE CSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews){this->m_pImpl->CSSetShaderResources(StartSlot, NumViews, ppShaderResourceViews); }
void STDMETHODCALLTYPE CSSetUnorderedAccessViews(UINT StartSlot, UINT NumUAVs, ID3D11UnorderedAccessView* const* ppUnorderedAccessViews, const UINT* pUAVInitialCounts){this->m_pImpl->CSSetUnorderedAccessViews(StartSlot, NumUAVs, ppUnorderedAccessViews, pUAVInitialCounts); }
void STDMETHODCALLTYPE CSSetShader(ID3D11ComputeShader* pComputeShader, ID3D11ClassInstance* const* ppClassInstances, UINT NumClassInstances){this->m_pImpl->CSSetShader(pComputeShader, ppClassInstances, NumClassInstances); }
void STDMETHODCALLTYPE CSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState* const* ppSamplers){this->m_pImpl->CSSetSamplers(StartSlot, NumSamplers, ppSamplers); }
void STDMETHODCALLTYPE CSSetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* ppConstantBuffers){this->m_pImpl->CSSetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); }
void STDMETHODCALLTYPE VSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers){this->m_pImpl->VSGetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); }
void STDMETHODCALLTYPE PSGetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews){this->m_pImpl->PSGetShaderResources(StartSlot, NumViews, ppShaderResourceViews); }
void STDMETHODCALLTYPE PSGetShader(ID3D11PixelShader** ppPixelShader, ID3D11ClassInstance** ppClassInstances, UINT* pNumClassInstances){this->m_pImpl->PSGetShader(ppPixelShader, ppClassInstances, pNumClassInstances); }
void STDMETHODCALLTYPE PSGetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState** ppSamplers){this->m_pImpl->PSGetSamplers(StartSlot, NumSamplers, ppSamplers); }
void STDMETHODCALLTYPE VSGetShader(ID3D11VertexShader** ppVertexShader, ID3D11ClassInstance** ppClassInstances, UINT* pNumClassInstances){this->m_pImpl->VSGetShader(ppVertexShader, ppClassInstances, pNumClassInstances); }
void STDMETHODCALLTYPE PSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers){this->m_pImpl->PSGetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); }
void STDMETHODCALLTYPE IAGetInputLayout(ID3D11InputLayout** ppInputLayout){this->m_pImpl->IAGetInputLayout(ppInputLayout); }
void STDMETHODCALLTYPE IAGetVertexBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppVertexBuffers, UINT* pStrides, UINT* pOffsets){this->m_pImpl->IAGetVertexBuffers(StartSlot, NumBuffers, ppVertexBuffers, pStrides, pOffsets); }
void STDMETHODCALLTYPE IAGetIndexBuffer(ID3D11Buffer** pIndexBuffer, DXGI_FORMAT* Format, UINT* Offset){this->m_pImpl->IAGetIndexBuffer(pIndexBuffer, Format, Offset); }
void STDMETHODCALLTYPE GSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers){this->m_pImpl->GSGetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); }
void STDMETHODCALLTYPE GSGetShader(ID3D11GeometryShader** ppGeometryShader, ID3D11ClassInstance** ppClassInstances, UINT* pNumClassInstances){this->m_pImpl->GSGetShader(ppGeometryShader, ppClassInstances, pNumClassInstances); }
void STDMETHODCALLTYPE IAGetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY* pTopology){this->m_pImpl->IAGetPrimitiveTopology(pTopology); }
void STDMETHODCALLTYPE VSGetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews){this->m_pImpl->VSGetShaderResources(StartSlot, NumViews, ppShaderResourceViews); }
void STDMETHODCALLTYPE VSGetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState** ppSamplers){this->m_pImpl->VSGetSamplers(StartSlot, NumSamplers, ppSamplers); }
void STDMETHODCALLTYPE GetPredication(ID3D11Predicate** ppPredicate, BOOL* pPredicateValue){this->m_pImpl->GetPredication(ppPredicate, pPredicateValue); }
void STDMETHODCALLTYPE GSGetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews){this->m_pImpl->GSGetShaderResources(StartSlot, NumViews, ppShaderResourceViews); }
void STDMETHODCALLTYPE GSGetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState** ppSamplers){this->m_pImpl->GSGetSamplers(StartSlot, NumSamplers, ppSamplers); }
void STDMETHODCALLTYPE OMGetRenderTargets(UINT NumViews, ID3D11RenderTargetView** ppRenderTargetViews, ID3D11DepthStencilView** ppDepthStencilView){this->m_pImpl->OMGetRenderTargets(NumViews, ppRenderTargetViews, ppDepthStencilView); }
void STDMETHODCALLTYPE OMGetRenderTargetsAndUnorderedAccessViews(UINT NumRTVs, ID3D11RenderTargetView** ppRenderTargetViews, ID3D11DepthStencilView** ppDepthStencilView, UINT UAVStartSlot, UINT NumUAVs, ID3D11UnorderedAccessView** ppUnorderedAccessViews){this->m_pImpl->OMGetRenderTargetsAndUnorderedAccessViews(NumRTVs, ppRenderTargetViews, ppDepthStencilView, UAVStartSlot, NumUAVs, ppUnorderedAccessViews); }
void STDMETHODCALLTYPE OMGetBlendState(ID3D11BlendState** ppBlendState, FLOAT BlendFactor[ 4 ], UINT* pSampleMask){this->m_pImpl->OMGetBlendState(ppBlendState, BlendFactor, pSampleMask); }
void STDMETHODCALLTYPE OMGetDepthStencilState(ID3D11DepthStencilState** ppDepthStencilState, UINT* pStencilRef){this->m_pImpl->OMGetDepthStencilState(ppDepthStencilState, pStencilRef); }
void STDMETHODCALLTYPE SOGetTargets(UINT NumBuffers, ID3D11Buffer** ppSOTargets){this->m_pImpl->SOGetTargets(NumBuffers, ppSOTargets); }
void STDMETHODCALLTYPE RSGetState(ID3D11RasterizerState** ppRasterizerState){this->m_pImpl->RSGetState(ppRasterizerState); }
void STDMETHODCALLTYPE RSGetViewports(UINT* pNumViewports, D3D11_VIEWPORT* pViewports){this->m_pImpl->RSGetViewports(pNumViewports, pViewports); }
void STDMETHODCALLTYPE RSGetScissorRects(UINT* pNumRects, D3D11_RECT* pRects){this->m_pImpl->RSGetScissorRects(pNumRects, pRects); }
void STDMETHODCALLTYPE HSGetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews){this->m_pImpl->HSGetShaderResources(StartSlot, NumViews, ppShaderResourceViews); }
void STDMETHODCALLTYPE HSGetShader(ID3D11HullShader** ppHullShader, ID3D11ClassInstance** ppClassInstances, UINT* pNumClassInstances){this->m_pImpl->HSGetShader(ppHullShader, ppClassInstances, pNumClassInstances); }
void STDMETHODCALLTYPE HSGetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState** ppSamplers){this->m_pImpl->HSGetSamplers(StartSlot, NumSamplers, ppSamplers); }
void STDMETHODCALLTYPE HSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers){this->m_pImpl->HSGetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); }
void STDMETHODCALLTYPE DSGetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews){this->m_pImpl->DSGetShaderResources(StartSlot, NumViews, ppShaderResourceViews); }
void STDMETHODCALLTYPE DSGetShader(ID3D11DomainShader** ppDomainShader, ID3D11ClassInstance** ppClassInstances, UINT* pNumClassInstances){this->m_pImpl->DSGetShader(ppDomainShader, ppClassInstances, pNumClassInstances); }
void STDMETHODCALLTYPE DSGetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState** ppSamplers){this->m_pImpl->DSGetSamplers(StartSlot, NumSamplers, ppSamplers); }
void STDMETHODCALLTYPE DSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers){this->m_pImpl->DSGetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); }
void STDMETHODCALLTYPE CSGetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews){this->m_pImpl->CSGetShaderResources(StartSlot, NumViews, ppShaderResourceViews); }
void STDMETHODCALLTYPE CSGetUnorderedAccessViews(UINT StartSlot, UINT NumUAVs, ID3D11UnorderedAccessView** ppUnorderedAccessViews){this->m_pImpl->CSGetUnorderedAccessViews(StartSlot, NumUAVs, ppUnorderedAccessViews); }
void STDMETHODCALLTYPE CSGetShader(ID3D11ComputeShader** ppComputeShader, ID3D11ClassInstance** ppClassInstances, UINT* pNumClassInstances){this->m_pImpl->CSGetShader(ppComputeShader, ppClassInstances, pNumClassInstances); }
void STDMETHODCALLTYPE CSGetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState** ppSamplers){this->m_pImpl->CSGetSamplers(StartSlot, NumSamplers, ppSamplers); }
void STDMETHODCALLTYPE CSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers){this->m_pImpl->CSGetConstantBuffers(StartSlot, NumBuffers, ppConstantBuffers); }
void STDMETHODCALLTYPE ClearState(void){this->m_pImpl->ClearState(); }
void STDMETHODCALLTYPE Flush(void){this->m_pImpl->Flush(); }
D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE GetType(void){return this->m_pImpl->GetType(); }
UINT STDMETHODCALLTYPE GetContextFlags(void){return this->m_pImpl->GetContextFlags(); }
HRESULT STDMETHODCALLTYPE FinishCommandList(BOOL RestoreDeferredContextState, ID3D11CommandList** ppCommandList){return this->m_pImpl->FinishCommandList(RestoreDeferredContextState, ppCommandList); }
};
} //namespace NDXGLWrappers
#undef DXGL_WRAPPER_ROOT_NO_COM
#undef DXGL_WRAPPER_ROOT
#undef DXGL_WRAPPER_DERIVED
#define DXGL_IMPLEMENT_INTERFACE(_Class, _Interface) \
typedef NDXGLWrappers::S ## _Interface<_Class, I ## _Interface> T ## _Interface ## Wrapper; \
T ## _Interface ## Wrapper m_k ## _Interface ## Wrapper; \
I ## _Interface * m_pVirtual ## _Interface ## Wrapper; \
static void ToInterface(I ## _Interface * *ppInterface, _Class * pObject) \
{ \
*ppInterface = (pObject == NULL ? NULL : pObject->m_pVirtual ## _Interface ## Wrapper); \
} \
static _Class* FromInterface(I ## _Interface * pInterface) \
{ \
return pInterface == NULL ? NULL : static_cast<T ## _Interface ## Wrapper*>(pInterface)->m_pImpl; \
}
#define DXGL_INITIALIZE_INTERFACE(_Interface) \
m_k ## _Interface ## Wrapper.InitializeWrapper(this);
#else
#define DXGL_IMPLEMENT_INTERFACE(_Class, _Interface) \
static void ToInterface(I ## _Interface * *ppInterface, _Class * pObject) \
{ \
*ppInterface = pObject; \
} \
static _Class* FromInterface(I ## _Interface * pInterface) \
{ \
return static_cast<_Class*>(pInterface); \
}
#define DXGL_INITIALIZE_INTERFACE(_Interface)
#endif
#endif //__DXEmulation__