aboutsummaryrefslogtreecommitdiff
path: root/tools/ArtistTools/source/CoreLib/Render
diff options
context:
space:
mode:
authorAnton Novoselov <[email protected]>2017-08-01 12:53:38 +0300
committerAnton Novoselov <[email protected]>2017-08-01 12:53:38 +0300
commit236f03c0b9a4982328ed1201978f7f69d192d9b2 (patch)
treee486f2fa39dba203563895541e92c60ed3e25759 /tools/ArtistTools/source/CoreLib/Render
parentAdded screens to welcome page (diff)
downloadblast-236f03c0b9a4982328ed1201978f7f69d192d9b2.tar.xz
blast-236f03c0b9a4982328ed1201978f7f69d192d9b2.zip
Blast 1.1 release (windows / linux)
see docs/release_notes.txt for details
Diffstat (limited to 'tools/ArtistTools/source/CoreLib/Render')
-rw-r--r--tools/ArtistTools/source/CoreLib/Render/D3D11/D3D11RenderInterface.cpp24
-rw-r--r--tools/ArtistTools/source/CoreLib/Render/D3D11/D3D11Shaders.cpp33
2 files changed, 23 insertions, 34 deletions
diff --git a/tools/ArtistTools/source/CoreLib/Render/D3D11/D3D11RenderInterface.cpp b/tools/ArtistTools/source/CoreLib/Render/D3D11/D3D11RenderInterface.cpp
index 71d1b7d..292de1a 100644
--- a/tools/ArtistTools/source/CoreLib/Render/D3D11/D3D11RenderInterface.cpp
+++ b/tools/ArtistTools/source/CoreLib/Render/D3D11/D3D11RenderInterface.cpp
@@ -225,11 +225,26 @@ HRESULT UseGoodGPUDevice()
std::wstring adapterName = adapterDesc.Description;
#endif
- D3D_FEATURE_LEVEL fl;
- HRESULT hr = D3D11CreateDevice(g_pAdapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,
+ D3D_FEATURE_LEVEL fl = D3D_FEATURE_LEVEL_9_1;
+ HRESULT hr = 0;
+
+ hr = D3D11CreateDevice(g_pAdapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,
createDeviceFlags, 0, 0,
D3D11_SDK_VERSION, &g_d3dDevice, &fl, &g_d3dDeviceContext);
+ if (g_d3dDevice == nullptr)
+ {
+ // here is the codes to make it run on a WARP device(Windows DirectX CPU - based emulation).
+ if (g_pAdapter)
+ {
+ g_pAdapter->Release();
+ g_pAdapter = nullptr;
+ }
+ hr = D3D11CreateDevice(g_pAdapter, D3D_DRIVER_TYPE_WARP, nullptr,
+ createDeviceFlags, 0, 0,
+ D3D11_SDK_VERSION, &g_d3dDevice, &fl, &g_d3dDeviceContext);
+ }
+
if(g_d3dDevice)
{
IDXGIDevice* dxgiDevice = nullptr;
@@ -237,6 +252,11 @@ HRESULT UseGoodGPUDevice()
if (SUCCEEDED(hr))
{
g_dxgiDevice = dxgiDevice;
+ if (g_pAdapter == nullptr)
+ {
+ // when running on WARP device, need find out adapter.
+ hr = dxgiDevice->GetAdapter(&g_pAdapter);
+ }
return hr;
}
else
diff --git a/tools/ArtistTools/source/CoreLib/Render/D3D11/D3D11Shaders.cpp b/tools/ArtistTools/source/CoreLib/Render/D3D11/D3D11Shaders.cpp
index eba1184..f3e210b 100644
--- a/tools/ArtistTools/source/CoreLib/Render/D3D11/D3D11Shaders.cpp
+++ b/tools/ArtistTools/source/CoreLib/Render/D3D11/D3D11Shaders.cpp
@@ -30,7 +30,6 @@
#include "MeshShaderParam.h"
#include "LightShaderParam.h"
-//#include <Nv/Blast/NvHairSdk.h>
#include "D3D11RenderShader.h"
using namespace RenderInterface;
@@ -39,7 +38,7 @@ using namespace RenderInterface;
// Common shader settings
//static D3D11RenderShader* g_pShaders[SHADER_TYPE_END];
static std::map<int, D3D11RenderShader*> g_pShaders;
-/*
+
namespace BodyShaderBlobs
{
#include "Shaders/BodyShader_VS.h"
@@ -76,22 +75,9 @@ namespace ColorBlobs
#include "Shaders/Color_PS.h"
}
-#ifndef NV_ARTISTTOOLS
-namespace BlastShaderBlobs
-{
-#include "Shaders/BlastShader_PS.h"
-}
-
-namespace BlastShadowBlobs
-{
-#include "Shaders/BlastShadow_PS.h"
-}
-#endif // NV_ARTISTTOOLS
-*/
//////////////////////////////////////////////////////////////////////////
bool InitializeShadersD3D11()
{
- /*
D3D11_INPUT_ELEMENT_DESC layoutBodyRender[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
@@ -142,23 +128,6 @@ bool InitializeShadersD3D11()
sizeof(SimpleShaderParam), 0,
&layout_Position_And_Color[0], numElements2);
-#ifndef NV_ARTISTTOOLS
- g_pShaders[SHADER_TYPE_HAIR_SHADER_DEFAULT] = D3D11RenderShader::Create(
- "hairShaderDefault", 0, 0,
- (void*)BlastShaderBlobs::g_ps_main, sizeof(BlastShaderBlobs::g_ps_main),
- sizeof(NvHair::ShaderConstantBuffer),
- sizeof(LightShaderParam)
- );
-
- g_pShaders[SHADER_TYPE_HAIR_SHADER_SHADOW] = D3D11RenderShader::Create(
- "hairShadow", 0, 0,
- (void*)BlastShadowBlobs::g_ps_main, sizeof(BlastShadowBlobs::g_ps_main),
- sizeof(NvHair::ShaderConstantBuffer),
- 0);
-#else
- CoreLib::Inst()->D3D11Shaders_InitializeShadersD3D11(g_pShaders);
-#endif // NV_ARTISTTOOLS
- */
return true;
}