Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge with upstream #1

Merged
merged 11 commits into from
Nov 26, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion authors.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Hendrik Polczynski <hendrikpolczyn at gmail dot com>
Hendrik Polczynski <hendrikpolczyn at gmail dot com>
Nick - Coherent Labs (http://coherent-labs.com/)
13 changes: 13 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
Plugin_D3D 2.0.0 (18.11.2013)
==============
Stable Release for CryEngine 3.5.4 (32/64 bit), DX11, DX10, DX10.1
Backward compatible with CryEngine 3.4.5 (32/64 bit), DX9 and DX11 (when recompiled)

New:
* Added DirectX 10 Support
* Added Support for Featurelevels 10.0 and 10.1
* Flownode to query DirectX and plugin status information

Changes:
* Reactivated automatic DirectX Scan since EF_Query is missing again

Plugin_D3D 1.9.0 (02.03.2013)
==============
Stable Release for CryEngine 3.4.5 (32/64 bit), DX9/DX11
Expand Down
8 changes: 6 additions & 2 deletions inc/IPluginD3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace D3DPlugin
D3D_NONE,
D3D_DX9,
D3D_DX11,
D3D_DX10,
};

struct ID3DEventListener
Expand All @@ -39,12 +40,15 @@ namespace D3DPlugin
virtual void RegisterListener( ID3DEventListener* item ) = 0;
virtual void UnregisterListener( ID3DEventListener* item ) = 0;

virtual void* GetSwapChain() = 0; // DX11 only
virtual void* GetDeviceContext() = 0; // DX11 only
virtual void* GetSwapChain() = 0; // >= DX10 only
virtual void* GetDeviceContext() = 0; // >= DX11 only
virtual void* GetDevice() = 0;

virtual int GetFeatureLevel() = 0;
virtual eD3DType GetType() = 0;

virtual const char* GetGPUName() = 0; // >= DX10 only

virtual ITexture* CreateTexture( void** pD3DTextureDst, int width, int height, int numMips, ETEX_Format eTF, int flags ) = 0;
virtual ITexture* InjectTexture( void* pD3DTextureSrc, int nWidth, int nHeight, ETEX_Format eTF, int flags ) = 0;
};
Expand Down
8 changes: 7 additions & 1 deletion project/D3D.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
<ItemGroup>
<ClCompile Include="..\src\CPluginD3D.cpp" />
<ClCompile Include="..\src\CPluginD3DModule.cpp" />
<ClCompile Include="..\src\dx10\CD3DSystemDX10.cpp" />
<ClCompile Include="..\src\dx11\CD3DSystemDX11.cpp" />
<ClCompile Include="..\src\dx9\CD3DSystemDX9.cpp" />
<ClCompile Include="..\src\Flownodes\CFlowD3DNode.cpp" />
<ClCompile Include="..\src\StdAfx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
Expand All @@ -44,12 +46,16 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\inc\IPluginD3D.h" />
<ClInclude Include="..\sample\D3DPlugin_Sample_impl.h" />
<ClInclude Include="..\sample\D3DPlugin_Sample_DX9_impl.h" />
<ClInclude Include="..\src\CPluginD3D.h" />
<ClInclude Include="..\src\dx10\CD3DSystemDX10.h" />
<ClInclude Include="..\src\dx10\d3d10hook.h" />
<ClInclude Include="..\src\dx11\CD3DSystemDX11.h" />
<ClInclude Include="..\src\dx11\d3d11hook.h" />
<ClInclude Include="..\src\dx9\CD3DSystemDX9.h" />
<ClInclude Include="..\src\dx9\d3d9hook.h" />
<ClInclude Include="..\src\dxgi\dxgihook.h" />
<ClInclude Include="..\src\dxgi\dxgiutils.hpp" />
<ClInclude Include="..\src\hooktools.h" />
<ClInclude Include="..\src\pp_tools.h" />
<ClInclude Include="..\src\StdAfx.h" />
Expand Down
29 changes: 28 additions & 1 deletion project/D3D.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@
<Filter Include="Tools">
<UniqueIdentifier>{c070122a-9e71-4ec8-bc5a-259b65125c77}</UniqueIdentifier>
</Filter>
<Filter Include="Systems\DX10">
<UniqueIdentifier>{5a739495-a3b3-4850-8c38-8fd3cfadc499}</UniqueIdentifier>
</Filter>
<Filter Include="Systems\DXGI">
<UniqueIdentifier>{34af623a-d47b-45e1-8ab9-6793ac61e5c1}</UniqueIdentifier>
</Filter>
<Filter Include="Flownodes">
<UniqueIdentifier>{a3fe528e-4827-4e17-b58f-c16326abce24}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="..\readme.md" />
Expand Down Expand Up @@ -73,6 +82,12 @@
<ClCompile Include="..\src\dx11\CD3DSystemDX11.cpp">
<Filter>Systems\DX11</Filter>
</ClCompile>
<ClCompile Include="..\src\dx10\CD3DSystemDX10.cpp">
<Filter>Systems\DX10</Filter>
</ClCompile>
<ClCompile Include="..\src\Flownodes\CFlowD3DNode.cpp">
<Filter>Flownodes</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\StdAfx.h">
Expand Down Expand Up @@ -105,7 +120,19 @@
<ClInclude Include="..\src\hooktools.h">
<Filter>utils</Filter>
</ClInclude>
<ClInclude Include="..\sample\D3DPlugin_Sample_impl.h">
<ClInclude Include="..\src\dx10\CD3DSystemDX10.h">
<Filter>Systems\DX10</Filter>
</ClInclude>
<ClInclude Include="..\src\dx10\d3d10hook.h">
<Filter>Systems\DX10</Filter>
</ClInclude>
<ClInclude Include="..\src\dxgi\dxgihook.h">
<Filter>Systems\DXGI</Filter>
</ClInclude>
<ClInclude Include="..\src\dxgi\dxgiutils.hpp">
<Filter>Systems\DXGI</Filter>
</ClInclude>
<ClInclude Include="..\sample\D3DPlugin_Sample_DX9_impl.h">
<Filter>Samples</Filter>
</ClInclude>
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions project/version.rc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,9,0,0
PRODUCTVERSION 1,9,0,0
FILEVERSION 2,0,0,0
PRODUCTVERSION 2,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -48,11 +48,11 @@ BEGIN
BEGIN
VALUE "CompanyName", "D3D Plugin Project"
VALUE "FileDescription", "D3D Plugin"
VALUE "FileVersion", "1.9.0.0"
VALUE "FileVersion", "2.0.0.0"
VALUE "LegalCopyright", "Plugin_D3D Copyright (c) 2013, The D3D Plugin projects authors, All Rights reserved."
VALUE "OriginalFilename", "Plugin_D3D.dll"
VALUE "ProductName", "D3D Plugin for CryEngine SDK"
VALUE "ProductVersion", "1.9.0.0"
VALUE "ProductVersion", "2.0.0.0"
END
END
BLOCK "VarFileInfo"
Expand Down
11 changes: 10 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ Using a Plugin from a Plugin (Dependency)
-----------------------------------------
* See [Plugin SDK Wiki: Plugin Dependencies](https://github.com/hendrikp/Plugin_SDK/wiki/Plugin-Dependencies)

Flownodes
=========
* ```D3D_Plugin:Info``` Retrieve Direct3D Informations
* In ```Get``` Retrieve the infos
* Out ```Hooked``` Is true when the Direct3D Plugin is working correctly
* Out ```Renderer``` CryEngine Render Subsystem in use (DX9, DX11)
* Out ```Featurelevel``` The FeatureLevel in use (9.3, 10.0, 10.1, 11.0)
* Out ```GPU``` The name of the GPU in use

Samples
=======

Expand Down Expand Up @@ -95,4 +104,4 @@ base by simply adding it to your project and creating an instance. This event li

This sample will make your rendering window green, but you are free to do something more meaningfull ;)

* [Sample File](sample/D3DPlugin_Sample_impl.h) (include into a cpp file of your choice or paste it there)
* [Sample File DX9](sample/D3DPlugin_Sample_DX9_impl.h) (include into a cpp file of your choice or paste it there)
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#include <IPluginManager.h>
#include <IPluginD3D.h>
#include <d3d9.h>
#include <dxgi.h>
#include <d3dcommon.h>
#include <d3d11.h>

class CMyD3D
: private D3DPlugin::ID3DEventListener
Expand All @@ -18,7 +15,6 @@ class CMyD3D
{
void* ptr;
IDirect3DDevice9* dx9;
//ID3D11Device* dx11;
} m_pDevice;

PluginManager::IPluginBase* m_pD3DPlugin;
Expand Down
7 changes: 7 additions & 0 deletions src/CPluginD3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <CPluginD3D.h>

#include "dx9/CD3DSystemDX9.h"
#include "dx10/CD3DSystemDX10.h"
#include "dx11/CD3DSystemDX11.h"

namespace D3DPlugin
Expand Down Expand Up @@ -61,6 +62,12 @@ namespace D3DPlugin
m_pDXSystem = new CD3DSystem11();
}

// This isnt used by CE3 instead it uses a DX11 device with reduced feature level
else if ( GetModuleHandle( "d3d10.dll" ) && gEnv->pRenderer->GetRenderType() != eRT_DX9 )
{
m_pDXSystem = new CD3DSystem10();
}

else if ( GetModuleHandle( "d3d9.dll" ) && gEnv->pRenderer->GetRenderType() == eRT_DX9 )
{
m_pDXSystem = new CD3DSystem9();
Expand Down
8 changes: 4 additions & 4 deletions src/CPluginD3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#pragma once

#include <IPluginBase.h>
#include <Game.h>

#include <IPluginManager.h>
#include <IPluginBase.h>
#include <CPluginBase.hpp>

#include <IPluginD3D.h>
Expand Down Expand Up @@ -64,7 +64,7 @@ namespace D3DPlugin
* @brief Small helper to clean up the correct system type (but outside the main interface)
*/
struct IPluginD3DEx :
public IPluginD3D
public IPluginD3D
{
public:
/**
Expand Down Expand Up @@ -98,7 +98,7 @@ namespace D3DPlugin

const char* GetVersion() const
{
return "1.9.0.0";
return "2.0.0.0";
};

const char* GetName() const
Expand All @@ -125,7 +125,7 @@ namespace D3DPlugin

void* GetConcreteInterface( const char* sInterfaceVersion )
{
return static_cast < IPluginD3D* > ( m_pDXSystem );
return static_cast <IPluginD3D*>( m_pDXSystem );
};

PluginManager::IPluginBase* GetBase()
Expand Down
140 changes: 140 additions & 0 deletions src/Flownodes/CFlowD3DNode.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
/* D3D_Plugin - for licensing and copyright see license.txt */

#include <StdAfx.h>

#include <CPluginD3D.h>
#include <IPluginManager.h>
#include <Nodes/G2FlowBaseNode.h>

#include <d3d11.h>

namespace D3DPlugin
{
class CFlowD3DNode :
public CFlowBaseNode<eNCT_Singleton>
{
enum EInputPorts
{
EIP_GET = 0,
};

enum EOutputPorts
{
EOP_HOOKED = 0,
EOP_RENDERER,
EOP_FEATURELEVEL,
EOP_GPU,
};

public:
virtual void GetMemoryUsage( ICrySizer* s ) const
{
s->Add( *this );
}

CFlowD3DNode( SActivationInfo* pActInfo )
{

}

virtual void GetConfiguration( SFlowNodeConfig& config )
{
static const SInputPortConfig inputs[] =
{
InputPortConfig_Void( "Get", _HELP( "Get" ) ),
InputPortConfig_Null(),
};

static const SOutputPortConfig outputs[] =
{
OutputPortConfig<bool>( "Hooked", _HELP( "D3D was hooked and D3D plugin is fully functional" ) ),
OutputPortConfig<string>( "Renderer", _HELP( "CryEngine Renderer in use" ) ),
OutputPortConfig<string>( "FeatureLevel", _HELP( "FeatureLevel in use" ) ),
OutputPortConfig<string>( "GPU", _HELP( "GPU that is in use" ) ),
OutputPortConfig_Null(),
};

config.pInputPorts = inputs;
config.pOutputPorts = outputs;
config.sDescription = _HELP( " D3D Info" );

config.SetCategory( EFLN_APPROVED );
}

virtual void ProcessEvent( EFlowEvent evt, SActivationInfo* pActInfo )
{
switch ( evt )
{
case eFE_Activate:

if ( IsPortActive( pActInfo, EIP_GET ) )
{
// This plug in is a bit special since the concrete interface is inside of the dx subsystem instead of the gPlugin pointer
IPluginD3D* pD3DPlugin = PluginManager::safeGetPluginConcreteInterface<IPluginD3D*>( PLUGIN_NAME );

string sRenderer = "N/A";
string sFeatureLevel = "N/A";
string sGPUName = "N/A";
bool bHooked = false;

if ( pD3DPlugin )
{
bHooked = pD3DPlugin->GetDevice();
sGPUName = pD3DPlugin->GetGPUName();

switch ( pD3DPlugin->GetType() )
{
case D3D_DX9:
sRenderer = "DX9";
break;

case D3D_DX10:
sRenderer = "DX10";
break;

case D3D_DX11:
sRenderer = "DX11";
break;
}

switch ( pD3DPlugin->GetFeatureLevel() )
{
case D3D_FEATURE_LEVEL_9_1:
sFeatureLevel = "9.1";
break;

case D3D_FEATURE_LEVEL_9_2:
sFeatureLevel = "9.2";
break;

case D3D_FEATURE_LEVEL_9_3:
sFeatureLevel = "9.3";
break;

case D3D_FEATURE_LEVEL_10_0:
sFeatureLevel = "10.0";
break;

case D3D_FEATURE_LEVEL_10_1:
sFeatureLevel = "10.1";
break;

case D3D_FEATURE_LEVEL_11_0:
sFeatureLevel = "11.0";
break;
}
}

ActivateOutput<bool>( pActInfo, EOP_HOOKED, bHooked );
ActivateOutput<string>( pActInfo, EOP_RENDERER, sRenderer );
ActivateOutput<string>( pActInfo, EOP_FEATURELEVEL, sFeatureLevel );
ActivateOutput<string>( pActInfo, EOP_GPU, sGPUName );
}

break;
}
}
};
}

REGISTER_FLOW_NODE_EX( "D3D_Plugin:Info", D3DPlugin::CFlowD3DNode, CFlowD3DNode );
Loading