2019.3
This commit is contained in:
parent
9455594fb7
commit
70a1778d22
|
@ -4,6 +4,7 @@
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
# User-specific files
|
# User-specific files
|
||||||
|
*.rsuser
|
||||||
*.suo
|
*.suo
|
||||||
*.user
|
*.user
|
||||||
*.userosscache
|
*.userosscache
|
||||||
|
@ -12,6 +13,9 @@
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
*.userprefs
|
*.userprefs
|
||||||
|
|
||||||
|
# Mono auto generated files
|
||||||
|
mono_crash.*
|
||||||
|
|
||||||
# Build results
|
# Build results
|
||||||
[Dd]ebug/
|
[Dd]ebug/
|
||||||
[Dd]ebugPublic/
|
[Dd]ebugPublic/
|
||||||
|
@ -19,6 +23,8 @@
|
||||||
[Rr]eleases/
|
[Rr]eleases/
|
||||||
x64/
|
x64/
|
||||||
x86/
|
x86/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
bld/
|
bld/
|
||||||
[Bb]in/
|
[Bb]in/
|
||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
|
@ -52,7 +58,6 @@ BenchmarkDotNet.Artifacts/
|
||||||
project.lock.json
|
project.lock.json
|
||||||
project.fragment.lock.json
|
project.fragment.lock.json
|
||||||
artifacts/
|
artifacts/
|
||||||
**/Properties/launchSettings.json
|
|
||||||
|
|
||||||
# StyleCop
|
# StyleCop
|
||||||
StyleCopReport.xml
|
StyleCopReport.xml
|
||||||
|
@ -60,12 +65,14 @@ StyleCopReport.xml
|
||||||
# Files built by Visual Studio
|
# Files built by Visual Studio
|
||||||
*_i.c
|
*_i.c
|
||||||
*_p.c
|
*_p.c
|
||||||
*_i.h
|
*_h.h
|
||||||
*.ilk
|
*.ilk
|
||||||
*.meta
|
*.meta
|
||||||
*.obj
|
*.obj
|
||||||
|
*.iobj
|
||||||
*.pch
|
*.pch
|
||||||
*.pdb
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
*.pgc
|
*.pgc
|
||||||
*.pgd
|
*.pgd
|
||||||
*.rsp
|
*.rsp
|
||||||
|
@ -75,6 +82,7 @@ StyleCopReport.xml
|
||||||
*.tlh
|
*.tlh
|
||||||
*.tmp
|
*.tmp
|
||||||
*.tmp_proj
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
*.log
|
*.log
|
||||||
*.vspscc
|
*.vspscc
|
||||||
*.vssscc
|
*.vssscc
|
||||||
|
@ -201,12 +209,14 @@ BundleArtifacts/
|
||||||
Package.StoreAssociation.xml
|
Package.StoreAssociation.xml
|
||||||
_pkginfo.txt
|
_pkginfo.txt
|
||||||
*.appx
|
*.appx
|
||||||
|
*.appxbundle
|
||||||
|
*.appxupload
|
||||||
|
|
||||||
# Visual Studio cache files
|
# Visual Studio cache files
|
||||||
# files ending in .cache can be ignored
|
# files ending in .cache can be ignored
|
||||||
*.[Cc]ache
|
*.[Cc]ache
|
||||||
# but keep track of directories ending in .cache
|
# but keep track of directories ending in .cache
|
||||||
!*.[Cc]ache/
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
# Others
|
# Others
|
||||||
ClientBin/
|
ClientBin/
|
||||||
|
@ -219,13 +229,15 @@ ClientBin/
|
||||||
*.publishsettings
|
*.publishsettings
|
||||||
orleans.codegen.cs
|
orleans.codegen.cs
|
||||||
|
|
||||||
# Including strong name files can present a security risk
|
# Including strong name files can present a security risk
|
||||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
#*.snk
|
#*.snk
|
||||||
|
|
||||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
#bower_components/
|
#bower_components/
|
||||||
|
# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true
|
||||||
|
**/wwwroot/lib/
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
# RIA/Silverlight projects
|
||||||
Generated_Code/
|
Generated_Code/
|
||||||
|
@ -238,6 +250,7 @@ Backup*/
|
||||||
UpgradeLog*.XML
|
UpgradeLog*.XML
|
||||||
UpgradeLog*.htm
|
UpgradeLog*.htm
|
||||||
ServiceFabricBackup/
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
# SQL Server files
|
# SQL Server files
|
||||||
*.mdf
|
*.mdf
|
||||||
|
@ -248,6 +261,8 @@ ServiceFabricBackup/
|
||||||
*.rdl.data
|
*.rdl.data
|
||||||
*.bim.layout
|
*.bim.layout
|
||||||
*.bim_*.settings
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
*- Backup*.rdl
|
||||||
|
|
||||||
# Microsoft Fakes
|
# Microsoft Fakes
|
||||||
FakesAssemblies/
|
FakesAssemblies/
|
||||||
|
@ -283,12 +298,8 @@ paket-files/
|
||||||
# FAKE - F# Make
|
# FAKE - F# Make
|
||||||
.fake/
|
.fake/
|
||||||
|
|
||||||
# JetBrains Rider
|
# CodeRush personal settings
|
||||||
.idea/
|
.cr/personal
|
||||||
*.sln.iml
|
|
||||||
|
|
||||||
# CodeRush
|
|
||||||
.cr/
|
|
||||||
|
|
||||||
# Python Tools for Visual Studio (PTVS)
|
# Python Tools for Visual Studio (PTVS)
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
@ -313,9 +324,23 @@ __pycache__/
|
||||||
# OpenCover UI analysis results
|
# OpenCover UI analysis results
|
||||||
OpenCover/
|
OpenCover/
|
||||||
|
|
||||||
# Azure Stream Analytics local run output
|
# Azure Stream Analytics local run output
|
||||||
ASALocalRun/
|
ASALocalRun/
|
||||||
|
|
||||||
# MSBuild Binary and Structured Log
|
# MSBuild Binary and Structured Log
|
||||||
*.binlog
|
*.binlog
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
.localhistory/
|
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database
|
||||||
|
healthchecksdb
|
||||||
|
|
||||||
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||||
|
MigrationBackup/
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
// RendererDirect3D12.cpp : Defines the exported functions for the DLL application.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
|
|
|
@ -38,16 +38,20 @@
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\Verus\Verus.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\Verus\Verus.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IncludePath>$(ProjectDir)src;$(IncludePath)</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IncludePath>$(ProjectDir)src;$(IncludePath)</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
|
@ -82,13 +86,19 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="stdafx.h" />
|
<ProjectReference Include="..\Verus\Verus.vcxproj">
|
||||||
<ClInclude Include="targetver.h" />
|
<Project>{b154d670-e4b1-4d8a-885c-69546a5bd833}</Project>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="dllmain.cpp" />
|
<ClInclude Include="src\CGI\CGI.h" />
|
||||||
<ClCompile Include="RendererDirect3D12.cpp" />
|
<ClInclude Include="src\CGI\RendererD3D12.h" />
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClInclude Include="src\stdafx.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="src\CGI\RendererD3D12.cpp" />
|
||||||
|
<ClCompile Include="src\main.cpp" />
|
||||||
|
<ClCompile Include="src\stdafx.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -13,24 +13,33 @@
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="src">
|
||||||
|
<UniqueIdentifier>{67b732c1-b652-4393-b74b-d4836b3df718}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="src\CGI">
|
||||||
|
<UniqueIdentifier>{8cd5524f-64b4-4674-ae77-6a7cf86b4449}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="stdafx.h">
|
<ClInclude Include="src\stdafx.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>src</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="targetver.h">
|
<ClInclude Include="src\CGI\CGI.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>src\CGI</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\CGI\RendererD3D12.h">
|
||||||
|
<Filter>src\CGI</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="src\main.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>src</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="RendererDirect3D12.cpp">
|
<ClCompile Include="src\stdafx.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>src</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="dllmain.cpp">
|
<ClCompile Include="src\CGI\RendererD3D12.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>src\CGI</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,19 +0,0 @@
|
||||||
// dllmain.cpp : Defines the entry point for the DLL application.
|
|
||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
|
||||||
DWORD ul_reason_for_call,
|
|
||||||
LPVOID lpReserved
|
|
||||||
)
|
|
||||||
{
|
|
||||||
switch (ul_reason_for_call)
|
|
||||||
{
|
|
||||||
case DLL_PROCESS_ATTACH:
|
|
||||||
case DLL_THREAD_ATTACH:
|
|
||||||
case DLL_THREAD_DETACH:
|
|
||||||
case DLL_PROCESS_DETACH:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "RendererD3D12.h"
|
|
@ -0,0 +1,285 @@
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
using namespace verus;
|
||||||
|
using namespace verus::CGI;
|
||||||
|
|
||||||
|
RendererD3D12::RendererD3D12()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
RendererD3D12::~RendererD3D12()
|
||||||
|
{
|
||||||
|
Done();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RendererD3D12::ReleaseMe()
|
||||||
|
{
|
||||||
|
Free();
|
||||||
|
TestAllocCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RendererD3D12::Init()
|
||||||
|
{
|
||||||
|
VERUS_INIT();
|
||||||
|
|
||||||
|
InitD3D();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RendererD3D12::Done()
|
||||||
|
{
|
||||||
|
VERUS_DONE(RendererD3D12);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RendererD3D12::EnableDebugLayer()
|
||||||
|
{
|
||||||
|
CComPtr<ID3D12Debug> pDebug;
|
||||||
|
if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&pDebug))))
|
||||||
|
pDebug->EnableDebugLayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
CComPtr<IDXGIFactory7> RendererD3D12::CreateDXGIFactory()
|
||||||
|
{
|
||||||
|
HRESULT hr = 0;
|
||||||
|
CComPtr<IDXGIFactory7> pFactory;
|
||||||
|
UINT flags = 0;
|
||||||
|
#if defined(_DEBUG) || defined(VERUS_DEBUG)
|
||||||
|
flags = DXGI_CREATE_FACTORY_DEBUG;
|
||||||
|
#endif
|
||||||
|
if (FAILED(hr = CreateDXGIFactory2(flags, IID_PPV_ARGS(&pFactory))))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "CreateDXGIFactory2(), hr=" << VERUS_HR(hr);
|
||||||
|
return pFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
CComPtr<IDXGIAdapter4> RendererD3D12::GetAdapter(CComPtr<IDXGIFactory7> pFactory)
|
||||||
|
{
|
||||||
|
HRESULT hr = 0;
|
||||||
|
CComPtr<IDXGIAdapter4> pAdapter;
|
||||||
|
if (FAILED(hr = pFactory->EnumAdapterByGpuPreference(0, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS(&pAdapter))))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "EnumAdapterByGpuPreference(), hr=" << VERUS_HR(hr);
|
||||||
|
return pAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RendererD3D12::CheckFeatureSupportAllowTearing(CComPtr<IDXGIFactory7> pFactory)
|
||||||
|
{
|
||||||
|
BOOL data = FALSE;
|
||||||
|
if (FAILED(pFactory->CheckFeatureSupport(DXGI_FEATURE_PRESENT_ALLOW_TEARING, &data, sizeof(data))))
|
||||||
|
data = FALSE;
|
||||||
|
return data == TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RendererD3D12::CreateSwapChainBuffersRTVs()
|
||||||
|
{
|
||||||
|
HRESULT hr = 0;
|
||||||
|
_swapChainBuffersRTVs = CreateDescriptorHeap(D3D12_DESCRIPTOR_HEAP_TYPE_RTV, _swapChainDesc.BufferCount);
|
||||||
|
_vSwapChainBuffers.resize(_swapChainDesc.BufferCount);
|
||||||
|
auto dh = _swapChainBuffersRTVs->GetCPUDescriptorHandleForHeapStart();
|
||||||
|
VERUS_U_FOR(i, _swapChainDesc.BufferCount)
|
||||||
|
{
|
||||||
|
CComPtr<ID3D12Resource> pBuffer;
|
||||||
|
if (FAILED(hr = _pSwapChain->GetBuffer(i, IID_PPV_ARGS(&pBuffer))))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "GetBuffer(), hr=" << VERUS_HR(hr);
|
||||||
|
_pDevice->CreateRenderTargetView(pBuffer, nullptr, dh);
|
||||||
|
_vSwapChainBuffers[i] = pBuffer;
|
||||||
|
dh.ptr += _descHandleIncSizeRTV;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RendererD3D12::InitD3D()
|
||||||
|
{
|
||||||
|
VERUS_QREF_SETTINGS;
|
||||||
|
|
||||||
|
HRESULT hr = 0;
|
||||||
|
|
||||||
|
#if defined(_DEBUG) || defined(VERUS_DEBUG)
|
||||||
|
EnableDebugLayer();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CComPtr<IDXGIFactory7> pFactory = CreateDXGIFactory();
|
||||||
|
|
||||||
|
CComPtr<IDXGIAdapter4> pAdapter = GetAdapter(pFactory);
|
||||||
|
|
||||||
|
if (FAILED(hr = D3D12CreateDevice(pAdapter, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&_pDevice))))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "D3D12CreateDevice(), hr=" << VERUS_HR(hr);
|
||||||
|
|
||||||
|
_pCommandQueue = CreateCommandQueue(D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||||
|
|
||||||
|
_swapChainDesc.Width = settings._screenSizeWidth;
|
||||||
|
_swapChainDesc.Height = settings._screenSizeHeight;
|
||||||
|
_swapChainDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||||
|
_swapChainDesc.Stereo = FALSE;
|
||||||
|
_swapChainDesc.SampleDesc.Count = 1;
|
||||||
|
_swapChainDesc.SampleDesc.Quality = 0;
|
||||||
|
_swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||||
|
_swapChainDesc.BufferCount = 2;
|
||||||
|
_swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
|
||||||
|
_swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
||||||
|
_swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED;
|
||||||
|
_swapChainDesc.Flags = CheckFeatureSupportAllowTearing(pFactory) ? DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING : 0;
|
||||||
|
|
||||||
|
CComPtr<IDXGISwapChain1> pSwapChain1;
|
||||||
|
if (FAILED(hr = pFactory->CreateSwapChainForHwnd(_pCommandQueue, GetActiveWindow(), &_swapChainDesc, nullptr, nullptr, &pSwapChain1)))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "CreateSwapChainForHwnd(), hr=" << VERUS_HR(hr);
|
||||||
|
if (FAILED(hr = pSwapChain1.QueryInterface(&_pSwapChain)))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "QueryInterface(), hr=" << VERUS_HR(hr);
|
||||||
|
|
||||||
|
_descHandleIncSizeRTV = _pDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
|
||||||
|
|
||||||
|
_currentBackBufferIndex = _pSwapChain->GetCurrentBackBufferIndex();
|
||||||
|
|
||||||
|
CreateSwapChainBuffersRTVs();
|
||||||
|
|
||||||
|
_vCommandAllocators.resize(_swapChainDesc.BufferCount);
|
||||||
|
VERUS_U_FOR(i, _swapChainDesc.BufferCount)
|
||||||
|
_vCommandAllocators[i] = CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT);
|
||||||
|
|
||||||
|
_pCommandList = CreateCommandList(D3D12_COMMAND_LIST_TYPE_DIRECT, _vCommandAllocators[_currentBackBufferIndex]);
|
||||||
|
|
||||||
|
_pFence = CreateFence();
|
||||||
|
_hFence = CreateEvent(nullptr, FALSE, FALSE, nullptr);
|
||||||
|
_vFenceValues.resize(_swapChainDesc.BufferCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
CComPtr<ID3D12CommandQueue> RendererD3D12::CreateCommandQueue(D3D12_COMMAND_LIST_TYPE type)
|
||||||
|
{
|
||||||
|
HRESULT hr = 0;
|
||||||
|
CComPtr<ID3D12CommandQueue> pCommandQueue;
|
||||||
|
D3D12_COMMAND_QUEUE_DESC desc = {};
|
||||||
|
desc.Type = type;
|
||||||
|
desc.Priority = D3D12_COMMAND_QUEUE_PRIORITY_NORMAL;
|
||||||
|
desc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
|
||||||
|
if (FAILED(hr = _pDevice->CreateCommandQueue(&desc, IID_PPV_ARGS(&pCommandQueue))))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "CreateCommandQueue(), hr=" << VERUS_HR(hr);
|
||||||
|
return pCommandQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
CComPtr<ID3D12CommandAllocator> RendererD3D12::CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE type)
|
||||||
|
{
|
||||||
|
HRESULT hr = 0;
|
||||||
|
CComPtr<ID3D12CommandAllocator> pCommandAllocator;
|
||||||
|
if (FAILED(hr = _pDevice->CreateCommandAllocator(type, IID_PPV_ARGS(&pCommandAllocator))))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "CreateCommandAllocator(), hr=" << VERUS_HR(hr);
|
||||||
|
return pCommandAllocator;
|
||||||
|
}
|
||||||
|
|
||||||
|
CComPtr<ID3D12GraphicsCommandList> RendererD3D12::CreateCommandList(D3D12_COMMAND_LIST_TYPE type, CComPtr<ID3D12CommandAllocator> pCommandAllocator)
|
||||||
|
{
|
||||||
|
HRESULT hr = 0;
|
||||||
|
CComPtr<ID3D12GraphicsCommandList> pGraphicsCommandList;
|
||||||
|
if (FAILED(hr = _pDevice->CreateCommandList(0, type, pCommandAllocator, nullptr, IID_PPV_ARGS(&pGraphicsCommandList))))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "CreateCommandList(), hr=" << VERUS_HR(hr);
|
||||||
|
if (FAILED(hr = pGraphicsCommandList->Close()))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "Close(), hr=" << VERUS_HR(hr);
|
||||||
|
return pGraphicsCommandList;
|
||||||
|
}
|
||||||
|
|
||||||
|
CComPtr<ID3D12DescriptorHeap> RendererD3D12::CreateDescriptorHeap(D3D12_DESCRIPTOR_HEAP_TYPE type, UINT num)
|
||||||
|
{
|
||||||
|
HRESULT hr = 0;
|
||||||
|
CComPtr<ID3D12DescriptorHeap> pDescriptorHeap;
|
||||||
|
D3D12_DESCRIPTOR_HEAP_DESC desc = {};
|
||||||
|
desc.Type = type;
|
||||||
|
desc.NumDescriptors = num;
|
||||||
|
if (FAILED(hr = _pDevice->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&pDescriptorHeap))))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "CreateDescriptorHeap(), hr=" << VERUS_HR(hr);
|
||||||
|
return pDescriptorHeap;
|
||||||
|
}
|
||||||
|
|
||||||
|
CComPtr<ID3D12Fence> RendererD3D12::CreateFence()
|
||||||
|
{
|
||||||
|
HRESULT hr = 0;
|
||||||
|
CComPtr<ID3D12Fence> pFence;
|
||||||
|
if (FAILED(hr = _pDevice->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&pFence))))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "CreateFence(), hr=" << VERUS_HR(hr);
|
||||||
|
return pFence;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINT64 RendererD3D12::Signal()
|
||||||
|
{
|
||||||
|
HRESULT hr = 0;
|
||||||
|
const UINT64 value = ++_fenceValue;
|
||||||
|
if (FAILED(hr = _pCommandQueue->Signal(_pFence, value)))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "Signal(), hr=" << VERUS_HR(hr);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RendererD3D12::WaitForFenceValue(UINT64 value)
|
||||||
|
{
|
||||||
|
HRESULT hr = 0;
|
||||||
|
if (_pFence->GetCompletedValue() < value)
|
||||||
|
{
|
||||||
|
if (FAILED(hr = _pFence->SetEventOnCompletion(value, _hFence)))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "SetEventOnCompletion(), hr=" << VERUS_HR(hr);
|
||||||
|
WaitForSingleObject(_hFence, INFINITE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RendererD3D12::Flush()
|
||||||
|
{
|
||||||
|
const UINT64 value = Signal();
|
||||||
|
WaitForFenceValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
D3D12_RESOURCE_BARRIER RendererD3D12::MakeResourceBarrierTransition(ID3D12Resource* pResource, D3D12_RESOURCE_STATES before, D3D12_RESOURCE_STATES after)
|
||||||
|
{
|
||||||
|
D3D12_RESOURCE_BARRIER rb = {};
|
||||||
|
rb.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
|
||||||
|
rb.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
|
||||||
|
rb.Transition.pResource = pResource;
|
||||||
|
rb.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
|
||||||
|
rb.Transition.StateBefore = before;
|
||||||
|
rb.Transition.StateAfter = after;
|
||||||
|
return rb;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RendererD3D12::PrepareDraw()
|
||||||
|
{
|
||||||
|
auto pBackBuffer = _vSwapChainBuffers[_currentBackBufferIndex];
|
||||||
|
auto pCommandAllocator = _vCommandAllocators[_currentBackBufferIndex];
|
||||||
|
|
||||||
|
pCommandAllocator->Reset();
|
||||||
|
_pCommandList->Reset(pCommandAllocator, nullptr);
|
||||||
|
|
||||||
|
const auto rb = MakeResourceBarrierTransition(pBackBuffer, D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET);
|
||||||
|
_pCommandList->ResourceBarrier(1, &rb);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RendererD3D12::Clear(UINT32 flags)
|
||||||
|
{
|
||||||
|
static float x = 0;
|
||||||
|
x += 0.0001f;
|
||||||
|
x = fmod(x, 1.f);
|
||||||
|
FLOAT clearColor[] = { x, 0.5f, 0.25f, 1.0f };
|
||||||
|
|
||||||
|
auto dh = _swapChainBuffersRTVs->GetCPUDescriptorHandleForHeapStart();
|
||||||
|
dh.ptr += _currentBackBufferIndex * _descHandleIncSizeRTV;
|
||||||
|
|
||||||
|
_pCommandList->ClearRenderTargetView(dh, clearColor, 0, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RendererD3D12::Present()
|
||||||
|
{
|
||||||
|
HRESULT hr = 0;
|
||||||
|
|
||||||
|
bool g_VSync = false;
|
||||||
|
bool g_TearingSupported = false;
|
||||||
|
|
||||||
|
auto pBackBuffer = _vSwapChainBuffers[_currentBackBufferIndex];
|
||||||
|
|
||||||
|
const auto rb = MakeResourceBarrierTransition(pBackBuffer, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT);
|
||||||
|
_pCommandList->ResourceBarrier(1, &rb);
|
||||||
|
|
||||||
|
if (FAILED(hr = _pCommandList->Close()))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "Close(), hr=" << VERUS_HR(hr);
|
||||||
|
|
||||||
|
ID3D12CommandList* ppCommandLists[] = { _pCommandList };
|
||||||
|
_pCommandQueue->ExecuteCommandLists(VERUS_ARRAY_LENGTH(ppCommandLists), ppCommandLists);
|
||||||
|
|
||||||
|
_vFenceValues[_currentBackBufferIndex] = Signal();
|
||||||
|
UINT syncInterval = g_VSync ? 1 : 0;
|
||||||
|
UINT flags = g_TearingSupported && !g_VSync ? DXGI_PRESENT_ALLOW_TEARING : 0;
|
||||||
|
if (FAILED(hr = _pSwapChain->Present(syncInterval, flags)))
|
||||||
|
throw VERUS_RUNTIME_ERROR << "Present(), hr=" << VERUS_HR(hr);
|
||||||
|
|
||||||
|
_currentBackBufferIndex = _pSwapChain->GetCurrentBackBufferIndex();
|
||||||
|
WaitForFenceValue(_vFenceValues[_currentBackBufferIndex]);
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace verus
|
||||||
|
{
|
||||||
|
namespace CGI
|
||||||
|
{
|
||||||
|
class RendererD3D12 : public Singleton<RendererD3D12>, public BaseRenderer
|
||||||
|
{
|
||||||
|
CComPtr<IDXGISwapChain4> _pSwapChain;
|
||||||
|
CComPtr<ID3D12Device3> _pDevice;
|
||||||
|
CComPtr<ID3D12CommandQueue> _pCommandQueue;
|
||||||
|
CComPtr<ID3D12Fence> _pFence;
|
||||||
|
CComPtr<ID3D12DescriptorHeap> _swapChainBuffersRTVs;
|
||||||
|
Vector<CComPtr<ID3D12Resource>> _vSwapChainBuffers;
|
||||||
|
Vector<CComPtr<ID3D12CommandAllocator>> _vCommandAllocators;
|
||||||
|
Vector<UINT64> _vFenceValues;
|
||||||
|
CComPtr<ID3D12GraphicsCommandList> _pCommandList;
|
||||||
|
DXGI_SWAP_CHAIN_DESC1 _swapChainDesc = {};
|
||||||
|
HANDLE _hFence = 0;
|
||||||
|
UINT64 _fenceValue = 0;
|
||||||
|
UINT _descHandleIncSizeRTV = 0;
|
||||||
|
UINT _currentBackBufferIndex = 0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
RendererD3D12();
|
||||||
|
~RendererD3D12();
|
||||||
|
|
||||||
|
virtual void ReleaseMe() override;
|
||||||
|
|
||||||
|
void Init();
|
||||||
|
void Done();
|
||||||
|
|
||||||
|
VERUS_P(static void EnableDebugLayer());
|
||||||
|
VERUS_P(static CComPtr<IDXGIFactory7> CreateDXGIFactory());
|
||||||
|
VERUS_P(static CComPtr<IDXGIAdapter4> GetAdapter(CComPtr<IDXGIFactory7> pFactory));
|
||||||
|
VERUS_P(static bool CheckFeatureSupportAllowTearing(CComPtr<IDXGIFactory7> pFactory));
|
||||||
|
VERUS_P(void CreateSwapChainBuffersRTVs());
|
||||||
|
VERUS_P(void InitD3D());
|
||||||
|
|
||||||
|
virtual Gapi GetGapi() override { return Gapi::direct3D12; }
|
||||||
|
|
||||||
|
CComPtr<ID3D12CommandQueue> CreateCommandQueue(D3D12_COMMAND_LIST_TYPE type);
|
||||||
|
CComPtr<ID3D12CommandAllocator> CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE type);
|
||||||
|
CComPtr<ID3D12GraphicsCommandList> CreateCommandList(D3D12_COMMAND_LIST_TYPE type, CComPtr<ID3D12CommandAllocator> pCommandAllocator);
|
||||||
|
CComPtr<ID3D12DescriptorHeap> CreateDescriptorHeap(D3D12_DESCRIPTOR_HEAP_TYPE type, UINT num);
|
||||||
|
CComPtr<ID3D12Fence> CreateFence();
|
||||||
|
UINT64 Signal();
|
||||||
|
void WaitForFenceValue(UINT64 value);
|
||||||
|
void Flush();
|
||||||
|
|
||||||
|
static D3D12_RESOURCE_BARRIER MakeResourceBarrierTransition(ID3D12Resource* pResource, D3D12_RESOURCE_STATES before, D3D12_RESOURCE_STATES after);
|
||||||
|
|
||||||
|
virtual void PrepareDraw() override;
|
||||||
|
virtual void Clear(UINT32 flags) override;
|
||||||
|
virtual void Present() override;
|
||||||
|
};
|
||||||
|
VERUS_TYPEDEFS(RendererD3D12);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define VERUS_QREF_RENDERER_D3D12 CGI::PRendererD3D12 pRendererD3D12 = CGI::RendererD3D12::P()
|
|
@ -0,0 +1,41 @@
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
|
||||||
|
{
|
||||||
|
switch (fdwReason)
|
||||||
|
{
|
||||||
|
case DLL_PROCESS_ATTACH:
|
||||||
|
break;
|
||||||
|
case DLL_THREAD_ATTACH:
|
||||||
|
break;
|
||||||
|
case DLL_THREAD_DETACH:
|
||||||
|
break;
|
||||||
|
case DLL_PROCESS_DETACH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
VERUS_DLL_EXPORT verus::CGI::PBaseRenderer VerusCreateRenderer(UINT32 version, verus::CGI::PBaseRendererDesc pDesc)
|
||||||
|
{
|
||||||
|
using namespace verus;
|
||||||
|
|
||||||
|
if (VERUS_SDK_VERSION != version)
|
||||||
|
{
|
||||||
|
VERUS_RT_FAIL("VerusCreateRenderer(), Wrong version");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
pDesc->_gvc.Paste();
|
||||||
|
|
||||||
|
CGI::RendererD3D12::Make();
|
||||||
|
VERUS_QREF_RENDERER_D3D12;
|
||||||
|
|
||||||
|
pRendererD3D12->SetDesc(*pDesc);
|
||||||
|
pRendererD3D12->Init();
|
||||||
|
|
||||||
|
return pRendererD3D12;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define VERUS_INCLUDE_D3D12
|
||||||
|
#include <verus.h>
|
||||||
|
|
||||||
|
#include "CGI/CGI.h"
|
|
@ -1,16 +0,0 @@
|
||||||
// stdafx.h : include file for standard system include files,
|
|
||||||
// or project specific include files that are used frequently, but
|
|
||||||
// are changed infrequently
|
|
||||||
//
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "targetver.h"
|
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
|
||||||
// Windows Header Files
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// reference additional headers your program requires here
|
|
|
@ -1,8 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
|
||||||
|
|
||||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
|
||||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
|
||||||
|
|
||||||
#include <SDKDDKVer.h>
|
|
|
@ -1,6 +0,0 @@
|
||||||
// RendererVulkan.cpp : Defines the exported functions for the DLL application.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
|
|
|
@ -38,16 +38,20 @@
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\Verus\Verus.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\Verus\Verus.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<LinkIncremental>true</LinkIncremental>
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IncludePath>$(ProjectDir)src;$(IncludePath)</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IncludePath>$(ProjectDir)src;$(IncludePath)</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
|
@ -82,13 +86,16 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="stdafx.h" />
|
<ProjectReference Include="..\Verus\Verus.vcxproj">
|
||||||
<ClInclude Include="targetver.h" />
|
<Project>{b154d670-e4b1-4d8a-885c-69546a5bd833}</Project>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="dllmain.cpp" />
|
<ClInclude Include="src\stdafx.h" />
|
||||||
<ClCompile Include="RendererVulkan.cpp" />
|
</ItemGroup>
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ItemGroup>
|
||||||
|
<ClCompile Include="src\main.cpp" />
|
||||||
|
<ClCompile Include="src\stdafx.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -13,24 +13,21 @@
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="src">
|
||||||
|
<UniqueIdentifier>{836b7e96-dc7f-4278-832a-6305a03b69e4}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="stdafx.h">
|
<ClInclude Include="src\stdafx.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>src</Filter>
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="targetver.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="src\main.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>src</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="RendererVulkan.cpp">
|
<ClCompile Include="src\stdafx.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>src</Filter>
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="dllmain.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -1,19 +0,0 @@
|
||||||
// dllmain.cpp : Defines the entry point for the DLL application.
|
|
||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
|
||||||
DWORD ul_reason_for_call,
|
|
||||||
LPVOID lpReserved
|
|
||||||
)
|
|
||||||
{
|
|
||||||
switch (ul_reason_for_call)
|
|
||||||
{
|
|
||||||
case DLL_PROCESS_ATTACH:
|
|
||||||
case DLL_THREAD_ATTACH:
|
|
||||||
case DLL_THREAD_DETACH:
|
|
||||||
case DLL_PROCESS_DETACH:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
|
||||||
|
{
|
||||||
|
switch (fdwReason)
|
||||||
|
{
|
||||||
|
case DLL_PROCESS_ATTACH:
|
||||||
|
break;
|
||||||
|
case DLL_THREAD_ATTACH:
|
||||||
|
break;
|
||||||
|
case DLL_THREAD_DETACH:
|
||||||
|
break;
|
||||||
|
case DLL_PROCESS_DETACH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
VERUS_DLL_EXPORT void* VerusCreateRenderer(UINT32 version, void* pDesc)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
#if 0
|
||||||
|
using namespace verus;
|
||||||
|
|
||||||
|
if (VERUS_SDK_VERSION != version)
|
||||||
|
{
|
||||||
|
VERUS_RT_FAIL("FAIL: wrong version");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
pDesc->_pack.Paste();
|
||||||
|
|
||||||
|
CGI::RendererVulkan::Make();
|
||||||
|
|
||||||
|
VERUS_QREF_RENDERER_VULKAN;
|
||||||
|
|
||||||
|
pRendererVulkan->SetDesc(*pDesc);
|
||||||
|
|
||||||
|
if (pDesc->m_createWindow)
|
||||||
|
pRendererVulkan->InitWindow();
|
||||||
|
|
||||||
|
pRendererVulkan->Init();
|
||||||
|
|
||||||
|
return pRendererVulkan;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define VERUS_INCLUDE_VULKAN
|
||||||
|
#include <verus.h>
|
|
@ -1,16 +0,0 @@
|
||||||
// stdafx.h : include file for standard system include files,
|
|
||||||
// or project specific include files that are used frequently, but
|
|
||||||
// are changed infrequently
|
|
||||||
//
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "targetver.h"
|
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
|
||||||
// Windows Header Files
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// reference additional headers your program requires here
|
|
|
@ -1,8 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
|
||||||
|
|
||||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
|
||||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
|
||||||
|
|
||||||
#include <SDKDDKVer.h>
|
|
|
@ -15,7 +15,7 @@
|
||||||
<ProjectGuid>{B154D670-E4B1-4D8A-885C-69546A5BD833}</ProjectGuid>
|
<ProjectGuid>{B154D670-E4B1-4D8A-885C-69546A5BD833}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
<Keyword>Win32Proj</Keyword>
|
||||||
<RootNamespace>Verus</RootNamespace>
|
<RootNamespace>Verus</RootNamespace>
|
||||||
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
|
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
@ -106,9 +106,11 @@
|
||||||
<ClInclude Include="src\Audio\StreamPlayer.h" />
|
<ClInclude Include="src\Audio\StreamPlayer.h" />
|
||||||
<ClInclude Include="src\CGI\BaseGeometry.h" />
|
<ClInclude Include="src\CGI\BaseGeometry.h" />
|
||||||
<ClInclude Include="src\CGI\BasePipeline.h" />
|
<ClInclude Include="src\CGI\BasePipeline.h" />
|
||||||
|
<ClInclude Include="src\CGI\BaseRenderer.h" />
|
||||||
<ClInclude Include="src\CGI\BaseShader.h" />
|
<ClInclude Include="src\CGI\BaseShader.h" />
|
||||||
<ClInclude Include="src\CGI\BaseTexture.h" />
|
<ClInclude Include="src\CGI\BaseTexture.h" />
|
||||||
<ClInclude Include="src\CGI\CGI.h" />
|
<ClInclude Include="src\CGI\CGI.h" />
|
||||||
|
<ClInclude Include="src\CGI\Renderer.h" />
|
||||||
<ClInclude Include="src\D\AssertionCompileTime.h" />
|
<ClInclude Include="src\D\AssertionCompileTime.h" />
|
||||||
<ClInclude Include="src\D\AssertionRunTime.h" />
|
<ClInclude Include="src\D\AssertionRunTime.h" />
|
||||||
<ClInclude Include="src\D\D.h" />
|
<ClInclude Include="src\D\D.h" />
|
||||||
|
@ -126,6 +128,7 @@
|
||||||
<ClInclude Include="src\Global\Blob.h" />
|
<ClInclude Include="src\Global\Blob.h" />
|
||||||
<ClInclude Include="src\Global\Convert.h" />
|
<ClInclude Include="src\Global\Convert.h" />
|
||||||
<ClInclude Include="src\Global\EngineInit.h" />
|
<ClInclude Include="src\Global\EngineInit.h" />
|
||||||
|
<ClInclude Include="src\Global\GlobalVarsClipboard.h" />
|
||||||
<ClInclude Include="src\Global\Linear.h" />
|
<ClInclude Include="src\Global\Linear.h" />
|
||||||
<ClInclude Include="src\Global\Lockable.h" />
|
<ClInclude Include="src\Global\Lockable.h" />
|
||||||
<ClInclude Include="src\Global\Object.h" />
|
<ClInclude Include="src\Global\Object.h" />
|
||||||
|
@ -203,8 +206,11 @@
|
||||||
<ClCompile Include="src\Audio\StreamPlayer.cpp" />
|
<ClCompile Include="src\Audio\StreamPlayer.cpp" />
|
||||||
<ClCompile Include="src\CGI\BaseGeometry.cpp" />
|
<ClCompile Include="src\CGI\BaseGeometry.cpp" />
|
||||||
<ClCompile Include="src\CGI\BasePipeline.cpp" />
|
<ClCompile Include="src\CGI\BasePipeline.cpp" />
|
||||||
|
<ClCompile Include="src\CGI\BaseRenderer.cpp" />
|
||||||
<ClCompile Include="src\CGI\BaseShader.cpp" />
|
<ClCompile Include="src\CGI\BaseShader.cpp" />
|
||||||
<ClCompile Include="src\CGI\BaseTexture.cpp" />
|
<ClCompile Include="src\CGI\BaseTexture.cpp" />
|
||||||
|
<ClCompile Include="src\CGI\CGI.cpp" />
|
||||||
|
<ClCompile Include="src\CGI\Renderer.cpp" />
|
||||||
<ClCompile Include="src\D\Log.cpp" />
|
<ClCompile Include="src\D\Log.cpp" />
|
||||||
<ClCompile Include="src\Game\BaseGame.cpp" />
|
<ClCompile Include="src\Game\BaseGame.cpp" />
|
||||||
<ClCompile Include="src\Game\State.cpp" />
|
<ClCompile Include="src\Game\State.cpp" />
|
||||||
|
@ -213,6 +219,7 @@
|
||||||
<ClCompile Include="src\Global\Convert.cpp" />
|
<ClCompile Include="src\Global\Convert.cpp" />
|
||||||
<ClCompile Include="src\Global\EngineInit.cpp" />
|
<ClCompile Include="src\Global\EngineInit.cpp" />
|
||||||
<ClCompile Include="src\Global\Global.cpp" />
|
<ClCompile Include="src\Global\Global.cpp" />
|
||||||
|
<ClCompile Include="src\Global\GlobalVarsClipboard.cpp" />
|
||||||
<ClCompile Include="src\Global\Object.cpp" />
|
<ClCompile Include="src\Global\Object.cpp" />
|
||||||
<ClCompile Include="src\Global\Random.cpp" />
|
<ClCompile Include="src\Global\Random.cpp" />
|
||||||
<ClCompile Include="src\Global\Str.cpp" />
|
<ClCompile Include="src\Global\Str.cpp" />
|
||||||
|
|
|
@ -354,6 +354,15 @@
|
||||||
<ClInclude Include="src\IO\Json.h">
|
<ClInclude Include="src\IO\Json.h">
|
||||||
<Filter>src\IO</Filter>
|
<Filter>src\IO</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\Global\GlobalVarsClipboard.h">
|
||||||
|
<Filter>src\Global</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\CGI\BaseRenderer.h">
|
||||||
|
<Filter>src\CGI</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\CGI\Renderer.h">
|
||||||
|
<Filter>src\CGI</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src\CGI\BaseGeometry.cpp">
|
<ClCompile Include="src\CGI\BaseGeometry.cpp">
|
||||||
|
@ -545,5 +554,17 @@
|
||||||
<ClCompile Include="src\IO\Json.cpp">
|
<ClCompile Include="src\IO\Json.cpp">
|
||||||
<Filter>src\IO</Filter>
|
<Filter>src\IO</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\Global\GlobalVarsClipboard.cpp">
|
||||||
|
<Filter>src\Global</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\CGI\BaseRenderer.cpp">
|
||||||
|
<Filter>src\CGI</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\CGI\Renderer.cpp">
|
||||||
|
<Filter>src\CGI</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\CGI\CGI.cpp">
|
||||||
|
<Filter>src\CGI</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -31,7 +31,7 @@ namespace verus
|
||||||
};
|
};
|
||||||
VERUS_TYPEDEFS(AlphaMotion);
|
VERUS_TYPEDEFS(AlphaMotion);
|
||||||
|
|
||||||
struct Bone : public AllocatorAware
|
struct Bone : AllocatorAware
|
||||||
{
|
{
|
||||||
Transform3 _matToBoneSpace = Transform3::identity();
|
Transform3 _matToBoneSpace = Transform3::identity();
|
||||||
Transform3 _matFromBoneSpace = Transform3::identity();
|
Transform3 _matFromBoneSpace = Transform3::identity();
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#include "verus.h"
|
||||||
|
|
||||||
|
using namespace verus;
|
||||||
|
using namespace verus::CGI;
|
||||||
|
|
||||||
|
BaseRenderer::BaseRenderer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseRenderer::~BaseRenderer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PBaseRenderer BaseRenderer::Load(CSZ dll, RBaseRendererDesc desc)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
PFNVERUSCREATERENDERER VerusCreateRenderer = reinterpret_cast<PFNVERUSCREATERENDERER>(
|
||||||
|
GetProcAddress(LoadLibraryA(dll), "VerusCreateRenderer"));
|
||||||
|
return VerusCreateRenderer(VERUS_SDK_VERSION, &desc);
|
||||||
|
#else
|
||||||
|
PFNVERUSCREATERENDERER VerusCreateRenderer = reinterpret_cast<PFNVERUSCREATERENDERER>(
|
||||||
|
dlsym(dlopen("./libRenderOpenGL.so", RTLD_LAZY), "VerusCreateRenderer"));
|
||||||
|
return VerusCreateRenderer(VERUS_SDK_VERSION, &desc);
|
||||||
|
#endif
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace verus
|
||||||
|
{
|
||||||
|
namespace CGI
|
||||||
|
{
|
||||||
|
enum class Gapi : int
|
||||||
|
{
|
||||||
|
unknown,
|
||||||
|
vulkan,
|
||||||
|
direct3D12
|
||||||
|
};
|
||||||
|
|
||||||
|
struct BaseRendererDesc
|
||||||
|
{
|
||||||
|
GlobalVarsClipboard _gvc;
|
||||||
|
|
||||||
|
BaseRendererDesc()
|
||||||
|
{
|
||||||
|
_gvc.Copy();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
VERUS_TYPEDEFS(BaseRendererDesc);
|
||||||
|
|
||||||
|
class BaseRenderer : public Object
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
BaseRendererDesc _desc;
|
||||||
|
|
||||||
|
BaseRenderer();
|
||||||
|
virtual ~BaseRenderer();
|
||||||
|
|
||||||
|
public:
|
||||||
|
static BaseRenderer* Load(CSZ dll, RBaseRendererDesc desc);
|
||||||
|
|
||||||
|
virtual void ReleaseMe() = 0;
|
||||||
|
|
||||||
|
void SetDesc(RBaseRendererDesc desc) { _desc = desc; }
|
||||||
|
|
||||||
|
// Which graphics API?
|
||||||
|
virtual Gapi GetGapi() = 0;
|
||||||
|
|
||||||
|
virtual void PrepareDraw() {}
|
||||||
|
virtual void Clear(UINT32 flags) {}
|
||||||
|
virtual void Present() {}
|
||||||
|
};
|
||||||
|
VERUS_TYPEDEFS(BaseRenderer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
typedef verus::CGI::PBaseRenderer(*PFNVERUSCREATERENDERER)(UINT32 version, verus::CGI::BaseRendererDesc* pDesc);
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
#include "verus.h"
|
||||||
|
|
||||||
|
namespace verus
|
||||||
|
{
|
||||||
|
void Make_CGI()
|
||||||
|
{
|
||||||
|
CGI::Renderer::Make();
|
||||||
|
}
|
||||||
|
void Free_CGI()
|
||||||
|
{
|
||||||
|
CGI::Renderer::Free();
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,3 +4,12 @@
|
||||||
#include "BasePipeline.h"
|
#include "BasePipeline.h"
|
||||||
#include "BaseShader.h"
|
#include "BaseShader.h"
|
||||||
#include "BaseTexture.h"
|
#include "BaseTexture.h"
|
||||||
|
#include "BaseRenderer.h"
|
||||||
|
|
||||||
|
#include "Renderer.h"
|
||||||
|
|
||||||
|
namespace verus
|
||||||
|
{
|
||||||
|
void Make_CGI();
|
||||||
|
void Free_CGI();
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
#include "verus.h"
|
||||||
|
|
||||||
|
using namespace verus;
|
||||||
|
using namespace verus::CGI;
|
||||||
|
|
||||||
|
Renderer::Renderer()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Renderer::~Renderer()
|
||||||
|
{
|
||||||
|
Done();
|
||||||
|
}
|
||||||
|
|
||||||
|
PBaseRenderer Renderer::operator->()
|
||||||
|
{
|
||||||
|
VERUS_RT_ASSERT(_pBaseRenderer);
|
||||||
|
return _pBaseRenderer;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Renderer::IsLoaded()
|
||||||
|
{
|
||||||
|
return IsValidSingleton() && !!I()._pBaseRenderer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Renderer::Init(PRendererDelegate pDelegate)
|
||||||
|
{
|
||||||
|
VERUS_INIT();
|
||||||
|
|
||||||
|
VERUS_QREF_SETTINGS;
|
||||||
|
|
||||||
|
_pRendererDelegate = pDelegate;
|
||||||
|
|
||||||
|
CSZ dll = "RendererDirect3D12.dll";
|
||||||
|
BaseRendererDesc desc;
|
||||||
|
|
||||||
|
_pBaseRenderer = BaseRenderer::Load(dll, desc);
|
||||||
|
|
||||||
|
_gapi = _pBaseRenderer->GetGapi();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Renderer::Done()
|
||||||
|
{
|
||||||
|
if (_pBaseRenderer)
|
||||||
|
{
|
||||||
|
_pBaseRenderer->ReleaseMe();
|
||||||
|
_pBaseRenderer = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
VERUS_SMART_DELETE(_pRendererDelegate);
|
||||||
|
|
||||||
|
VERUS_DONE(Renderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Renderer::Draw()
|
||||||
|
{
|
||||||
|
if (_pRendererDelegate)
|
||||||
|
_pRendererDelegate->Renderer_OnDraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Renderer::Present()
|
||||||
|
{
|
||||||
|
if (_pRendererDelegate)
|
||||||
|
_pRendererDelegate->Renderer_OnPresent();
|
||||||
|
_numFrames++;
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace verus
|
||||||
|
{
|
||||||
|
namespace CGI
|
||||||
|
{
|
||||||
|
struct RendererDelegate
|
||||||
|
{
|
||||||
|
virtual void Renderer_OnDraw() = 0;
|
||||||
|
virtual void Renderer_OnDrawOverlay() = 0;
|
||||||
|
virtual void Renderer_OnPresent() = 0;
|
||||||
|
virtual void Renderer_OnDrawCubeMap() {}
|
||||||
|
};
|
||||||
|
VERUS_TYPEDEFS(RendererDelegate);
|
||||||
|
|
||||||
|
class Renderer : public Singleton<Renderer>, public Object
|
||||||
|
{
|
||||||
|
PBaseRenderer _pBaseRenderer = nullptr;
|
||||||
|
PRendererDelegate _pRendererDelegate = nullptr;
|
||||||
|
UINT64 _numFrames = 0;
|
||||||
|
Gapi _gapi = Gapi::unknown;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Renderer();
|
||||||
|
~Renderer();
|
||||||
|
|
||||||
|
// Device-specific:
|
||||||
|
PBaseRenderer operator->();
|
||||||
|
static bool IsLoaded();
|
||||||
|
|
||||||
|
void Init(PRendererDelegate pDelegate);
|
||||||
|
void Done();
|
||||||
|
|
||||||
|
void Draw();
|
||||||
|
void Present();
|
||||||
|
};
|
||||||
|
VERUS_TYPEDEFS(Renderer);
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,38 +3,37 @@
|
||||||
using namespace verus;
|
using namespace verus;
|
||||||
using namespace verus::Game;
|
using namespace verus::Game;
|
||||||
|
|
||||||
#if 0
|
struct MyRendererDelegate : CGI::RendererDelegate
|
||||||
struct MyRenderDelegate : CGL::CRenderDelegate
|
|
||||||
{
|
{
|
||||||
PBaseGame _p = nullptr;
|
PBaseGame _p = nullptr;
|
||||||
|
|
||||||
MyRenderDelegate(PBaseGame p) : _p(p) {}
|
MyRendererDelegate(PBaseGame p) : _p(p) {}
|
||||||
~MyRenderDelegate() {}
|
~MyRendererDelegate() {}
|
||||||
|
|
||||||
virtual void Render_OnDraw() override
|
virtual void Renderer_OnDraw() override
|
||||||
{
|
{
|
||||||
VERUS_QREF_RENDER;
|
VERUS_QREF_RENDERER;
|
||||||
render.BindOffscreenRT();
|
renderer->PrepareDraw();
|
||||||
|
renderer->Clear(0);
|
||||||
_p->BaseGame_Draw();
|
_p->BaseGame_Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Render_OnDrawOverlay() override
|
virtual void Renderer_OnDrawOverlay() override
|
||||||
{
|
{
|
||||||
_p->BaseGame_DrawOverlay();
|
_p->BaseGame_DrawOverlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Render_OnPresent() override
|
virtual void Renderer_OnPresent() override
|
||||||
{
|
{
|
||||||
VERUS_QREF_RENDER;
|
VERUS_QREF_RENDERER;
|
||||||
render->Present();
|
renderer->Present();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Render_OnDrawCubeMap() override
|
virtual void Renderer_OnDrawCubeMap() override
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
VERUS_TYPEDEFS(MyRenderDelegate);
|
VERUS_TYPEDEFS(MyRendererDelegate);
|
||||||
#endif
|
|
||||||
|
|
||||||
struct BaseGame::Pimpl : AllocatorAware
|
struct BaseGame::Pimpl : AllocatorAware
|
||||||
{
|
{
|
||||||
|
@ -85,9 +84,9 @@ void BaseGame::Initialize(VERUS_MAIN_DEFAULT_ARGS)
|
||||||
{
|
{
|
||||||
VERUS_SDL_CENTERED;
|
VERUS_SDL_CENTERED;
|
||||||
|
|
||||||
//Settings::Make();
|
App::Settings::Make();
|
||||||
//VERUS_QREF_SETTINGS;
|
VERUS_QREF_SETTINGS;
|
||||||
//settings.ParseCommandLineArgs(argc, argv);
|
settings.ParseCommandLineArgs(argc, argv);
|
||||||
//settings.LoadValidateSave();
|
//settings.LoadValidateSave();
|
||||||
|
|
||||||
const int ret = SDL_Init(SDL_INIT_EVERYTHING);
|
const int ret = SDL_Init(SDL_INIT_EVERYTHING);
|
||||||
|
@ -101,8 +100,8 @@ void BaseGame::Initialize(VERUS_MAIN_DEFAULT_ARGS)
|
||||||
//Utils::TestAll();
|
//Utils::TestAll();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialization:
|
_window.Init();
|
||||||
//_engineInit.Init(this, new MyRenderDelegate(this), true);
|
_engineInit.Init(this, new MyRendererDelegate(this));
|
||||||
|
|
||||||
// Configure:
|
// Configure:
|
||||||
//VERUS_QREF_RENDER;
|
//VERUS_QREF_RENDER;
|
||||||
|
@ -118,7 +117,7 @@ void BaseGame::Run()
|
||||||
VERUS_QREF_TIMER;
|
VERUS_QREF_TIMER;
|
||||||
VERUS_QREF_KM;
|
VERUS_QREF_KM;
|
||||||
//VERUS_QREF_BULLET;
|
//VERUS_QREF_BULLET;
|
||||||
//VERUS_QREF_RENDER;
|
VERUS_QREF_RENDERER;
|
||||||
VERUS_QREF_ASYNC;
|
VERUS_QREF_ASYNC;
|
||||||
VERUS_QREF_ASYS;
|
VERUS_QREF_ASYS;
|
||||||
|
|
||||||
|
@ -219,16 +218,9 @@ void BaseGame::Run()
|
||||||
asys.Update();
|
asys.Update();
|
||||||
|
|
||||||
// Draw current frame:
|
// Draw current frame:
|
||||||
//if (render.Draw())
|
renderer.Draw();
|
||||||
{
|
|
||||||
#ifdef VERUS_DEBUG
|
|
||||||
if (_p->_debugBullet)
|
|
||||||
bullet.DebugDraw();
|
|
||||||
#endif
|
|
||||||
//render.DrawToScreen();
|
|
||||||
}
|
|
||||||
km.ResetClickState();
|
km.ResetClickState();
|
||||||
//render.Present(); // This can take a while.
|
renderer.Present(); // This can take a while.
|
||||||
|
|
||||||
// Show FPS:
|
// Show FPS:
|
||||||
if (_p->_showFPS && timer.IsEventEvery(500))
|
if (_p->_showFPS && timer.IsEventEvery(500))
|
||||||
|
@ -259,10 +251,10 @@ void BaseGame::Exit()
|
||||||
|
|
||||||
void BaseGame::KeyMapper_OnMouseMove(int x, int y)
|
void BaseGame::KeyMapper_OnMouseMove(int x, int y)
|
||||||
{
|
{
|
||||||
//VERUS_QREF_CONST_SETTINGS;
|
VERUS_QREF_CONST_SETTINGS;
|
||||||
|
|
||||||
//const float fx = x * 0.006f*settings.m_inputMouseSensitivity;
|
const float fx = x * 0.006f*settings._inputMouseSensitivity;
|
||||||
//const float fy = y * 0.006f*settings.m_inputMouseSensitivity;
|
const float fy = y * 0.006f*settings._inputMouseSensitivity;
|
||||||
|
|
||||||
if (_p->_defaultCameraMovement)
|
if (_p->_defaultCameraMovement)
|
||||||
{
|
{
|
||||||
|
@ -270,7 +262,7 @@ void BaseGame::KeyMapper_OnMouseMove(int x, int y)
|
||||||
//_p->_cameraCharacter.TurnYaw(fx);
|
//_p->_cameraCharacter.TurnYaw(fx);
|
||||||
}
|
}
|
||||||
|
|
||||||
//BaseGame_OnMouseMove(fx, fy);
|
BaseGame_OnMouseMove(fx, fy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseGame::KeyMapper_OnKey(int scancode)
|
void BaseGame::KeyMapper_OnKey(int scancode)
|
||||||
|
|
|
@ -10,6 +10,7 @@ namespace verus
|
||||||
Pimpl* _p = nullptr;
|
Pimpl* _p = nullptr;
|
||||||
AlignedAllocator _alloc;
|
AlignedAllocator _alloc;
|
||||||
EngineInit _engineInit;
|
EngineInit _engineInit;
|
||||||
|
App::Window _window;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BaseGame();
|
BaseGame();
|
||||||
|
|
|
@ -4,9 +4,8 @@ using namespace verus;
|
||||||
|
|
||||||
void EngineInit::Make()
|
void EngineInit::Make()
|
||||||
{
|
{
|
||||||
#if 0
|
if (_makeGlobal)
|
||||||
if (_makeUtils)
|
Make_Global();
|
||||||
Make_Utils();
|
|
||||||
if (_makeNet)
|
if (_makeNet)
|
||||||
Make_Net();
|
Make_Net();
|
||||||
if (_makeIO)
|
if (_makeIO)
|
||||||
|
@ -15,36 +14,34 @@ void EngineInit::Make()
|
||||||
Make_Input();
|
Make_Input();
|
||||||
if (_makeAudio)
|
if (_makeAudio)
|
||||||
Make_Audio();
|
Make_Audio();
|
||||||
if (_makeCGL)
|
if (_makeCGI)
|
||||||
Make_CGL();
|
Make_CGI();
|
||||||
if (_makePhysics)
|
//if (_makePhysics)
|
||||||
Make_Physics();
|
// Make_Physics();
|
||||||
if (_makeEffects)
|
//if (_makeEffects)
|
||||||
Make_Effects();
|
// Make_Effects();
|
||||||
if (_makeExtra)
|
//if (_makeExtra)
|
||||||
Make_Extra();
|
// Make_Extra();
|
||||||
if (_makeScene)
|
//if (_makeScene)
|
||||||
Make_Scene();
|
// Make_Scene();
|
||||||
if (_makeGUI)
|
//if (_makeGUI)
|
||||||
Make_GUI();
|
// Make_GUI();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineInit::Free()
|
void EngineInit::Free()
|
||||||
{
|
{
|
||||||
#if 0
|
//if (_makeGUI)
|
||||||
if (_makeGUI)
|
// Free_GUI();
|
||||||
Free_GUI();
|
//if (_makeScene)
|
||||||
if (_makeScene)
|
// Free_Scene();
|
||||||
Free_Scene();
|
//if (_makeExtra)
|
||||||
if (_makeExtra)
|
// Free_Extra();
|
||||||
Free_Extra();
|
//if (_makeEffects)
|
||||||
if (_makeEffects)
|
// Free_Effects();
|
||||||
Free_Effects();
|
//if (_makePhysics)
|
||||||
if (_makePhysics)
|
// Free_Physics();
|
||||||
Free_Physics();
|
if (_makeCGI)
|
||||||
if (_makeCGL)
|
Free_CGI();
|
||||||
Free_CGL();
|
|
||||||
if (_makeAudio)
|
if (_makeAudio)
|
||||||
Free_Audio();
|
Free_Audio();
|
||||||
if (_makeInput)
|
if (_makeInput)
|
||||||
|
@ -53,70 +50,63 @@ void EngineInit::Free()
|
||||||
Free_IO();
|
Free_IO();
|
||||||
if (_makeNet)
|
if (_makeNet)
|
||||||
Free_Net();
|
Free_Net();
|
||||||
if (_makeUtils)
|
if (_makeGlobal)
|
||||||
Free_Utils();
|
Free_Global();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineInit::Init(Input::PKeyMapperDelegate pKeyMapperDelegate, CGI::RenderDelegate* pRenderDelegate, bool createWindow)
|
void EngineInit::Init(Input::PKeyMapperDelegate pKeyMapperDelegate, CGI::RendererDelegate* pRendererDelegate)
|
||||||
{
|
{
|
||||||
#if 0
|
Timer::I().Init();
|
||||||
if (_makeUtils)
|
|
||||||
Utils::CTimer::I().Init();
|
|
||||||
|
|
||||||
if (_makeIO)
|
if (_makeIO)
|
||||||
IO::CAsync::I().Init();
|
IO::Async::I().Init();
|
||||||
|
|
||||||
// "A.P.I.":
|
// "A.P.I.":
|
||||||
if (_makeAudio)
|
if (_makeAudio)
|
||||||
Audio::CAudio::I().Init();
|
Audio::AudioSystem::I().Init();
|
||||||
if (_makePhysics)
|
//if (_makePhysics)
|
||||||
Physics::CBullet::I().Init();
|
// Physics::CBullet::I().Init();
|
||||||
if (_makeInput)
|
if (_makeInput)
|
||||||
{
|
{
|
||||||
Input::CKeyMapper::I().Init();
|
Input::KeyMapper::I().Init();
|
||||||
Input::CKeyMapper::I().SetDelegate(pKeyMapperDelegate);
|
Input::KeyMapper::I().SetDelegate(pKeyMapperDelegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_makeCGL)
|
if (_makeCGI)
|
||||||
{
|
{
|
||||||
CGL::CRender::I().Init(pRenderDelegate, createWindow);
|
CGI::Renderer::I().Init(pRendererDelegate);
|
||||||
#ifdef _WIN32
|
|
||||||
CGL::CRender::InitWin32(_C(CUtils::I().GetWritablePath()), 101);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Static init:
|
// Static init:
|
||||||
if (_makeEffects)
|
//if (_makeEffects)
|
||||||
Effects::CParticles::InitStatic();
|
// Effects::CParticles::InitStatic();
|
||||||
if (_makeGUI)
|
//if (_makeGUI)
|
||||||
GUI::CFont::InitStatic();
|
// GUI::CFont::InitStatic();
|
||||||
if (_makeScene)
|
//if (_makeScene)
|
||||||
{
|
{
|
||||||
Scene::CMesh::InitStatic();
|
//Scene::CMesh::InitStatic();
|
||||||
Scene::CTerrain::InitStatic();
|
//Scene::CTerrain::InitStatic();
|
||||||
Scene::CForest::InitStatic();
|
//Scene::CForest::InitStatic();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helpers:
|
// Helpers:
|
||||||
if (_makeCGL)
|
//if (_makeCGI)
|
||||||
CGL::CDebugRender::I().Init();
|
// CGL::CDebugRender::I().Init();
|
||||||
if (_makeScene)
|
//if (_makeScene)
|
||||||
Scene::CHelpers::I().Init();
|
// Scene::CHelpers::I().Init();
|
||||||
|
|
||||||
// Effects:
|
// Effects:
|
||||||
if (_makeEffects)
|
//if (_makeEffects)
|
||||||
{
|
//{
|
||||||
Effects::CBlur::I().Init();
|
// Effects::CBlur::I().Init();
|
||||||
Effects::CBloom::I().Init();
|
// Effects::CBloom::I().Init();
|
||||||
Effects::CSsao::I().Init();
|
// Effects::CSsao::I().Init();
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Materials & textures:
|
// Materials & textures:
|
||||||
if (_makeScene)
|
//if (_makeScene)
|
||||||
Scene::CMaterialManager::I().Init();
|
// Scene::CMaterialManager::I().Init();
|
||||||
|
|
||||||
if (_makeGUI)
|
//if (_makeGUI)
|
||||||
GUI::CGUI::I().Init();
|
// GUI::CGUI::I().Init();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace verus
|
||||||
}
|
}
|
||||||
namespace CGI
|
namespace CGI
|
||||||
{
|
{
|
||||||
struct RenderDelegate;
|
struct RendererDelegate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,12 +17,12 @@ namespace verus
|
||||||
class EngineInit
|
class EngineInit
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool _makeUtils = true;
|
bool _makeGlobal = true;
|
||||||
bool _makeNet = true;
|
bool _makeNet = true;
|
||||||
bool _makeIO = true;
|
bool _makeIO = true;
|
||||||
bool _makeInput = true;
|
bool _makeInput = true;
|
||||||
bool _makeAudio = true;
|
bool _makeAudio = true;
|
||||||
bool _makeCGL = true;
|
bool _makeCGI = true;
|
||||||
bool _makePhysics = true;
|
bool _makePhysics = true;
|
||||||
bool _makeEffects = true;
|
bool _makeEffects = true;
|
||||||
bool _makeExtra = false;
|
bool _makeExtra = false;
|
||||||
|
@ -32,7 +32,7 @@ namespace verus
|
||||||
void Make();
|
void Make();
|
||||||
void Free();
|
void Free();
|
||||||
|
|
||||||
void Init(Input::KeyMapperDelegate* pKeyMapperDelegate, CGI::RenderDelegate* pRenderDelegate, bool createWindow);
|
void Init(Input::KeyMapperDelegate* pKeyMapperDelegate, CGI::RendererDelegate* pRendererDelegate);
|
||||||
};
|
};
|
||||||
VERUS_TYPEDEFS(EngineInit);
|
VERUS_TYPEDEFS(EngineInit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "Convert.h"
|
#include "Convert.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "EngineInit.h"
|
#include "EngineInit.h"
|
||||||
|
#include "GlobalVarsClipboard.h"
|
||||||
|
|
||||||
namespace verus
|
namespace verus
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#include "verus.h"
|
||||||
|
|
||||||
|
using namespace verus;
|
||||||
|
|
||||||
|
void GlobalVarsClipboard::Copy()
|
||||||
|
{
|
||||||
|
_vPairs.reserve(8);
|
||||||
|
|
||||||
|
_vPairs.push_back(Pair(0, Utils::P()));
|
||||||
|
_vPairs.push_back(Pair(1, App::Settings::P()));
|
||||||
|
_vPairs.push_back(Pair(2, CGI::Renderer::P()));
|
||||||
|
_vPairs.push_back(Pair(3, IO::Async::P()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void GlobalVarsClipboard::Paste()
|
||||||
|
{
|
||||||
|
Utils::Assign(static_cast<Utils*>(_vPairs[0]._p));
|
||||||
|
App::Settings::Assign(static_cast<App::Settings*>(_vPairs[1]._p));
|
||||||
|
CGI::Renderer::Assign(static_cast<CGI::Renderer*>(_vPairs[2]._p));
|
||||||
|
IO::Async::Assign(static_cast<IO::Async*>(_vPairs[3]._p));
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace verus
|
||||||
|
{
|
||||||
|
//! This class can transfer singleton pointers to another library.
|
||||||
|
class GlobalVarsClipboard
|
||||||
|
{
|
||||||
|
struct Pair
|
||||||
|
{
|
||||||
|
int _id;
|
||||||
|
void* _p;
|
||||||
|
|
||||||
|
Pair(int id, void* p) : _id(id), _p(p) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
Vector<Pair> _vPairs;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void Copy();
|
||||||
|
void Paste();
|
||||||
|
};
|
||||||
|
}
|
|
@ -24,6 +24,7 @@
|
||||||
#define _C(x) ((x).c_str())
|
#define _C(x) ((x).c_str())
|
||||||
|
|
||||||
#define VERUS_P_FOR(i, to) Parallel::For(0, to, [&](int i)
|
#define VERUS_P_FOR(i, to) Parallel::For(0, to, [&](int i)
|
||||||
|
#define VERUS_U_FOR(i, to) for(UINT32 i = 0; i < to; ++i)
|
||||||
#define VERUS_FOR(i, to) for(int i = 0; i < to; ++i)
|
#define VERUS_FOR(i, to) for(int i = 0; i < to; ++i)
|
||||||
#define VERUS_FOREACH(T, v, it) for(T::iterator it=(v).begin(), itEnd=(v).end(); it!=itEnd; ++it)
|
#define VERUS_FOREACH(T, v, it) for(T::iterator it=(v).begin(), itEnd=(v).end(); it!=itEnd; ++it)
|
||||||
#define VERUS_FOREACH_CONST(T, v, it) for(T::const_iterator it=(v).begin(), itEnd=(v).end(); it!=itEnd; ++it)
|
#define VERUS_FOREACH_CONST(T, v, it) for(T::const_iterator it=(v).begin(), itEnd=(v).end(); it!=itEnd; ++it)
|
||||||
|
@ -64,3 +65,11 @@
|
||||||
#else
|
#else
|
||||||
# define VERUS_SDL_CENTERED putenv("SDL_VIDEO_WINDOW_POS"); putenv("SDL_VIDEO_CENTERED=1")
|
# define VERUS_SDL_CENTERED putenv("SDL_VIDEO_WINDOW_POS"); putenv("SDL_VIDEO_CENTERED=1")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
# define VERUS_DLL_EXPORT __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
# define VERUS_DLL_EXPORT __attribute__ ((visibility("default")))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define VERUS_HR(hr) std::hex << std::uppercase << "0x" << hr
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERUS_QREF_ASYNC IO::RAsync async = IO::Async::I()
|
#define VERUS_QREF_ASYNC IO::RAsync async = IO::Async::I()
|
||||||
#define VERUS_QREF_ASYS Audio::RAudioSystem asys = Audio::AudioSystem::I()
|
#define VERUS_QREF_ASYS Audio::RAudioSystem asys = Audio::AudioSystem::I()
|
||||||
#define VERUS_QREF_ATMO Scene::RAtmosphere atmo = Scene::Atmosphere::I()
|
#define VERUS_QREF_ATMO Scene::RAtmosphere atmo = Scene::Atmosphere::I()
|
||||||
#define VERUS_QREF_BLOOM Effects::RBloom bloom = Effects::Bloom::I()
|
#define VERUS_QREF_BLOOM Effects::RBloom bloom = Effects::Bloom::I()
|
||||||
#define VERUS_QREF_BLUR Effects::RBlur blur = Effects::Blur::I()
|
#define VERUS_QREF_BLUR Effects::RBlur blur = Effects::Blur::I()
|
||||||
#define VERUS_QREF_BULLET Physics::RBullet bullet = Physics::Bullet::I()
|
#define VERUS_QREF_BULLET Physics::RBullet bullet = Physics::Bullet::I()
|
||||||
#define VERUS_QREF_CONST_SETTINGS RcSettings settings = CSettings::IConst()
|
#define VERUS_QREF_CONST_SETTINGS App::RcSettings settings = App::Settings::IConst()
|
||||||
#define VERUS_QREF_DEPTH Effects::RDepth depth = Effects::Depth::I()
|
#define VERUS_QREF_DEPTH Effects::RDepth depth = Effects::Depth::I()
|
||||||
#define VERUS_QREF_DR CGL::RDebugRender dr = CGL::DebugRender::I()
|
#define VERUS_QREF_DR CGL::RDebugRender dr = CGL::DebugRender::I()
|
||||||
#define VERUS_QREF_FSYS IO::RFileSys fsys = IO::FileSys::I()
|
#define VERUS_QREF_FSYS IO::RFileSys fsys = IO::FileSys::I()
|
||||||
#define VERUS_QREF_GAME Game::RGame game = Game::Game::I()
|
#define VERUS_QREF_GAME Game::RGame game = Game::Game::I()
|
||||||
#define VERUS_QREF_GRASS Scene::RGrass grass = Scene::Grass::I()
|
#define VERUS_QREF_GRASS Scene::RGrass grass = Scene::Grass::I()
|
||||||
#define VERUS_QREF_GUI GUI::RGUI gui = GUI::GUI::I()
|
#define VERUS_QREF_GUI GUI::RGUI gui = GUI::GUI::I()
|
||||||
#define VERUS_QREF_HELPERS Scene::RHelpers helpers = Scene::Helpers::I()
|
#define VERUS_QREF_HELPERS Scene::RHelpers helpers = Scene::Helpers::I()
|
||||||
#define VERUS_QREF_KM Input::RKeyMapper km = Input::KeyMapper::I()
|
#define VERUS_QREF_KM Input::RKeyMapper km = Input::KeyMapper::I()
|
||||||
#define VERUS_QREF_LS Scene::RLandscape ls = Scene::Landscape::I()
|
#define VERUS_QREF_LS Scene::RLandscape ls = Scene::Landscape::I()
|
||||||
#define VERUS_QREF_MM Scene::RMaterialManager mm = Scene::MaterialManager::I()
|
#define VERUS_QREF_MM Scene::RMaterialManager mm = Scene::MaterialManager::I()
|
||||||
#define VERUS_QREF_MP Net::RMultiplayer mp = Net::Multiplayer::I()
|
#define VERUS_QREF_MP Net::RMultiplayer mp = Net::Multiplayer::I()
|
||||||
#define VERUS_QREF_PHYSICS Physics::RPhysics physics = Physics::Physics::I()
|
#define VERUS_QREF_PHYSICS Physics::RPhysics physics = Physics::Physics::I()
|
||||||
#define VERUS_QREF_RENDER CGL::RRender render = CGL::Render::I()
|
#define VERUS_QREF_RENDERER CGI::RRenderer renderer = CGI::Renderer::I()
|
||||||
#define VERUS_QREF_SETTINGS App::RSettings settings = App::Settings::I()
|
#define VERUS_QREF_SETTINGS App::RSettings settings = App::Settings::I()
|
||||||
#define VERUS_QREF_SM Scene::RSceneManager sm = Scene::SceneManager::I()
|
#define VERUS_QREF_SM Scene::RSceneManager sm = Scene::SceneManager::I()
|
||||||
#define VERUS_QREF_SSAO Effects::RSsao ssao = Effects::Ssao::I()
|
#define VERUS_QREF_SSAO Effects::RSsao ssao = Effects::Ssao::I()
|
||||||
#define VERUS_QREF_TIMER RTimer timer = Timer::I(); const float dt = timer.GetDeltaTime()
|
#define VERUS_QREF_TIMER RTimer timer = Timer::I(); const float dt = timer.GetDeltaTime()
|
||||||
#define VERUS_QREF_TIMER_GUI RTimer timer = Timer::I(); const float dt = timer.GetDeltaTime(Timer::Type::gui)
|
#define VERUS_QREF_TIMER_GUI RTimer timer = Timer::I(); const float dt = timer.GetDeltaTime(Timer::Type::gui)
|
||||||
#define VERUS_QREF_UTILS RUtils utils = Utils::I()
|
#define VERUS_QREF_UTILS RUtils utils = Utils::I()
|
||||||
#define VERUS_QREF_WATER Scene::RWater water = Scene::Water::I()
|
#define VERUS_QREF_WATER Scene::RWater water = Scene::Water::I()
|
||||||
|
|
|
@ -13,10 +13,10 @@ Timer::~Timer()
|
||||||
void Timer::Init()
|
void Timer::Init()
|
||||||
{
|
{
|
||||||
const TTimePoint timeNow = std::chrono::high_resolution_clock::now();
|
const TTimePoint timeNow = std::chrono::high_resolution_clock::now();
|
||||||
VERUS_FOR(i, +Type::count)
|
for (auto& data : _data)
|
||||||
{
|
{
|
||||||
_data[i]._t = _data[i]._dt = 0;
|
data._t = data._dt = 0;
|
||||||
_data[i]._timePrev = timeNow;
|
data._timePrev = timeNow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ void Utils::MakeEx(PBaseAllocator pAlloc)
|
||||||
{
|
{
|
||||||
const float mx = FLT_MAX;
|
const float mx = FLT_MAX;
|
||||||
const UINT32 imx = *(UINT32*)&mx;
|
const UINT32 imx = *(UINT32*)&mx;
|
||||||
VERUS_RT_ASSERT(imx == 0x7f7fffff);
|
VERUS_RT_ASSERT(imx == 0x7F7FFFFF);
|
||||||
|
|
||||||
Utils* p = static_cast<Utils*>(pAlloc->malloc(sizeof(Utils)));
|
Utils* p = static_cast<Utils*>(pAlloc->malloc(sizeof(Utils)));
|
||||||
p = new(p)Utils(pAlloc);
|
p = new(p)Utils(pAlloc);
|
||||||
|
|
|
@ -21,7 +21,7 @@ void Json::SetFilename(CSZ name)
|
||||||
CSZ pSlash = strchr(name, '/');
|
CSZ pSlash = strchr(name, '/');
|
||||||
if (!pSlash)
|
if (!pSlash)
|
||||||
{
|
{
|
||||||
//pathName = CUtils::I().GetWritablePath() + "/" + name;
|
//pathName = Utils::I().GetWritablePath() + "/" + name;
|
||||||
//name = _C(pathName);
|
//name = _C(pathName);
|
||||||
}
|
}
|
||||||
_pathName = name;
|
_pathName = name;
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue