mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 08:15:44 +00:00
lighting single buffer
This commit is contained in:
parent
ecef09525a
commit
b0fff30d33
37 changed files with 309 additions and 813 deletions
|
|
@ -38,12 +38,14 @@
|
|||
#include "gfx/D3D11/screenshotD3D11.h"
|
||||
#include "materials/shaderData.h"
|
||||
#include "shaderGen/shaderGen.h"
|
||||
#include <d3d9.h> //d3dperf
|
||||
|
||||
#ifdef TORQUE_DEBUG
|
||||
#include "d3d11sdklayers.h"
|
||||
#endif
|
||||
|
||||
#pragma comment(lib, "dxgi.lib")
|
||||
#pragma comment(lib, "d3d9.lib") //d3dperf
|
||||
#pragma comment(lib, "d3d11.lib")
|
||||
|
||||
class GFXPCD3D11RegisterDevice
|
||||
|
|
@ -90,9 +92,6 @@ GFXD3D11Device::GFXD3D11Device(U32 index)
|
|||
mAdapterIndex = index;
|
||||
mD3DDevice = NULL;
|
||||
mD3DDeviceContext = NULL;
|
||||
mD3DDevice1 = NULL;
|
||||
mD3DDeviceContext1 = NULL;
|
||||
mUserAnnotation = NULL;
|
||||
mVolatileVB = NULL;
|
||||
|
||||
mCurrentPB = NULL;
|
||||
|
|
@ -126,7 +125,6 @@ GFXD3D11Device::GFXD3D11Device(U32 index)
|
|||
mCurrentConstBuffer = NULL;
|
||||
|
||||
mOcclusionQuerySupported = false;
|
||||
mCbufferPartialSupported = false;
|
||||
|
||||
mDebugLayers = false;
|
||||
|
||||
|
|
@ -166,8 +164,6 @@ GFXD3D11Device::~GFXD3D11Device()
|
|||
SAFE_RELEASE(mDeviceBackBufferView);
|
||||
SAFE_RELEASE(mDeviceDepthStencil);
|
||||
SAFE_RELEASE(mDeviceBackbuffer);
|
||||
SAFE_RELEASE(mUserAnnotation);
|
||||
SAFE_RELEASE(mD3DDeviceContext1);
|
||||
SAFE_RELEASE(mD3DDeviceContext);
|
||||
|
||||
SAFE_DELETE(mCardProfiler);
|
||||
|
|
@ -185,7 +181,6 @@ GFXD3D11Device::~GFXD3D11Device()
|
|||
#endif
|
||||
|
||||
SAFE_RELEASE(mSwapChain);
|
||||
SAFE_RELEASE(mD3DDevice1);
|
||||
SAFE_RELEASE(mD3DDevice);
|
||||
}
|
||||
|
||||
|
|
@ -439,6 +434,7 @@ void GFXD3D11Device::init(const GFXVideoMode &mode, PlatformWindow *window)
|
|||
AssertFatal(window, "GFXD3D11Device::init - must specify a window!");
|
||||
|
||||
HWND winHwnd = (HWND)window->getSystemWindow( PlatformWindow::WindowSystem_Windows );
|
||||
SetFocus(winHwnd);
|
||||
|
||||
UINT createDeviceFlags = D3D11_CREATE_DEVICE_SINGLETHREADED | D3D11_CREATE_DEVICE_BGRA_SUPPORT;
|
||||
#ifdef TORQUE_DEBUG
|
||||
|
|
@ -489,26 +485,6 @@ void GFXD3D11Device::init(const GFXVideoMode &mode, PlatformWindow *window)
|
|||
#endif
|
||||
}
|
||||
|
||||
// Grab DX 11.1 device and context if available and also ID3DUserDefinedAnnotation
|
||||
hres = mD3DDevice->QueryInterface(__uuidof(ID3D11Device1), reinterpret_cast<void**>(&mD3DDevice1));
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
//11.1 context
|
||||
mD3DDeviceContext->QueryInterface(__uuidof(ID3D11DeviceContext1), reinterpret_cast<void**>(&mD3DDeviceContext1));
|
||||
// ID3DUserDefinedAnnotation
|
||||
mD3DDeviceContext->QueryInterface(IID_PPV_ARGS(&mUserAnnotation));
|
||||
//Check what is supported, windows 7 supports very little from 11.1
|
||||
D3D11_FEATURE_DATA_D3D11_OPTIONS options;
|
||||
mD3DDevice1->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &options,
|
||||
sizeof(D3D11_FEATURE_DATA_D3D11_OPTIONS));
|
||||
|
||||
//Cbuffer partial updates
|
||||
if (options.ConstantBufferOffsetting && options.ConstantBufferPartialUpdate)
|
||||
mCbufferPartialSupported = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//set the fullscreen state here if we need to
|
||||
if(mode.fullScreen)
|
||||
{
|
||||
|
|
@ -1875,28 +1851,27 @@ GFXCubemapArray * GFXD3D11Device::createCubemapArray()
|
|||
//------------------------------------------------------------------------------
|
||||
void GFXD3D11Device::enterDebugEvent(ColorI color, const char *name)
|
||||
{
|
||||
if (mUserAnnotation)
|
||||
{
|
||||
WCHAR eventName[260];
|
||||
MultiByteToWideChar(CP_ACP, 0, name, -1, eventName, 260);
|
||||
mUserAnnotation->BeginEvent(eventName);
|
||||
}
|
||||
// BJGFIX
|
||||
WCHAR eventName[260];
|
||||
MultiByteToWideChar(CP_ACP, 0, name, -1, eventName, 260);
|
||||
|
||||
D3DPERF_BeginEvent(D3DCOLOR_ARGB(color.alpha, color.red, color.green, color.blue),
|
||||
(LPCWSTR)&eventName);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void GFXD3D11Device::leaveDebugEvent()
|
||||
{
|
||||
if (mUserAnnotation)
|
||||
mUserAnnotation->EndEvent();
|
||||
D3DPERF_EndEvent();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void GFXD3D11Device::setDebugMarker(ColorI color, const char *name)
|
||||
{
|
||||
if (mUserAnnotation)
|
||||
{
|
||||
WCHAR eventName[260];
|
||||
MultiByteToWideChar(CP_ACP, 0, name, -1, eventName, 260);
|
||||
mUserAnnotation->SetMarker(eventName);
|
||||
}
|
||||
// BJGFIX
|
||||
WCHAR eventName[260];
|
||||
MultiByteToWideChar(CP_ACP, 0, name, -1, eventName, 260);
|
||||
|
||||
D3DPERF_SetMarker(D3DCOLOR_ARGB(color.alpha, color.red, color.green, color.blue),
|
||||
(LPCWSTR)&eventName);
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef _GFXD3D11DEVICE_H_
|
||||
#define _GFXD3D11DEVICE_H_
|
||||
|
||||
#include <d3d11_1.h>
|
||||
#include <d3d11.h>
|
||||
|
||||
#include "platform/tmm_off.h"
|
||||
#include "platformWin32/platformWin32.h"
|
||||
|
|
@ -39,9 +39,6 @@
|
|||
#define D3D11 static_cast<GFXD3D11Device*>(GFX)
|
||||
#define D3D11DEVICE D3D11->getDevice()
|
||||
#define D3D11DEVICECONTEXT D3D11->getDeviceContext()
|
||||
// DX 11.1 - always check these are not NULL, dodgy support with win 7
|
||||
#define D3D11DEVICE1 D3D11->getDevice1()
|
||||
#define D3D11DEVICECONTEXT1 D3D11->getDeviceContext1()
|
||||
|
||||
class PlatformWindow;
|
||||
class GFXD3D11ShaderConstBuffer;
|
||||
|
|
@ -129,10 +126,6 @@ protected:
|
|||
IDXGISwapChain *mSwapChain;
|
||||
ID3D11Device* mD3DDevice;
|
||||
ID3D11DeviceContext* mD3DDeviceContext;
|
||||
// DX 11.1
|
||||
ID3D11Device1* mD3DDevice1;
|
||||
ID3D11DeviceContext1* mD3DDeviceContext1;
|
||||
ID3DUserDefinedAnnotation* mUserAnnotation;
|
||||
|
||||
GFXShaderRef mGenericShader[GS_COUNT];
|
||||
GFXShaderConstBufferRef mGenericShaderBuffer[GS_COUNT];
|
||||
|
|
@ -153,7 +146,6 @@ protected:
|
|||
DXGI_SAMPLE_DESC mMultisampleDesc;
|
||||
|
||||
bool mOcclusionQuerySupported;
|
||||
bool mCbufferPartialSupported;
|
||||
|
||||
U32 mDrawInstancesCount;
|
||||
|
||||
|
|
@ -300,9 +292,6 @@ public:
|
|||
ID3D11DeviceContext* getDeviceContext(){ return mD3DDeviceContext; }
|
||||
ID3D11Device* getDevice(){ return mD3DDevice; }
|
||||
IDXGISwapChain* getSwapChain() { return mSwapChain; }
|
||||
//DX 11.1
|
||||
ID3D11DeviceContext1* getDeviceContext1() { return mD3DDeviceContext1; }
|
||||
ID3D11Device1* getDevice1() { return mD3DDevice1; }
|
||||
|
||||
/// Reset
|
||||
void reset( DXGI_SWAP_CHAIN_DESC &d3dpp );
|
||||
|
|
|
|||
|
|
@ -561,7 +561,7 @@ const String GFXD3D11ShaderConstBuffer::describeSelf() const
|
|||
GenericConstBufferLayout::ParamDesc pd;
|
||||
mVertexConstBufferLayout->getDesc(i, pd);
|
||||
|
||||
ret += String::ToString(" Constant name: %s", pd.name);
|
||||
ret += String::ToString(" Constant name: %s", pd.name.c_str());
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue