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 "CCryDXGLBase.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
{
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)NCryOpenGL::GetCRC32(&kGuid, sizeof(kGuid));
}
bool CCryDXGLPrivateDataContainer::SGuidHashCompare::operator()(const GUID& kLeft, const GUID& kRight) const
{
return memcmp(&kLeft, &kRight, sizeof(kLeft)) == 0;
}
@@ -0,0 +1,94 @@
/*
* 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 __CRYDXGLBASE__
#define __CRYDXGLBASE__
#include "../Definitions/CryDXGLGuid.hpp"
#include "../Definitions/ICryDXGLUnknown.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 //__CRYDXGLBASE__
@@ -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 "CCryDXGLBlendState.hpp"
#include "CCryDXGLDevice.hpp"
#include "../Implementation/GLState.hpp"
#include "../Implementation/GLDevice.hpp"
CCryDXGLBlendState::CCryDXGLBlendState(const D3D11_BLEND_DESC& kDesc, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_kDesc(kDesc)
, m_pGLState(new NCryOpenGL::SBlendState)
{
DXGL_INITIALIZE_INTERFACE(D3D11BlendState)
}
CCryDXGLBlendState::~CCryDXGLBlendState()
{
delete m_pGLState;
}
bool CCryDXGLBlendState::Initialize(CCryDXGLDevice* pDevice, NCryOpenGL::CContext* pContext)
{
return NCryOpenGL::InitializeBlendState(m_kDesc, *m_pGLState, pContext);
}
bool CCryDXGLBlendState::Apply(NCryOpenGL::CContext* pContext)
{
return pContext->SetBlendState(*m_pGLState);
}
////////////////////////////////////////////////////////////////////////////////
// Implementation of ID3D11BlendState
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLBlendState::GetDesc(D3D11_BLEND_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 ID3D11BlendState
#ifndef __CRYDXGLBLENDSTATE__
#define __CRYDXGLBLENDSTATE__
#include "CCryDXGLDeviceChild.hpp"
namespace NCryOpenGL
{
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, NCryOpenGL::CContext* pContext);
bool Apply(NCryOpenGL::CContext* pContext);
// Implementation of ID3D11BlendState
void GetDesc(D3D11_BLEND_DESC* pDesc);
protected:
D3D11_BLEND_DESC m_kDesc;
NCryOpenGL::SBlendState* m_pGLState;
};
#endif //__CRYDXGLBLENDSTATE__
@@ -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 "CCryDXGLBlob.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 __CRYDXGLBLOB__
#define __CRYDXGLBLOB__
#include "CCryDXGLBase.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 //__CRYDXGLBLOB__
@@ -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 "CCryDXGLBuffer.hpp"
#include "CCryDXGLDeviceContext.hpp"
#include "../Implementation/GLResource.hpp"
CCryDXGLBuffer::CCryDXGLBuffer(const D3D11_BUFFER_DESC& kDesc, NCryOpenGL::SBuffer* pGLBuffer, CCryDXGLDevice* pDevice)
: CCryDXGLResource(D3D11_RESOURCE_DIMENSION_BUFFER, pGLBuffer, pDevice)
, m_kDesc(kDesc)
{
DXGL_INITIALIZE_INTERFACE(D3D11Buffer)
}
CCryDXGLBuffer::~CCryDXGLBuffer()
{
}
NCryOpenGL::SBuffer* CCryDXGLBuffer::GetGLBuffer()
{
return static_cast<NCryOpenGL::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 __CRYDXGLBUFFER__
#define __CRYDXGLBUFFER__
#include "CCryDXGLResource.hpp"
namespace NCryOpenGL
{
struct SBuffer;
}
class CCryDXGLBuffer
: public CCryDXGLResource
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLBuffer, D3D11Buffer)
CCryDXGLBuffer(const D3D11_BUFFER_DESC& kDesc, NCryOpenGL::SBuffer* pGLBuffer, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLBuffer();
// ID3D11Buffer implementation
void GetDesc(D3D11_BUFFER_DESC* pDesc);
NCryOpenGL::SBuffer* GetGLBuffer();
private:
D3D11_BUFFER_DESC m_kDesc;
};
#endif //__CRYDXGLBUFFER__
@@ -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 : Definition of the DXGL wrapper for ID3D11DepthStencilState
#include "RenderDll_precompiled.h"
#include "CCryDXGLDepthStencilState.hpp"
#include "CCryDXGLDevice.hpp"
#include "../Implementation/GLState.hpp"
#include "../Implementation/GLDevice.hpp"
CCryDXGLDepthStencilState::CCryDXGLDepthStencilState(const D3D11_DEPTH_STENCIL_DESC& kDesc, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_kDesc(kDesc)
, m_pGLState(new NCryOpenGL::SDepthStencilState)
{
DXGL_INITIALIZE_INTERFACE(D3D11DepthStencilState)
}
CCryDXGLDepthStencilState::~CCryDXGLDepthStencilState()
{
delete m_pGLState;
}
bool CCryDXGLDepthStencilState::Initialize(CCryDXGLDevice* pDevice, NCryOpenGL::CContext* pContext)
{
return NCryOpenGL::InitializeDepthStencilState(m_kDesc, *m_pGLState, pContext);
}
bool CCryDXGLDepthStencilState::Apply(uint32 uStencilReference, NCryOpenGL::CContext* pContext)
{
return pContext->SetDepthStencilState(*m_pGLState, static_cast<GLint>(uStencilReference));
}
////////////////////////////////////////////////////////////////////////////////
// Implementation of ID3D11DepthStencilState
////////////////////////////////////////////////////////////////////////////////
void CCryDXGLDepthStencilState::GetDesc(D3D11_DEPTH_STENCIL_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 ID3D11DepthStencilState
#ifndef __CRYDXGLDEPTHSTENCILSTATE__
#define __CRYDXGLDEPTHSTENCILSTATE__
#include "CCryDXGLDeviceChild.hpp"
namespace NCryOpenGL
{
struct SDepthStencilState;
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, NCryOpenGL::CContext* pContext);
bool Apply(uint32 uStencilReference, NCryOpenGL::CContext* pContext);
// Implementation of ID3D11DepthStencilState
void GetDesc(D3D11_DEPTH_STENCIL_DESC* pDesc);
protected:
D3D11_DEPTH_STENCIL_DESC m_kDesc;
NCryOpenGL::SDepthStencilState* m_pGLState;
};
#endif //__CRYDXGLDEPTHSTENCILSTATE__
@@ -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 "CCryDXGLDepthStencilView.hpp"
#include "CCryDXGLDevice.hpp"
#include "CCryDXGLResource.hpp"
#include "../Implementation/GLDevice.hpp"
#include "../Implementation/GLView.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(NCryOpenGL::CContext* pContext)
{
D3D11_RESOURCE_DIMENSION eDimension;
m_spResource->GetType(&eDimension);
m_spGLView = NCryOpenGL::CreateDepthStencilView(m_spResource->GetGLResource(), eDimension, m_kDesc, pContext);
return m_spGLView != NULL;
}
NCryOpenGL::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 __CRYDXGLDEPTHSTENCILVIEW__
#define __CRYDXGLDEPTHSTENCILVIEW__
#include "CCryDXGLView.hpp"
namespace NCryOpenGL
{
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(NCryOpenGL::CContext* pContext);
NCryOpenGL::SOutputMergerView* GetGLView();
// Implementation of ID3D11DepthStencilView
void GetDesc(D3D11_DEPTH_STENCIL_VIEW_DESC* pDesc);
protected:
D3D11_DEPTH_STENCIL_VIEW_DESC m_kDesc;
_smart_ptr<NCryOpenGL::SOutputMergerView> m_spGLView;
};
#endif //__CRYDXGLDEPTHSTENCILVIEW__
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,116 @@
/*
* 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 __CRYDXGLDEVICE__
#define __CRYDXGLDEVICE__
#include "CCryDXGLGIObject.hpp"
namespace NCryOpenGL
{
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);
NCryOpenGL::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<NCryOpenGL::CDevice> m_spGLDevice;
_smart_ptr<CCryDXGLDeviceContext> m_spImmediateContext;
D3D_FEATURE_LEVEL m_eFeatureLevel;
#if DXGL_FULL_EMULATION
NCryOpenGL::SDummyContext* m_pDummyContext;
#endif //DXGL_FULL_EMULATION
};
#endif //__CRYDXGLDEVICE__
@@ -0,0 +1,76 @@
/*
* 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 "CCryDXGLDeviceChild.hpp"
#include "CCryDXGLDevice.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 __CRYDXGLDEVICECHILD__
#define __CRYDXGLDEVICECHILD__
#include "CCryDXGLBase.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 //__CRYDXGLDEVICECHILD__
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,247 @@
/*
* 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 __CRYDXGLDEVICECONTEXT__
#define __CRYDXGLDEVICECONTEXT__
#include "CCryDXGLDeviceChild.hpp"
namespace NCryOpenGL
{
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();
NCryOpenGL::CContext* GetGLContext();
// 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);
// Partial ID3D11DeviceContext1 implementation
void STDMETHODCALLTYPE CSSetConstantBuffers1(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* pConstantBuffers, const UINT* pFirstConstant, const UINT* pNumConstants);
void STDMETHODCALLTYPE PSSetConstantBuffers1(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* pConstantBuffers, const UINT* pFirstConstant, const UINT* pNumConstants);
void STDMETHODCALLTYPE VSSetConstantBuffers1(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* pConstantBuffers, const UINT* pFirstConstant, const UINT* pNumConstants);
void STDMETHODCALLTYPE GSSetConstantBuffers1(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* pConstantBuffers, const UINT* pFirstConstant, const UINT* pNumConstants);
void STDMETHODCALLTYPE HSSetConstantBuffers1(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* pConstantBuffers, const UINT* pFirstConstant, const UINT* pNumConstants);
void STDMETHODCALLTYPE DSSetConstantBuffers1(UINT StartSlot, UINT NumBuffers, ID3D11Buffer* const* pConstantBuffers, const UINT* pFirstConstant, const UINT* pNumConstants);
void STDMETHODCALLTYPE CSGetConstantBuffers1(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers, UINT* pFirstConstant, UINT* pNumConstants);
void STDMETHODCALLTYPE PSGetConstantBuffers1(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers, UINT* pFirstConstant, UINT* pNumConstants);
void STDMETHODCALLTYPE VSGetConstantBuffers1(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers, UINT* pFirstConstant, UINT* pNumConstants);
void STDMETHODCALLTYPE GSGetConstantBuffers1(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers, UINT* pFirstConstant, UINT* pNumConstants);
void STDMETHODCALLTYPE HSGetConstantBuffers1(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers, UINT* pFirstConstant, UINT* pNumConstants);
void STDMETHODCALLTYPE DSGetConstantBuffers1(UINT StartSlot, UINT NumBuffers, ID3D11Buffer** ppConstantBuffers, UINT* pFirstConstant, UINT* pNumConstants);
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<CCryDXGLUnorderedAccessView> m_aspUnorderedAccessViews[D3D11_1_UAV_SLOT_COUNT];
_smart_ptr<CCryDXGLBuffer> m_aspConstantBuffers[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT];
uint32 m_auConstantBufferOffsets[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT];
uint32 m_auConstantBufferSizes[D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT];
};
void SetShaderResources(uint32 uStage, UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView* const* ppShaderResourceViews);
void SetUnorderedAccessViews(uint32 uStage, UINT StartSlot, UINT NumViews, ID3D11UnorderedAccessView* const* ppUnorderedAccessViews);
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, const UINT* pFirstConstant = NULL, const UINT* pNumConstants = NULL);
void GetShaderResources(uint32 uStage, UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView** ppShaderResourceViews);
void GetUnorderedAccesses(uint32 uStage, UINT StartSlot, UINT NumViews, ID3D11UnorderedAccessView** ppUnorderedAccessViews);
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, UINT* pFirstConstant = NULL, UINT* pNumConstants = NULL);
protected:
NCryOpenGL::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;
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 //__CRYDXGLDEVICECONTEXT__
@@ -0,0 +1,151 @@
/*
* 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 "CCryDXGLGIAdapter.hpp"
#include "CCryDXGLGIFactory.hpp"
#include "CCryDXGLGIOutput.hpp"
#include "../Implementation/GLDevice.hpp"
#include "UnicodeFunctions.h"
#include "../../../Common/RenderCapabilities.h"
CCryDXGLGIAdapter::CCryDXGLGIAdapter(CCryDXGLGIFactory* pFactory, NCryOpenGL::SAdapter* pGLAdapter)
: m_spGLAdapter(pGLAdapter)
, m_spFactory(pFactory)
{
DXGL_INITIALIZE_INTERFACE(DXGIAdapter)
DXGL_INITIALIZE_INTERFACE(DXGIAdapter1)
}
CCryDXGLGIAdapter::~CCryDXGLGIAdapter()
{
}
bool CCryDXGLGIAdapter::Initialize()
{
memset(&m_kDesc1, 0, sizeof(m_kDesc1));
Unicode::Convert(m_kDesc.Description, m_spGLAdapter->m_strRenderer);
memcpy(m_kDesc1.Description, m_kDesc.Description, sizeof(m_kDesc1.Description));
m_kDesc1.VendorId = m_spGLAdapter->m_eDriverVendor;
std::vector<NCryOpenGL::SOutputPtr> kGLOutputs;
if (!NCryOpenGL::DetectOutputs(*m_spGLAdapter, m_spGLAdapter->m_kOutputs))
{
return false;
}
m_kOutputs.reserve(m_spGLAdapter->m_kOutputs.size());
std::vector<NCryOpenGL::SOutputPtr>::const_iterator kGLOutputIter(m_spGLAdapter->m_kOutputs.begin());
const std::vector<NCryOpenGL::SOutputPtr>::const_iterator kGLOutputEnd(m_spGLAdapter->m_kOutputs.end());
for (; kGLOutputIter != kGLOutputEnd; ++kGLOutputIter)
{
_smart_ptr<CCryDXGLGIOutput> spOutput(new CCryDXGLGIOutput(*kGLOutputIter));
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_uVRAMBytes;
return true;
}
D3D_FEATURE_LEVEL CCryDXGLGIAdapter::GetSupportedFeatureLevel()
{
return m_eSupportedFeatureLevel;
}
NCryOpenGL::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 __CRYDXGLGIADAPTER__
#define __CRYDXGLGIADAPTER__
#include "CCryDXGLGIObject.hpp"
namespace NCryOpenGL
{
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, NCryOpenGL::SAdapter* pGLAdapter);
virtual ~CCryDXGLGIAdapter();
bool Initialize();
D3D_FEATURE_LEVEL GetSupportedFeatureLevel();
NCryOpenGL::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<NCryOpenGL::SAdapter> m_spGLAdapter;
DXGI_ADAPTER_DESC m_kDesc;
DXGI_ADAPTER_DESC1 m_kDesc1;
D3D_FEATURE_LEVEL m_eSupportedFeatureLevel;
};
#endif //__CRYDXGLGIADAPTER__
@@ -0,0 +1,155 @@
/*
* 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 "CCryDXGLGIAdapter.hpp"
#include "CCryDXGLGIFactory.hpp"
#include "CCryDXGLSwapChain.hpp"
#include "../Interfaces/CCryDXGLDevice.hpp"
#include "../Implementation/GLDevice.hpp"
CCryDXGLGIFactory::CCryDXGLGIFactory()
{
DXGL_INITIALIZE_INTERFACE(DXGIFactory)
DXGL_INITIALIZE_INTERFACE(DXGIFactory1)
}
CCryDXGLGIFactory::~CCryDXGLGIFactory()
{
}
bool CCryDXGLGIFactory::Initialize()
{
std::vector<NCryOpenGL::SAdapterPtr> kAdapters;
if (!NCryOpenGL::DetectAdapters(kAdapters))
{
return false;
}
// Check if the adapters support what's needed for running the game.
bool foundCapableAdapter = false;
AZStd::string errorMsg;
for (const NCryOpenGL::SAdapterPtr& adapterPtr : kAdapters)
{
AZStd::string adapterError;
if (adapterPtr && NCryOpenGL::CheckAdapterCapabilities(*adapterPtr, &adapterError))
{
foundCapableAdapter = true;
break;
}
errorMsg += adapterError;
}
if (!foundCapableAdapter)
{
AZ_Assert(false, "The available graphic adapters don't meet the minimum requirements for running the game. \n%s", errorMsg.c_str());
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 __CRYDXGLGIFACTORY__
#define __CRYDXGLGIFACTORY__
#include "CCryDXGLGIObject.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 //__CRYDXGLGIFACTORY__
@@ -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 "CCryDXGLGIObject.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,52 @@
/*
* 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 __CRYDXGLGIOBJECT__
#define __CRYDXGLGIOBJECT__
#include "CCryDXGLBase.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 //__CRYDXGLGIOBJECT__
@@ -0,0 +1,334 @@
/*
* 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 "CCryDXGLGIOutput.hpp"
#include "../Implementation/GLDevice.hpp"
#include "UnicodeFunctions.h"
CCryDXGLGIOutput::CCryDXGLGIOutput(NCryOpenGL::SOutput* pGLOutput)
: m_spGLOutput(pGLOutput)
{
DXGL_INITIALIZE_INTERFACE(DXGIOutput)
}
CCryDXGLGIOutput::~CCryDXGLGIOutput()
{
}
bool CCryDXGLGIOutput::Initialize()
{
ZeroMemory(&m_kDesc, sizeof(m_kDesc));
Unicode::Convert(m_kDesc.DeviceName, m_spGLOutput->m_strDeviceName);
if (m_spGLOutput->m_kModes.empty())
{
DXGL_ERROR("GL Output has no display modes");
return false;
}
m_kDisplayModes.resize(m_spGLOutput->m_kModes.size());
std::vector<NCryOpenGL::SDisplayMode>::const_iterator kGLModeIter(m_spGLOutput->m_kModes.begin());
const std::vector<NCryOpenGL::SDisplayMode>::const_iterator kGLModeEnd(m_spGLOutput->m_kModes.end());
std::vector<DXGI_MODE_DESC>::iterator kModeIter;
for (kModeIter = m_kDisplayModes.begin(); kGLModeIter != kGLModeEnd; ++kGLModeIter, ++kModeIter)
{
NCryOpenGL::GetDXGIModeDesc(&*kModeIter, *kGLModeIter);
}
return true;
}
NCryOpenGL::SOutput* CCryDXGLGIOutput::GetGLOutput()
{
return m_spGLOutput;
}
////////////////////////////////////////////////////////////////////////////////
// IDXGIOutput implementation
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLGIOutput::GetDesc(DXGI_OUTPUT_DESC* pDesc)
{
*pDesc = m_kDesc;
return S_OK;
}
HRESULT CCryDXGLGIOutput::GetDisplayModeList(DXGI_FORMAT EnumFormat, UINT Flags, UINT* pNumModes, DXGI_MODE_DESC* pDesc)
{
DXGL_TODO("Take into account Flags as well (for filtering scaled/interlaced modes) if required")
Flags;
DXGI_MODE_DESC* pDescEnd(pDesc == NULL ? NULL : pDesc + *pNumModes);
std::vector<DXGI_MODE_DESC>::const_iterator kModeIter(m_kDisplayModes.begin());
const std::vector<DXGI_MODE_DESC>::const_iterator kModeEnd(m_kDisplayModes.end());
for (; kModeIter != kModeEnd; ++kModeIter)
{
if (EnumFormat == DXGI_FORMAT_UNKNOWN || EnumFormat == kModeIter->Format)
{
if (pDesc == NULL)
{
++(*pNumModes);
}
else if (pDesc < pDescEnd)
{
*(pDesc++) = *kModeIter;
}
else
{
return DXGI_ERROR_MORE_DATA;
}
}
}
return S_OK;
}
HRESULT CCryDXGLGIOutput::FindClosestMatchingMode(const DXGI_MODE_DESC* pModeToMatch, DXGI_MODE_DESC* pClosestMatch, IUnknown* pConcernedDevice)
{
struct SRank
{
uint32 m_uOrdering;
uint32 m_uScaling;
uint32 m_uFormat;
uint32 m_uResolution;
uint32 m_uRefreshRate;
SRank(uint32 uDefaultValue)
: m_uOrdering(uDefaultValue)
, m_uScaling(uDefaultValue)
, m_uFormat(uDefaultValue)
, m_uResolution(uDefaultValue)
, m_uRefreshRate(uDefaultValue)
{
}
SRank(const DXGI_MODE_DESC& kDesc, const DXGI_MODE_DESC& kReference)
{
m_uOrdering = MatchOrdering(kDesc, kReference);
m_uScaling = MatchScaling(kDesc, kReference);
m_uFormat = kDesc.Format == kReference.Format;
m_uResolution = abs((int32)kDesc.Width * (int32)kDesc.Height - (int32)kReference.Width * (int32)kReference.Height);
m_uRefreshRate = (uint32)abs((float)kDesc.RefreshRate.Numerator / (float)kDesc.RefreshRate.Denominator - (float)kReference.RefreshRate.Numerator / (float)kReference.RefreshRate.Denominator);
}
static bool MatchScaling(const DXGI_MODE_DESC& kDesc, const DXGI_MODE_DESC& kReference)
{
return kReference.Scaling != DXGI_MODE_SCALING_UNSPECIFIED && kReference.Scaling != kDesc.Scaling;
}
static bool MatchOrdering(const DXGI_MODE_DESC& kDesc, const DXGI_MODE_DESC& kReference)
{
return kReference.ScanlineOrdering != DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED && kReference.ScanlineOrdering != kDesc.ScanlineOrdering;
}
static bool MatchFormat(const DXGI_MODE_DESC& kDesc, const DXGI_MODE_DESC& kReference)
{
return kReference.Format == kDesc.Format;
}
static bool MatchResolution(const DXGI_MODE_DESC& kDesc, const DXGI_MODE_DESC& kReference)
{
return kDesc.Height >= kReference.Height && kDesc.Width >= kReference.Width;
}
static bool MatchRefreshRate(const DXGI_MODE_DESC& kDesc, const DXGI_MODE_DESC& kReference)
{
return kDesc.RefreshRate.Numerator * kReference.RefreshRate.Denominator >= kReference.RefreshRate.Numerator * kDesc.RefreshRate.Denominator;
}
bool operator<(const SRank& kOther) const
{
if (m_uOrdering != kOther.m_uOrdering)
{
return m_uOrdering < kOther.m_uOrdering;
}
if (m_uScaling != kOther.m_uScaling)
{
return m_uScaling < kOther.m_uScaling;
}
if (m_uFormat != kOther.m_uFormat)
{
return m_uFormat < kOther.m_uFormat;
}
if (m_uResolution != kOther.m_uResolution)
{
return m_uResolution < kOther.m_uResolution;
}
return m_uRefreshRate < kOther.m_uRefreshRate;
}
};
bool bScanlineOrdering(pModeToMatch->ScanlineOrdering != DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED);
bool bScaling(pModeToMatch->Scaling != DXGI_MODE_SCALING_UNSPECIFIED);
bool bFormat(pModeToMatch->Format != DXGI_FORMAT_UNKNOWN);
bool bResolution(pModeToMatch->Width != 0 || pModeToMatch->Height != 0);
bool bRefreshRate(pModeToMatch->RefreshRate.Numerator != 0 || pModeToMatch->RefreshRate.Denominator != 0);
if ((!bFormat && pConcernedDevice == NULL) ||
bResolution != (pModeToMatch->Width != 0 && pModeToMatch->Height != 0) ||
bRefreshRate != (pModeToMatch->RefreshRate.Numerator != 0 && pModeToMatch->RefreshRate.Denominator != 0))
{
return E_FAIL;
}
ID3D11Device* pConcernedD3D11Device(NULL);
DXGI_MODE_DESC kTarget(*pModeToMatch);
if (!bScanlineOrdering)
{
kTarget.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE;
}
if (!bScaling)
{
kTarget.Scaling = DXGI_MODE_SCALING_STRETCHED;
}
if (!bFormat || !bResolution || !bRefreshRate)
{
DXGI_MODE_DESC kDXGIDesktopModeDesc;
GetDXGIModeDesc(&kDXGIDesktopModeDesc, m_spGLOutput->m_kDesktopMode);
if (!bFormat)
{
void* pvConcernedD3D11Device(NULL);
if (pConcernedDevice != NULL && !FAILED(pConcernedDevice->QueryInterface(__uuidof(ID3D11Device), &pvConcernedD3D11Device)))
{
pConcernedD3D11Device = static_cast<ID3D11Device*>(pvConcernedD3D11Device);
}
else
{
kTarget.Format = kDXGIDesktopModeDesc.Format;
}
}
if (!bResolution)
{
kTarget.Width = kDXGIDesktopModeDesc.Width;
kTarget.Height = kDXGIDesktopModeDesc.Height;
}
if (!bRefreshRate)
{
kTarget.RefreshRate.Numerator = kDXGIDesktopModeDesc.RefreshRate.Numerator;
kTarget.RefreshRate.Denominator = kDXGIDesktopModeDesc.RefreshRate.Denominator;
}
}
uint32 uMinMode = m_kDisplayModes.size();
SRank kMinRank(~0);
for (uint32 uMode = 0; uMode < m_kDisplayModes.size(); ++uMode)
{
const DXGI_MODE_DESC& kMode(m_kDisplayModes.at(uMode));
if ((bScanlineOrdering && !SRank::MatchOrdering(kMode, kTarget)) ||
(bScaling && !SRank::MatchScaling(kMode, kTarget)) ||
(bFormat && !SRank::MatchFormat(kMode, kTarget)) ||
(bResolution && !SRank::MatchResolution(kMode, kTarget)) ||
(bRefreshRate && !SRank::MatchRefreshRate(kMode, kTarget)))
{
continue;
}
if (pConcernedD3D11Device != NULL)
{
UINT uModeFormatSuppport;
if (FAILED(pConcernedD3D11Device->CheckFormatSupport(kMode.Format, &uModeFormatSuppport)) ||
(uModeFormatSuppport & D3D11_FORMAT_SUPPORT_DISPLAY) == 0)
{
continue;
}
}
SRank kModeRank(kMode, kTarget);
if (kModeRank < kMinRank)
{
uMinMode = uMode;
kMinRank = kModeRank;
}
}
if (uMinMode < m_kDisplayModes.size())
{
*pClosestMatch = m_kDisplayModes.at(uMinMode);
if (pClosestMatch->Scaling == DXGI_MODE_SCALING_UNSPECIFIED)
{
pClosestMatch->Scaling = kTarget.Scaling;
}
if (pClosestMatch->ScanlineOrdering == DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED)
{
pClosestMatch->ScanlineOrdering = kTarget.ScanlineOrdering;
}
return S_OK;
}
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,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 IDXGIOutput
#ifndef __CRYDXGLGIOUTPUT__
#define __CRYDXGLGIOUTPUT__
#include "CCryDXGLGIObject.hpp"
namespace NCryOpenGL
{
struct SOutput;
}
class CCryDXGLGIOutput
: public CCryDXGLGIObject
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLGIOutput, DXGIOutput)
CCryDXGLGIOutput(NCryOpenGL::SOutput* pGLOutput);
virtual ~CCryDXGLGIOutput();
bool Initialize();
NCryOpenGL::SOutput* GetGLOutput();
// 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:
_smart_ptr<NCryOpenGL::SOutput> m_spGLOutput;
std::vector<DXGI_MODE_DESC> m_kDisplayModes;
DXGI_OUTPUT_DESC m_kDesc;
};
#endif //__CRYDXGLGIOUTPUT__
@@ -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 : Definition of the DXGL wrapper for ID3D11InputLayout
#include "RenderDll_precompiled.h"
#include "CCryDXGLInputLayout.hpp"
#include "../Implementation/GLShader.hpp"
CCryDXGLInputLayout::CCryDXGLInputLayout(NCryOpenGL::SInputLayout* pGLLayout, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_spGLLayout(pGLLayout)
{
DXGL_INITIALIZE_INTERFACE(D3D11InputLayout)
}
CCryDXGLInputLayout::~CCryDXGLInputLayout()
{
}
NCryOpenGL::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 __CRYDXGLINPUTLAYOUT__
#define __CRYDXGLINPUTLAYOUT__
#include "CCryDXGLDeviceChild.hpp"
namespace NCryOpenGL
{
struct SInputLayout;
}
class CCryDXGLInputLayout
: public CCryDXGLDeviceChild
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLInputLayout, D3D11InputLayout)
CCryDXGLInputLayout(NCryOpenGL::SInputLayout* pGLLayout, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLInputLayout();
NCryOpenGL::SInputLayout* GetGLLayout();
private:
_smart_ptr<NCryOpenGL::SInputLayout> m_spGLLayout;
};
#endif //__CRYDXGLINPUTLAYOUT__
@@ -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 "CCryDXGLQuery.hpp"
#include "../Implementation/GLResource.hpp"
CCryDXGLQuery::CCryDXGLQuery(const D3D11_QUERY_DESC& kDesc, NCryOpenGL::SQuery* pGLQuery, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_kDesc(kDesc)
, m_spGLQuery(pGLQuery)
{
DXGL_INITIALIZE_INTERFACE(D3D11Asynchronous)
DXGL_INITIALIZE_INTERFACE(D3D11Query)
}
CCryDXGLQuery::~CCryDXGLQuery()
{
}
NCryOpenGL::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 __CRYDXGLQUERY__
#define __CRYDXGLQUERY__
#include "CCryDXGLDeviceChild.hpp"
namespace NCryOpenGL
{
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, NCryOpenGL::SQuery* pGLQuery, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLQuery();
NCryOpenGL::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<NCryOpenGL::SQuery> m_spGLQuery;
};
#endif //__CRYDXGLQUERY__
@@ -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 "CCryDXGLRasterizerState.hpp"
#include "CCryDXGLDevice.hpp"
#include "../Implementation/GLState.hpp"
#include "../Implementation/GLDevice.hpp"
CCryDXGLRasterizerState::CCryDXGLRasterizerState(const D3D11_RASTERIZER_DESC& kDesc, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_kDesc(kDesc)
, m_pGLState(new NCryOpenGL::SRasterizerState)
{
DXGL_INITIALIZE_INTERFACE(D3D11RasterizerState)
}
CCryDXGLRasterizerState::~CCryDXGLRasterizerState()
{
delete m_pGLState;
}
bool CCryDXGLRasterizerState::Initialize(CCryDXGLDevice* pDevice, NCryOpenGL::CContext* pContext)
{
return NCryOpenGL::InitializeRasterizerState(m_kDesc, *m_pGLState, pContext);
}
bool CCryDXGLRasterizerState::Apply(NCryOpenGL::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 __CRYDXGLRASTERIZERSTATE__
#define __CRYDXGLRASTERIZERSTATE__
#include "CCryDXGLDeviceChild.hpp"
namespace NCryOpenGL
{
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, NCryOpenGL::CContext* pContext);
bool Apply(NCryOpenGL::CContext* pContext);
// Implementation of ID3D11RasterizerState
void GetDesc(D3D11_RASTERIZER_DESC* pDesc);
protected:
D3D11_RASTERIZER_DESC m_kDesc;
NCryOpenGL::SRasterizerState* m_pGLState;
};
#endif //__CRYDXGLRASTERIZERSTATE__
@@ -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 "CCryDXGLDevice.hpp"
#include "CCryDXGLRenderTargetView.hpp"
#include "CCryDXGLResource.hpp"
#include "../Implementation/GLDevice.hpp"
#include "../Implementation/GLView.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(NCryOpenGL::CContext* pContext)
{
D3D11_RESOURCE_DIMENSION eDimension;
m_spResource->GetType(&eDimension);
m_spGLView = NCryOpenGL::CreateRenderTargetView(m_spResource->GetGLResource(), eDimension, m_kDesc, pContext);
return m_spGLView != NULL;
}
NCryOpenGL::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 __CRYDXGLRENDERTARGETVIEW__
#define __CRYDXGLRENDERTARGETVIEW__
#include "CCryDXGLView.hpp"
namespace NCryOpenGL
{
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(NCryOpenGL::CContext* pContext);
NCryOpenGL::SOutputMergerView* GetGLView();
// Implementation of ID3D11RenderTargetView
void GetDesc(D3D11_RENDER_TARGET_VIEW_DESC* pDesc);
private:
D3D11_RENDER_TARGET_VIEW_DESC m_kDesc;
_smart_ptr<NCryOpenGL::SOutputMergerView> m_spGLView;
};
#endif //__CRYDXGLRENDERTARGETVIEW__
@@ -0,0 +1,52 @@
/*
* 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 "CCryDXGLResource.hpp"
#include "../Implementation/GLResource.hpp"
CCryDXGLResource::CCryDXGLResource(D3D11_RESOURCE_DIMENSION eDimension, NCryOpenGL::SResource* pGLResource, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_spGLResource(pGLResource)
, m_eDimension(eDimension)
{
DXGL_INITIALIZE_INTERFACE(D3D11Resource)
}
CCryDXGLResource::~CCryDXGLResource()
{
}
////////////////////////////////////////////////////////////////////////////////
// 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 __CRYDXGLRESOURCE__
#define __CRYDXGLRESOURCE__
#include "CCryDXGLDeviceChild.hpp"
namespace NCryOpenGL
{
class CDevice;
struct SResource;
};
class CCryDXGLResource
: public CCryDXGLDeviceChild
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLResource, D3D11Resource)
virtual ~CCryDXGLResource();
ILINE NCryOpenGL::SResource* GetGLResource() { return m_spGLResource; }
// 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, NCryOpenGL::SResource* pResource, CCryDXGLDevice* pDevice);
protected:
_smart_ptr<NCryOpenGL::SResource> m_spGLResource;
D3D11_RESOURCE_DIMENSION m_eDimension;
};
#endif //__CRYDXGLRESOURCE__
@@ -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 ID3D11SamplerState
#include "RenderDll_precompiled.h"
#include "CCryDXGLSamplerState.hpp"
#include "CCryDXGLDevice.hpp"
#include "../Implementation/GLState.hpp"
#include "../Implementation/GLDevice.hpp"
CCryDXGLSamplerState::CCryDXGLSamplerState(const D3D11_SAMPLER_DESC& kDesc, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_kDesc(kDesc)
, m_pGLState(new NCryOpenGL::SSamplerState)
{
DXGL_INITIALIZE_INTERFACE(D3D11SamplerState)
}
CCryDXGLSamplerState::~CCryDXGLSamplerState()
{
delete m_pGLState;
}
bool CCryDXGLSamplerState::Initialize(CCryDXGLDevice* pDevice, NCryOpenGL::CContext* pContext)
{
return NCryOpenGL::InitializeSamplerState(m_kDesc, *m_pGLState, pContext);
}
void CCryDXGLSamplerState::Apply(uint32 uStage, uint32 uSlot, NCryOpenGL::CContext* pContext)
{
pContext->SetSampler(m_pGLState, uStage, uSlot);
}
////////////////////////////////////////////////////////////////
// Implementation of ID3D11SamplerState
////////////////////////////////////////////////////////////////
void CCryDXGLSamplerState::GetDesc(D3D11_SAMPLER_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 ID3D11SamplerState
#ifndef __CRYDXGLSAMPLERSTATE__
#define __CRYDXGLSAMPLERSTATE__
#include "CCryDXGLDeviceChild.hpp"
namespace NCryOpenGL
{
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, NCryOpenGL::CContext* pContext);
void Apply(uint32 uStage, uint32 uSlot, NCryOpenGL::CContext* pContext);
// Implementation of ID3D11SamplerState
void GetDesc(D3D11_SAMPLER_DESC* pDesc);
protected:
D3D11_SAMPLER_DESC m_kDesc;
NCryOpenGL::SSamplerState* m_pGLState;
};
#endif //__CRYDXGLSAMPLERSTATE__
@@ -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 "CCryDXGLShader.hpp"
#include "../Implementation/GLShader.hpp"
CCryDXGLShader::CCryDXGLShader(NCryOpenGL::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLDeviceChild(pDevice)
, m_spGLShader(pGLShader)
{
}
CCryDXGLShader::~CCryDXGLShader()
{
}
NCryOpenGL::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 __CRYDXGLSHADER__
#define __CRYDXGLSHADER__
#include "CCryDXGLDeviceChild.hpp"
namespace NCryOpenGL
{
struct SShader;
}
class CCryDXGLShader
: public CCryDXGLDeviceChild
{
public:
CCryDXGLShader(NCryOpenGL::SShader* pGLShader, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLShader();
NCryOpenGL::SShader* GetGLShader();
private:
_smart_ptr<NCryOpenGL::SShader> m_spGLShader;
};
class CCryDXGLVertexShader
: public CCryDXGLShader
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLVertexShader, D3D11VertexShader)
CCryDXGLVertexShader(NCryOpenGL::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLShader(pGLShader, pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11VertexShader)
}
};
class CCryDXGLHullShader
: public CCryDXGLShader
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLHullShader, D3D11HullShader)
CCryDXGLHullShader(NCryOpenGL::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLShader(pGLShader, pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11HullShader)
}
};
class CCryDXGLDomainShader
: public CCryDXGLShader
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLDomainShader, D3D11DomainShader)
CCryDXGLDomainShader(NCryOpenGL::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLShader(pGLShader, pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11DomainShader)
}
};
class CCryDXGLGeometryShader
: public CCryDXGLShader
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLGeometryShader, D3D11GeometryShader)
CCryDXGLGeometryShader(NCryOpenGL::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLShader(pGLShader, pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11GeometryShader)
}
};
class CCryDXGLPixelShader
: public CCryDXGLShader
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLPixelShader, D3D11PixelShader)
CCryDXGLPixelShader(NCryOpenGL::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLShader(pGLShader, pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11PixelShader)
}
};
class CCryDXGLComputeShader
: public CCryDXGLShader
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLComputeShader, D3D11ComputeShader)
CCryDXGLComputeShader(NCryOpenGL::SShader* pGLShader, CCryDXGLDevice* pDevice)
: CCryDXGLShader(pGLShader, pDevice)
{
DXGL_INITIALIZE_INTERFACE(D3D11ComputeShader)
}
};
#endif //__CRYDXGLSHADER__
@@ -0,0 +1,417 @@
/*
* 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 "CCryDXGLShaderReflection.hpp"
#include "../Implementation/GLShader.hpp"
////////////////////////////////////////////////////////////////////////////////
// CCryDXGLShaderReflectionVariable
////////////////////////////////////////////////////////////////////////////////
struct CCryDXGLShaderReflectionVariable::Impl
{
NCryOpenGL::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<NCryOpenGL::SShaderReflectionVariable*>(pvData);
return true;
}
HRESULT CCryDXGLShaderReflectionVariable::GetDesc(D3D11_SHADER_VARIABLE_DESC* pDesc)
{
(*pDesc) = m_pImpl->m_pVariable->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) = m_pImpl->m_pVariable->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;
}
////////////////////////////////////////////////////////////////////////////////
// CCryDXGLShaderReflectionConstBuffer
////////////////////////////////////////////////////////////////////////////////
struct CCryDXGLShaderReflectionConstBuffer::Impl
{
typedef std::vector<_smart_ptr<CCryDXGLShaderReflectionVariable> > TVariables;
TVariables m_kVariables;
NCryOpenGL::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<NCryOpenGL::SShaderReflectionConstBuffer*>(pvData);
NCryOpenGL::SShaderReflectionConstBuffer::TVariables::iterator kVarIter(m_pImpl->m_pConstBuffer->m_kVariables.begin());
const NCryOpenGL::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;
}
HRESULT CCryDXGLShaderReflectionConstBuffer::GetDesc(D3D11_SHADER_BUFFER_DESC* pDesc)
{
(*pDesc) = m_pImpl->m_pConstBuffer->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;
}
////////////////////////////////////////////////////////////////////////////////
// CCryDXGLShaderReflection
////////////////////////////////////////////////////////////////////////////////
struct CCryDXGLShaderReflection::Impl
{
struct SResource
{
NCryOpenGL::SShaderReflectionResource* m_pResource;
};
struct SParameter
{
NCryOpenGL::SShaderReflectionParameter* m_pParameter;
};
typedef std::vector<_smart_ptr<CCryDXGLShaderReflectionConstBuffer> > TConstantBuffers;
TConstantBuffers m_kConstantBuffers;
NCryOpenGL::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 (!InitializeShaderReflectionFromInput(&m_pImpl->m_kReflection, pvData))
{
return false;
}
NCryOpenGL::SShaderReflection::TConstantBuffers::iterator kConstBufferIter(m_pImpl->m_kReflection.m_kConstantBuffers.begin());
const NCryOpenGL::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;
}
HRESULT CCryDXGLShaderReflection::GetDesc(D3D11_SHADER_DESC* pDesc)
{
(*pDesc) = m_pImpl->m_kReflection.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 >= m_pImpl->m_kReflection.m_kResources.size())
{
return E_FAIL;
}
*pDesc = m_pImpl->m_kReflection.m_kResources[ResourceIndex].m_kDesc;
return S_OK;
}
HRESULT CCryDXGLShaderReflection::GetInputParameterDesc(UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc)
{
if (ParameterIndex >= m_pImpl->m_kReflection.m_kInputs.size())
{
return E_FAIL;
}
*pDesc = m_pImpl->m_kReflection.m_kInputs[ParameterIndex].m_kDesc;
return S_OK;
}
HRESULT CCryDXGLShaderReflection::GetOutputParameterDesc(UINT ParameterIndex, D3D11_SIGNATURE_PARAMETER_DESC* pDesc)
{
if (ParameterIndex >= m_pImpl->m_kReflection.m_kOutputs.size())
{
return E_FAIL;
}
*pDesc = m_pImpl->m_kReflection.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;
}
@@ -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 __CRYDXGLSHADERREFLECTION__
#define __CRYDXGLSHADERREFLECTION__
#include "CCryDXGLBase.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 //__CRYDXGLSHADERREFLECTION__
@@ -0,0 +1,52 @@
/*
* 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 "CCryDXGLShaderResourceView.hpp"
#include "CCryDXGLDevice.hpp"
#include "CCryDXGLResource.hpp"
#include "../Implementation/GLView.hpp"
#include "../Implementation/GLDevice.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(NCryOpenGL::CContext* pContext)
{
D3D11_RESOURCE_DIMENSION eDimension;
m_spResource->GetType(&eDimension);
m_spGLView = NCryOpenGL::CreateShaderResourceView(m_spResource->GetGLResource(), eDimension, m_kDesc, pContext);
return m_spGLView != NULL;
}
////////////////////////////////////////////////////////////////////////////////
// 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 __CRYDXGLSHADERRESOURCEVIEW__
#define __CRYDXGLSHADERRESOURCEVIEW__
#include "CCryDXGLView.hpp"
namespace NCryOpenGL
{
struct SShaderView;
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(NCryOpenGL::CContext* pContext);
ILINE NCryOpenGL::SShaderView* GetGLView() { return m_spGLView; }
// Implementation of ID3D11ShaderResourceView
void GetDesc(D3D11_SHADER_RESOURCE_VIEW_DESC* pDesc);
protected:
D3D11_SHADER_RESOURCE_VIEW_DESC m_kDesc;
_smart_ptr<NCryOpenGL::SShaderView> m_spGLView;
};
#endif //__CRYDXGLSHADERRESOURCEVIEW__
@@ -0,0 +1,214 @@
/*
* 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 "CCryDXGLDevice.hpp"
#include "CCryDXGLGIOutput.hpp"
#include "CCryDXGLSwapChain.hpp"
#include "CCryDXGLTexture2D.hpp"
#include "../Implementation/GLDevice.hpp"
#include "../Implementation/GLContext.hpp"
#include "../Implementation/GLResource.hpp"
CCryDXGLSwapChain::CCryDXGLSwapChain(CCryDXGLDevice* pDevice, const DXGI_SWAP_CHAIN_DESC& kDesc)
: m_spDevice(pDevice)
{
DXGL_INITIALIZE_INTERFACE(DXGIDeviceSubObject)
DXGL_INITIALIZE_INTERFACE(DXGISwapChain)
m_kDesc = kDesc;
}
CCryDXGLSwapChain::~CCryDXGLSwapChain()
{
}
bool CCryDXGLSwapChain::Initialize()
{
if (!m_kDesc.Windowed &&
FAILED(SetFullscreenState(TRUE, NULL)))
{
return false;
}
return UpdateTexture(true);
}
bool CCryDXGLSwapChain::UpdateTexture(bool bSetPixelFormat)
{
// 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; // Default back buffer can only be bound as render target
kBackBufferDesc.CPUAccessFlags = 0;
kBackBufferDesc.MiscFlags = 0;
NCryOpenGL::SDefaultFrameBufferTexturePtr spBackBufferTex(NCryOpenGL::CreateBackBufferTexture(kBackBufferDesc));
m_spBackBufferTexture = new CCryDXGLTexture2D(kBackBufferDesc, spBackBufferTex, m_spDevice);
#if DXGL_FULL_EMULATION
if (bSetPixelFormat)
{
NCryOpenGL::CDevice* pDevice(m_spDevice->GetGLDevice());
NCryOpenGL::TNativeDisplay kNativeDisplay(NULL);
NCryOpenGL::TWindowContext kCustomWindowContext(NULL);
if (!NCryOpenGL::GetNativeDisplay(kNativeDisplay, m_kDesc.OutputWindow) ||
!NCryOpenGL::CreateWindowContext(kCustomWindowContext, pDevice->GetFeatureSpec(), pDevice->GetPixelFormatSpec(), kNativeDisplay))
{
return false;
}
spBackBufferTex->SetCustomWindowContext(kCustomWindowContext);
}
#endif //DXGL_FULL_EMULATION
return true;
}
////////////////////////////////////////////////////////////////////////////////
// IDXGISwapChain implementation
////////////////////////////////////////////////////////////////////////////////
HRESULT CCryDXGLSwapChain::Present(UINT SyncInterval, UINT Flags)
{
NCryOpenGL::CDevice* pDevice(m_spDevice->GetGLDevice());
NCryOpenGL::CContext* pContext(pDevice->ReserveContext());
if (pContext == NULL)
{
return E_FAIL;
}
NCryOpenGL::SDefaultFrameBufferTexture* pGLBackBufferTexture(static_cast<NCryOpenGL::SDefaultFrameBufferTexture*>(m_spBackBufferTexture->GetGLTexture()));
#if DXGL_FULL_EMULATION
const NCryOpenGL::TWindowContext& kWindowContext(
pGLBackBufferTexture->m_kCustomWindowContext != NULL ?
pGLBackBufferTexture->m_kCustomWindowContext :
pDevice->GetDefaultWindowContext());
pContext->SetWindowContext(kWindowContext);
#else
const NCryOpenGL::TWindowContext& kWindowContext(pDevice->GetDefaultWindowContext());
#endif
pGLBackBufferTexture->Flush(pContext);
HRESULT kResult(pDevice->Present(kWindowContext) ? S_OK : E_FAIL);
pDevice->ReleaseContext();
return kResult;
}
HRESULT CCryDXGLSwapChain::GetBuffer(UINT Buffer, REFIID riid, void** ppSurface)
{
if (Buffer == 0 && riid == __uuidof(ID3D11Texture2D))
{
m_spBackBufferTexture->AddRef();
CCryDXGLTexture2D::ToInterface(reinterpret_cast<ID3D11Texture2D**>(ppSurface), m_spBackBufferTexture.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)
{
NCryOpenGL::SFrameBufferSpec kFrameBufferSpec;
if (!SwapChainDescToFrameBufferSpec(kFrameBufferSpec, m_kDesc))
{
return E_FAIL;
}
NCryOpenGL::SOutput* pGLOutput(pTarget == NULL ? NULL : CCryDXGLGIOutput::FromInterface(pTarget)->GetGLOutput());
return m_spDevice->GetGLDevice()->SetFullScreenState(kFrameBufferSpec, Fullscreen == TRUE, pGLOutput) ? S_OK : 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))
{
return S_OK;
}
}
return E_FAIL;
}
HRESULT CCryDXGLSwapChain::ResizeTarget(const DXGI_MODE_DESC* pNewTargetParameters)
{
NCryOpenGL::SDisplayMode kDisplayMode;
if (!NCryOpenGL::GetDisplayMode(&kDisplayMode, *pNewTargetParameters) ||
m_spDevice->GetGLDevice()->ResizeTarget(kDisplayMode))
{
return E_FAIL;
}
return S_OK;
}
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;
}
@@ -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 IDXGISwapChain
#ifndef __CRYDXGLSWAPCHAIN__
#define __CRYDXGLSWAPCHAIN__
#include "CCryDXGLBase.hpp"
#include "CCryDXGLGIObject.hpp"
namespace NCryOpenGL
{
class CDeviceContextProxy;
}
class CCryDXGLDevice;
class CCryDXGLTexture2D;
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; }
protected:
bool UpdateTexture(bool bSetPixelFormat);
protected:
_smart_ptr<CCryDXGLDevice> m_spDevice;
_smart_ptr<CCryDXGLTexture2D> m_spBackBufferTexture;
DXGI_SWAP_CHAIN_DESC m_kDesc;
};
#endif //__CRYDXGLSWAPCHAIN__
@@ -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 "CCryDXGLSwitchToRef.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 __CRYDXGLSWITCHTOREF__
#define __CRYDXGLSWITCHTOREF__
#include "CCryDXGLDeviceChild.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 //__CRYDXGLSWITCHTOREF__
@@ -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 "CCryDXGLTexture1D.hpp"
CCryDXGLTexture1D::CCryDXGLTexture1D(const D3D11_TEXTURE1D_DESC& kDesc, NCryOpenGL::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 __CRYDXGLTEXTURE1D__
#define __CRYDXGLTEXTURE1D__
#include "CCryDXGLTextureBase.hpp"
class CCryDXGLTexture1D
: public CCryDXGLTextureBase
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLTexture1D, D3D11Texture1D)
CCryDXGLTexture1D(const D3D11_TEXTURE1D_DESC& kDesc, NCryOpenGL::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 //__CRYDXGLTEXTURE1D__
@@ -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 "CCryDXGLTexture2D.hpp"
CCryDXGLTexture2D::CCryDXGLTexture2D(const D3D11_TEXTURE2D_DESC& kDesc, NCryOpenGL::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 __CRYDXGLTEXTURE2D__
#define __CRYDXGLTEXTURE2D__
#include "CCryDXGLTextureBase.hpp"
class CCryDXGLTexture2D
: public CCryDXGLTextureBase
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLTexture2D, D3D11Texture2D)
CCryDXGLTexture2D(const D3D11_TEXTURE2D_DESC& kDesc, NCryOpenGL::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 //__CRYDXGLTEXTURE2D__
@@ -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 "CCryDXGLTexture3D.hpp"
CCryDXGLTexture3D::CCryDXGLTexture3D(const D3D11_TEXTURE3D_DESC& kDesc, NCryOpenGL::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 __CRYDXGLTEXTURE3D__
#define __CRYDXGLTEXTURE3D__
#include "CCryDXGLTextureBase.hpp"
class CCryDXGLTexture3D
: public CCryDXGLTextureBase
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLTexture3D, D3D11Texture3D)
CCryDXGLTexture3D(const D3D11_TEXTURE3D_DESC& kDesc, NCryOpenGL::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 //__CRYDXGLTEXTURE3D__
@@ -0,0 +1,33 @@
/*
* 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 "CCryDXGLTextureBase.hpp"
#include "../Implementation/GLResource.hpp"
CCryDXGLTextureBase::CCryDXGLTextureBase(D3D11_RESOURCE_DIMENSION eDimension, NCryOpenGL::STexture* pGLTexture, CCryDXGLDevice* pDevice)
: CCryDXGLResource(eDimension, pGLTexture, pDevice)
{
}
CCryDXGLTextureBase::~CCryDXGLTextureBase()
{
}
NCryOpenGL::STexture* CCryDXGLTextureBase::GetGLTexture()
{
return static_cast<NCryOpenGL::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 __CRYDXGLTEXTUREBASE__
#define __CRYDXGLTEXTUREBASE__
#include "CCryDXGLResource.hpp"
namespace NCryOpenGL
{
struct STexture;
};
class CCryDXGLTextureBase
: public CCryDXGLResource
{
public:
CCryDXGLTextureBase(D3D11_RESOURCE_DIMENSION eDimension, NCryOpenGL::STexture* pGLTexture, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLTextureBase();
NCryOpenGL::STexture* GetGLTexture();
};
#endif //__CRYDXGLTEXTUREBASE__
@@ -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 ID3D11UnorderedAccessView
#include "RenderDll_precompiled.h"
#include "CCryDXGLUnorderedAccessView.hpp"
#include "CCryDXGLDevice.hpp"
#include "CCryDXGLResource.hpp"
#include "../Implementation/GLView.hpp"
#include "../Implementation/GLDevice.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()
{
}
bool CCryDXGLUnorderedAccessView::Initialize(NCryOpenGL::CContext* pContext)
{
D3D11_RESOURCE_DIMENSION eDimension;
m_spResource->GetType(&eDimension);
m_spGLView = NCryOpenGL::CreateUnorderedAccessView(m_spResource->GetGLResource(), eDimension, m_kDesc, pContext);
return m_spGLView != NULL;
}
NCryOpenGL::SShaderView* CCryDXGLUnorderedAccessView::GetGLView()
{
return m_spGLView;
}
////////////////////////////////////////////////////////////////
// Implementation of ID3D11UnorderedAccessView
////////////////////////////////////////////////////////////////
void CCryDXGLUnorderedAccessView::GetDesc(D3D11_UNORDERED_ACCESS_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 ID3D11UnorderedAccessView
#ifndef __CRYDXGLUNORDEREDACCESSVIEW__
#define __CRYDXGLUNORDEREDACCESSVIEW__
#include "CCryDXGLView.hpp"
namespace NCryOpenGL
{
struct SShaderView;
class CContext;
}
class CCryDXGLUnorderedAccessView
: public CCryDXGLView
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLUnorderedAccessView, D3D11UnorderedAccessView)
CCryDXGLUnorderedAccessView(CCryDXGLResource* pResource, const D3D11_UNORDERED_ACCESS_VIEW_DESC& kDesc, CCryDXGLDevice* pDevice);
virtual ~CCryDXGLUnorderedAccessView();
bool Initialize(NCryOpenGL::CContext* pContext);
NCryOpenGL::SShaderView* GetGLView();
// Implementation of ID3D11UnorderedAccessView
void GetDesc(D3D11_UNORDERED_ACCESS_VIEW_DESC* pDesc);
protected:
D3D11_UNORDERED_ACCESS_VIEW_DESC m_kDesc;
_smart_ptr<NCryOpenGL::SShaderView> m_spGLView;
};
#endif //__CRYDXGLUNORDEREDACCESSVIEW__
@@ -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 "CCryDXGLView.hpp"
#include "CCryDXGLResource.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,52 @@
/*
* 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 __CRYDXGLVIEW__
#define __CRYDXGLVIEW__
#include "CCryDXGLDeviceChild.hpp"
class CCryDXGLResource;
class CCryDXGLView
: public CCryDXGLDeviceChild
{
public:
DXGL_IMPLEMENT_INTERFACE(CCryDXGLView, D3D11View)
virtual ~CCryDXGLView();
inline CCryDXGLResource* GetGLResource() { return m_spResource; }
// 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 //__CRYDXGLVIEW__
@@ -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 ILINE void ToInterface(I ## _Interface * *ppInterface, _Class * pObject) \
{ \
*ppInterface = (pObject == NULL ? NULL : pObject->m_pVirtual ## _Interface ## Wrapper); \
} \
static ILINE _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 ILINE void ToInterface(I ## _Interface * *ppInterface, _Class * pObject) \
{ \
*ppInterface = pObject; \
} \
static ILINE _Class* FromInterface(I ## _Interface * pInterface) \
{ \
return static_cast<_Class*>(pInterface); \
}
#define DXGL_INITIALIZE_INTERFACE(_Interface)
#endif
#endif //__DXEmulation__