Compare commits
54 Commits
608346d80b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 76848ab4e3 | |||
| 94292851cc | |||
| 2d3a075eb6 | |||
| d8c36b7715 | |||
| c56bc43723 | |||
| f4c82f0fb3 | |||
| 4e0aaa129f | |||
| f4ba25bec1 | |||
| c9cd01bb31 | |||
| f01c8c3ccb | |||
| 84e1194f21 | |||
| a2d9980dc8 | |||
| df870b717e | |||
| 0d93cd9e6d | |||
| a9fe4683fb | |||
| a366d75fdc | |||
| aae780ec6d | |||
| 8c6c42e123 | |||
| da203c80f3 | |||
| f9f292b6d6 | |||
| 5fd3fc75eb | |||
| 231fea81dd | |||
| 764824ff24 | |||
| 09dc26ae79 | |||
| fc399d52ec | |||
| 67528aaee1 | |||
| 7c8f8a3bb1 | |||
| 051939f827 | |||
| f83a238473 | |||
| 8326772558 | |||
| cc9bbf0ef5 | |||
| 857f8c4e69 | |||
| ed9482b8f8 | |||
| f1b7f8eb29 | |||
| ee194b2d69 | |||
| 7e8aaaa891 | |||
| 3e7caa2c7c | |||
| d90a0bdf83 | |||
| d5e09e28bf | |||
| 004698b135 | |||
| 7d0b8be65c | |||
| 97c2b3c1dc | |||
| 85b0b5d30e | |||
| fc5e09fab0 | |||
| 4c43cce133 | |||
| 6c80168e8c | |||
| 312e139a97 | |||
| 434f15a9d4 | |||
| 836d0fa185 | |||
| 2b82952f62 | |||
| 915858c0d3 | |||
| 5b4b6f2c52 | |||
| 14e49c163f | |||
| 6e6f08be7e |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -11,7 +11,8 @@
|
||||
[Bb]in/
|
||||
[Ll]ib/
|
||||
.idea/
|
||||
.vs
|
||||
.vs/
|
||||
[Ii]ntermediate/
|
||||
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
BIN
Assets/compiled/SolidColor.frag.dxil
Normal file
BIN
Assets/compiled/SolidColor.frag.dxil
Normal file
Binary file not shown.
BIN
Assets/compiled/Triangle.vert.dxil
Normal file
BIN
Assets/compiled/Triangle.vert.dxil
Normal file
Binary file not shown.
4
Assets/source/SolidColor.frag.hlsl
Normal file
4
Assets/source/SolidColor.frag.hlsl
Normal file
@@ -0,0 +1,4 @@
|
||||
float4 main(float4 Color : TEXCOORD0) : SV_Target0
|
||||
{
|
||||
return Color;
|
||||
}
|
||||
39
Assets/source/Triangle.vert.hlsl
Normal file
39
Assets/source/Triangle.vert.hlsl
Normal file
@@ -0,0 +1,39 @@
|
||||
struct Input
|
||||
{
|
||||
uint VertexIndex : SV_VertexID;
|
||||
};
|
||||
|
||||
struct Output
|
||||
{
|
||||
float4 Color : TEXCOORD0;
|
||||
float4 Position : SV_Position;
|
||||
};
|
||||
|
||||
Output main(Input input)
|
||||
{
|
||||
Output output;
|
||||
float2 pos;
|
||||
if (input.VertexIndex == 0)
|
||||
{
|
||||
pos = (-1.0f).xx;
|
||||
output.Color = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (input.VertexIndex == 1)
|
||||
{
|
||||
pos = float2(1.0f, -1.0f);
|
||||
output.Color = float4(0.0f, 1.0f, 0.0f, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (input.VertexIndex == 2)
|
||||
{
|
||||
pos = float2(0.0f, 1.0f);
|
||||
output.Color = float4(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
output.Position = float4(pos, 0.0f, 1.0f);
|
||||
return output;
|
||||
}
|
||||
69
Game/Entity/Entity.h
Normal file
69
Game/Entity/Entity.h
Normal file
@@ -0,0 +1,69 @@
|
||||
#pragma once
|
||||
|
||||
#include <concepts>
|
||||
#include <Core/Common/CoreUtils.h>
|
||||
#include <Core/Memory/Allocator.h>
|
||||
#include <Engine/Class.h>
|
||||
#include <Entity/EntityManager.h>
|
||||
#include <type_traits>
|
||||
|
||||
// Add any new fields into the concept below
|
||||
#define DECLARE_ENTITY(entity) \
|
||||
Entity* Base; \
|
||||
static const Juliet::Class* Kind;
|
||||
|
||||
// Will register the class globally at launch
|
||||
#define DEFINE_ENTITY(entity) \
|
||||
constexpr Juliet::Class entityKind##entity(#entity, sizeof(#entity) / sizeof(char)); \
|
||||
const Juliet::Class* entity::Kind = &entityKind##entity;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
using DerivedType = void*;
|
||||
|
||||
struct Entity final
|
||||
{
|
||||
EntityID ID;
|
||||
const Juliet::Class* Kind;
|
||||
DerivedType Derived;
|
||||
float X, Y;
|
||||
};
|
||||
|
||||
template <typename EntityType>
|
||||
concept EntityConcept = requires(EntityType entity) {
|
||||
requires std::same_as<decltype(entity.Kind), const Juliet::Class*>;
|
||||
requires std::same_as<decltype(entity.Base), Entity*>;
|
||||
};
|
||||
|
||||
template <typename EntityType>
|
||||
requires EntityConcept<EntityType>
|
||||
bool IsA(const Entity* entity)
|
||||
{
|
||||
return entity->Kind == EntityType::Kind;
|
||||
}
|
||||
|
||||
template <typename EntityType>
|
||||
requires EntityConcept<EntityType>
|
||||
EntityType* MakeEntity(EntityManager& manager, float x, float y)
|
||||
{
|
||||
EntityType* result = static_cast<EntityType*>(Juliet::Calloc(1, sizeof(EntityType)));
|
||||
Entity* base = result->Base = static_cast<Entity*>(Juliet::Calloc(1, sizeof(Entity)));
|
||||
base->X = x;
|
||||
base->Y = y;
|
||||
base->Derived = result;
|
||||
base->Kind = EntityType::Kind;
|
||||
|
||||
RegisterEntity(manager, base);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename EntityType>
|
||||
requires EntityConcept<EntityType>
|
||||
EntityType* DownCast(Entity* entity)
|
||||
{
|
||||
Assert(IsA<EntityType>(entity));
|
||||
return static_cast<EntityType*>(entity->Derived);
|
||||
}
|
||||
|
||||
} // namespace Game
|
||||
25
Game/Entity/EntityManager.cpp
Normal file
25
Game/Entity/EntityManager.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <Entity/EntityManager.h>
|
||||
|
||||
#include <Entity/Entity.h>
|
||||
|
||||
namespace Game
|
||||
{
|
||||
namespace
|
||||
{
|
||||
EntityManager Manager;
|
||||
}
|
||||
|
||||
EntityID EntityManager::ID = 0;
|
||||
|
||||
void InitEntityManager() {}
|
||||
|
||||
EntityManager& GetEntityManager()
|
||||
{
|
||||
return Manager;
|
||||
}
|
||||
|
||||
void RegisterEntity(EntityManager& manager, Entity* entity)
|
||||
{
|
||||
entity->ID = EntityManager::ID++;
|
||||
}
|
||||
} // namespace Game
|
||||
19
Game/Entity/EntityManager.h
Normal file
19
Game/Entity/EntityManager.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/CoreTypes.h>
|
||||
|
||||
namespace Game
|
||||
{
|
||||
using EntityID = uint64_t;
|
||||
|
||||
struct Entity;
|
||||
struct EntityManager
|
||||
{
|
||||
static EntityID ID;
|
||||
// May be this should contains the allocator for each entity types
|
||||
};
|
||||
|
||||
void InitEntityManager();
|
||||
EntityManager& GetEntityManager();
|
||||
void RegisterEntity(EntityManager& manager, Entity* entity);
|
||||
} // namespace Game
|
||||
112
Game/Game.vcxproj
Normal file
112
Game/Game.vcxproj
Normal file
@@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{B7B12DCC-1A69-4371-A9FE-D6E7671497B0}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>Game</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.26100.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup>
|
||||
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>ClangCL</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>ClangCL</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<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"/>
|
||||
</ImportGroup>
|
||||
<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"/>
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros"/>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)Intermediate\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;CPPDYNAMICLIBRARYTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Juliet\include\;$(SolutionDir)Game;</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>Juliet.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\lib\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||
<ProgramDatabaseFile>$(OutDir)$(TargetName)_$(Random).pdb</ProgramDatabaseFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;CPPDYNAMICLIBRARYTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Juliet\include\;$(SolutionDir)Game;</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)\lib\$(Platform)\$(Configuration)\</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>Juliet.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="game.cpp"/>
|
||||
<ClCompile Include="Entity\EntityManager.cpp"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Entity\Entity.h"/>
|
||||
<ClInclude Include="Entity\EntityManager.h"/>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
22
Game/Game.vcxproj.filters
Normal file
22
Game/Game.vcxproj.filters
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<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>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
70
Game/game.cpp
Normal file
70
Game/game.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
#include <cstdio>
|
||||
#include <windows.h> // TODO: remove because our dll should not be platform dependant
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
#include <Core/HAL/Filesystem/Filesystem.h>
|
||||
#include <Core/Logging/LogManager.h>
|
||||
#include <Core/Logging/LogTypes.h>
|
||||
#include <Entity/Entity.h>
|
||||
#include <Entity/EntityManager.h>
|
||||
#include <Graphics/Graphics.h>
|
||||
|
||||
// Test code
|
||||
namespace Game
|
||||
{
|
||||
struct Door
|
||||
{
|
||||
DECLARE_ENTITY()
|
||||
bool IsOpened;
|
||||
};
|
||||
DEFINE_ENTITY(Door);
|
||||
|
||||
struct Rock
|
||||
{
|
||||
DECLARE_ENTITY()
|
||||
int Health;
|
||||
};
|
||||
DEFINE_ENTITY(Rock);
|
||||
|
||||
} // namespace Game
|
||||
|
||||
using namespace Juliet;
|
||||
|
||||
extern "C" __declspec(dllexport) void __cdecl GameInit()
|
||||
{
|
||||
using namespace Game;
|
||||
|
||||
// Entity Use case
|
||||
InitEntityManager();
|
||||
auto& manager = GetEntityManager();
|
||||
Door* door = MakeEntity<Door>(manager, 10.0f, 2.0f);
|
||||
door->IsOpened = true;
|
||||
|
||||
Entity* ent = door->Base;
|
||||
Door* stillDoor = DownCast<Door>(ent);
|
||||
Assert(door == stillDoor);
|
||||
|
||||
Rock* rock = MakeEntity<Rock>(manager, 1.f, 2.f);
|
||||
rock->Health = 100;
|
||||
Assert(door->Base != rock->Base);
|
||||
|
||||
printf("Door is %s\n", door->IsOpened ? "Opened" : "Closed");
|
||||
printf("Rock has %d health points\n", rock->Health);
|
||||
|
||||
// Have to manually free for now because im not using arenas or anything
|
||||
free(door->Base);
|
||||
free(door);
|
||||
free(rock->Base);
|
||||
free(rock);
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void __cdecl GameShutdown()
|
||||
{
|
||||
printf("Shutting down game...\n");
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void __cdecl GameUpdate(float deltaTime)
|
||||
{
|
||||
//printf("Updating game...\n");
|
||||
}
|
||||
18
Juliet.sln
18
Juliet.sln
@@ -10,6 +10,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JulietApp", "JulietApp\Juli
|
||||
{1BBC0B92-E4D8-4838-974B-439C5C501E82} = {1BBC0B92-E4D8-4838-974B-439C5C501E82}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Game", "Game\Game.vcxproj", "{B7B12DCC-1A69-4371-A9FE-D6E7671497B0}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{1BBC0B92-E4D8-4838-974B-439C5C501E82} = {1BBC0B92-E4D8-4838-974B-439C5C501E82}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JulietShaderCompiler", "JulietShaderCompiler\JulietShaderCompiler.vcxproj", "{26880364-45F4-4817-BFD3-0ACC0958757D}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{1BBC0B92-E4D8-4838-974B-439C5C501E82} = {1BBC0B92-E4D8-4838-974B-439C5C501E82}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@@ -24,6 +34,14 @@ Global
|
||||
{4B2A0F9C-5F78-4BC9-BEE9-1E58BB85FA79}.Debug|x64.Build.0 = Debug|x64
|
||||
{4B2A0F9C-5F78-4BC9-BEE9-1E58BB85FA79}.Release|x64.ActiveCfg = Release|x64
|
||||
{4B2A0F9C-5F78-4BC9-BEE9-1E58BB85FA79}.Release|x64.Build.0 = Release|x64
|
||||
{B7B12DCC-1A69-4371-A9FE-D6E7671497B0}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B7B12DCC-1A69-4371-A9FE-D6E7671497B0}.Debug|x64.Build.0 = Debug|x64
|
||||
{B7B12DCC-1A69-4371-A9FE-D6E7671497B0}.Release|x64.ActiveCfg = Release|x64
|
||||
{B7B12DCC-1A69-4371-A9FE-D6E7671497B0}.Release|x64.Build.0 = Release|x64
|
||||
{26880364-45F4-4817-BFD3-0ACC0958757D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{26880364-45F4-4817-BFD3-0ACC0958757D}.Debug|x64.Build.0 = Debug|x64
|
||||
{26880364-45F4-4817-BFD3-0ACC0958757D}.Release|x64.ActiveCfg = Release|x64
|
||||
{26880364-45F4-4817-BFD3-0ACC0958757D}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -15,17 +15,17 @@
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{1bbc0b92-e4d8-4838-974b-439c5c501e82}</ProjectGuid>
|
||||
<RootNamespace>Juliet</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.26100.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>ClangCL</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>ClangCL</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
@@ -44,20 +44,20 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros"/>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)\lib\$(Platform)\$(Configuration)\</OutDir>
|
||||
<OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)Intermediate\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
||||
<IncludePath>$(SolutionDir)Juliet\include\;$(SolutionDir)Juliet\src\;$(SolutionDir)Juliet\src\Graphics\RHI\DX12\D3D12;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(SolutionDir)Juliet\include\;$(SolutionDir)Juliet\src\;$(SolutionDir)Juliet\src\Graphics\D3D12\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)Intermediate\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
|
||||
<IncludePath>$(SolutionDir)Juliet\include\;$(SolutionDir)Juliet\src\;$(SolutionDir)Juliet\src\Graphics\RHI\DX12\D3D12;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(SolutionDir)Juliet\include\;$(SolutionDir)Juliet\src\;$(SolutionDir)Juliet\src\Graphics\D3D12\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;JULIET_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_DEBUG;JULIET_EXPORT;JULIET_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
@@ -70,7 +70,13 @@
|
||||
<SubSystem>
|
||||
</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>ws2_32.lib;dxgi.lib;dxguid.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ImportLibrary>$(SolutionDir)\lib\$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>
|
||||
</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
@@ -78,7 +84,7 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;JULIET_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NDEBUG;JULIET_EXPORT;JULIET_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
@@ -93,6 +99,8 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>ws2_32.lib;d3d12.lib;dxgi.lib;dxguid.lib;$(CoreLibraryDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ImportLibrary>$(SolutionDir)\lib\$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -100,21 +108,29 @@
|
||||
<ClInclude Include="include\Core\Application\IApplication.h"/>
|
||||
<ClInclude Include="include\Core\Common\CoreTypes.h"/>
|
||||
<ClInclude Include="include\Core\Common\CoreUtils.h"/>
|
||||
<ClInclude Include="include\Core\Common\CRC32.h"/>
|
||||
<ClInclude Include="include\Core\Common\EnumUtils.h"/>
|
||||
<ClInclude Include="include\Core\Common\NonCopyable.h"/>
|
||||
<ClInclude Include="include\Core\Common\NonMovable.h"/>
|
||||
<ClInclude Include="include\Core\Common\NonNullPtr.h"/>
|
||||
<ClInclude Include="include\Core\Common\Singleton.h"/>
|
||||
<ClInclude Include="include\Core\Common\String.h"/>
|
||||
<ClInclude Include="include\Core\Container\Vector.h"/>
|
||||
<ClInclude Include="include\Core\HAL\Display\Display.h"/>
|
||||
<ClInclude Include="include\Core\HAL\DynLib\DynamicLibrary.h"/>
|
||||
<ClInclude Include="include\Core\HAL\Event\SystemEvent.h"/>
|
||||
<ClInclude Include="include\Core\HAL\Filesystem\Filesystem.h"/>
|
||||
<ClInclude Include="include\Core\HAL\IO\IOStream.h"/>
|
||||
<ClInclude Include="include\Core\HAL\Keyboard\Keyboard.h"/>
|
||||
<ClInclude Include="include\Core\HAL\Keyboard\KeyCode.h"/>
|
||||
<ClInclude Include="include\Core\HAL\Keyboard\ScanCode.h"/>
|
||||
<ClInclude Include="include\Core\HAL\Mouse\Mouse.h"/>
|
||||
<ClInclude Include="include\Core\HotReload\HotReload.h"/>
|
||||
<ClInclude Include="include\Core\JulietInit.h"/>
|
||||
<ClInclude Include="include\Core\Logging\LogManager.h"/>
|
||||
<ClInclude Include="include\Core\Logging\LogTypes.h"/>
|
||||
<ClInclude Include="include\Core\Math\MathUtils.h" />
|
||||
<ClInclude Include="include\Core\Math\Shape.h"/>
|
||||
<ClInclude Include="include\Core\Memory\Allocator.h"/>
|
||||
<ClInclude Include="include\Core\Memory\Utils.h"/>
|
||||
<ClInclude Include="include\Core\Networking\IPAddress.h"/>
|
||||
@@ -124,13 +140,19 @@
|
||||
<ClInclude Include="include\Core\Networking\TcpListener.h"/>
|
||||
<ClInclude Include="include\Core\Networking\TcpSocket.h"/>
|
||||
<ClInclude Include="include\Core\Thread\Thread.h"/>
|
||||
<ClInclude Include="include\Engine\Class.h"/>
|
||||
<ClInclude Include="include\Engine\Engine.h"/>
|
||||
<ClInclude Include="include\Graphics\Colors.h"/>
|
||||
<ClInclude Include="include\Graphics\Graphics.h"/>
|
||||
<ClInclude Include="include\Graphics\GraphicsConfig.h"/>
|
||||
<ClInclude Include="include\Graphics\GraphicsPipeline.h" />
|
||||
<ClInclude Include="include\Graphics\RenderPass.h"/>
|
||||
<ClInclude Include="include\Graphics\Shader.h" />
|
||||
<ClInclude Include="include\Graphics\Texture.h"/>
|
||||
<ClInclude Include="include\Juliet.h"/>
|
||||
<ClInclude Include="include\pch.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Display\DisplayDevice.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Display\Display_Private.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Display\Win32\Win32DisplayDevice.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Display\Win32\Win32DisplayEvent.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Display\Win32\Win32Window.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Display\Window.h"/>
|
||||
@@ -139,80 +161,95 @@
|
||||
<ClInclude Include="src\Core\HAL\Event\Mouse_Private.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Event\Win32ScanCode.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Event\WindowEvent.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Filesystem\Filesystem_Platform.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Filesystem\Filesystem_Private.h"/>
|
||||
<ClInclude Include="src\Core\HAL\IO\IOStream_Private.h"/>
|
||||
<ClInclude Include="src\Core\Math\Math_Private.h" />
|
||||
<ClInclude Include="src\Core\Networking\SocketPlatformImpl.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Win32.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12compatibility.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12sdklayers.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12shader.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\D3D12TokenizedProgramFormat.hpp"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12video.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dcommon.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_barriers.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_check_feature_support.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_core.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_default.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_pipeline_state_stream.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_property_format_table.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_render_pass.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_resource_helpers.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_root_signature.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_state_object.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\DirectML.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\dxcore.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\dxcore_interface.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\dxgicommon.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\directx\dxgiformat.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\dxguids\dxguids.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\basetsd.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\oaidl.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\ocidl.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\rpc.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\rpcndr.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\unknwn.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\unknwnbase.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\winapifamily.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\wrl\client.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\stubs\wrl\implements.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\winadapter.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\D3D12\wsl\wrladapter.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\DX12Includes.h"/>
|
||||
<ClInclude Include="src\Graphics\RHI\DX12\DX12Utils.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3d12.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3d12compatibility.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3d12sdklayers.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3d12shader.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\D3D12TokenizedProgramFormat.hpp" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3d12video.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3dcommon.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3dx12\d3dx12.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3dx12\d3dx12_barriers.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3dx12\d3dx12_check_feature_support.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3dx12\d3dx12_core.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3dx12\d3dx12_default.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3dx12\d3dx12_pipeline_state_stream.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3dx12\d3dx12_property_format_table.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3dx12\d3dx12_render_pass.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3dx12\d3dx12_resource_helpers.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3dx12\d3dx12_root_signature.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\d3dx12\d3dx12_state_object.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\AgilitySDK\dxgiformat.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12Common.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12DescriptorHeap.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12GraphicsPipeline.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12RenderPass.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12Shader.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12Synchronization.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12Texture.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12CommandList.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12GraphicsDevice.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12Includes.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12SwapChain.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12Utils.h" />
|
||||
<ClInclude Include="src\Graphics\GraphicsDevice.h"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Core\Application\ApplicationManager.cpp"/>
|
||||
<ClCompile Include="src\Core\Common\CoreUtils.cpp"/>
|
||||
<ClCompile Include="src\Core\Common\String.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Display\Display.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32DisplayDevice.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32DisplayEvent.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32Window.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\DynLib\Win32\DynamicLibrary.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\Keyboard.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\KeyboardMapping.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\Mouse.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\SystemEvent.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\WindowEvent.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Filesystem\Filesystem.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Filesystem\Win32\Win32Filesystem.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\IO\IOStream.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\IO\Win32\Win32IOStream.cpp"/>
|
||||
<ClCompile Include="src\Core\HotReload\HotReload.cpp"/>
|
||||
<ClCompile Include="src\Core\HotReload\Win32\Win32HotReload.cpp"/>
|
||||
<ClCompile Include="src\Core\Juliet.cpp"/>
|
||||
<ClCompile Include="src\Core\Logging\LogManager.cpp"/>
|
||||
<ClCompile Include="src\Core\Memory\Allocator.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\NetworkPacket.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\Socket.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\TcpListener.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\TcpSocket.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\Win32\Win32SocketPlatformImpl.cpp"/>
|
||||
<ClCompile Include="src\Engine\Engine.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Graphics\Graphics.cpp"/>
|
||||
<ClCompile Include="src\Graphics\RHI\DX12\D3D12\directx\d3dx12_property_format_table.cpp">
|
||||
<ClCompile Include="src\Core\Math\MathRound.cpp" />
|
||||
<ClCompile Include="src\Core\Memory\Allocator.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\NetworkPacket.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\Socket.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\TcpListener.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\TcpSocket.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\Win32\Win32SocketPlatformImpl.cpp" />
|
||||
<ClCompile Include="src\Engine\Engine.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\AgilitySDK\d3dx12\d3dx12_property_format_table.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12Common.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12DescriptorHeap.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12GraphicsPipeline.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12RenderPass.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12Shader.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12Synchronization.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12Texture.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12CommandList.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12GraphicsDevice.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12SwapChain.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12Utils.cpp" />
|
||||
<ClCompile Include="src\Graphics\Graphics.cpp">
|
||||
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SupportJustMyCode>true</SupportJustMyCode>
|
||||
<AssemblerOutput>NoListing</AssemblerOutput>
|
||||
<AssemblerListingLocation>W:\Classified\RomeoAndJuliet\Intermediate\Juliet\x64\Debug\</AssemblerListingLocation>
|
||||
<AssemblerListingLocation>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\</AssemblerListingLocation>
|
||||
<UndefineAllPreprocessorDefinitions>false</UndefineAllPreprocessorDefinitions>
|
||||
<BrowseInformationFile>W:\Classified\RomeoAndJuliet\Intermediate\Juliet\x64\Debug\</BrowseInformationFile>
|
||||
<BrowseInformationFile>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\</BrowseInformationFile>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<ConformanceMode>Default</ConformanceMode>
|
||||
<DiagnosticsFormat>Column</DiagnosticsFormat>
|
||||
@@ -225,29 +262,29 @@
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<LanguageStandard_C>Default</LanguageStandard_C>
|
||||
<ModuleDependenciesFile>W:\Classified\RomeoAndJuliet\Intermediate\Juliet\x64\Debug\</ModuleDependenciesFile>
|
||||
<ModuleDependenciesFile>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\</ModuleDependenciesFile>
|
||||
<OmitDefaultLibName>false</OmitDefaultLibName>
|
||||
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
|
||||
<ObjectFileName>W:\Classified\RomeoAndJuliet\Intermediate\Juliet\x64\Debug\</ObjectFileName>
|
||||
<ObjectFileName>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\</ObjectFileName>
|
||||
<CallingConvention>Cdecl</CallingConvention>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>W:\Classified\RomeoAndJuliet\Intermediate\Juliet\x64\Debug\Juliet.pch</PrecompiledHeaderOutputFile>
|
||||
<PrecompiledHeaderOutputFile>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\Juliet.pch</PrecompiledHeaderOutputFile>
|
||||
<PreprocessToFile>false</PreprocessToFile>
|
||||
<PreprocessKeepComments>false</PreprocessKeepComments>
|
||||
<PreprocessSuppressLineNumbers>false</PreprocessSuppressLineNumbers>
|
||||
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
<SourceDependenciesFile>W:\Classified\RomeoAndJuliet\Intermediate\Juliet\x64\Debug\</SourceDependenciesFile>
|
||||
<SourceDependenciesFile>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\</SourceDependenciesFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<SmallerTypeCheck>false</SmallerTypeCheck>
|
||||
<StructMemberAlignment>Default</StructMemberAlignment>
|
||||
<TrackerLogDirectory>W:\Classified\RomeoAndJuliet\Intermediate\Juliet\x64\Debug\Juliet.tlog\</TrackerLogDirectory>
|
||||
<TrackerLogDirectory>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\Juliet.tlog\</TrackerLogDirectory>
|
||||
<MinimalRebuildFromTracking>true</MinimalRebuildFromTracking>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<XMLDocumentationFileName>W:\Classified\RomeoAndJuliet\Intermediate\Juliet\x64\Debug\</XMLDocumentationFileName>
|
||||
<XMLDocumentationFileName>W:\Classified\Juliet\Intermediate\Juliet\x64\Debug\</XMLDocumentationFileName>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<IntelJCCErratum>false</IntelJCCErratum>
|
||||
<BuildStlModules>false</BuildStlModules>
|
||||
@@ -259,24 +296,21 @@
|
||||
<MSCVersion>Default</MSCVersion>
|
||||
<AdditionalOptions>--target=amd64-pc-windows-msvc</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Graphics\RHI\DX12\D3D12\dxguids\dxguids.cpp"/>
|
||||
<ClCompile Include="src\pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="include\Core\Thread\Mutex.h"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12.idl"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12compatibility.idl"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12sdklayers.idl"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\d3d12video.idl"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\d3dcommon.idl"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\dxgicommon.idl"/>
|
||||
<Content Include="src\Graphics\RHI\DX12\D3D12\directx\dxgiformat.idl"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="include\Graphics\RHI\"/>
|
||||
<Content Include="include\Core\Thread\Mutex.h" />
|
||||
<Content Include="src\Graphics\D3D12\AgilitySDK\d3d12.idl" />
|
||||
<Content Include="src\Graphics\D3D12\AgilitySDK\d3d12compatibility.idl" />
|
||||
<Content Include="src\Graphics\D3D12\AgilitySDK\d3d12sdklayers.idl" />
|
||||
<Content Include="src\Graphics\D3D12\AgilitySDK\d3d12video.idl" />
|
||||
<Content Include="src\Graphics\D3D12\AgilitySDK\d3dcommon.idl" />
|
||||
<Content Include="src\Graphics\D3D12\AgilitySDK\dxgiformat.idl" />
|
||||
<Content Include="src\Graphics\D3D12\AgilitySDK\VERSION.txt" />
|
||||
<Content Include="src\TODO.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
||||
@@ -54,10 +54,247 @@
|
||||
<ClInclude Include="include\Engine\Engine.h">
|
||||
<Filter>Header Files\Engine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Platform\Win32\Win32.h">
|
||||
<ClInclude Include="include\pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\pch.h">
|
||||
<ClInclude Include="include\Core\Common\CoreTypes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Common\CoreUtils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Common\EnumUtils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Common\NonCopyable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Common\NonMovable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Common\NonNullPtr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Common\Singleton.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Container\Vector.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\HAL\Display\Display.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\HAL\Event\SystemEvent.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\HAL\Keyboard\Keyboard.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\HAL\Keyboard\KeyCode.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\HAL\Keyboard\ScanCode.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\HAL\Mouse\Mouse.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\JulietInit.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Logging\LogManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Logging\LogTypes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Memory\Allocator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Memory\Utils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Networking\IPAddress.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Networking\NetworkPacket.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Networking\Socket.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Networking\SocketHandle.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Networking\TcpListener.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Networking\TcpSocket.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Thread\Thread.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Graphics\Graphics.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Graphics\GraphicsConfig.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Core\HAL\Display\DisplayDevice.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Core\HAL\Display\Display_Private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Core\HAL\Display\Win32\Win32DisplayDevice.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Core\HAL\Display\Win32\Win32DisplayEvent.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Core\HAL\Display\Win32\Win32Window.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Core\HAL\Display\Window.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Core\HAL\Event\KeyboardMapping.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Core\HAL\Event\Keyboard_Private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Core\HAL\Event\Mouse_Private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Core\HAL\Event\Win32ScanCode.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Core\HAL\Event\WindowEvent.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Core\Networking\SocketPlatformImpl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Core\HAL\Win32.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3d12.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3d12compatibility.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3d12sdklayers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3d12shader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\D3D12TokenizedProgramFormat.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3d12video.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3dcommon.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3dx12.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3dx12_barriers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3dx12_check_feature_support.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3dx12_core.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3dx12_default.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3dx12_pipeline_state_stream.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3dx12_property_format_table.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3dx12_render_pass.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3dx12_resource_helpers.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3dx12_root_signature.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\d3dx12_state_object.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\DirectML.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\dxcore.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\dxcore_interface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\dxgicommon.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\directx\dxgiformat.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\dxguids\dxguids.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\wsl\stubs\basetsd.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\wsl\stubs\oaidl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\wsl\stubs\ocidl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\wsl\stubs\rpc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\wsl\stubs\rpcndr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\wsl\stubs\unknwn.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\wsl\stubs\unknwnbase.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\wsl\stubs\winapifamily.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\wsl\stubs\wrl\client.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\wsl\stubs\wrl\implements.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\wsl\winadapter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\D3D12\wsl\wrladapter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\DX12Includes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\DX12\DX12Utils.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Graphics\GraphicsDevice.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
@@ -71,5 +308,71 @@
|
||||
<ClCompile Include="src\pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\Common\CoreUtils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\HAL\Display\Display.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32DisplayDevice.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32DisplayEvent.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32Window.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\HAL\Event\Keyboard.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\HAL\Event\KeyboardMapping.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\HAL\Event\Mouse.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\HAL\Event\SystemEvent.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\HAL\Event\WindowEvent.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\Juliet.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\Logging\LogManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\Memory\Allocator.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\Networking\NetworkPacket.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\Networking\Socket.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\Networking\TcpListener.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\Networking\TcpSocket.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\Networking\Win32\Win32SocketPlatformImpl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Graphics\DX12\D3D12\directx\d3dx12_property_format_table.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Graphics\DX12\D3D12\dxguids\dxguids.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Graphics\DX12\DX12GraphicsDevice.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Graphics\Graphics.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -5,5 +5,6 @@
|
||||
namespace Juliet
|
||||
{
|
||||
enum class JulietInit_Flags : uint8;
|
||||
void StartApplication(IApplication& app, JulietInit_Flags flags);
|
||||
|
||||
extern JULIET_API void StartApplication(IApplication& app, JulietInit_Flags flags);
|
||||
} // namespace Juliet
|
||||
|
||||
58
Juliet/include/Core/Common/CRC32.h
Normal file
58
Juliet/include/Core/Common/CRC32.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
// From https://web.mit.edu/freebsd/head/sys/libkern/crc32.c
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
namespace details
|
||||
{
|
||||
constexpr uint32_t crc32_tab[] = {
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832,
|
||||
0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
|
||||
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a,
|
||||
0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
|
||||
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
|
||||
0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
|
||||
0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab,
|
||||
0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
||||
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4,
|
||||
0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
||||
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074,
|
||||
0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
|
||||
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525,
|
||||
0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
|
||||
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
|
||||
0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
||||
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76,
|
||||
0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
|
||||
0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6,
|
||||
0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
||||
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7,
|
||||
0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
|
||||
0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7,
|
||||
0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
||||
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
|
||||
0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
|
||||
0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330,
|
||||
0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
||||
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
||||
};
|
||||
}
|
||||
|
||||
consteval uint32 crc32(const char* str, size_t length)
|
||||
{
|
||||
const char* p = str;
|
||||
uint32_t crc = ~0U;
|
||||
while (length--)
|
||||
{
|
||||
crc = details::crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
|
||||
}
|
||||
return crc ^ ~0U;
|
||||
}
|
||||
|
||||
consteval uint32 operator""_crc32(const char* str, size_t length)
|
||||
{
|
||||
return crc32(str, length);
|
||||
}
|
||||
|
||||
} // namespace Juliet
|
||||
@@ -2,26 +2,42 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
|
||||
namespace Juliet
|
||||
using uint8 = uint8_t;
|
||||
using uint16 = uint16_t;
|
||||
using uint32 = uint32_t;
|
||||
using uint64 = uint64_t;
|
||||
|
||||
using int8 = int8_t;
|
||||
using int16 = int16_t;
|
||||
using int32 = int32_t;
|
||||
using int64 = int64_t;
|
||||
|
||||
using Byte = std::byte;
|
||||
|
||||
using size_t = std::size_t;
|
||||
|
||||
struct ByteBuffer
|
||||
{
|
||||
using uint8 = uint8_t;
|
||||
using uint16 = uint16_t;
|
||||
using uint32 = uint32_t;
|
||||
using uint64 = uint64_t;
|
||||
Byte* Data;
|
||||
size_t Size;
|
||||
};
|
||||
|
||||
using int8 = int8_t;
|
||||
using int16 = int16_t;
|
||||
using int32 = int32_t;
|
||||
using int64 = int64_t;
|
||||
using FunctionPtr = auto (*)(void) -> void;
|
||||
|
||||
using byte = std::byte;
|
||||
// Limits
|
||||
template <typename Type>
|
||||
consteval Type MaxValueOf()
|
||||
{
|
||||
return std::numeric_limits<Type>::max();
|
||||
}
|
||||
constexpr uint8 uint8Max = MaxValueOf<uint8>();
|
||||
constexpr uint16 uint16Max = MaxValueOf<uint16>();
|
||||
constexpr uint32 uint32Max = MaxValueOf<uint32>();
|
||||
constexpr uint64 uint64Max = MaxValueOf<uint64>();
|
||||
|
||||
using size_t = std::size_t;
|
||||
|
||||
struct ByteBuffer
|
||||
{
|
||||
const byte* Data;
|
||||
size_t Size;
|
||||
};
|
||||
} // namespace Juliet
|
||||
constexpr int8 int8Max = MaxValueOf<int8>();
|
||||
constexpr int16 int16Max = MaxValueOf<int16>();
|
||||
constexpr int32 int32Max = MaxValueOf<int32>();
|
||||
constexpr int64 int64Max = MaxValueOf<int64>();
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/CoreTypes.h>
|
||||
#include <Juliet.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
|
||||
#if _DEBUG
|
||||
#define Assert(expression) \
|
||||
@@ -10,13 +14,71 @@
|
||||
{ \
|
||||
if (!(expression)) \
|
||||
{ \
|
||||
JulietAssert("Assertion Failed: " #expression); \
|
||||
Juliet::JulietAssert("Assertion Failed: " #expression); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define Unimplemented() \
|
||||
do \
|
||||
{ \
|
||||
Juliet::JulietAssert("Unimplemented!"); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#else
|
||||
#define Assert(Expression)
|
||||
#define Unimplemented()
|
||||
#endif
|
||||
|
||||
void JulietAssert(const char* expression);
|
||||
extern void JULIET_API JulietAssert(const char* expression);
|
||||
|
||||
#define ZeroStruct(structInstance) ZeroSize(sizeof(structInstance), &(structInstance))
|
||||
#define ZeroArray(array) ZeroSize(sizeof((array)), (array))
|
||||
#define ZeroDynArray(Count, Pointer) ZeroSize((Count) * sizeof((Pointer)[0]), Pointer)
|
||||
inline void ZeroSize(size_t size, void* ptr)
|
||||
{
|
||||
auto Byte = (uint8*)ptr;
|
||||
while (size--)
|
||||
{
|
||||
*Byte++ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
template <class Function>
|
||||
class DeferredFunction
|
||||
{
|
||||
public:
|
||||
explicit DeferredFunction(const Function& otherFct) noexcept
|
||||
: Callback(otherFct)
|
||||
{
|
||||
}
|
||||
explicit DeferredFunction(Function&& otherFct) noexcept
|
||||
: Callback(std::move(otherFct))
|
||||
{
|
||||
}
|
||||
|
||||
~DeferredFunction() noexcept { Callback(); }
|
||||
|
||||
DeferredFunction(const DeferredFunction&) = delete;
|
||||
DeferredFunction(const DeferredFunction&&) = delete;
|
||||
void operator=(const DeferredFunction&) = delete;
|
||||
void operator=(DeferredFunction&&) = delete;
|
||||
|
||||
private:
|
||||
Function Callback;
|
||||
};
|
||||
|
||||
template <class Function>
|
||||
auto Defer(Function&& fct) noexcept
|
||||
{
|
||||
return DeferredFunction<std::decay_t<Function>>{ std::forward<Function>(fct) };
|
||||
}
|
||||
|
||||
inline bool IsValid(ByteBuffer buffer)
|
||||
{
|
||||
return buffer.Size > 0 && buffer.Data;
|
||||
}
|
||||
|
||||
extern JULIET_API void Free(ByteBuffer& buffer);
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -105,4 +105,7 @@ namespace Juliet
|
||||
private:
|
||||
Type* InternalPtr;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
NonNullPtr(T) -> NonNullPtr<T>;
|
||||
} // namespace Juliet
|
||||
|
||||
162
Juliet/include/Core/Common/String.h
Normal file
162
Juliet/include/Core/Common/String.h
Normal file
@@ -0,0 +1,162 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Math/MathUtils.h>
|
||||
#include <Core/Memory/Utils.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
#define ConstString(str) { const_cast<char*>((str)), sizeof(str) - 1 }
|
||||
#define CStr(str) ((str).Data)
|
||||
#define InplaceString(name, size) \
|
||||
char name##_[size]; \
|
||||
MemSet(name##_, 0, sizeof(uint32)); \
|
||||
String name = { name##_, 0 }
|
||||
|
||||
// Everything is Little Endian
|
||||
enum class StringEncoding : uint8
|
||||
{
|
||||
Unknown = 0,
|
||||
ASCII,
|
||||
LATIN1,
|
||||
UTF8,
|
||||
UTF16,
|
||||
UTF32,
|
||||
UCS2,
|
||||
UCS4,
|
||||
};
|
||||
|
||||
// Represents a UTF-8 String.
|
||||
// Not null terminated.
|
||||
struct String
|
||||
{
|
||||
char* Data;
|
||||
size_t Size;
|
||||
};
|
||||
|
||||
struct StringBuffer : String
|
||||
{
|
||||
size_t Capacity;
|
||||
};
|
||||
|
||||
constexpr uint32 kInvalidUTF8 = 0xFFFD;
|
||||
|
||||
inline size_t StringLength(String str)
|
||||
{
|
||||
return str.Size;
|
||||
}
|
||||
|
||||
inline size_t StringLength(const char* str)
|
||||
{
|
||||
size_t length = 0;
|
||||
if (str)
|
||||
{
|
||||
while (char ch = *str)
|
||||
{
|
||||
if ((ch & 0xC0) != 0x80)
|
||||
{
|
||||
++length;
|
||||
}
|
||||
++str;
|
||||
}
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
inline bool IsValid(String str)
|
||||
{
|
||||
return str.Size > 0 && str.Data != nullptr && *str.Data;
|
||||
}
|
||||
|
||||
inline String WrapString(const char* str)
|
||||
{
|
||||
String result = {};
|
||||
result.Data = const_cast<char*>(str);
|
||||
result.Size = StringLength(str);
|
||||
return result;
|
||||
}
|
||||
|
||||
inline String FindChar(String str, char c)
|
||||
{
|
||||
String result = str;
|
||||
while (result.Size)
|
||||
{
|
||||
if (*result.Data != c)
|
||||
{
|
||||
++result.Data;
|
||||
--result.Size;
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
inline bool ContainsChar(String str, char c)
|
||||
{
|
||||
return IsValid(FindChar(str, c));
|
||||
}
|
||||
|
||||
// Return:
|
||||
// - < 0 if str1 < str2
|
||||
// - = 0 : Both strings are equals
|
||||
// - > 0 if str1 > str2
|
||||
inline int32 StringCompare(String str1, String str2)
|
||||
{
|
||||
size_t len1 = StringLength(str1);
|
||||
size_t len2 = StringLength(str2);
|
||||
size_t minLen = Min(len1, len2);
|
||||
int32 result = MemCompare(CStr(str1), CStr(str2), minLen);
|
||||
if (result == 0)
|
||||
{
|
||||
if (len1 > len2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (len1 < len2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
JULIET_API uint32 StepUTF8(String& inStr);
|
||||
JULIET_API String FindString(String strLeft, String strRight);
|
||||
|
||||
// Case insensitive compare. Supports ASCII only
|
||||
// TODO: Support UNICODE
|
||||
extern JULIET_API int8 StringCompareCaseInsensitive(String str1, String str2);
|
||||
|
||||
// Do not allocate anything, you must allocate your out buffer yourself
|
||||
// TODO: Version taking arena that can allocate
|
||||
// Do not take String type because we dont know the string encoding we are going from/to
|
||||
// src and dst will be casted based on the encoding.
|
||||
// size will correspond to the number of characters
|
||||
// Will convert \0 character if present.
|
||||
extern JULIET_API bool ConvertString(StringEncoding from, StringEncoding to, String src, StringBuffer& dst);
|
||||
extern JULIET_API bool ConvertString(String from, String to, String src, StringBuffer& dst);
|
||||
|
||||
} // namespace Juliet
|
||||
|
||||
#ifdef UNIT_TEST
|
||||
namespace Juliet::UnitTest
|
||||
{
|
||||
inline void TestFindChar()
|
||||
{
|
||||
String s1 = ConstString("");
|
||||
String s2 = ConstString("abcdefabcdef");
|
||||
String s3 = ConstString("11111111111111111111");
|
||||
|
||||
Assert(FindChar(s1, 'x').Data == nullptr);
|
||||
Assert(FindChar(s2, 'y').Data == nullptr);
|
||||
Assert(FindChar(s2, 'a').Data - s2.Data == 0);
|
||||
Assert(FindChar(s2, 'd').Data - s2.Data == 3);
|
||||
Assert(FindChar(s2, 'f').Data - s2.Data == 5);
|
||||
Assert(FindChar(s3, '1').Data - s3.Data == 0);
|
||||
}
|
||||
} // namespace Juliet::UnitTest
|
||||
#endif
|
||||
@@ -5,7 +5,8 @@
|
||||
namespace Juliet
|
||||
{
|
||||
// TODO : Create my own Vector class based on https://github.com/niklas-ourmachinery/bitsquid-foundation/blob/master/collection_types.h
|
||||
template <typename T> class Vector : public std::vector<T>
|
||||
template <typename T>
|
||||
class Vector : public std::vector<T>
|
||||
{
|
||||
};
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/CoreTypes.h>
|
||||
#include <core/Common/NonNullPtr.h>
|
||||
#include <Core/Common/NonNullPtr.h>
|
||||
#include <Juliet.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
struct Window;
|
||||
|
||||
using WindowID = uint8;
|
||||
extern Window* CreatePlatformWindow(const char* title, uint16 width, uint16 height, int flags = 0 /* unused */);
|
||||
extern void DestroyPlatformWindow(NonNullPtr<Window> window);
|
||||
extern JULIET_API Window* CreatePlatformWindow(const char* title, uint16 width, uint16 height, int flags = 0 /* unused */);
|
||||
extern JULIET_API void DestroyPlatformWindow(NonNullPtr<Window> window);
|
||||
|
||||
extern void ShowWindow(NonNullPtr<Window> window);
|
||||
extern void HideWindow(NonNullPtr<Window> window);
|
||||
extern JULIET_API void ShowWindow(NonNullPtr<Window> window);
|
||||
extern JULIET_API void HideWindow(NonNullPtr<Window> window);
|
||||
|
||||
extern WindowID GetWindowID(NonNullPtr<Window> window);
|
||||
extern JULIET_API WindowID GetWindowID(NonNullPtr<Window> window);
|
||||
} // namespace Juliet
|
||||
|
||||
12
Juliet/include/Core/HAL/DynLib/DynamicLibrary.h
Normal file
12
Juliet/include/Core/HAL/DynLib/DynamicLibrary.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/NonNullPtr.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
struct DynamicLibrary;
|
||||
|
||||
extern JULIET_API DynamicLibrary* LoadDynamicLibrary(const char* filename);
|
||||
extern JULIET_API FunctionPtr LoadFunction(NonNullPtr<DynamicLibrary> lib, const char* functionName);
|
||||
extern JULIET_API void UnloadDynamicLibrary(NonNullPtr<DynamicLibrary> lib);
|
||||
} // namespace Juliet
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <Core/HAL/Keyboard/Keyboard.h>
|
||||
#include <Core/HAL/Keyboard/KeyCode.h>
|
||||
#include <Core/HAL/Mouse/Mouse.h>
|
||||
#include <Juliet.h>
|
||||
|
||||
// Handles all events from systems handling the Hardware
|
||||
// Very inspired by SDL3
|
||||
@@ -106,15 +107,15 @@ namespace Juliet
|
||||
// Poll for any event, return false if no event is available.
|
||||
// Equivalent to WaitEvent(event, 0);
|
||||
// Will not block
|
||||
extern bool GetEvent(SystemEvent& event);
|
||||
extern JULIET_API bool GetEvent(SystemEvent& event);
|
||||
|
||||
// TODO : use chrono to tag the timeout correctly with nanosec
|
||||
// timeout == -1 means wait for any event before pursuing
|
||||
// timeout == 0 means checking once for the frame and getting out
|
||||
// timeout > 0 means wait until time is out
|
||||
extern bool WaitEvent(SystemEvent& event, int32 timeoutInNS = -1);
|
||||
extern JULIET_API bool WaitEvent(SystemEvent& event, int32 timeoutInNS = -1);
|
||||
|
||||
// Add an event onto the event queue.
|
||||
// TODO : support array of events
|
||||
extern bool AddEvent(SystemEvent& event);
|
||||
extern JULIET_API bool AddEvent(SystemEvent& event);
|
||||
} // namespace Juliet
|
||||
|
||||
11
Juliet/include/Core/HAL/Filesystem/Filesystem.h
Normal file
11
Juliet/include/Core/HAL/Filesystem/Filesystem.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/String.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Returns the path to the application directory
|
||||
extern JULIET_API String GetBasePath();
|
||||
|
||||
extern JULIET_API bool IsAbsolutePath(String path);
|
||||
} // namespace Juliet
|
||||
69
Juliet/include/Core/HAL/IO/IOStream.h
Normal file
69
Juliet/include/Core/HAL/IO/IOStream.h
Normal file
@@ -0,0 +1,69 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/NonNullPtr.h>
|
||||
#include <Core/Common/String.h>
|
||||
#include <Juliet.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Opaque type
|
||||
struct IOStream;
|
||||
|
||||
struct IOStreamDataPayload
|
||||
{
|
||||
};
|
||||
|
||||
enum class IOStreamStatus : uint8
|
||||
{
|
||||
Ready,
|
||||
Error,
|
||||
EndOfFile,
|
||||
NotReady,
|
||||
ReadOnly,
|
||||
WriteOnly
|
||||
};
|
||||
|
||||
enum class IOStreamSeekPivot : uint8
|
||||
{
|
||||
Begin,
|
||||
Current,
|
||||
End,
|
||||
Count
|
||||
};
|
||||
|
||||
// IOStream can be opened on a file or memory, or anything else.
|
||||
// Use the interface to make it transparent to the user.
|
||||
struct IOStreamInterface
|
||||
{
|
||||
uint32 Version;
|
||||
|
||||
int64 (*Size)(NonNullPtr<IOStreamDataPayload> data);
|
||||
|
||||
int64 (*Seek)(NonNullPtr<IOStreamDataPayload> data, int64 offset, IOStreamSeekPivot pivot);
|
||||
size_t (*Read)(NonNullPtr<IOStreamDataPayload> data, void* outBuffer, size_t size, NonNullPtr<IOStreamStatus> status);
|
||||
size_t (*Write)(NonNullPtr<IOStreamDataPayload> data, ByteBuffer inBuffer, NonNullPtr<IOStreamStatus> status);
|
||||
bool (*Flush)(NonNullPtr<IOStreamDataPayload> data, NonNullPtr<IOStreamStatus> status);
|
||||
|
||||
bool (*Close)(NonNullPtr<IOStreamDataPayload> data);
|
||||
};
|
||||
|
||||
extern JULIET_API IOStream* IOFromFile(String filename, String mode);
|
||||
|
||||
// Let you use an interface to open any io. Is used internally by IOFromFile
|
||||
extern JULIET_API IOStream* IOFromInterface(NonNullPtr<const IOStreamInterface> interface, NonNullPtr<IOStreamDataPayload> payload);
|
||||
|
||||
// Write formatted string into the stream.
|
||||
extern JULIET_API size_t IOPrintf(NonNullPtr<IOStream> stream, _Printf_format_string_ const char* format, ...);
|
||||
extern JULIET_API size_t IOWrite(NonNullPtr<IOStream> stream, ByteBuffer inBuffer);
|
||||
|
||||
extern JULIET_API size_t IORead(NonNullPtr<IOStream> stream, void* ptr, size_t size);
|
||||
extern JULIET_API int64 IOSeek(NonNullPtr<IOStream> stream, int64 offset, IOStreamSeekPivot pivot);
|
||||
|
||||
extern JULIET_API int64 IOSize(NonNullPtr<IOStream> stream);
|
||||
|
||||
// TODO : Use memory arena because that Allocates
|
||||
extern JULIET_API ByteBuffer LoadFile(String filename);
|
||||
extern JULIET_API ByteBuffer LoadFile(NonNullPtr<IOStream> stream, bool closeStreamWhenDone);
|
||||
|
||||
extern JULIET_API bool IOClose(NonNullPtr<IOStream> stream);
|
||||
} // namespace Juliet
|
||||
@@ -20,8 +20,8 @@ namespace Juliet
|
||||
uint16 Raw;
|
||||
};
|
||||
|
||||
extern bool IsKeyDown(ScanCode scanCode);
|
||||
extern JULIET_API bool IsKeyDown(ScanCode scanCode);
|
||||
|
||||
extern KeyMod GetKeyModState();
|
||||
extern KeyCode GetKeyCodeFromScanCode(ScanCode scanCode, KeyMod keyModState);
|
||||
extern JULIET_API KeyMod GetKeyModState();
|
||||
extern JULIET_API KeyCode GetKeyCodeFromScanCode(ScanCode scanCode, KeyMod keyModState);
|
||||
} // namespace Juliet
|
||||
|
||||
38
Juliet/include/Core/HotReload/HotReload.h
Normal file
38
Juliet/include/Core/HotReload/HotReload.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/String.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Fwd Declare
|
||||
struct DynamicLibrary;
|
||||
|
||||
struct HotReloadCode
|
||||
{
|
||||
String DLLFullPath;
|
||||
String LockFullPath;
|
||||
String TransientDLLName;
|
||||
|
||||
uint64 LastWriteTime;
|
||||
|
||||
DynamicLibrary* Dll;
|
||||
|
||||
void** Functions;
|
||||
const char** FunctionNames;
|
||||
uint32 FunctionCount;
|
||||
|
||||
uint32 UniqueID;
|
||||
|
||||
bool IsValid : 1;
|
||||
};
|
||||
|
||||
extern JULIET_API void InitHotReloadCode(HotReloadCode& code, String dllName,
|
||||
String transientDllName, String lockFilename);
|
||||
extern JULIET_API void ShutdownHotReloadCode(HotReloadCode& code);
|
||||
|
||||
extern JULIET_API void LoadCode(HotReloadCode& code);
|
||||
extern JULIET_API void UnloadCode(HotReloadCode& code);
|
||||
|
||||
extern JULIET_API void ReloadCode(HotReloadCode& code);
|
||||
extern JULIET_API bool ShouldReloadCode(const HotReloadCode& code);
|
||||
} // namespace Juliet
|
||||
@@ -1,5 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/CoreTypes.h>
|
||||
#include <Juliet.h>
|
||||
|
||||
// TODO : Juliet strings
|
||||
#include <string>
|
||||
// TODO Juliet Containers + Allocators...
|
||||
@@ -32,12 +35,15 @@ namespace Juliet
|
||||
std::deque<Entry> Entries;
|
||||
bool IsInitialized : 1;
|
||||
|
||||
friend void Log(LogLevel level, LogCategory category, const char* fmt, ...);
|
||||
friend void Log(LogLevel level, LogCategory category, const char* fmt, va_list args);
|
||||
void AddEntry(Entry&& entry);
|
||||
static void OutputLog(Entry& entry);
|
||||
};
|
||||
|
||||
void InitializeLogManager();
|
||||
void ShutdownLogManager();
|
||||
void Log(LogLevel level, LogCategory category, const char* fmt, ...);
|
||||
extern void JULIET_API InitializeLogManager();
|
||||
extern void JULIET_API ShutdownLogManager();
|
||||
extern void JULIET_API Log(LogLevel level, LogCategory category, const char* fmt, ...);
|
||||
extern void JULIET_API LogMessage(LogCategory category, const char* fmt, ...);
|
||||
extern void JULIET_API LogWarning(LogCategory category, const char* fmt, ...);
|
||||
extern void JULIET_API LogError(LogCategory category, const char* fmt, ...);
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -12,9 +12,10 @@ namespace Juliet
|
||||
enum class LogCategory : uint8
|
||||
{
|
||||
Core = 0,
|
||||
Networking = 1,
|
||||
Engine = 2,
|
||||
Editor = 3,
|
||||
Game = 4,
|
||||
Graphics = 1,
|
||||
Networking = 2,
|
||||
Engine = 3,
|
||||
Tool = 4,
|
||||
Game = 5,
|
||||
};
|
||||
} // namespace Juliet
|
||||
|
||||
40
Juliet/include/Core/Math/MathUtils.h
Normal file
40
Juliet/include/Core/Math/MathUtils.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/CoreTypes.h>
|
||||
#include <Juliet.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
extern JULIET_API float RoundF(float value);
|
||||
|
||||
inline int32 LRoundF(float value)
|
||||
{
|
||||
return RoundF(value);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
constexpr Type Min(Type lhs, Type rhs)
|
||||
{
|
||||
return rhs < lhs ? rhs : lhs;
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
constexpr Type Max(Type lhs, Type rhs)
|
||||
{
|
||||
return lhs < rhs ? rhs : lhs;
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
constexpr Type Clamp(Type val, Type min, Type max)
|
||||
{
|
||||
if (val < min)
|
||||
{
|
||||
return min;
|
||||
}
|
||||
if (val > max)
|
||||
{
|
||||
return max;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
} // namespace Juliet
|
||||
12
Juliet/include/Core/Math/Shape.h
Normal file
12
Juliet/include/Core/Math/Shape.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
struct Rectangle
|
||||
{
|
||||
int32 X;
|
||||
int32 Y;
|
||||
int32 Width;
|
||||
int32 Height;
|
||||
};
|
||||
} // namespace Juliet
|
||||
@@ -1,28 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <core/Common/CoreTypes.h>
|
||||
#include <Juliet.h>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Uninitialized allocation
|
||||
void* Malloc(size_t nb_elem, size_t elem_size);
|
||||
JULIET_API void* Malloc(size_t elem_size);
|
||||
// Initialized to 0 allocation
|
||||
void* Calloc(size_t nb_elem, size_t elem_size);
|
||||
void* Realloc(void* memory, size_t newSize);
|
||||
JULIET_API void* Calloc(size_t nb_elem, size_t elem_size);
|
||||
JULIET_API void* Realloc(void* memory, size_t newSize);
|
||||
|
||||
// Free
|
||||
template <typename Type>
|
||||
void Free(Type* memory)
|
||||
{
|
||||
Assert(memory);
|
||||
free(memory);
|
||||
::free(memory);
|
||||
}
|
||||
// Free and Set the ptr to nullptr
|
||||
template <typename Type>
|
||||
void SafeFree(Type*& memory)
|
||||
{
|
||||
Assert(memory);
|
||||
free(memory);
|
||||
memory = nullptr;
|
||||
if (memory)
|
||||
{
|
||||
::free(memory);
|
||||
memory = nullptr;
|
||||
}
|
||||
}
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -1,3 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/CoreTypes.h>
|
||||
|
||||
#define ArraySize(array) (sizeof(array) / sizeof(array[0]))
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
inline int32 MemCompare(const void* leftValue, const void* rightValue, size_t size)
|
||||
{
|
||||
auto left = static_cast<const unsigned char*>(leftValue);
|
||||
auto right = static_cast<const unsigned char*>(rightValue);
|
||||
while (size && *left == *right)
|
||||
{
|
||||
++left;
|
||||
++right;
|
||||
--size;
|
||||
}
|
||||
return size ? *left - *right : 0;
|
||||
}
|
||||
|
||||
// TODO: homemade versions
|
||||
#define MemSet memset
|
||||
#define MemCopy memcpy
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Juliet
|
||||
|
||||
// Pack
|
||||
NetworkPacket& operator<<(uint32 value);
|
||||
NetworkPacket& operator<<(const char* data);
|
||||
NetworkPacket& operator<<(char* data);
|
||||
|
||||
protected:
|
||||
void Append(ByteBuffer buffer);
|
||||
@@ -29,7 +29,7 @@ namespace Juliet
|
||||
friend class TcpSocket;
|
||||
|
||||
private:
|
||||
Vector<byte> Data;
|
||||
Vector<Byte> Data;
|
||||
size_t PartialSendIndex = 0;
|
||||
};
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -5,4 +5,13 @@
|
||||
namespace Juliet
|
||||
{
|
||||
using Thread = std::thread;
|
||||
}
|
||||
|
||||
// TODO : Proper wait
|
||||
inline void wait_ms(int milliseconds)
|
||||
{
|
||||
clock_t start_time = clock();
|
||||
while (clock() < start_time + milliseconds)
|
||||
{
|
||||
}
|
||||
}
|
||||
} // namespace Juliet
|
||||
|
||||
33
Juliet/include/Engine/Class.h
Normal file
33
Juliet/include/Engine/Class.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/CRC32.h>
|
||||
#include <Juliet.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
struct Class
|
||||
{
|
||||
uint32 CRC;
|
||||
#if JULIET_DEBUG
|
||||
// TODO: string struct may be
|
||||
const char* Name;
|
||||
size_t Name_Length;
|
||||
#endif
|
||||
|
||||
consteval Class(const char* className, size_t name_length)
|
||||
{
|
||||
CRC = crc32(className, name_length);
|
||||
#if JULIET_DEBUG
|
||||
// TODO: string struct may be
|
||||
Name = className;
|
||||
Name_Length = name_length;
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
template <typename type>
|
||||
bool IsA(Class& cls)
|
||||
{
|
||||
return cls.CRC == type::StaticClass->CRC;
|
||||
}
|
||||
} // namespace Juliet
|
||||
16
Juliet/include/Graphics/Colors.h
Normal file
16
Juliet/include/Graphics/Colors.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
template <typename Type>
|
||||
struct ColorType
|
||||
{
|
||||
Type R;
|
||||
Type G;
|
||||
Type B;
|
||||
Type A;
|
||||
};
|
||||
|
||||
using FColor = ColorType<float>;
|
||||
using Color = ColorType<uint8>;
|
||||
} // namespace Juliet
|
||||
@@ -1,9 +1,141 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/NonNullPtr.h>
|
||||
#include <Core/Common/String.h>
|
||||
#include <Core/HAL/Display/Display.h>
|
||||
#include <Core/Math/Shape.h>
|
||||
#include <Graphics/GraphicsConfig.h>
|
||||
#include <Graphics/GraphicsPipeline.h>
|
||||
#include <Graphics/RenderPass.h>
|
||||
#include <Graphics/Shader.h>
|
||||
#include <Juliet.h>
|
||||
|
||||
#ifdef JULIET_DEBUG
|
||||
#define ALLOW_SHADER_HOT_RELOAD 1
|
||||
#endif
|
||||
|
||||
// Graphics Interface
|
||||
namespace Juliet::Graphics
|
||||
namespace Juliet
|
||||
{
|
||||
// Add functions to create windows, device, attach to the window etc...
|
||||
} // namespace Juliet::Graphics
|
||||
// Opaque types
|
||||
struct CommandList;
|
||||
struct GraphicsDevice;
|
||||
struct Fence;
|
||||
|
||||
// Parameters of an indirect draw command
|
||||
struct IndirectDrawCommand
|
||||
{
|
||||
uint32 VertexCount; // Number of vertices to draw
|
||||
uint32 InstanceCount; // Number of instanced to draw
|
||||
uint32 FirstVertex; // Index of the first vertex to draw
|
||||
uint32 FirstInstance; // ID of the first instance to draw
|
||||
};
|
||||
|
||||
// Parameters of an INDEXED indirect draw command
|
||||
struct IndexedIndirectDrawCommand
|
||||
{
|
||||
uint32 VertexCount; // Number of vertices to draw
|
||||
uint32 InstanceCount; // Number of instanced to draw
|
||||
uint32 FirstIndex; // Base Index within the index buffer
|
||||
int32 VertexOffset; // Offset the vertex index into the buffer
|
||||
uint32 FirstInstance; // ID of the first instance to draw
|
||||
};
|
||||
|
||||
// Parameters of an INDEXED Indirect Dispatch Command
|
||||
struct IndirectDispatchCommand
|
||||
{
|
||||
uint32 X_WorkGroupCount; // Number of Workgroup to dispatch on dimension X
|
||||
uint32 Y_WorkGroupCount; // Number of Workgroup to dispatch on dimension Y
|
||||
uint32 Z_WorkGroupCount; // Number of Workgroup to dispatch on dimension Z
|
||||
};
|
||||
|
||||
enum class QueueType : uint8
|
||||
{
|
||||
Graphics = 0,
|
||||
Compute,
|
||||
Copy,
|
||||
Count
|
||||
};
|
||||
|
||||
enum struct SwapChainComposition : uint8
|
||||
{
|
||||
SDR,
|
||||
SDR_LINEAR,
|
||||
HDR_EXTENDED_LINEAR,
|
||||
HDR10_ST2084
|
||||
};
|
||||
|
||||
// PresentMode from highest to lowest latency
|
||||
// Vsync prevents tearing. Enqueue ready images.
|
||||
// Mailbox prevents tearing. When image is ready, replace any pending image
|
||||
// Immediate replace current image as soon as possible. Can cause tearing
|
||||
enum struct PresentMode : uint8
|
||||
{
|
||||
VSync,
|
||||
Mailbox,
|
||||
Immediate
|
||||
};
|
||||
|
||||
struct GraphicsViewPort
|
||||
{
|
||||
float X;
|
||||
float Y;
|
||||
float Width;
|
||||
float Height;
|
||||
float MinDepth;
|
||||
float MaxDepth;
|
||||
};
|
||||
|
||||
extern JULIET_API GraphicsDevice* CreateGraphicsDevice(GraphicsConfig config);
|
||||
extern JULIET_API void DestroyGraphicsDevice(NonNullPtr<GraphicsDevice> device);
|
||||
|
||||
// Attach To Window
|
||||
extern JULIET_API bool AttachToWindow(NonNullPtr<GraphicsDevice> device, NonNullPtr<Window> window);
|
||||
extern JULIET_API void DetachFromWindow(NonNullPtr<GraphicsDevice> device, NonNullPtr<Window> window);
|
||||
|
||||
// SwapChain
|
||||
extern JULIET_API bool AcquireSwapChainTexture(NonNullPtr<CommandList> commandList, NonNullPtr<Window> window,
|
||||
Texture** swapChainTexture);
|
||||
extern JULIET_API bool WaitAndAcquireSwapChainTexture(NonNullPtr<CommandList> commandList,
|
||||
NonNullPtr<Window> window, Texture** swapChainTexture);
|
||||
extern JULIET_API bool WaitForSwapchain(NonNullPtr<GraphicsDevice> device, NonNullPtr<Window> window);
|
||||
extern JULIET_API TextureFormat GetSwapChainTextureFormat(NonNullPtr<GraphicsDevice> device, NonNullPtr<Window> window);
|
||||
|
||||
// Command List
|
||||
extern JULIET_API CommandList* AcquireCommandList(NonNullPtr<GraphicsDevice> device, QueueType queueType = QueueType::Graphics);
|
||||
extern JULIET_API void SubmitCommandLists(NonNullPtr<CommandList> commandList);
|
||||
|
||||
// RenderPass
|
||||
extern JULIET_API RenderPass* BeginRenderPass(NonNullPtr<CommandList> commandList, ColorTargetInfo& colorTargetInfo);
|
||||
extern JULIET_API RenderPass* BeginRenderPass(NonNullPtr<CommandList> commandList,
|
||||
NonNullPtr<const ColorTargetInfo> colorTargetInfos, uint32 colorTargetInfoCount);
|
||||
extern JULIET_API void EndRenderPass(NonNullPtr<RenderPass> renderPass);
|
||||
|
||||
extern JULIET_API void SetGraphicsViewPort(NonNullPtr<RenderPass> renderPass, const GraphicsViewPort& viewPort);
|
||||
extern JULIET_API void SetScissorRect(NonNullPtr<RenderPass> renderPass, const Rectangle& rectangle);
|
||||
extern JULIET_API void SetBlendConstants(NonNullPtr<RenderPass> renderPass, FColor blendConstants);
|
||||
extern JULIET_API void SetStencilReference(NonNullPtr<RenderPass> renderPass, uint8 reference);
|
||||
|
||||
extern JULIET_API void BindGraphicsPipeline(NonNullPtr<RenderPass> renderPass, NonNullPtr<GraphicsPipeline> graphicsPipeline);
|
||||
|
||||
extern JULIET_API void DrawPrimitives(NonNullPtr<RenderPass> renderPass, uint32 numVertices, uint32 numInstances,
|
||||
uint32 firstVertex, uint32 firstInstance);
|
||||
|
||||
// Fences
|
||||
extern JULIET_API bool WaitUntilGPUIsIdle(NonNullPtr<GraphicsDevice> device);
|
||||
|
||||
// Shaders
|
||||
extern JULIET_API Shader* CreateShader(NonNullPtr<GraphicsDevice> device, String filename, ShaderCreateInfo& shaderCreateInfo);
|
||||
extern JULIET_API void DestroyShader(NonNullPtr<GraphicsDevice> device, NonNullPtr<Shader> shader);
|
||||
|
||||
// Pipelines
|
||||
extern JULIET_API GraphicsPipeline* CreateGraphicsPipeline(NonNullPtr<GraphicsDevice> device,
|
||||
const GraphicsPipelineCreateInfo& createInfo);
|
||||
extern JULIET_API void DestroyGraphicsPipeline(NonNullPtr<GraphicsDevice> device, NonNullPtr<GraphicsPipeline> graphicsPipeline);
|
||||
#if ALLOW_SHADER_HOT_RELOAD
|
||||
// Allows updating the graphics pipeline shaders. Can update either one or both shaders.
|
||||
extern JULIET_API bool UpdateGraphicsPipelineShaders(NonNullPtr<GraphicsDevice> device, NonNullPtr<GraphicsPipeline> graphicsPipeline,
|
||||
Shader* optional_vertexShader, Shader* optional_fragmentShader);
|
||||
#endif
|
||||
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
enum class RendererType
|
||||
{
|
||||
DX12 = 0
|
||||
};
|
||||
enum class DriverType : uint8
|
||||
{
|
||||
Any = 0,
|
||||
DX12 = 1,
|
||||
};
|
||||
|
||||
struct GraphicsConfig
|
||||
{
|
||||
RendererType Renderer = RendererType::DX12;
|
||||
};
|
||||
}
|
||||
struct GraphicsConfig
|
||||
{
|
||||
DriverType PreferredDriver = DriverType::DX12;
|
||||
bool EnableDebug;
|
||||
};
|
||||
} // namespace Juliet
|
||||
|
||||
225
Juliet/include/Graphics/GraphicsPipeline.h
Normal file
225
Juliet/include/Graphics/GraphicsPipeline.h
Normal file
@@ -0,0 +1,225 @@
|
||||
#pragma once
|
||||
#include <Graphics/Shader.h>
|
||||
#include <Graphics/Texture.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Forward Declare
|
||||
struct ColorTargetDescription;
|
||||
|
||||
enum class FillMode : uint8
|
||||
{
|
||||
Solid,
|
||||
Wireframe,
|
||||
Count
|
||||
};
|
||||
|
||||
enum class CullMode : uint8
|
||||
{
|
||||
None,
|
||||
Front,
|
||||
Back,
|
||||
Count
|
||||
};
|
||||
|
||||
enum class FrontFace : uint8
|
||||
{
|
||||
CounterClockwise,
|
||||
Clockwise,
|
||||
Count
|
||||
};
|
||||
|
||||
enum class PrimitiveType : uint8
|
||||
{
|
||||
TriangleList,
|
||||
TriangleStrip,
|
||||
LineList,
|
||||
LineStrip,
|
||||
PointList,
|
||||
Count
|
||||
};
|
||||
|
||||
struct RasterizerState
|
||||
{
|
||||
FillMode FillMode;
|
||||
CullMode CullMode;
|
||||
FrontFace FrontFace;
|
||||
|
||||
float DepthBiasConstantFactor; // How much depth value is added to each fragment
|
||||
float DepthBiasClamp; // Maximum depth bias
|
||||
float DepthBiasSlopeFactor; // Scalar applied to Fragment's slope
|
||||
bool EnableDepthBias; // Bias fragment depth values
|
||||
bool EnableDepthClip; // True to clip, false to clamp
|
||||
};
|
||||
|
||||
enum class VertexInputRate : uint8
|
||||
{
|
||||
Vertex, // Use vertex index
|
||||
Instance, // Use instance index
|
||||
Count
|
||||
};
|
||||
|
||||
struct VertexBufferDescription
|
||||
{
|
||||
uint32 Slot; // Binding Slot
|
||||
uint32 PitchInBytes; // Pitch between two elements
|
||||
VertexInputRate InputRate;
|
||||
uint32 InstanceStepRate; // Only used when input rate == Instance. Number of instances to draw before advancing in the instance buffer by 1
|
||||
};
|
||||
|
||||
enum class VertexElementFormat : uint8
|
||||
{
|
||||
Invalid,
|
||||
|
||||
/* 32-bit Signed Integers */
|
||||
Int,
|
||||
Int2,
|
||||
Int3,
|
||||
Int4,
|
||||
|
||||
/* 32-bit Unsigned Integers */
|
||||
UInt,
|
||||
UInt2,
|
||||
UInt3,
|
||||
UInt4,
|
||||
|
||||
/* 32-bit Floats */
|
||||
Float,
|
||||
Float2,
|
||||
Float3,
|
||||
Float4,
|
||||
|
||||
/* 8-bit Signed Integers */
|
||||
Byte2,
|
||||
Byte4,
|
||||
|
||||
/* 8-bit Unsigned Integers */
|
||||
UByte2,
|
||||
UByte4,
|
||||
|
||||
/* 8-bit Signed Normalized */
|
||||
Byte2_Norm,
|
||||
Byte4_Norm,
|
||||
|
||||
/* 8-bit Unsigned Normalized */
|
||||
UByte2_Norm,
|
||||
UByte4_Norm,
|
||||
|
||||
/* 16-bit Signed Integers */
|
||||
Short2,
|
||||
Short4,
|
||||
|
||||
/* 16-bit Unsigned Integers */
|
||||
UShort2,
|
||||
UShort4,
|
||||
|
||||
/* 16-bit Signed Normalized */
|
||||
Short2_Norm,
|
||||
Short4_Norm,
|
||||
|
||||
/* 16-bit Unsigned Normalized */
|
||||
UShort2_Norm,
|
||||
UShort4_Norm,
|
||||
|
||||
/* 16-bit Floats */
|
||||
Half2,
|
||||
Half4,
|
||||
|
||||
//
|
||||
Count
|
||||
};
|
||||
|
||||
struct VertexAttribute
|
||||
{
|
||||
uint32 Location; // Shader input location index
|
||||
uint32 BufferSlot; // Binding slot of associated vertex buffer
|
||||
VertexElementFormat Format; // Size and type of attribute
|
||||
uint32 Offset; // Offset of this attribute relative to the start of the vertex element
|
||||
};
|
||||
|
||||
struct VertexInputState
|
||||
{
|
||||
const VertexBufferDescription* VertexBufferDescriptions;
|
||||
uint32 NumVertexBufferDescriptions;
|
||||
const VertexAttribute* VertexAttributes;
|
||||
uint32 NumVertexAttributes;
|
||||
};
|
||||
|
||||
struct GraphicsPipelineTargetInfo
|
||||
{
|
||||
const ColorTargetDescription* ColorTargetDescriptions;
|
||||
size_t NumColorTargets;
|
||||
TextureFormat DepthStencilFormat;
|
||||
bool HasDepthStencilTarget;
|
||||
};
|
||||
|
||||
enum class CompareOperation : uint8
|
||||
{
|
||||
Invalid,
|
||||
Never, // The comparison always evaluates false.
|
||||
Less, // The comparison evaluates reference < test.
|
||||
Equal, // The comparison evaluates reference == test.
|
||||
LessOrEqual, // The comparison evaluates reference <= test.
|
||||
Greater, // The comparison evaluates reference > test.
|
||||
NotEqual, // The comparison evaluates reference != test.
|
||||
GreaterOrEqual, // The comparison evalutes reference >= test.
|
||||
Always, // The comparison always evaluates true.
|
||||
Count
|
||||
};
|
||||
|
||||
enum class StencilOperation : uint8
|
||||
{
|
||||
Invalid,
|
||||
Keep, // Keeps the current value.
|
||||
Zero, // Sets the value to 0.
|
||||
Replace, // Sets the value to reference.
|
||||
IncrementAndClamp, // Increments the current value and clamps to the maximum value.
|
||||
DecrementAndClamp, // Decrements the current value and clamps to 0.
|
||||
Invert, // Bitwise-inverts the current value.
|
||||
IncrementAndWrap, // Increments the current value and wraps back to 0.
|
||||
DecrementAndWrap, // Decrements the current value and wraps to the maximum value.
|
||||
Count
|
||||
};
|
||||
|
||||
struct StencilOperationState
|
||||
{
|
||||
StencilOperation FailOperation; // The action performed on samples that fail the stencil test.
|
||||
StencilOperation PassOperation; // The action performed on samples that pass the depth and stencil tests.
|
||||
StencilOperation DepthFailOperation; // The action performed on samples that pass the stencil test and fail the depth test.
|
||||
StencilOperation CompareOperation; // The comparison operator used in the stencil test.
|
||||
};
|
||||
|
||||
struct DepthStencilState
|
||||
{
|
||||
CompareOperation CompareOperation; // The comparison operator used for depth testing.
|
||||
StencilOperationState BackStencilState; // The stencil op state for back-facing triangles.
|
||||
StencilOperationState FrontStencilState; // The stencil op state for front-facing triangles.
|
||||
uint8 CompareMask; // Selects the bits of the stencil values participating in the stencil test.
|
||||
uint8 WriteMask; // Selects the bits of the stencil values updated by the stencil test.
|
||||
bool EnableDepthTest : 1; // true enables the depth test.
|
||||
bool EnableDepthWrite : 1; // true enables depth writes. Depth writes are always disabled when enable_depth_test is false.
|
||||
bool EnableStencilTest : 1; // true enables the stencil test.
|
||||
};
|
||||
|
||||
struct MultisampleState
|
||||
{
|
||||
TextureSampleCount SampleCount;
|
||||
uint32 SampleMask; // Which sample should be updated. If Enabled mask == false -> 0xFFFFFFFF
|
||||
bool EnableMask;
|
||||
};
|
||||
|
||||
struct GraphicsPipelineCreateInfo
|
||||
{
|
||||
Shader* VertexShader;
|
||||
Shader* FragmentShader;
|
||||
PrimitiveType PrimitiveType;
|
||||
GraphicsPipelineTargetInfo TargetInfo;
|
||||
RasterizerState RasterizerState;
|
||||
MultisampleState MultisampleState;
|
||||
VertexInputState VertexInputState;
|
||||
DepthStencilState DepthStencilState;
|
||||
};
|
||||
|
||||
// Opaque type
|
||||
struct GraphicsPipeline;
|
||||
} // namespace Juliet
|
||||
103
Juliet/include/Graphics/RenderPass.h
Normal file
103
Juliet/include/Graphics/RenderPass.h
Normal file
@@ -0,0 +1,103 @@
|
||||
#pragma once
|
||||
|
||||
#include <Graphics/Colors.h>
|
||||
#include <Graphics/Texture.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
enum struct LoadOperation : uint8
|
||||
{
|
||||
Load, // Load the texture from memory (preserve)
|
||||
Clear, // Clear the texture
|
||||
Ignore // Ignore the content of the texture (undefined)
|
||||
};
|
||||
|
||||
enum struct StoreOperation : uint8
|
||||
{
|
||||
Store, // Store the result of the render pass into memory
|
||||
Ignore, // Whatever is generated is ignored (undefined)
|
||||
Resolve, // Resolve MipMaps into non mip map texture. Discard MipMap content
|
||||
ResolveAndStore // Same but store the MipMap content to memory
|
||||
};
|
||||
|
||||
struct ColorTargetInfo
|
||||
{
|
||||
Texture* TargetTexture;
|
||||
uint32 MipLevel;
|
||||
union
|
||||
{
|
||||
uint32 DepthPlane;
|
||||
uint32 LayerIndex;
|
||||
};
|
||||
bool CycleTexture; // Whether the texture should be cycled if already bound (and load operation != LOAD)
|
||||
|
||||
Texture* ResolveTexture;
|
||||
uint32 ResolveMipLevel;
|
||||
uint32 ResolveLayerIndex;
|
||||
bool CycleResolveTexture;
|
||||
|
||||
FColor ClearColor;
|
||||
LoadOperation LoadOperation;
|
||||
StoreOperation StoreOperation;
|
||||
};
|
||||
|
||||
enum class BlendFactor : uint8
|
||||
{
|
||||
Invalid,
|
||||
Zero,
|
||||
One,
|
||||
Src_Color,
|
||||
One_Minus_Src_Color,
|
||||
Dst_Color,
|
||||
One_Minus_Dst_Color,
|
||||
Src_Alpha,
|
||||
One_Minus_Src_Alpha,
|
||||
Dst_Alpha,
|
||||
One_Minus_Dst_Alpha,
|
||||
Constant_Color,
|
||||
One_MINUS_Constant_Color,
|
||||
Src_Alpha_Saturate, // min(source alpha, 1 - destination alpha)
|
||||
Count
|
||||
};
|
||||
|
||||
enum class BlendOperation : uint8
|
||||
{
|
||||
Invalid,
|
||||
Add, // (source * source_factor) + (destination * destination_factor)
|
||||
Subtract, // (source * source_factor) - (destination * destination_factor)
|
||||
ReverseSubtract, // (destination * destination_factor) - (source * source_factor)
|
||||
Min, // min(source, destination)
|
||||
Max, // max(source, destination)
|
||||
Count
|
||||
};
|
||||
|
||||
enum class ColorComponentFlags : uint8
|
||||
{
|
||||
R = 1u << 0,
|
||||
G = 1u << 1,
|
||||
B = 1u << 2,
|
||||
A = 1u << 3
|
||||
};
|
||||
|
||||
struct ColorTargetBlendState
|
||||
{
|
||||
BlendFactor SourceColorBlendFactor; // The value to be multiplied by the source RGB value.
|
||||
BlendFactor DestinationColorBlendFactor; // The value to be multiplied by the destination RGB value.
|
||||
BlendOperation ColorBlendOperation; // The blend operation for the RGB components.
|
||||
BlendFactor SourceAlphaBlendFactor; // The value to be multiplied by the source alpha.
|
||||
BlendFactor DestinationAlphaBlendFactor; // The value to be multiplied by the destination alpha.
|
||||
BlendOperation AlphaBlendOperation; // The blend operation for the alpha component.
|
||||
ColorComponentFlags ColorWriteMask; // A bitmask specifying which of the RGBA components are enabled for writing. Writes to all channels if enable_color_write_mask is false.
|
||||
bool EnableBlend : 1; // Whether blending is enabled for the color target.
|
||||
bool EnableColorWriteMask : 1; // Whether the color write mask is enabled.
|
||||
};
|
||||
|
||||
struct ColorTargetDescription
|
||||
{
|
||||
TextureFormat Format;
|
||||
ColorTargetBlendState BlendState;
|
||||
};
|
||||
|
||||
// Opaque Type
|
||||
struct RenderPass;
|
||||
} // namespace Juliet
|
||||
23
Juliet/include/Graphics/Shader.h
Normal file
23
Juliet/include/Graphics/Shader.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/String.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Opaque type
|
||||
struct Shader;
|
||||
|
||||
enum class ShaderStage : uint8
|
||||
{
|
||||
Vertex,
|
||||
Fragment,
|
||||
Compute
|
||||
};
|
||||
|
||||
struct ShaderCreateInfo
|
||||
{
|
||||
ShaderStage Stage;
|
||||
String EntryPoint;
|
||||
};
|
||||
|
||||
} // namespace Juliet
|
||||
183
Juliet/include/Graphics/Texture.h
Normal file
183
Juliet/include/Graphics/Texture.h
Normal file
@@ -0,0 +1,183 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
enum struct TextureFormat : uint8
|
||||
{
|
||||
Invalid,
|
||||
|
||||
/* Unsigned Normalized Float Color Formats */
|
||||
A8_UNORM,
|
||||
R8_UNORM,
|
||||
R8G8_UNORM,
|
||||
R8G8B8A8_UNORM,
|
||||
R16_UNORM,
|
||||
R16G16_UNORM,
|
||||
R16G16B16A16_UNORM,
|
||||
R10G10B10A2_UNORM,
|
||||
B5G6R5_UNORM,
|
||||
B5G5R5A1_UNORM,
|
||||
B4G4R4A4_UNORM,
|
||||
B8G8R8A8_UNORM,
|
||||
/* Compressed Unsigned Normalized Float Color Formats */
|
||||
BC1_RGBA_UNORM,
|
||||
BC2_RGBA_UNORM,
|
||||
BC3_RGBA_UNORM,
|
||||
BC4_R_UNORM,
|
||||
BC5_RG_UNORM,
|
||||
BC7_RGBA_UNORM,
|
||||
/* Compressed Signed Float Color Formats */
|
||||
BC6H_RGB_FLOAT,
|
||||
/* Compressed Unsigned Float Color Formats */
|
||||
BC6H_RGB_UFLOAT,
|
||||
/* Signed Normalized Float Color Formats */
|
||||
R8_SNORM,
|
||||
R8G8_SNORM,
|
||||
R8G8B8A8_SNORM,
|
||||
R16_SNORM,
|
||||
R16G16_SNORM,
|
||||
R16G16B16A16_SNORM,
|
||||
/* Signed Float Color Formats */
|
||||
R16_FLOAT,
|
||||
R16G16_FLOAT,
|
||||
R16G16B16A16_FLOAT,
|
||||
R32_FLOAT,
|
||||
R32G32_FLOAT,
|
||||
R32G32B32A32_FLOAT,
|
||||
/* Unsigned Float Color Formats */
|
||||
R11G11B10_UFLOAT,
|
||||
/* Unsigned Integer Color Formats */
|
||||
R8_UINT,
|
||||
R8G8_UINT,
|
||||
R8G8B8A8_UINT,
|
||||
R16_UINT,
|
||||
R16G16_UINT,
|
||||
R16G16B16A16_UINT,
|
||||
R32_UINT,
|
||||
R32G32_UINT,
|
||||
R32G32B32A32_UINT,
|
||||
/* Signed Integer Color Formats */
|
||||
R8_INT,
|
||||
R8G8_INT,
|
||||
R8G8B8A8_INT,
|
||||
R16_INT,
|
||||
R16G16_INT,
|
||||
R16G16B16A16_INT,
|
||||
R32_INT,
|
||||
R32G32_INT,
|
||||
R32G32B32A32_INT,
|
||||
/* SRGB Unsigned Normalized Color Formats */
|
||||
R8G8B8A8_UNORM_SRGB,
|
||||
B8G8R8A8_UNORM_SRGB,
|
||||
/* Compressed SRGB Unsigned Normalized Color Formats */
|
||||
BC1_RGBA_UNORM_SRGB,
|
||||
BC2_RGBA_UNORM_SRGB,
|
||||
BC3_RGBA_UNORM_SRGB,
|
||||
BC7_RGBA_UNORM_SRGB,
|
||||
/* Depth Formats */
|
||||
D16_UNORM,
|
||||
D24_UNORM,
|
||||
D32_FLOAT,
|
||||
D24_UNORM_S8_UINT,
|
||||
D32_FLOAT_S8_UINT,
|
||||
/* Compressed ASTC Normalized Float Color Formats*/
|
||||
ASTC_4x4_UNORM,
|
||||
ASTC_5x4_UNORM,
|
||||
ASTC_5x5_UNORM,
|
||||
ASTC_6x5_UNORM,
|
||||
ASTC_6x6_UNORM,
|
||||
ASTC_8x5_UNORM,
|
||||
ASTC_8x6_UNORM,
|
||||
ASTC_8x8_UNORM,
|
||||
ASTC_10x5_UNORM,
|
||||
ASTC_10x6_UNORM,
|
||||
ASTC_10x8_UNORM,
|
||||
ASTC_10x10_UNORM,
|
||||
ASTC_12x10_UNORM,
|
||||
ASTC_12x12_UNORM,
|
||||
/* Compressed SRGB ASTC Normalized Float Color Formats*/
|
||||
ASTC_4x4_UNORM_SRGB,
|
||||
ASTC_5x4_UNORM_SRGB,
|
||||
ASTC_5x5_UNORM_SRGB,
|
||||
ASTC_6x5_UNORM_SRGB,
|
||||
ASTC_6x6_UNORM_SRGB,
|
||||
ASTC_8x5_UNORM_SRGB,
|
||||
ASTC_8x6_UNORM_SRGB,
|
||||
ASTC_8x8_UNORM_SRGB,
|
||||
ASTC_10x5_UNORM_SRGB,
|
||||
ASTC_10x6_UNORM_SRGB,
|
||||
ASTC_10x8_UNORM_SRGB,
|
||||
ASTC_10x10_UNORM_SRGB,
|
||||
ASTC_12x10_UNORM_SRGB,
|
||||
ASTC_12x12_UNORM_SRGB,
|
||||
/* Compressed ASTC Signed Float Color Formats*/
|
||||
ASTC_4x4_FLOAT,
|
||||
ASTC_5x4_FLOAT,
|
||||
ASTC_5x5_FLOAT,
|
||||
ASTC_6x5_FLOAT,
|
||||
ASTC_6x6_FLOAT,
|
||||
ASTC_8x5_FLOAT,
|
||||
ASTC_8x6_FLOAT,
|
||||
ASTC_8x8_FLOAT,
|
||||
ASTC_10x5_FLOAT,
|
||||
ASTC_10x6_FLOAT,
|
||||
ASTC_10x8_FLOAT,
|
||||
ASTC_10x10_FLOAT,
|
||||
ASTC_12x10_FLOAT,
|
||||
ASTC_12x12_FLOAT,
|
||||
|
||||
Count
|
||||
};
|
||||
|
||||
enum struct TextureUsageFlag : uint8
|
||||
{
|
||||
None = 0,
|
||||
Sampler = 1 << 0, // Textures supports sampling
|
||||
ColorTarget = 1 << 1, // Texture is color render target
|
||||
DepthStencilTarget = 1 << 2, // Texture is depth stencil target
|
||||
GraphicsStorageRead = 1 << 3, // Support Storage read at graphics stage
|
||||
ComputeStorageRead = 1 << 4, // Support Storage read at compute stage
|
||||
ComputeStorageWrite = 1 << 5, // Support Storage Write at compute stage
|
||||
ComputeStorageSimultaneousReadWrite =
|
||||
1 << 6, // Supports reads and writes in the same compute shader. Not equivalent to ComputeStorageRead | ComputeStorageWrite
|
||||
};
|
||||
|
||||
enum struct TextureType : uint8
|
||||
{
|
||||
Texture_2D,
|
||||
Texture_2DArray,
|
||||
Texture_3D,
|
||||
Texture_3DArray,
|
||||
Texture_Cube,
|
||||
Texture_CubeArray,
|
||||
};
|
||||
|
||||
enum struct TextureSampleCount : uint8
|
||||
{
|
||||
One,
|
||||
Two,
|
||||
Four,
|
||||
Eight,
|
||||
};
|
||||
|
||||
// Create Information structs
|
||||
struct TextureCreateInfo
|
||||
{
|
||||
TextureType Type;
|
||||
TextureFormat Format;
|
||||
TextureUsageFlag Flags;
|
||||
TextureSampleCount SampleCount;
|
||||
|
||||
uint32 Width;
|
||||
uint32 Height;
|
||||
union
|
||||
{
|
||||
uint32 LayerCount;
|
||||
uint32 DepthPlane;
|
||||
}; // LayerCount is used in 2d array textures and Depth for 3d textures
|
||||
uint32 MipLevelCount;
|
||||
};
|
||||
|
||||
// Opaque Type
|
||||
struct Texture;
|
||||
} // namespace Juliet
|
||||
25
Juliet/include/Juliet.h
Normal file
25
Juliet/include/Juliet.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
// Should be included in all files to define basic includes and macros
|
||||
|
||||
// clang-format off
|
||||
#if defined(_WIN32)
|
||||
#define JULIET_WIN32 1
|
||||
#endif
|
||||
|
||||
#ifndef JULIET_API
|
||||
# if defined(JULIET_WIN32)
|
||||
# ifdef JULIET_EXPORT
|
||||
# define JULIET_API __declspec(dllexport)
|
||||
# else
|
||||
#define JULIET_API
|
||||
# endif
|
||||
# else
|
||||
# define JULIET_API (void) // Only Win32 is supported for now
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if _DEBUG
|
||||
#define JULIET_DEBUG 1
|
||||
#endif
|
||||
// clang-format on
|
||||
@@ -11,5 +11,6 @@
|
||||
#include <Core/Common/CoreUtils.h>
|
||||
#include <Core/Logging/LogManager.h>
|
||||
#include <Core/Logging/LogTypes.h>
|
||||
#include <Juliet.h>
|
||||
|
||||
#endif // PCH_H
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
#include <pch.h>
|
||||
|
||||
void JulietAssert(const char* expression)
|
||||
#include <Core/Memory/Allocator.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
Juliet::Log(Juliet::LogLevel::Error, Juliet::LogCategory::Core, expression);
|
||||
__debugbreak();
|
||||
}
|
||||
void JulietAssert(const char* expression)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, expression);
|
||||
__debugbreak();
|
||||
}
|
||||
|
||||
void Free(ByteBuffer& buffer)
|
||||
{
|
||||
if (buffer.Data)
|
||||
{
|
||||
Free(buffer.Data);
|
||||
}
|
||||
buffer = {};
|
||||
}
|
||||
} // namespace Juliet
|
||||
|
||||
461
Juliet/src/Core/Common/String.cpp
Normal file
461
Juliet/src/Core/Common/String.cpp
Normal file
@@ -0,0 +1,461 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Common/String.h>
|
||||
#include <Core/Memory/Utils.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
namespace
|
||||
{
|
||||
constexpr int32 kUnknown_UNICODE = 0xFFFD;
|
||||
|
||||
struct
|
||||
{
|
||||
String Name;
|
||||
StringEncoding Format;
|
||||
} Encodings[] = {
|
||||
/* *INDENT-OFF* */ // clang-format off
|
||||
{ ConstString("ASCII"), StringEncoding::ASCII },
|
||||
{ ConstString("US-ASCII"), StringEncoding::ASCII },
|
||||
{ ConstString("8859-1"), StringEncoding::LATIN1 },
|
||||
{ ConstString("ISO-8859-1"), StringEncoding::LATIN1 },
|
||||
#if defined(JULIET_WIN32)
|
||||
{ ConstString("WCHAR_T"), StringEncoding::UTF16 },
|
||||
#else
|
||||
{ ConstString("WCHAR_T"), StringEncoding::UCS4 },
|
||||
#endif
|
||||
{ ConstString("UTF8"), StringEncoding::UTF8 },
|
||||
{ ConstString("UTF-8"), StringEncoding::UTF8 },
|
||||
{ ConstString("UTF16"), StringEncoding::UTF16 },
|
||||
{ ConstString("UTF-16"), StringEncoding::UTF16 },
|
||||
{ ConstString("UTF32"), StringEncoding::UTF32 },
|
||||
{ ConstString("UTF-32"), StringEncoding::UTF32 },
|
||||
{ ConstString("UCS2"), StringEncoding::UCS2 },
|
||||
{ ConstString("UCS-2"), StringEncoding::UCS2 },
|
||||
{ ConstString("UCS-2-INTERNAL"), StringEncoding::UCS2 },
|
||||
{ ConstString("UCS4"), StringEncoding::UCS4 },
|
||||
{ ConstString("UCS-4"), StringEncoding::UCS4 },
|
||||
{ ConstString("UCS-4-INTERNAL"), StringEncoding::UCS4 },
|
||||
/* *INDENT-ON* */ // clang-format on
|
||||
};
|
||||
|
||||
// Returns the number of codepoint case folded (lowercase equivalent in the language)
|
||||
// Takes an UTF-8 codepoint (uint32) and codefold it to up to 3 uint32
|
||||
// TODO Supports more than low ASCI :)
|
||||
int8 CaseFoldUnicode(uint32 from, uint32* to)
|
||||
{
|
||||
if (from < 128)
|
||||
{
|
||||
// low-ASCII, easy!
|
||||
if ((from >= 'A') && (from <= 'Z'))
|
||||
{
|
||||
*to = 'a' + (from - 'A');
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
*to = from;
|
||||
return 1;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
uint32 StepUTF8(String& inStr)
|
||||
{
|
||||
// From rfc3629, the UTF-8 spec:
|
||||
// https://www.ietf.org/rfc/rfc3629.txt
|
||||
//
|
||||
// Char. number range | UTF-8 octet sequence
|
||||
// (hexadecimal) | (binary)
|
||||
// --------------------+---------------------------------------------
|
||||
// 0000 0000-0000 007F | 0xxxxxxx
|
||||
// 0000 0080-0000 07FF | 110xxxxx 10xxxxxx
|
||||
// 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
|
||||
// 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
||||
//
|
||||
// The function checks character validity and overlong (using too many bytes to encode the character) and return invalid utf8 char if detected.
|
||||
|
||||
// If string is empty then it's done.
|
||||
if (inStr.Size == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto str = reinterpret_cast<const uint8*>(CStr(inStr));
|
||||
const uint32 octet = *str;
|
||||
bool isOverlong = false;
|
||||
bool isInvalid = false;
|
||||
bool isUTF16Surrogate = false;
|
||||
if (octet == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if ((octet & 0x80) == 0x0) // One byte code point: 0xxxxxxx
|
||||
{
|
||||
inStr.Data += 1;
|
||||
inStr.Size -= 1;
|
||||
return octet;
|
||||
}
|
||||
else if ((octet & 0xE0) == 0xC0) // Two bytes code point: 110xxxxx 10xxxxxx
|
||||
{
|
||||
const uint8 secondByte = str[1];
|
||||
if ((secondByte & 0xC0) == 0x80) // Make sure the trailing byte is correct
|
||||
{
|
||||
const uint32 result = ((octet & 0x1F) << 6) | (secondByte & 0x3F);
|
||||
if (result >= 0x80) // If the result is smaller than 0x80 its an overlong!
|
||||
{
|
||||
inStr.Data += 2;
|
||||
inStr.Size -= 1;
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
isOverlong = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isInvalid = true;
|
||||
}
|
||||
}
|
||||
else if (((octet & 0xF0) == 0xE0)) // Three bytes code point: 1110xxxx 10xxxxxx 10xxxxxx
|
||||
{
|
||||
const uint8 secondByte = str[1];
|
||||
const uint8 thirdByte = str[2];
|
||||
if (((secondByte & 0xC0) == 0x80) && ((thirdByte & 0xC0) == 0x80)) // Make sure the trailing bytes are correct
|
||||
{
|
||||
const uint32 secondOctet = static_cast<uint32>(secondByte & 0x3F) << 6;
|
||||
const uint32 thirdOctet = static_cast<uint32>(thirdByte & 0x3F);
|
||||
const uint32 result = ((octet & 0x0F) << 12) | secondOctet | thirdOctet;
|
||||
if (result >= 0x0800) // if the result is smaller its an overlong.
|
||||
{
|
||||
if ((result < 0xD800) || (result > 0xDFFF)) // If out of range its an UTF-16 surrogate
|
||||
{
|
||||
inStr.Data += 3;
|
||||
inStr.Size -= 1;
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
isUTF16Surrogate = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isOverlong = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isInvalid = true;
|
||||
}
|
||||
}
|
||||
else if (((octet & 0xF8) == 0xF0))
|
||||
{ // Four bytes code point: 11110xxxx 10xxxxxx 10xxxxxx 10xxxxxx
|
||||
const uint8 secondByte = str[1];
|
||||
const uint8 thirdByte = str[2];
|
||||
const uint8 fourthByte = str[3];
|
||||
if (((secondByte & 0xC0) == 0x80) && ((thirdByte & 0xC0) == 0x80) &&
|
||||
((fourthByte & 0xC0) == 0x80)) // // Make sure the trailing bytes are correct
|
||||
{
|
||||
const uint32 secondOctet = static_cast<uint32>(secondByte & 0x1F) << 12;
|
||||
const uint32 thirdOctet = static_cast<uint32>(thirdByte & 0x3F) << 6;
|
||||
const uint32 fourthOctet = static_cast<uint32>(fourthByte & 0x3F);
|
||||
const uint32 result = ((octet & 0x07) << 18) | secondOctet | thirdOctet | fourthOctet;
|
||||
if (result >= 0x10000) // If smaller its an overlong
|
||||
{
|
||||
inStr.Data += 4;
|
||||
inStr.Size -= 1;
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
isOverlong = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isInvalid = true;
|
||||
}
|
||||
}
|
||||
LogError(LogCategory::Core, "StepUTF8: Non supported codepoint. IsOverlong: %s. IsInvalid %s. IsUTF16Surrogate %s",
|
||||
isOverlong ? "true" : "false", isInvalid ? "true" : "false", isUTF16Surrogate ? "true" : "false");
|
||||
inStr.Data += 1;
|
||||
return kInvalidUTF8;
|
||||
}
|
||||
|
||||
String FindString(String haystack, String needle)
|
||||
{
|
||||
if (!IsValid(needle))
|
||||
{
|
||||
return haystack;
|
||||
}
|
||||
|
||||
for (; IsValid(haystack); StepUTF8(haystack))
|
||||
{
|
||||
String tempHaystack = haystack;
|
||||
String testNeedle = needle;
|
||||
|
||||
while (IsValid(tempHaystack) && IsValid(testNeedle))
|
||||
{
|
||||
uint32 codepointHaystack = StepUTF8(tempHaystack);
|
||||
uint32 codepointNeedle = StepUTF8(testNeedle);
|
||||
if (codepointHaystack != codepointNeedle)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsValid(testNeedle))
|
||||
{
|
||||
return haystack;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
int8 StringCompareCaseInsensitive(String str1, String str2)
|
||||
{
|
||||
// TODO: Support UTF8. For now ASCII only.
|
||||
uint32 left = 0;
|
||||
uint32 right = 0;
|
||||
while (true)
|
||||
{
|
||||
{
|
||||
uint32 leftFolded[3];
|
||||
int8 num_folded = CaseFoldUnicode(StepUTF8(str1), leftFolded);
|
||||
Assert(num_folded == 1); // Only one uint32 codepoint supported for now (low ascii)
|
||||
left = leftFolded[0];
|
||||
}
|
||||
{
|
||||
uint32 rightFolded[3];
|
||||
int8 num_folded = CaseFoldUnicode(StepUTF8(str2), rightFolded);
|
||||
Assert(num_folded == 1); // Only one uint32 codepoint supported for now (low ascii)
|
||||
right = rightFolded[0];
|
||||
}
|
||||
if (left < right)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (left > right)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (left == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ConvertString(StringEncoding from, StringEncoding to, String src, StringBuffer& dst)
|
||||
{
|
||||
Assert(IsValid(src));
|
||||
|
||||
const char* srcStr = src.Data;
|
||||
char* dstStr = dst.Data;
|
||||
size_t remainingCapacity = dst.Capacity;
|
||||
|
||||
uint32 character = 0;
|
||||
while (src.Size > 0)
|
||||
{
|
||||
// Decode in character
|
||||
switch (from)
|
||||
{
|
||||
case StringEncoding::UTF8: // Uses RFC 3629
|
||||
{
|
||||
auto p = reinterpret_cast<const uint8*>(srcStr);
|
||||
size_t left = 0;
|
||||
bool overlong = false;
|
||||
if (p[0] >= 0xF0)
|
||||
{
|
||||
if ((p[0] & 0xF8) != 0xF0)
|
||||
{
|
||||
character = kUnknown_UNICODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p[0] == 0xF0 && src.Size > 1 && (p[1] & 0xF0) == 0x80)
|
||||
{
|
||||
overlong = true;
|
||||
}
|
||||
character = static_cast<uint32>(p[0] & 0x07);
|
||||
left = 3;
|
||||
}
|
||||
}
|
||||
else if (p[0] >= 0xE0)
|
||||
{
|
||||
if ((p[0] & 0xF0) != 0xE0)
|
||||
{
|
||||
character = kUnknown_UNICODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p[0] == 0xE0 && src.Size > 1 && (p[1] & 0xE0) == 0x80)
|
||||
{
|
||||
overlong = true;
|
||||
}
|
||||
character = static_cast<uint32>(p[0] & 0x0F);
|
||||
left = 2;
|
||||
}
|
||||
}
|
||||
else if (p[0] >= 0xC0)
|
||||
{
|
||||
if ((p[0] & 0xE0) != 0xC0)
|
||||
{
|
||||
character = kUnknown_UNICODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((p[0] & 0xDE) == 0xC0)
|
||||
{
|
||||
overlong = true;
|
||||
}
|
||||
character = static_cast<uint32>(p[0] & 0x1F);
|
||||
left = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (p[0] & 0x80)
|
||||
{
|
||||
character = kUnknown_UNICODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
character = static_cast<uint32>(p[0]);
|
||||
}
|
||||
}
|
||||
++srcStr;
|
||||
--src.Size;
|
||||
if (src.Size < left)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "ConvertString: Failed to convert string. Incomplete input sequence");
|
||||
return false;
|
||||
}
|
||||
while (left--)
|
||||
{
|
||||
++p;
|
||||
if ((p[0] & 0xC0) != 0x80)
|
||||
{
|
||||
character = kUnknown_UNICODE;
|
||||
break;
|
||||
}
|
||||
character <<= 6;
|
||||
character |= (p[0] & 0x3F);
|
||||
++srcStr;
|
||||
--src.Size;
|
||||
}
|
||||
if (overlong)
|
||||
{
|
||||
character = kUnknown_UNICODE;
|
||||
}
|
||||
if ((character >= 0xD800 && character <= 0xDFFF) || (character == 0xFFFE || character == 0xFFFF) ||
|
||||
character > 0x10FFFF)
|
||||
{
|
||||
character = kUnknown_UNICODE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case StringEncoding::Unknown: Assert(false && "ConvertString: Invalid Source Format: Unknown"); break;
|
||||
case StringEncoding::ASCII:
|
||||
case StringEncoding::LATIN1:
|
||||
case StringEncoding::UTF16:
|
||||
case StringEncoding::UTF32:
|
||||
case StringEncoding::UCS2:
|
||||
case StringEncoding::UCS4: Assert(false && "ConvertString: Unsupported Source Format"); break;
|
||||
}
|
||||
|
||||
// Encode out character
|
||||
switch (to)
|
||||
{
|
||||
case StringEncoding::UTF16: // RFC 2781
|
||||
{
|
||||
auto p = reinterpret_cast<uint8*>(dstStr);
|
||||
if (character > 0x10FFFF)
|
||||
{
|
||||
character = kUnknown_UNICODE;
|
||||
}
|
||||
if (character < 0x10000)
|
||||
{
|
||||
if (remainingCapacity < 2)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "ConvertString: Destination buffer too short to fit UTF16");
|
||||
return false;
|
||||
}
|
||||
p[1] = static_cast<uint8>(character >> 8);
|
||||
p[0] = static_cast<uint8>(character);
|
||||
|
||||
dstStr += 2;
|
||||
dst.Size += 1;
|
||||
remainingCapacity -= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (remainingCapacity < 4)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "ConvertString: Destination buffer too short to fit UTF16");
|
||||
return false;
|
||||
}
|
||||
character = character - 0x10000;
|
||||
uint16 word1 = 0xD800 | static_cast<uint16>((character >> 10) & 0x3FF);
|
||||
uint16 word2 = 0xDC00 | static_cast<uint16>(character & 0x3FF);
|
||||
p[1] = static_cast<uint8>(word1 >> 8);
|
||||
p[0] = static_cast<uint8>(word1);
|
||||
p[3] = static_cast<uint8>(word2 >> 8);
|
||||
p[2] = static_cast<uint8>(word2);
|
||||
|
||||
dstStr += 4;
|
||||
dst.Size += 1;
|
||||
remainingCapacity -= 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case StringEncoding::Unknown: Assert(false && "ConvertString: Invalid Source Format: Unknown"); break;
|
||||
case StringEncoding::ASCII:
|
||||
case StringEncoding::LATIN1:
|
||||
case StringEncoding::UTF8:
|
||||
case StringEncoding::UTF32:
|
||||
case StringEncoding::UCS2:
|
||||
case StringEncoding::UCS4: Assert(false && "ConvertString: Unsupported Destination Format"); break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConvertString(String from, String to, String src, StringBuffer& dst)
|
||||
{
|
||||
Assert(IsValid(from));
|
||||
Assert(IsValid(to));
|
||||
|
||||
// First find the encoding of the strings
|
||||
auto sourceFormat = StringEncoding::Unknown;
|
||||
auto destFormat = StringEncoding::Unknown;
|
||||
for (auto& encoding : Encodings)
|
||||
{
|
||||
if (StringCompareCaseInsensitive(from, encoding.Name) == 0)
|
||||
{
|
||||
sourceFormat = encoding.Format;
|
||||
if (destFormat != StringEncoding::Unknown)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (StringCompareCaseInsensitive(to, encoding.Name) == 0)
|
||||
{
|
||||
destFormat = encoding.Format;
|
||||
if (sourceFormat != StringEncoding::Unknown)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sourceFormat == StringEncoding::Unknown || destFormat == StringEncoding::Unknown)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return ConvertString(sourceFormat, destFormat, src, dst);
|
||||
}
|
||||
} // namespace Juliet
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Common/CoreTypes.h>
|
||||
#include <Core/HAL/Display/Display_Private.h>
|
||||
#include <Core/HAL/Display/DisplayDevice.h>
|
||||
#include <Core/Memory/Allocator.h>
|
||||
@@ -11,6 +12,7 @@ namespace Juliet
|
||||
{
|
||||
DisplayDevice* CurrentDisplayDevice = nullptr;
|
||||
|
||||
// TODO : IfDef new factories that are not compatible
|
||||
constexpr DisplayDeviceFactory* Factories[] = { &Win32DisplayDeviceFactory, nullptr };
|
||||
} // namespace
|
||||
|
||||
@@ -53,7 +55,10 @@ namespace Juliet
|
||||
}
|
||||
|
||||
// Destroy all Windows that are still alive
|
||||
DestroyPlatformWindow(CurrentDisplayDevice->MainWindow);
|
||||
if (CurrentDisplayDevice->MainWindow)
|
||||
{
|
||||
DestroyPlatformWindow(CurrentDisplayDevice->MainWindow);
|
||||
}
|
||||
|
||||
CurrentDisplayDevice->Shutdown(CurrentDisplayDevice);
|
||||
// Free anything that was freed by the shutdown and then free the display
|
||||
@@ -89,11 +94,14 @@ namespace Juliet
|
||||
|
||||
void DestroyPlatformWindow(NonNullPtr<Window> window)
|
||||
{
|
||||
Assert(CurrentDisplayDevice->MainWindow == window.Get());
|
||||
|
||||
HideWindow(window);
|
||||
|
||||
CurrentDisplayDevice->DestroyPlatformWindow(CurrentDisplayDevice, window);
|
||||
|
||||
Free(window.Get());
|
||||
CurrentDisplayDevice->MainWindow = nullptr;
|
||||
}
|
||||
|
||||
void ShowWindow(NonNullPtr<Window> window)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/HAL/Display/DisplayDevice.h>
|
||||
#include <Core/HAL/Display/Win32/Win32DisplayDevice.h>
|
||||
#include <Core/HAL/Display/Win32/Win32DisplayEvent.h>
|
||||
#include <Core/HAL/Display/Win32/Win32Window.h>
|
||||
#include <Core/Memory/Allocator.h>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet::Win32
|
||||
{
|
||||
|
||||
}
|
||||
@@ -134,10 +134,10 @@ namespace Juliet::Win32
|
||||
{
|
||||
uint8 peekedMessageCount = 0;
|
||||
MSG message = {};
|
||||
while (PeekMessage(&message, nullptr, 0, 0, PM_REMOVE))
|
||||
while (PeekMessageA(&message, nullptr, 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&message);
|
||||
DispatchMessage(&message);
|
||||
DispatchMessageA(&message);
|
||||
|
||||
// Since we peek at all messages of the program, it's possible that it stall here so we limit the number of peeked messages to an arbitrary limit
|
||||
if (++peekedMessageCount > kPeekMessageLimit)
|
||||
|
||||
@@ -3,15 +3,14 @@
|
||||
#include <Core/HAL/Display/Win32/Win32DisplayEvent.h>
|
||||
#include <Core/HAL/Display/Win32/Win32Window.h>
|
||||
#include <Core/HAL/Display/Window.h>
|
||||
#include <Core/HAL/Win32.h>
|
||||
#include <Core/Memory/Allocator.h>
|
||||
|
||||
namespace Juliet::Win32
|
||||
{
|
||||
namespace
|
||||
{
|
||||
constexpr auto WindowClassName = L"JulietWindowClass";
|
||||
constexpr LPCWSTR WindowClassPtr = WindowClassName;
|
||||
constexpr auto WindowClassName = "JulietWindowClass";
|
||||
constexpr LPCSTR WindowClassPtr = WindowClassName;
|
||||
|
||||
bool SetupWindowState(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window, HWND handle)
|
||||
{
|
||||
@@ -35,7 +34,7 @@ namespace Juliet::Win32
|
||||
ReleaseDC(state->Handle, state->HDC);
|
||||
DestroyWindow(state->Handle);
|
||||
|
||||
Free(state);
|
||||
SafeFree(state);
|
||||
}
|
||||
window->State = nullptr;
|
||||
}
|
||||
@@ -44,10 +43,10 @@ namespace Juliet::Win32
|
||||
bool CreatePlatformWindow(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window)
|
||||
{
|
||||
// TODO : save the instance in app state or something
|
||||
HINSTANCE instance = GetModuleHandle(NULL);
|
||||
HINSTANCE instance = GetModuleHandle(nullptr);
|
||||
|
||||
// TODO : Put outside, we should not create a new class for each new window
|
||||
WNDCLASSEX WindowClass = {};
|
||||
WNDCLASSEXA WindowClass = {};
|
||||
WindowClass.cbSize = sizeof(WNDCLASSEX);
|
||||
WindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
||||
WindowClass.lpfnWndProc = Win32MainWindowCallback;
|
||||
@@ -55,7 +54,7 @@ namespace Juliet::Win32
|
||||
WindowClass.hCursor = LoadCursor(0, IDC_ARROW);
|
||||
WindowClass.hbrBackground = static_cast<HBRUSH>(GetStockObject(LTGRAY_BRUSH));
|
||||
WindowClass.lpszClassName = WindowClassName;
|
||||
if (!RegisterClassEx(&WindowClass))
|
||||
if (!RegisterClassExA(&WindowClass))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -65,8 +64,8 @@ namespace Juliet::Win32
|
||||
|
||||
int x = CW_USEDEFAULT, y = CW_USEDEFAULT;
|
||||
const int w = window->Width, h = window->Height;
|
||||
HWND handle = CreateWindowEx(styleEx, WindowClassPtr, L"JULIET TODO PASS TITLE", style, x, y, w, h, nullptr,
|
||||
nullptr, instance, nullptr);
|
||||
HWND handle = CreateWindowExA(styleEx, WindowClassPtr, "JULIET TODO PASS TITLE", style, x, y, w, h, nullptr,
|
||||
nullptr, instance, nullptr);
|
||||
|
||||
PumpEvents(self);
|
||||
|
||||
@@ -98,69 +97,4 @@ namespace Juliet::Win32
|
||||
auto& win32State = reinterpret_cast<Window32State&>(*window->State);
|
||||
::ShowWindow(win32State.Handle, SW_HIDE);
|
||||
}
|
||||
|
||||
/*
|
||||
namespace
|
||||
{
|
||||
LRESULT CALLBACK Win32MainWindowCallback(HWND Window, UINT Message, WPARAM WParam, LPARAM LParam);
|
||||
}
|
||||
|
||||
void CreateOSWindow(WindowState& state, uint16 width, uint16 height)
|
||||
{
|
||||
auto& win32State = reinterpret_cast<Window32State&>(state);
|
||||
|
||||
HINSTANCE Instance = GetModuleHandle(0);
|
||||
|
||||
WNDCLASSA WindowClass = {};
|
||||
WindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
||||
WindowClass.lpfnWndProc = Win32MainWindowCallback;
|
||||
WindowClass.hInstance = Instance;
|
||||
WindowClass.hCursor = LoadCursor(0, IDC_ARROW);
|
||||
WindowClass.hbrBackground = static_cast<HBRUSH>(GetStockObject(LTGRAY_BRUSH));
|
||||
WindowClass.lpszClassName = WindowClassName;
|
||||
|
||||
if (RegisterClassA(&WindowClass))
|
||||
{
|
||||
HWND handle = CreateWindowExA(0, WindowClass.lpszClassName, "Juliet", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
|
||||
CW_USEDEFAULT, width, height, 0, 0, Instance, 0);
|
||||
if (handle)
|
||||
{
|
||||
win32State.Handle = handle;
|
||||
SetWindowLongPtr(win32State.Handle, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(&win32State));
|
||||
ShowWindow(handle, SW_SHOW);
|
||||
win32State.IsOpen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert(false);
|
||||
// Win32ErrorMessage(PlatformError_Fatal,
|
||||
// "Unable to open game window.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert(false);
|
||||
// Win32ErrorMessage(PlatformError_Fatal,
|
||||
// "Unable to register game window handle.");
|
||||
}
|
||||
}
|
||||
|
||||
void DestroyOSWindow(WindowState& state)
|
||||
{
|
||||
auto& win32State = reinterpret_cast<Window32State&>(state);
|
||||
::DestroyWindow(win32State.Handle);
|
||||
UnregisterClassA(WindowClassName, ::GetModuleHandle(nullptr));
|
||||
}
|
||||
|
||||
void UpdateOSWindowState(WindowState& state)
|
||||
{
|
||||
auto& win32State = reinterpret_cast<Window32State&>(state);
|
||||
MSG msg = {};
|
||||
while (::PeekMessage(&msg, win32State.Handle, 0, 0, PM_REMOVE))
|
||||
{
|
||||
::TranslateMessage(&msg);
|
||||
::DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
*/
|
||||
} // namespace Juliet::Win32
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <Core/Common/NonNullPtr.h>
|
||||
#include <Core/HAL/Display/Window.h>
|
||||
#include <Core/HAL/Win32.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
|
||||
41
Juliet/src/Core/HAL/DynLib/Win32/DynamicLibrary.cpp
Normal file
41
Juliet/src/Core/HAL/DynLib/Win32/DynamicLibrary.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/HAL/DynLib/DynamicLibrary.h>
|
||||
#include <Core/HAL/Win32.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
DynamicLibrary* LoadDynamicLibrary(const char* filename)
|
||||
{
|
||||
if (!filename)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "Library filename is invalid (empty)");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HMODULE handle = LoadLibraryA(filename);
|
||||
|
||||
// Generate an error message if all loads failed
|
||||
if (!handle)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "Failed loading %s", filename);
|
||||
return nullptr;
|
||||
}
|
||||
return reinterpret_cast<DynamicLibrary*>(handle);
|
||||
}
|
||||
|
||||
FunctionPtr LoadFunction(NonNullPtr<DynamicLibrary> lib, const char* functionName)
|
||||
{
|
||||
auto function = reinterpret_cast<FunctionPtr>(GetProcAddress(reinterpret_cast<HMODULE>(lib.Get()), functionName));
|
||||
if (!function)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "Failed loading %s", functionName);
|
||||
}
|
||||
return function;
|
||||
}
|
||||
|
||||
void UnloadDynamicLibrary(NonNullPtr<DynamicLibrary> lib)
|
||||
{
|
||||
FreeLibrary(reinterpret_cast<HMODULE>(lib.Get()));
|
||||
}
|
||||
} // namespace Juliet
|
||||
44
Juliet/src/Core/HAL/Filesystem/Filesystem.cpp
Normal file
44
Juliet/src/Core/HAL/Filesystem/Filesystem.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Common/String.h>
|
||||
#include <Core/HAL/Filesystem/Filesystem.h>
|
||||
#include <Core/HAL/Filesystem/Filesystem_Platform.h>
|
||||
#include <Core/HAL/Filesystem/Filesystem_Private.h>
|
||||
#include <Core/Memory/Allocator.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
namespace
|
||||
{
|
||||
String CachedBasePath = {};
|
||||
}
|
||||
|
||||
String GetBasePath()
|
||||
{
|
||||
if (!IsValid(CachedBasePath))
|
||||
{
|
||||
CachedBasePath = Platform::GetBasePath();
|
||||
}
|
||||
return CachedBasePath;
|
||||
}
|
||||
|
||||
bool IsAbsolutePath(String path)
|
||||
{
|
||||
if (!IsValid(path))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Platform::IsAbsolutePath(path);
|
||||
}
|
||||
|
||||
void InitFilesystem() {}
|
||||
|
||||
void ShutdownFilesystem()
|
||||
{
|
||||
if (IsValid(CachedBasePath))
|
||||
{
|
||||
CachedBasePath.Size = 0;
|
||||
SafeFree(CachedBasePath.Data);
|
||||
}
|
||||
}
|
||||
} // namespace Juliet
|
||||
7
Juliet/src/Core/HAL/Filesystem/Filesystem_Platform.h
Normal file
7
Juliet/src/Core/HAL/Filesystem/Filesystem_Platform.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet::Platform
|
||||
{
|
||||
extern String GetBasePath();
|
||||
extern bool IsAbsolutePath(String path);
|
||||
} // namespace Juliet::Platform
|
||||
7
Juliet/src/Core/HAL/Filesystem/Filesystem_Private.h
Normal file
7
Juliet/src/Core/HAL/Filesystem/Filesystem_Private.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
extern void InitFilesystem();
|
||||
extern void ShutdownFilesystem();
|
||||
} // namespace Juliet
|
||||
94
Juliet/src/Core/HAL/Filesystem/Win32/Win32Filesystem.cpp
Normal file
94
Juliet/src/Core/HAL/Filesystem/Win32/Win32Filesystem.cpp
Normal file
@@ -0,0 +1,94 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Common/String.h>
|
||||
#include <Core/HAL/Filesystem/Filesystem_Platform.h>
|
||||
#include <Core/HAL/Win32.h>
|
||||
#include <Core/Memory/Allocator.h>
|
||||
|
||||
namespace Juliet::Platform
|
||||
{
|
||||
String GetBasePath()
|
||||
{
|
||||
// Allocate a buffer that could fit the module size.
|
||||
// Max Path is a good start but could be bigger if the path include long path prefix
|
||||
size_t bufferSize = MAX_PATH;
|
||||
auto buffer = static_cast<char*>(Calloc(MAX_PATH, sizeof(char)));
|
||||
if (buffer == nullptr)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
size_t moduleFilenameLength = 0;
|
||||
while (true)
|
||||
{
|
||||
moduleFilenameLength = GetModuleFileNameA(nullptr, buffer, static_cast<uint32>(bufferSize));
|
||||
|
||||
// If the module filename length is bigger than the buffer size, we need to reallocate a bigger buffer
|
||||
if (moduleFilenameLength >= bufferSize - 1)
|
||||
{
|
||||
bufferSize *= 2;
|
||||
buffer = static_cast<char*>(Realloc(buffer, bufferSize * sizeof(char)));
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (moduleFilenameLength == 0)
|
||||
{
|
||||
SafeFree(buffer);
|
||||
Log(LogLevel::Error, LogCategory::Core, "Filesystem: Cannot locate executable path");
|
||||
}
|
||||
|
||||
size_t idx = 0;
|
||||
for (idx = moduleFilenameLength - 1; idx > 0; --idx)
|
||||
{
|
||||
if (buffer[idx] == '\\')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Assert(idx > 0 && "Path is not absolute!");
|
||||
buffer[idx + 1] = '\0'; // Chop chop
|
||||
|
||||
return WrapString(buffer);
|
||||
}
|
||||
|
||||
bool IsAbsolutePath(String path)
|
||||
{
|
||||
if (path.Data || path.Size == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// From https://learn.microsoft.com/en-ca/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN#fully_qualified_vs._relative_paths
|
||||
// Windows path starts with either:
|
||||
// A UNC name of any format, which always start with two backslash characters ("\\"). For more information, see the next section.
|
||||
// A disk designator with a backslash, for example "C:\" or "d:\".
|
||||
// A single backslash, for example, "\directory" or "\file.txt". This is also referred to as an absolute path.
|
||||
// We will only handle the first two. Single backslash is weird.
|
||||
const char* pathStr = path.Data;
|
||||
size_t pathLen = path.Size;
|
||||
|
||||
if (pathLen > 1)
|
||||
{
|
||||
if (pathStr[0] == '\\' && pathStr[1] == '\\')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (pathLen > 2)
|
||||
{
|
||||
char first = pathStr[0];
|
||||
char second = pathStr[1];
|
||||
char third = pathStr[2];
|
||||
return ((first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z')) && second == ':' &&
|
||||
(third == '\\' || third == '/');
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
} // namespace Juliet::Platform
|
||||
230
Juliet/src/Core/HAL/IO/IOStream.cpp
Normal file
230
Juliet/src/Core/HAL/IO/IOStream.cpp
Normal file
@@ -0,0 +1,230 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Common/String.h>
|
||||
#include <Core/HAL/IO/IOStream.h>
|
||||
#include <Core/HAL/IO/IOStream_Private.h>
|
||||
#include <Core/Memory/Allocator.h>
|
||||
#include <Core/Thread/Thread.h>
|
||||
#include <cstdarg>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
IOStream* IOFromFile(String filename, String mode)
|
||||
{
|
||||
if (!IsValid(filename))
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "Trying to open IOStream on invalid filename");
|
||||
return nullptr;
|
||||
}
|
||||
if (!IsValid(mode))
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "Trying to open IOStream with invalid mode");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return Internal::IOFromFile(filename, mode);
|
||||
}
|
||||
|
||||
IOStream* IOFromInterface(NonNullPtr<const IOStreamInterface> interface, NonNullPtr<IOStreamDataPayload> payload)
|
||||
{
|
||||
Assert(interface->Version >= sizeof(*interface.Get()));
|
||||
|
||||
auto stream = static_cast<IOStream*>(Calloc(1, sizeof(IOStream)));
|
||||
if (stream)
|
||||
{
|
||||
IOStreamInterface* dstInterface = &stream->Interface;
|
||||
const IOStreamInterface* srcInterface = interface.Get();
|
||||
static_assert(sizeof(*(dstInterface)) == sizeof(*(srcInterface)), "Source and Destination type mismatch");
|
||||
MemCopy(dstInterface, srcInterface, sizeof(*srcInterface));
|
||||
stream->Data = payload.Get();
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
size_t IOPrintf(NonNullPtr<IOStream> stream, _Printf_format_string_ const char* format, ...)
|
||||
{
|
||||
// TODO: Juliet format function should be able to allocate on scratch arena here.
|
||||
// This buffer should be big enough until then
|
||||
char formattedBuffer[4096];
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
int writtenSize = vsprintf_s(formattedBuffer, format, args); // Cast to void to ignore the return type. TODO : Juliet format function
|
||||
va_end(args);
|
||||
|
||||
Assert(writtenSize >= 0);
|
||||
|
||||
ByteBuffer buffer = {.Data = reinterpret_cast<Byte*>(formattedBuffer), .Size = static_cast<size_t>(writtenSize) };
|
||||
return IOWrite(stream, buffer);
|
||||
}
|
||||
|
||||
size_t IOWrite(NonNullPtr<IOStream> stream, ByteBuffer inBuffer)
|
||||
{
|
||||
if (!stream->Interface.Write)
|
||||
{
|
||||
stream->Status = IOStreamStatus::ReadOnly;
|
||||
Log(LogLevel::Error, LogCategory::Core, "Trying to write to a readonly IOStream");
|
||||
return 0;
|
||||
}
|
||||
|
||||
stream->Status = IOStreamStatus::Ready;
|
||||
|
||||
if (!IsValid(inBuffer))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t writtenBytes = stream->Interface.Write(stream->Data, inBuffer, &stream->Status);
|
||||
if ((writtenBytes == 0) && (stream->Status == IOStreamStatus::Ready))
|
||||
{
|
||||
stream->Status = IOStreamStatus::Error;
|
||||
}
|
||||
return writtenBytes;
|
||||
}
|
||||
|
||||
size_t IORead(NonNullPtr<IOStream> stream, void* ptr, size_t size)
|
||||
{
|
||||
if (!stream->Interface.Read)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "Trying to read a writeonly IOStream");
|
||||
stream->Status = IOStreamStatus::WriteOnly;
|
||||
return 0;
|
||||
}
|
||||
|
||||
stream->Status = IOStreamStatus::Ready;
|
||||
if (size == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
size_t bytes = stream->Interface.Read(stream->Data, ptr, size, &stream->Status);
|
||||
if (bytes == 0 && stream->Status == IOStreamStatus::Ready)
|
||||
{
|
||||
// TODO: Detect error and do this stream->Status = IOStreamStatus::Error;
|
||||
stream->Status = IOStreamStatus::EndOfFile;
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
int64 IOSeek(NonNullPtr<IOStream> stream, int64 offset, IOStreamSeekPivot pivot)
|
||||
{
|
||||
if (!stream->Interface.Seek)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "IOSeek: Stream interface cannot Seek");
|
||||
return -1;
|
||||
}
|
||||
return stream->Interface.Seek(stream->Data, offset, pivot);
|
||||
}
|
||||
|
||||
int64 IOSize(NonNullPtr<IOStream> stream)
|
||||
{
|
||||
if (!stream->Interface.Size)
|
||||
{
|
||||
int64 pos = IOSeek(stream, 0, IOStreamSeekPivot::Current);
|
||||
if (pos < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int64 size = IOSeek(stream, 0, IOStreamSeekPivot::End);
|
||||
|
||||
IOSeek(stream, pos, IOStreamSeekPivot::Begin);
|
||||
return size;
|
||||
}
|
||||
return stream->Interface.Size(stream->Data);
|
||||
}
|
||||
|
||||
ByteBuffer LoadFile(String filename)
|
||||
{
|
||||
IOStream* stream = IOFromFile(filename, WrapString("rb"));
|
||||
if (!stream)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
return LoadFile(stream, true);
|
||||
}
|
||||
|
||||
ByteBuffer LoadFile(NonNullPtr<IOStream> stream, bool closeStreamWhenDone)
|
||||
{
|
||||
constexpr size_t kFileChunkSize = 1024;
|
||||
uint8* data = nullptr;
|
||||
uint8* newData = nullptr;
|
||||
size_t totalSize = 0;
|
||||
ByteBuffer resultBuffer = {};
|
||||
|
||||
auto deferred = Defer(
|
||||
[&]()
|
||||
{
|
||||
if (closeStreamWhenDone)
|
||||
{
|
||||
IOClose(stream);
|
||||
}
|
||||
});
|
||||
|
||||
// Try reading the size from the stream, if failing we'll try to read it chunk by chunk
|
||||
bool loadChunks = false;
|
||||
int64 size = IOSize(stream);
|
||||
if (size < 0)
|
||||
{
|
||||
size = kFileChunkSize;
|
||||
loadChunks = true;
|
||||
}
|
||||
data = static_cast<uint8*>(Malloc(static_cast<size_t>(size + 1)));
|
||||
if (!data)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (loadChunks)
|
||||
{
|
||||
if ((totalSize + kFileChunkSize) > size)
|
||||
{
|
||||
size = static_cast<int64>(totalSize + kFileChunkSize);
|
||||
newData = static_cast<uint8*>(Realloc(data, static_cast<size_t>(size + 1)));
|
||||
if (!newData)
|
||||
{
|
||||
Free(data);
|
||||
return {};
|
||||
}
|
||||
data = newData;
|
||||
}
|
||||
}
|
||||
|
||||
size_t sizeRead = IORead(stream, data + totalSize, (size - totalSize));
|
||||
if (sizeRead > 0)
|
||||
{
|
||||
totalSize += sizeRead;
|
||||
continue;
|
||||
}
|
||||
if (stream->Status == IOStreamStatus::NotReady)
|
||||
{
|
||||
// Wait for the stream to be ready
|
||||
wait_ms(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
// The stream status will remain set for the caller to check
|
||||
break;
|
||||
}
|
||||
|
||||
// Adding null terminator
|
||||
data[totalSize] = '\0';
|
||||
|
||||
resultBuffer.Data = reinterpret_cast<Byte*>(data);
|
||||
resultBuffer.Size = totalSize;
|
||||
|
||||
return resultBuffer;
|
||||
}
|
||||
|
||||
bool IOClose(NonNullPtr<IOStream> stream)
|
||||
{
|
||||
bool result = true;
|
||||
if (stream->Interface.Close)
|
||||
{
|
||||
result = stream->Interface.Close(stream->Data);
|
||||
}
|
||||
Free(stream.Get());
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace Juliet
|
||||
19
Juliet/src/Core/HAL/IO/IOStream_Private.h
Normal file
19
Juliet/src/Core/HAL/IO/IOStream_Private.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/String.h>
|
||||
#include <Core/HAL/IO/IOStream.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
struct IOStream
|
||||
{
|
||||
IOStreamInterface Interface;
|
||||
IOStreamDataPayload* Data;
|
||||
IOStreamStatus Status;
|
||||
};
|
||||
} // namespace Juliet
|
||||
|
||||
namespace Juliet::Internal
|
||||
{
|
||||
extern JULIET_API IOStream* IOFromFile(String filename, String mode);
|
||||
}
|
||||
280
Juliet/src/Core/HAL/IO/Win32/Win32IOStream.cpp
Normal file
280
Juliet/src/Core/HAL/IO/Win32/Win32IOStream.cpp
Normal file
@@ -0,0 +1,280 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Common/EnumUtils.h>
|
||||
#include <Core/Common/String.h>
|
||||
#include <Core/HAL/IO/IOStream.h>
|
||||
#include <Core/HAL/Win32.h>
|
||||
#include <Core/Memory/Allocator.h>
|
||||
|
||||
namespace Juliet::Internal
|
||||
{
|
||||
namespace
|
||||
{
|
||||
struct Win32IOStreamDataPayload : IOStreamDataPayload
|
||||
{
|
||||
HANDLE Handle;
|
||||
void* Data;
|
||||
size_t Size;
|
||||
size_t SizeLeft;
|
||||
bool IsAppending;
|
||||
bool ShouldAutoClose;
|
||||
};
|
||||
|
||||
constexpr size_t kFileReadBufferSize = 1024;
|
||||
|
||||
int64 FileSize(NonNullPtr<IOStreamDataPayload> payload)
|
||||
{
|
||||
auto win32Payload = static_cast<Win32IOStreamDataPayload*>(payload.Get());
|
||||
LARGE_INTEGER size;
|
||||
|
||||
if (!GetFileSizeEx(win32Payload->Handle, &size))
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "IoStream:Size error: %d", GetLastError());
|
||||
return 0;
|
||||
}
|
||||
|
||||
return size.QuadPart;
|
||||
}
|
||||
|
||||
int64 FileSeek(NonNullPtr<IOStreamDataPayload> payload, int64 offset, IOStreamSeekPivot pivot)
|
||||
{
|
||||
auto win32Payload = static_cast<Win32IOStreamDataPayload*>(payload.Get());
|
||||
if ((pivot == IOStreamSeekPivot::Current) && (win32Payload->SizeLeft > 0))
|
||||
{
|
||||
offset -= static_cast<int64>(win32Payload->SizeLeft);
|
||||
}
|
||||
win32Payload->SizeLeft = 0;
|
||||
|
||||
DWORD windowsPivot = 0;
|
||||
switch (pivot)
|
||||
{
|
||||
case IOStreamSeekPivot::Begin: windowsPivot = FILE_BEGIN; break;
|
||||
case IOStreamSeekPivot::Current: windowsPivot = FILE_CURRENT; break;
|
||||
case IOStreamSeekPivot::End: windowsPivot = FILE_END; break;
|
||||
case IOStreamSeekPivot::Count:
|
||||
Log(LogLevel::Error, LogCategory::Core, "IoStream:Seek: Invalid Pivot value");
|
||||
return -1;
|
||||
}
|
||||
static_assert(ToUnderlying(IOStreamSeekPivot::Count) == 3, "IOStreamSeekPivot::Count must be 3");
|
||||
|
||||
LARGE_INTEGER windowsOffset;
|
||||
windowsOffset.QuadPart = offset;
|
||||
if (!SetFilePointerEx(win32Payload->Handle, windowsOffset, &windowsOffset, windowsPivot))
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "IoStream:Seek:Error: %d", GetLastError());
|
||||
return 0;
|
||||
}
|
||||
return windowsOffset.QuadPart;
|
||||
}
|
||||
|
||||
size_t FileRead(NonNullPtr<IOStreamDataPayload> payload, void* outBuffer, size_t size, NonNullPtr<IOStreamStatus> status)
|
||||
{
|
||||
auto win32Payload = static_cast<Win32IOStreamDataPayload*>(payload.Get());
|
||||
size_t totalNeed = size;
|
||||
size_t totalRead = 0;
|
||||
size_t sizeToReadAhead = 0;
|
||||
if (win32Payload->SizeLeft > 0)
|
||||
{
|
||||
uint8* data = static_cast<uint8*>(win32Payload->Data) + win32Payload->Size - win32Payload->SizeLeft;
|
||||
sizeToReadAhead = Min(totalNeed, win32Payload->SizeLeft);
|
||||
MemCopy(outBuffer, data, sizeToReadAhead);
|
||||
win32Payload->SizeLeft -= sizeToReadAhead;
|
||||
|
||||
if (sizeToReadAhead == totalNeed)
|
||||
{
|
||||
return size;
|
||||
}
|
||||
outBuffer = static_cast<uint8*>(outBuffer) + sizeToReadAhead;
|
||||
totalNeed -= sizeToReadAhead;
|
||||
totalRead += sizeToReadAhead;
|
||||
}
|
||||
|
||||
DWORD bytes = 0;
|
||||
if (totalNeed < kFileReadBufferSize)
|
||||
{
|
||||
if (!ReadFile(win32Payload->Handle, win32Payload->Data, kFileReadBufferSize, &bytes, nullptr))
|
||||
{
|
||||
switch (DWORD error = GetLastError())
|
||||
{
|
||||
case ERROR_BROKEN_PIPE:
|
||||
case ERROR_HANDLE_EOF: break;
|
||||
case ERROR_NO_DATA: *status = IOStreamStatus::NotReady; break;
|
||||
default:
|
||||
Log(LogLevel::Error, LogCategory::Core, "IoStream:Win32 Read: Error reading from data stream: %d", error);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
sizeToReadAhead = Min(totalNeed, static_cast<size_t>(bytes));
|
||||
MemCopy(outBuffer, win32Payload->Data, sizeToReadAhead);
|
||||
win32Payload->Size = bytes;
|
||||
win32Payload->SizeLeft = bytes - sizeToReadAhead;
|
||||
totalRead += sizeToReadAhead;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ReadFile(win32Payload->Handle, outBuffer, static_cast<DWORD>(totalNeed), &bytes, nullptr))
|
||||
{
|
||||
switch (DWORD error = GetLastError())
|
||||
{
|
||||
case ERROR_BROKEN_PIPE:
|
||||
case ERROR_HANDLE_EOF: break;
|
||||
case ERROR_NO_DATA: *status = IOStreamStatus::NotReady; break;
|
||||
default:
|
||||
Log(LogLevel::Error, LogCategory::Core, "IoStream:Win32 Read: Error reading from data stream: %d", error);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
totalRead += bytes;
|
||||
}
|
||||
return totalRead;
|
||||
}
|
||||
|
||||
size_t FileWrite(NonNullPtr<IOStreamDataPayload> payload, ByteBuffer inBuffer, NonNullPtr<IOStreamStatus> status)
|
||||
{
|
||||
auto win32Payload = static_cast<Win32IOStreamDataPayload*>(payload.Get());
|
||||
DWORD bytes;
|
||||
|
||||
if (win32Payload->SizeLeft)
|
||||
{
|
||||
if (!SetFilePointer(win32Payload->Handle, -static_cast<LONG>(win32Payload->SizeLeft), nullptr, FILE_CURRENT))
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "IoStream:FileWrite:Error seeking in datastream: %d", GetLastError());
|
||||
return 0;
|
||||
}
|
||||
win32Payload->SizeLeft = 0;
|
||||
}
|
||||
|
||||
// if in append mode, we must go to the EOF before write
|
||||
if (win32Payload->IsAppending)
|
||||
{
|
||||
LARGE_INTEGER windowsOffset;
|
||||
windowsOffset.QuadPart = 0;
|
||||
if (!SetFilePointerEx(win32Payload->Handle, windowsOffset, &windowsOffset, FILE_END))
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "IoStream:FileWrite:Error seeking in datastream: %d", GetLastError());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!WriteFile(win32Payload->Handle, inBuffer.Data, static_cast<DWORD>(inBuffer.Size), &bytes, nullptr))
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "IoStream:FileWrite:Error writing to datastream: %d", GetLastError());
|
||||
return 0;
|
||||
}
|
||||
if (bytes == 0 && inBuffer.Size > 0)
|
||||
{
|
||||
*status = IOStreamStatus::NotReady;
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
bool FileClose(NonNullPtr<IOStreamDataPayload> payload)
|
||||
{
|
||||
auto win32Payload = static_cast<Win32IOStreamDataPayload*>(payload.Get());
|
||||
if (win32Payload->Handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
if (win32Payload->ShouldAutoClose)
|
||||
{
|
||||
CloseHandle(win32Payload->Handle);
|
||||
}
|
||||
win32Payload->Handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
SafeFree(win32Payload->Data);
|
||||
SafeFree(win32Payload);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
IOStream* IOFromFile(String filename, String mode)
|
||||
{
|
||||
// "r" = reading, file must exist
|
||||
// "w" = writing, truncate existing, file may not exist
|
||||
// "r+"= reading or writing, file must exist
|
||||
// "a" = writing, append file may not exist
|
||||
// "a+"= append + read, file may not exist
|
||||
// "w+" = read, write, truncate. file may not exist
|
||||
|
||||
#if _DEBUG
|
||||
// Making sure the mode is valid
|
||||
size_t modeLength = StringLength(mode);
|
||||
Assert((modeLength <= 2) &&
|
||||
"Mode should have at most 2 characters, one being either r,w or a and the other can only be +");
|
||||
if (modeLength == 1)
|
||||
{
|
||||
Assert((mode.Data[0] == 'r' || mode.Data[0] == 'w' || mode.Data[0] == 'a') &&
|
||||
"Invalid Mode. First char is not r,w or a");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert((mode.Data[1] == '+' || mode.Data[1] == 'b') && "Invalid Mode. Second char is not +");
|
||||
}
|
||||
#endif
|
||||
|
||||
DWORD openExisting = ContainsChar(mode, 'r') ? OPEN_EXISTING : 0;
|
||||
DWORD createAlways = ContainsChar(mode, 'w') ? CREATE_ALWAYS : 0;
|
||||
const bool isAppending = ContainsChar(mode, 'a');
|
||||
DWORD openAlways = isAppending ? OPEN_ALWAYS : 0;
|
||||
|
||||
bool hasPlus = ContainsChar(mode, '+');
|
||||
DWORD canRead = openExisting || hasPlus ? GENERIC_READ : 0;
|
||||
DWORD canWrite = createAlways || openAlways || hasPlus ? GENERIC_WRITE : 0;
|
||||
|
||||
if (!canRead && !canWrite)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "IOFromFile: Invalid Mode (cannot read nor write)");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// TODO: Detect when folder is missing and create it if in w or a mode.
|
||||
HANDLE hFile = CreateFileA(CStr(filename), (canWrite | canRead), (canWrite) ? 0 : FILE_SHARE_READ, nullptr,
|
||||
(openExisting | createAlways | openAlways), FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "IOFromFile: couldn't open %s. Error: %d", CStr(filename), GetLastError());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
constexpr bool autoClose = true;
|
||||
auto payload = static_cast<Win32IOStreamDataPayload*>(Calloc(1, sizeof(Win32IOStreamDataPayload)));
|
||||
if (!payload)
|
||||
{
|
||||
if (autoClose)
|
||||
{
|
||||
CloseHandle(hFile);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IOStreamInterface iface = {};
|
||||
iface.Version = sizeof(iface);
|
||||
if (GetFileType(hFile) == FILE_TYPE_DISK)
|
||||
{
|
||||
iface.Size = FileSize;
|
||||
iface.Seek = FileSeek;
|
||||
}
|
||||
iface.Read = FileRead;
|
||||
iface.Write = FileWrite;
|
||||
iface.Close = FileClose;
|
||||
|
||||
payload->Handle = hFile;
|
||||
payload->IsAppending = isAppending;
|
||||
payload->ShouldAutoClose = autoClose;
|
||||
|
||||
payload->Data = static_cast<char*>(Malloc(kFileReadBufferSize));
|
||||
if (!payload->Data)
|
||||
{
|
||||
iface.Close(payload);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IOStream* stream = IOFromInterface(&iface, payload);
|
||||
if (!stream)
|
||||
{
|
||||
iface.Close(payload);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
} // namespace Juliet::Internal
|
||||
@@ -14,6 +14,12 @@
|
||||
#define UNICODE
|
||||
#endif
|
||||
|
||||
// Only Supports Win10 and greater
|
||||
#undef WINVER
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0A00
|
||||
#define WINVER _WIN32_WINNT
|
||||
|
||||
#define NOIME
|
||||
#define NOWINRES
|
||||
#define NOGDICAPMASKS
|
||||
@@ -52,3 +58,6 @@
|
||||
#define ANSI_ONLY
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
69
Juliet/src/Core/HotReload/HotReload.cpp
Normal file
69
Juliet/src/Core/HotReload/HotReload.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/HAL/Filesystem/Filesystem.h>
|
||||
#include <Core/HotReload/HotReload.h>
|
||||
#include <Core/Memory/Allocator.h>
|
||||
#include <Core/Thread/Thread.h>
|
||||
|
||||
#define MAX_TRIES 100
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
void InitHotReloadCode(HotReloadCode& code, String dllName, String transientDllName, String lockFilename)
|
||||
{
|
||||
// Get the app base path and build the dll path from there.
|
||||
String basePath = GetBasePath();
|
||||
size_t basePathLength = StringLength(basePath);
|
||||
|
||||
// Assign Transient dll path
|
||||
code.TransientDLLName = transientDllName;
|
||||
|
||||
// First allocate all the full path.
|
||||
// TODO: Add path composition into filesystem + string format + string builder
|
||||
const size_t dllFullPathLength = basePathLength + StringLength(dllName) + 1; // Need +1 because snprintf needs 0 terminated strings
|
||||
code.DLLFullPath.Data = static_cast<char*>(Calloc(dllFullPathLength, sizeof(char)));
|
||||
int writtenSize = snprintf(CStr(code.DLLFullPath), dllFullPathLength, "%s%s", CStr(basePath), CStr(dllName));
|
||||
if (writtenSize < static_cast<int>(dllFullPathLength) - 1)
|
||||
{
|
||||
SafeFree(code.DLLFullPath.Data);
|
||||
Log(LogLevel::Error, LogCategory::Core, "Cannot create DLL Full Path");
|
||||
return;
|
||||
}
|
||||
code.DLLFullPath.Size = writtenSize;
|
||||
|
||||
// Lock filename path
|
||||
const size_t lockPathLength = basePathLength + StringLength(lockFilename) + 1; // Need +1 because snprintf needs 0 terminated strings
|
||||
code.LockFullPath.Data = static_cast<char*>(Calloc(lockPathLength, sizeof(char)));
|
||||
writtenSize = snprintf(CStr(code.LockFullPath), lockPathLength, "%s%s", CStr(basePath), CStr(lockFilename));
|
||||
if (writtenSize < static_cast<int>(lockPathLength) - 1)
|
||||
{
|
||||
code.LockFullPath.Size = 0;
|
||||
SafeFree(code.LockFullPath.Data);
|
||||
Log(LogLevel::Error, LogCategory::Core, "Cannot create lock file full path");
|
||||
return;
|
||||
}
|
||||
code.LockFullPath.Size = writtenSize;
|
||||
|
||||
LoadCode(code);
|
||||
}
|
||||
|
||||
void ShutdownHotReloadCode(HotReloadCode& code)
|
||||
{
|
||||
UnloadCode(code);
|
||||
|
||||
code.DLLFullPath.Size = 0;
|
||||
SafeFree(code.DLLFullPath.Data);
|
||||
code.LockFullPath.Size = 0;
|
||||
SafeFree(code.LockFullPath.Data);
|
||||
}
|
||||
|
||||
void ReloadCode(HotReloadCode& code)
|
||||
{
|
||||
UnloadCode(code);
|
||||
for (uint32 tryItr = 0; !code.IsValid && tryItr < MAX_TRIES; ++tryItr)
|
||||
{
|
||||
LoadCode(code);
|
||||
wait_ms(100);
|
||||
}
|
||||
}
|
||||
} // namespace Juliet
|
||||
133
Juliet/src/Core/HotReload/Win32/Win32HotReload.cpp
Normal file
133
Juliet/src/Core/HotReload/Win32/Win32HotReload.cpp
Normal file
@@ -0,0 +1,133 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/HAL/DynLib/DynamicLibrary.h>
|
||||
#include <Core/HAL/Filesystem/Filesystem.h>
|
||||
#include <Core/HAL/Win32.h>
|
||||
#include <Core/HotReload/HotReload.h>
|
||||
#include <Core/Memory/Allocator.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
namespace
|
||||
{
|
||||
FILETIME GetLastWriteTime(const char* filename)
|
||||
{
|
||||
FILETIME lastWriteTime = {};
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA Data;
|
||||
if (GetFileAttributesExA(filename, GetFileExInfoStandard, &Data))
|
||||
{
|
||||
lastWriteTime = Data.ftLastWriteTime;
|
||||
}
|
||||
|
||||
return lastWriteTime;
|
||||
}
|
||||
|
||||
constexpr size_t kMaxAttempts = 256;
|
||||
constexpr size_t kMaxDLLID = 256;
|
||||
constexpr size_t kTempDLLBufferSizeForID = 5; // Max ID numbers
|
||||
} // namespace
|
||||
|
||||
void LoadCode(HotReloadCode& code)
|
||||
{
|
||||
// TODO : Create and use a TransientAllocator
|
||||
// Create temp dll name
|
||||
|
||||
char* lockFilename = code.LockFullPath.Data;
|
||||
WIN32_FILE_ATTRIBUTE_DATA Ignored;
|
||||
if (!GetFileAttributesExA(lockFilename, GetFileExInfoStandard, &Ignored))
|
||||
{
|
||||
const char* dllName = code.DLLFullPath.Data;
|
||||
|
||||
FILETIME lastWriteTime = GetLastWriteTime(dllName);
|
||||
ULARGE_INTEGER result{ .LowPart = lastWriteTime.dwLowDateTime, .HighPart = lastWriteTime.dwHighDateTime };
|
||||
code.LastWriteTime = result.QuadPart;
|
||||
|
||||
// Create filename for the temp dll until we find a valid id.
|
||||
// This is not infinite, in a big session we could reach the 128 attempts and fail...
|
||||
// We'll see for better later.
|
||||
|
||||
// Get the app base path and build the dll path from there.
|
||||
String basePath = GetBasePath();
|
||||
size_t basePathLength = StringLength(basePath);
|
||||
|
||||
const size_t tempDllMaxBufferSize =
|
||||
basePathLength + StringLength(code.TransientDLLName) + /* _ */ 1 + kTempDLLBufferSizeForID + 1 /* \0 */;
|
||||
auto tempDllPath = static_cast<char*>(Calloc(tempDllMaxBufferSize, sizeof(char)));
|
||||
for (uint32 attempt = 0; attempt < kMaxAttempts; ++attempt)
|
||||
{
|
||||
// int to char
|
||||
char idToStr[kTempDLLBufferSizeForID + 1];
|
||||
int idLength = snprintf(idToStr, sizeof(idToStr), "%u", code.UniqueID);
|
||||
|
||||
int writtenSize = snprintf(tempDllPath, tempDllMaxBufferSize, "%s%s_%s", CStr(basePath), idToStr,
|
||||
CStr(code.TransientDLLName));
|
||||
if (writtenSize < static_cast<int>(basePathLength + idLength + code.TransientDLLName.Size) - 1)
|
||||
{
|
||||
SafeFree(tempDllPath);
|
||||
Log(LogLevel::Error, LogCategory::Core, "Cannot create temp full path");
|
||||
return;
|
||||
}
|
||||
|
||||
if (++code.UniqueID >= kMaxDLLID)
|
||||
{
|
||||
code.UniqueID = 0;
|
||||
}
|
||||
if (CopyFileA(dllName, tempDllPath, false))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
code.Dll = LoadDynamicLibrary(tempDllPath);
|
||||
if (code.Dll)
|
||||
{
|
||||
code.IsValid = true;
|
||||
for (size_t FunctionIndex = 0; FunctionIndex < code.FunctionCount; ++FunctionIndex)
|
||||
{
|
||||
if (auto function = reinterpret_cast<void*>(LoadFunction(code.Dll, code.FunctionNames[FunctionIndex])))
|
||||
{
|
||||
code.Functions[FunctionIndex] = function;
|
||||
}
|
||||
else
|
||||
{
|
||||
code.IsValid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SafeFree(tempDllPath);
|
||||
}
|
||||
|
||||
if (!code.IsValid)
|
||||
{
|
||||
UnloadCode(code);
|
||||
}
|
||||
}
|
||||
|
||||
void UnloadCode(HotReloadCode& code)
|
||||
{
|
||||
code.IsValid = false;
|
||||
if (code.Dll)
|
||||
{
|
||||
UnloadDynamicLibrary(code.Dll);
|
||||
}
|
||||
code.Dll = nullptr;
|
||||
|
||||
code.LastWriteTime = 0;
|
||||
ZeroDynArray(code.FunctionCount, code.Functions);
|
||||
}
|
||||
|
||||
bool ShouldReloadCode(const HotReloadCode& code)
|
||||
{
|
||||
ULARGE_INTEGER largeInt = {};
|
||||
FILETIME codeLastWriteTime = {};
|
||||
largeInt.QuadPart = code.LastWriteTime;
|
||||
codeLastWriteTime.dwHighDateTime = largeInt.HighPart;
|
||||
codeLastWriteTime.dwLowDateTime = largeInt.LowPart;
|
||||
|
||||
FILETIME lastWriteTime = GetLastWriteTime(code.DLLFullPath.Data);
|
||||
int compare = CompareFileTime(&lastWriteTime, &codeLastWriteTime);
|
||||
return compare != 0;
|
||||
}
|
||||
} // namespace Juliet
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <Core/Common/EnumUtils.h>
|
||||
#include <Core/HAL/Display/Display_Private.h>
|
||||
#include <Core/HAL/Filesystem/Filesystem_Private.h>
|
||||
#include <Core/JulietInit.h>
|
||||
|
||||
namespace Juliet
|
||||
@@ -40,6 +41,10 @@ namespace Juliet
|
||||
|
||||
void JulietInit(JulietInit_Flags flags)
|
||||
{
|
||||
// Mandatory systems
|
||||
InitFilesystem();
|
||||
|
||||
// Optional systems
|
||||
if ((flags | JulietInit_Flags::Display) != JulietInit_Flags::None)
|
||||
{
|
||||
InitializeDisplaySystem();
|
||||
@@ -55,6 +60,8 @@ namespace Juliet
|
||||
DecrementSystemRefCount(JulietInit_Flags::Display);
|
||||
ShutdownDisplaySystem();
|
||||
}
|
||||
|
||||
ShutdownFilesystem();
|
||||
}
|
||||
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -7,8 +7,12 @@
|
||||
#include <cstdarg>
|
||||
|
||||
// Begin Todo JULIET debug output
|
||||
#include <cinttypes>
|
||||
|
||||
#ifdef JULIET_WIN32
|
||||
#include <Core/HAL/Win32.h>
|
||||
#include <debugapi.h>
|
||||
#endif
|
||||
// End Todo
|
||||
|
||||
namespace Juliet
|
||||
@@ -62,12 +66,19 @@ namespace Juliet
|
||||
void LogManager::OutputLog(Entry& entry)
|
||||
{
|
||||
// TODO Juliet Output io for each platform
|
||||
#ifdef JULIET_WIN32
|
||||
OutputDebugStringA((entry.Value + "\n").c_str());
|
||||
#endif
|
||||
printf("%s", (entry.Value + "\n").c_str());
|
||||
}
|
||||
|
||||
void InitializeLogManager()
|
||||
{
|
||||
#ifdef JULIET_WIN32
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
SetConsoleCP(CP_UTF8);
|
||||
#endif
|
||||
|
||||
LogManagerSingleton.Init();
|
||||
}
|
||||
|
||||
@@ -76,15 +87,12 @@ namespace Juliet
|
||||
LogManagerSingleton.Shutdown();
|
||||
}
|
||||
|
||||
void Log(LogLevel level, LogCategory category, const char* fmt, ...)
|
||||
void Log(LogLevel level, LogCategory category, const char* fmt, va_list args)
|
||||
{
|
||||
// TODO : Revisit, copy from https://github.com/Eclmist/Ether/blob/develop/src/common/logging/loggingmanager.cpp
|
||||
char formattedBuffer[4096];
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
(void)vsprintf_s(formattedBuffer, fmt, args); // Cast to void to ignore the return type. TODO : Juliet format function
|
||||
va_end(args);
|
||||
|
||||
std::string formattedText(formattedBuffer);
|
||||
|
||||
@@ -103,4 +111,35 @@ namespace Juliet
|
||||
}
|
||||
}
|
||||
|
||||
void Log(LogLevel level, LogCategory category, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
Log(level, category, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void LogMessage(LogCategory category, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
Log(LogLevel::Message, category, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void LogWarning(LogCategory category, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
Log(LogLevel::Warning, category, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void LogError(LogCategory category, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
Log(LogLevel::Error, category, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
} // namespace Juliet
|
||||
|
||||
63
Juliet/src/Core/Math/MathRound.cpp
Normal file
63
Juliet/src/Core/Math/MathRound.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Math/Math_Private.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// From MUSL lib https://github.com/rofl0r/musl
|
||||
#if FLT_EVAL_METHOD == 0
|
||||
#define EPS FLT_EPSILON
|
||||
#elif FLT_EVAL_METHOD == 1
|
||||
#define EPS DBL_EPSILON
|
||||
#elif FLT_EVAL_METHOD == 2
|
||||
#define EPS LDBL_EPSILON
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
const float_t toint = 1 / EPS;
|
||||
}
|
||||
|
||||
float RoundF(float value)
|
||||
{
|
||||
union
|
||||
{
|
||||
float f;
|
||||
uint32_t i;
|
||||
} u = { value };
|
||||
int e = u.i >> 23 & 0xff;
|
||||
float_t y;
|
||||
|
||||
if (e >= 0x7f + 23)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
if (u.i >> 31)
|
||||
{
|
||||
value = -value;
|
||||
}
|
||||
if (e < 0x7f - 1)
|
||||
{
|
||||
FORCE_EVAL(value + toint);
|
||||
return 0 * u.f;
|
||||
}
|
||||
y = value + toint - toint - value;
|
||||
if (y > 0.5f)
|
||||
{
|
||||
y = y + value - 1;
|
||||
}
|
||||
else if (y <= -0.5f)
|
||||
{
|
||||
y = y + value + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = y + value;
|
||||
}
|
||||
if (u.i >> 31)
|
||||
{
|
||||
y = -y;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
} // namespace Juliet
|
||||
51
Juliet/src/Core/Math/Math_Private.h
Normal file
51
Juliet/src/Core/Math/Math_Private.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// From MUSL lib https://github.com/rofl0r/musl
|
||||
#ifndef fp_force_evalf
|
||||
#define fp_force_evalf fp_force_evalf
|
||||
static inline void fp_force_evalf(float x)
|
||||
{
|
||||
volatile float y;
|
||||
y = x;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef fp_force_eval
|
||||
#define fp_force_eval fp_force_eval
|
||||
static inline void fp_force_eval(double x)
|
||||
{
|
||||
volatile double y;
|
||||
y = x;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef fp_force_evall
|
||||
#define fp_force_evall fp_force_evall
|
||||
static inline void fp_force_evall(long double x)
|
||||
{
|
||||
volatile long double y;
|
||||
y = x;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define FORCE_EVAL(x) \
|
||||
do \
|
||||
{ \
|
||||
if (sizeof(x) == sizeof(float)) \
|
||||
{ \
|
||||
fp_force_evalf(x); \
|
||||
} \
|
||||
else if (sizeof(x) == sizeof(double)) \
|
||||
{ \
|
||||
fp_force_eval(x); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
fp_force_evall(x); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
} // namespace Juliet
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <Core/Networking/NetworkPacket.h>
|
||||
#include <Core/Networking/SocketPlatformImpl.h>
|
||||
|
||||
#define TO_BUFFER(ptr) reinterpret_cast<const byte*>(ptr)
|
||||
#define TO_BUFFER(ptr) reinterpret_cast<Byte*>(ptr)
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
@@ -29,12 +29,12 @@ namespace Juliet
|
||||
// Begin - Pack
|
||||
NetworkPacket& NetworkPacket::operator<<(uint32 value)
|
||||
{
|
||||
const uint32 toWrite = htonl(value);
|
||||
uint32 toWrite = htonl(value);
|
||||
Append({ TO_BUFFER(&toWrite), sizeof(toWrite) });
|
||||
return *this;
|
||||
}
|
||||
|
||||
NetworkPacket& NetworkPacket::operator<<(const char* data)
|
||||
NetworkPacket& NetworkPacket::operator<<(char* data)
|
||||
{
|
||||
Assert(data && "NetworkPacket::operator<< Data must not be null");
|
||||
|
||||
|
||||
@@ -7,7 +7,11 @@
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
Socket::Socket(Protocol protocol) : Handle(SocketImpl::GetInvalidSocketHandle()), ProtocolType(protocol) {}
|
||||
Socket::Socket(Protocol protocol)
|
||||
: Handle(SocketImpl::GetInvalidSocketHandle())
|
||||
, ProtocolType(protocol)
|
||||
{
|
||||
}
|
||||
|
||||
Socket::~Socket()
|
||||
{
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
TcpListener::TcpListener() : Socket(Protocol::TCP) {}
|
||||
TcpListener::TcpListener()
|
||||
: Socket(Protocol::TCP)
|
||||
{
|
||||
}
|
||||
|
||||
Socket::Status TcpListener::Listen(uint16 port, uint32 address)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,10 @@
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
TcpSocket::TcpSocket() : Socket(Protocol::TCP) {}
|
||||
TcpSocket::TcpSocket()
|
||||
: Socket(Protocol::TCP)
|
||||
{
|
||||
}
|
||||
|
||||
Socket::RequestStatus TcpSocket::Send(NetworkPacket& packet)
|
||||
{
|
||||
@@ -26,7 +29,7 @@ namespace Juliet
|
||||
// Because of that we will send the size of the packet first before sending the data.
|
||||
|
||||
// TODO Use scratch allocator.
|
||||
Vector<byte> scratchVector;
|
||||
Vector<Byte> scratchVector;
|
||||
scratchVector.resize(buffer.Size + sizeof(uint32));
|
||||
|
||||
// htonl converts uint32 from host byte order to network byte order
|
||||
|
||||
@@ -7,79 +7,78 @@
|
||||
|
||||
namespace Juliet::SocketImpl
|
||||
{
|
||||
sockaddr_in CreateAddress(uint32 address, uint16 port)
|
||||
{
|
||||
auto addr = sockaddr_in();
|
||||
addr.sin_addr.s_addr = htonl(address);
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
SOCKET GetInvalidSocketHandle()
|
||||
{
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
|
||||
void Close(SOCKET socketHandle)
|
||||
{
|
||||
::closesocket(socketHandle);
|
||||
}
|
||||
|
||||
const char* GetErrorString()
|
||||
{
|
||||
switch (WSAGetLastError())
|
||||
sockaddr_in CreateAddress(uint32 address, uint16 port)
|
||||
{
|
||||
case WSAEWOULDBLOCK: return "WSAEWOULDBLOCK";
|
||||
case WSAEALREADY: return "WSAEALREADY";
|
||||
case WSAECONNABORTED: return "WSAECONNABORTED";
|
||||
case WSAECONNRESET: return "WSAECONNRESET";
|
||||
case WSAETIMEDOUT: return "WSAETIMEDOUT";
|
||||
case WSAENETRESET: return "WSAENETRESET";
|
||||
case WSAENOTCONN: return "WSAENOTCONN";
|
||||
case WSAEISCONN: return "WSAEISCONN";
|
||||
default: return "Other"; // TODO: Include the error number inside the string
|
||||
}
|
||||
}
|
||||
auto addr = sockaddr_in();
|
||||
addr.sin_addr.s_addr = htonl(address);
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
|
||||
Socket::Status GetErrorStatus()
|
||||
{
|
||||
switch (WSAGetLastError())
|
||||
{
|
||||
case WSAEWOULDBLOCK: return Socket::Status::NotReady;
|
||||
case WSAEALREADY: return Socket::Status::NotReady;
|
||||
case WSAECONNABORTED: return Socket::Status::Disconnected;
|
||||
case WSAECONNRESET: return Socket::Status::Disconnected;
|
||||
case WSAETIMEDOUT: return Socket::Status::Disconnected;
|
||||
case WSAENETRESET: return Socket::Status::Disconnected;
|
||||
case WSAENOTCONN: return Socket::Status::Disconnected;
|
||||
case WSAEISCONN:
|
||||
return Socket::Status::Done; // when connecting a non-blocking socket
|
||||
default: return Socket::Status::Error;
|
||||
return addr;
|
||||
}
|
||||
|
||||
SOCKET GetInvalidSocketHandle()
|
||||
{
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
|
||||
void Close(SOCKET socketHandle)
|
||||
{
|
||||
::closesocket(socketHandle);
|
||||
}
|
||||
|
||||
const char* GetErrorString()
|
||||
{
|
||||
switch (WSAGetLastError())
|
||||
{
|
||||
case WSAEWOULDBLOCK: return "WSAEWOULDBLOCK";
|
||||
case WSAEALREADY: return "WSAEALREADY";
|
||||
case WSAECONNABORTED: return "WSAECONNABORTED";
|
||||
case WSAECONNRESET: return "WSAECONNRESET";
|
||||
case WSAETIMEDOUT: return "WSAETIMEDOUT";
|
||||
case WSAENETRESET: return "WSAENETRESET";
|
||||
case WSAENOTCONN: return "WSAENOTCONN";
|
||||
case WSAEISCONN: return "WSAEISCONN";
|
||||
default: return "Other"; // TODO: Include the error number inside the string
|
||||
}
|
||||
}
|
||||
|
||||
Socket::Status GetErrorStatus()
|
||||
{
|
||||
switch (WSAGetLastError())
|
||||
{
|
||||
case WSAEWOULDBLOCK: return Socket::Status::NotReady;
|
||||
case WSAEALREADY: return Socket::Status::NotReady;
|
||||
case WSAECONNABORTED: return Socket::Status::Disconnected;
|
||||
case WSAECONNRESET: return Socket::Status::Disconnected;
|
||||
case WSAETIMEDOUT: return Socket::Status::Disconnected;
|
||||
case WSAENETRESET: return Socket::Status::Disconnected;
|
||||
case WSAENOTCONN: return Socket::Status::Disconnected;
|
||||
case WSAEISCONN: return Socket::Status::Done; // when connecting a non-blocking socket
|
||||
default: return Socket::Status::Error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Juliet::SocketImpl
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Windows needs its socket dll to be initialized for the whole process
|
||||
struct WSAAutoRelease
|
||||
{
|
||||
WSAAutoRelease()
|
||||
// Windows needs its socket dll to be initialized for the whole process
|
||||
struct WSAAutoRelease
|
||||
{
|
||||
WORD wVersionRequested = MAKEWORD(2, 2);
|
||||
WSADATA wsaData;
|
||||
if (WSAStartup(wVersionRequested, &wsaData) != 0)
|
||||
WSAAutoRelease()
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "Failed to startup WinSock2");
|
||||
return;
|
||||
WORD wVersionRequested = MAKEWORD(2, 2);
|
||||
WSADATA wsaData;
|
||||
if (WSAStartup(wVersionRequested, &wsaData) != 0)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Core, "Failed to startup WinSock2");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~WSAAutoRelease() { WSACleanup(); }
|
||||
};
|
||||
~WSAAutoRelease() { WSACleanup(); }
|
||||
};
|
||||
|
||||
WSAAutoRelease gWSAautoRelease;
|
||||
WSAAutoRelease gWSAautoRelease;
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -37,22 +37,11 @@ namespace Juliet
|
||||
EngineInstance.Application = nullptr;
|
||||
}
|
||||
|
||||
// Todo: proper fixed tick
|
||||
void wait_ms(int milliseconds)
|
||||
{
|
||||
clock_t start_time = clock();
|
||||
while (clock() < start_time + milliseconds)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void RunEngine()
|
||||
{
|
||||
while (EngineInstance.Application->IsRunning())
|
||||
{
|
||||
EngineInstance.Application->Update();
|
||||
|
||||
wait_ms(16);
|
||||
}
|
||||
}
|
||||
} // namespace Juliet
|
||||
|
||||
5
Juliet/src/Graphics/D3D12/AgilitySDK/VERSION.txt
Normal file
5
Juliet/src/Graphics/D3D12/AgilitySDK/VERSION.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
https://www.nuget.org/packages/Microsoft.Direct3D.D3D12/1.615.1
|
||||
Version 615
|
||||
|
||||
|
||||
https://devblogs.microsoft.com/directx/directx12agility/
|
||||
@@ -486,6 +486,27 @@ typedef interface ID3D12Tools ID3D12Tools;
|
||||
#endif /* __ID3D12Tools_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __ID3D12Tools1_FWD_DEFINED__
|
||||
#define __ID3D12Tools1_FWD_DEFINED__
|
||||
typedef interface ID3D12Tools1 ID3D12Tools1;
|
||||
|
||||
#endif /* __ID3D12Tools1_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __ID3D12PageableTools_FWD_DEFINED__
|
||||
#define __ID3D12PageableTools_FWD_DEFINED__
|
||||
typedef interface ID3D12PageableTools ID3D12PageableTools;
|
||||
|
||||
#endif /* __ID3D12PageableTools_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __ID3D12DeviceTools_FWD_DEFINED__
|
||||
#define __ID3D12DeviceTools_FWD_DEFINED__
|
||||
typedef interface ID3D12DeviceTools ID3D12DeviceTools;
|
||||
|
||||
#endif /* __ID3D12DeviceTools_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __ID3D12SDKConfiguration_FWD_DEFINED__
|
||||
#define __ID3D12SDKConfiguration_FWD_DEFINED__
|
||||
typedef interface ID3D12SDKConfiguration ID3D12SDKConfiguration;
|
||||
@@ -563,6 +584,13 @@ typedef interface ID3D12GraphicsCommandList10 ID3D12GraphicsCommandList10;
|
||||
#endif /* __ID3D12GraphicsCommandList10_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __ID3D12DSRDeviceFactory_FWD_DEFINED__
|
||||
#define __ID3D12DSRDeviceFactory_FWD_DEFINED__
|
||||
typedef interface ID3D12DSRDeviceFactory ID3D12DSRDeviceFactory;
|
||||
|
||||
#endif /* __ID3D12DSRDeviceFactory_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __ID3D12GBVDiagnostics_FWD_DEFINED__
|
||||
#define __ID3D12GBVDiagnostics_FWD_DEFINED__
|
||||
typedef interface ID3D12GBVDiagnostics ID3D12GBVDiagnostics;
|
||||
@@ -1102,7 +1130,7 @@ extern "C"{
|
||||
|
||||
#define D3D12_PIXEL_ADDRESS_RANGE_BIT_COUNT ( 15 )
|
||||
|
||||
#define D3D12_PREVIEW_SDK_VERSION ( 714 )
|
||||
#define D3D12_PREVIEW_SDK_VERSION ( 716 )
|
||||
|
||||
#define D3D12_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT ( 16 )
|
||||
|
||||
@@ -1235,7 +1263,7 @@ extern "C"{
|
||||
|
||||
#define D3D12_RS_SET_SHADING_RATE_COMBINER_COUNT ( 2 )
|
||||
|
||||
#define D3D12_SDK_VERSION ( 614 )
|
||||
#define D3D12_SDK_VERSION ( 615 )
|
||||
|
||||
#define D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES ( 32 )
|
||||
|
||||
@@ -1521,6 +1549,19 @@ typedef struct D3D12_BOX
|
||||
UINT back;
|
||||
} D3D12_BOX;
|
||||
|
||||
#ifdef __midl
|
||||
#ifndef LUID_DEFINED
|
||||
#define LUID_DEFINED 1
|
||||
typedef struct __LUID
|
||||
{
|
||||
DWORD LowPart;
|
||||
LONG HighPart;
|
||||
} LUID;
|
||||
|
||||
typedef struct __LUID *PLUID;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
typedef
|
||||
enum D3D12_COMPARISON_FUNC
|
||||
{
|
||||
@@ -2311,7 +2352,8 @@ enum D3D12_FEATURE
|
||||
D3D12_FEATURE_PREDICATION = 50,
|
||||
D3D12_FEATURE_PLACED_RESOURCE_SUPPORT_INFO = 51,
|
||||
D3D12_FEATURE_HARDWARE_COPY = 52,
|
||||
D3D12_FEATURE_D3D12_OPTIONS21 = 53
|
||||
D3D12_FEATURE_D3D12_OPTIONS21 = 53,
|
||||
D3D12_FEATURE_BYTECODE_BYPASS_HASH_SUPPORTED = 57
|
||||
} D3D12_FEATURE;
|
||||
|
||||
typedef
|
||||
@@ -2882,6 +2924,11 @@ typedef struct D3D12_FEATURE_DATA_HARDWARE_COPY
|
||||
_Out_ BOOL Supported;
|
||||
} D3D12_FEATURE_DATA_HARDWARE_COPY;
|
||||
|
||||
typedef struct D3D12_FEATURE_DATA_BYTECODE_BYPASS_HASH_SUPPORTED
|
||||
{
|
||||
_Out_ BOOL Supported;
|
||||
} D3D12_FEATURE_DATA_BYTECODE_BYPASS_HASH_SUPPORTED;
|
||||
|
||||
typedef struct D3D12_RESOURCE_ALLOCATION_INFO
|
||||
{
|
||||
UINT64 SizeInBytes;
|
||||
@@ -4375,6 +4422,20 @@ HRESULT WINAPI D3D12CreateVersionedRootSignatureDeserializer(
|
||||
_In_ REFIID pRootSignatureDeserializerInterface,
|
||||
_Out_ void** ppRootSignatureDeserializer);
|
||||
|
||||
typedef HRESULT (WINAPI* PFN_D3D12_CREATE_VERSIONED_ROOT_SIGNATURE_DESERIALIZER_FROM_SUBOBJECT_IN_LIBRARY)(
|
||||
_In_reads_bytes_(SrcDataSizeInBytes) LPCVOID pSrcData,
|
||||
_In_ SIZE_T SrcDataSizeInBytes,
|
||||
_In_ LPCWSTR RootSignatureSubobjectName,
|
||||
_In_ REFIID pRootSignatureDeserializerInterface,
|
||||
_Out_ void** ppRootSignatureDeserializer);
|
||||
|
||||
HRESULT WINAPI D3D12CreateVersionedRootSignatureDeserializerFromSubobjectInLibrary(
|
||||
_In_reads_bytes_(SrcDataSizeInBytes) LPCVOID pSrcData,
|
||||
_In_ SIZE_T SrcDataSizeInBytes,
|
||||
_In_opt_ LPCWSTR RootSignatureSubobjectName,
|
||||
_In_ REFIID pRootSignatureDeserializerInterface,
|
||||
_Out_ void** ppRootSignatureDeserializer);
|
||||
|
||||
typedef struct D3D12_CPU_DESCRIPTOR_HANDLE
|
||||
{
|
||||
SIZE_T ptr;
|
||||
@@ -8898,27 +8959,6 @@ EXTERN_C const IID IID_ID3D12CommandQueue;
|
||||
#endif /* __ID3D12CommandQueue_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d12_0000_0020 */
|
||||
/* [local] */
|
||||
|
||||
#ifdef __midl
|
||||
#ifndef LUID_DEFINED
|
||||
#define LUID_DEFINED 1
|
||||
typedef struct __LUID
|
||||
{
|
||||
DWORD LowPart;
|
||||
LONG HighPart;
|
||||
} LUID;
|
||||
|
||||
typedef struct __LUID *PLUID;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0020_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0020_v0_0_s_ifspec;
|
||||
|
||||
#ifndef __ID3D12Device_INTERFACE_DEFINED__
|
||||
#define __ID3D12Device_INTERFACE_DEFINED__
|
||||
|
||||
@@ -15634,7 +15674,8 @@ enum D3D12_AUTO_BREADCRUMB_OP
|
||||
D3D12_AUTO_BREADCRUMB_OP_BARRIER = 45,
|
||||
D3D12_AUTO_BREADCRUMB_OP_BEGIN_COMMAND_LIST = 46,
|
||||
D3D12_AUTO_BREADCRUMB_OP_DISPATCHGRAPH = 47,
|
||||
D3D12_AUTO_BREADCRUMB_OP_SETPROGRAM = 48
|
||||
D3D12_AUTO_BREADCRUMB_OP_SETPROGRAM = 48,
|
||||
D3D12_AUTO_BREADCRUMB_OP_PROCESSFRAMES2 = 52
|
||||
} D3D12_AUTO_BREADCRUMB_OP;
|
||||
|
||||
typedef struct D3D12_AUTO_BREADCRUMB_NODE
|
||||
@@ -28635,7 +28676,283 @@ EXTERN_C const IID IID_ID3D12Tools;
|
||||
#endif /* __ID3D12Tools_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d12_0000_0062 */
|
||||
#ifndef __ID3D12Tools1_INTERFACE_DEFINED__
|
||||
#define __ID3D12Tools1_INTERFACE_DEFINED__
|
||||
|
||||
/* interface ID3D12Tools1 */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_ID3D12Tools1;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("e4fbc019-dd3c-43e1-8f32-7f649575f0a0")
|
||||
ID3D12Tools1 : public ID3D12Tools
|
||||
{
|
||||
public:
|
||||
virtual HRESULT STDMETHODCALLTYPE ReserveGPUVARangesAtCreate(
|
||||
_In_reads_(uiNumRanges) D3D12_GPU_VIRTUAL_ADDRESS_RANGE *pRanges,
|
||||
_In_ UINT uiNumRanges) = 0;
|
||||
|
||||
virtual void STDMETHODCALLTYPE ClearReservedGPUVARangesList( void) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct ID3D12Tools1Vtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
ID3D12Tools1 * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
ID3D12Tools1 * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
ID3D12Tools1 * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(ID3D12Tools, EnableShaderInstrumentation)
|
||||
void ( STDMETHODCALLTYPE *EnableShaderInstrumentation )(
|
||||
ID3D12Tools1 * This,
|
||||
BOOL bEnable);
|
||||
|
||||
DECLSPEC_XFGVIRT(ID3D12Tools, ShaderInstrumentationEnabled)
|
||||
BOOL ( STDMETHODCALLTYPE *ShaderInstrumentationEnabled )(
|
||||
ID3D12Tools1 * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(ID3D12Tools1, ReserveGPUVARangesAtCreate)
|
||||
HRESULT ( STDMETHODCALLTYPE *ReserveGPUVARangesAtCreate )(
|
||||
ID3D12Tools1 * This,
|
||||
_In_reads_(uiNumRanges) D3D12_GPU_VIRTUAL_ADDRESS_RANGE *pRanges,
|
||||
_In_ UINT uiNumRanges);
|
||||
|
||||
DECLSPEC_XFGVIRT(ID3D12Tools1, ClearReservedGPUVARangesList)
|
||||
void ( STDMETHODCALLTYPE *ClearReservedGPUVARangesList )(
|
||||
ID3D12Tools1 * This);
|
||||
|
||||
END_INTERFACE
|
||||
} ID3D12Tools1Vtbl;
|
||||
|
||||
interface ID3D12Tools1
|
||||
{
|
||||
CONST_VTBL struct ID3D12Tools1Vtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define ID3D12Tools1_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define ID3D12Tools1_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define ID3D12Tools1_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#define ID3D12Tools1_EnableShaderInstrumentation(This,bEnable) \
|
||||
( (This)->lpVtbl -> EnableShaderInstrumentation(This,bEnable) )
|
||||
|
||||
#define ID3D12Tools1_ShaderInstrumentationEnabled(This) \
|
||||
( (This)->lpVtbl -> ShaderInstrumentationEnabled(This) )
|
||||
|
||||
|
||||
#define ID3D12Tools1_ReserveGPUVARangesAtCreate(This,pRanges,uiNumRanges) \
|
||||
( (This)->lpVtbl -> ReserveGPUVARangesAtCreate(This,pRanges,uiNumRanges) )
|
||||
|
||||
#define ID3D12Tools1_ClearReservedGPUVARangesList(This) \
|
||||
( (This)->lpVtbl -> ClearReservedGPUVARangesList(This) )
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __ID3D12Tools1_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __ID3D12PageableTools_INTERFACE_DEFINED__
|
||||
#define __ID3D12PageableTools_INTERFACE_DEFINED__
|
||||
|
||||
/* interface ID3D12PageableTools */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_ID3D12PageableTools;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("8f1359db-d8d1-42f9-b5cf-79f4cbad0d3d")
|
||||
ID3D12PageableTools : public IUnknown
|
||||
{
|
||||
public:
|
||||
virtual HRESULT STDMETHODCALLTYPE GetAllocation(
|
||||
_Inout_ D3D12_GPU_VIRTUAL_ADDRESS_RANGE *pAllocation) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct ID3D12PageableToolsVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
ID3D12PageableTools * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
ID3D12PageableTools * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
ID3D12PageableTools * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(ID3D12PageableTools, GetAllocation)
|
||||
HRESULT ( STDMETHODCALLTYPE *GetAllocation )(
|
||||
ID3D12PageableTools * This,
|
||||
_Inout_ D3D12_GPU_VIRTUAL_ADDRESS_RANGE *pAllocation);
|
||||
|
||||
END_INTERFACE
|
||||
} ID3D12PageableToolsVtbl;
|
||||
|
||||
interface ID3D12PageableTools
|
||||
{
|
||||
CONST_VTBL struct ID3D12PageableToolsVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define ID3D12PageableTools_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define ID3D12PageableTools_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define ID3D12PageableTools_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#define ID3D12PageableTools_GetAllocation(This,pAllocation) \
|
||||
( (This)->lpVtbl -> GetAllocation(This,pAllocation) )
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __ID3D12PageableTools_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __ID3D12DeviceTools_INTERFACE_DEFINED__
|
||||
#define __ID3D12DeviceTools_INTERFACE_DEFINED__
|
||||
|
||||
/* interface ID3D12DeviceTools */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_ID3D12DeviceTools;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("2ea68e9c-19c3-4e47-a109-6cdadff0aca9")
|
||||
ID3D12DeviceTools : public IUnknown
|
||||
{
|
||||
public:
|
||||
virtual void STDMETHODCALLTYPE SetNextAllocationAddress(
|
||||
_In_ D3D12_GPU_VIRTUAL_ADDRESS nextAllocationVirtualAddress) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct ID3D12DeviceToolsVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
ID3D12DeviceTools * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
ID3D12DeviceTools * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
ID3D12DeviceTools * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(ID3D12DeviceTools, SetNextAllocationAddress)
|
||||
void ( STDMETHODCALLTYPE *SetNextAllocationAddress )(
|
||||
ID3D12DeviceTools * This,
|
||||
_In_ D3D12_GPU_VIRTUAL_ADDRESS nextAllocationVirtualAddress);
|
||||
|
||||
END_INTERFACE
|
||||
} ID3D12DeviceToolsVtbl;
|
||||
|
||||
interface ID3D12DeviceTools
|
||||
{
|
||||
CONST_VTBL struct ID3D12DeviceToolsVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define ID3D12DeviceTools_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define ID3D12DeviceTools_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define ID3D12DeviceTools_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#define ID3D12DeviceTools_SetNextAllocationAddress(This,nextAllocationVirtualAddress) \
|
||||
( (This)->lpVtbl -> SetNextAllocationAddress(This,nextAllocationVirtualAddress) )
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __ID3D12DeviceTools_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d12_0000_0065 */
|
||||
/* [local] */
|
||||
|
||||
typedef struct D3D12_SUBRESOURCE_DATA
|
||||
@@ -28753,6 +29070,21 @@ static const UUID D3D12TiledResourceTier4 = { /* c9c4725f-a81a-4f56-8c5b-c51039d
|
||||
{ 0x8c, 0x5b, 0xc5, 0x10, 0x39, 0xd6, 0x94, 0xfb }
|
||||
};
|
||||
// --------------------------------------------------------------------------------------------------------------------------------
|
||||
// Experimental Feature: D3D12GPUUploadHeapsOnUnsupportedOS
|
||||
//
|
||||
// Use with D3D12EnableExperimentalFeatures to enable GPU upload heaps support on an unsupported OS,
|
||||
// driver support is still required for this feature.
|
||||
//
|
||||
// Enabling D3D12GPUUploadHeapsOnUnsupportedOS needs no configuration struct, pass NULL in the pConfigurationStructs array.
|
||||
//
|
||||
// --------------------------------------------------------------------------------------------------------------------------------
|
||||
static const UUID D3D12GPUUploadHeapsOnUnsupportedOS = { /* 45dc51f3-767f-4588-b206-0baa2b16fbae */
|
||||
0x45dc51f3,
|
||||
0x767f,
|
||||
0x4588,
|
||||
{ 0xb2, 0x06, 0x0b, 0xaa, 0x2b, 0x16, 0xfb, 0xae }
|
||||
};
|
||||
// --------------------------------------------------------------------------------------------------------------------------------
|
||||
// D3D12GetInterface
|
||||
//
|
||||
// Retrieve Global D3D12 Interface.
|
||||
@@ -28763,6 +29095,7 @@ DEFINE_GUID(CLSID_D3D12Tools, 0xe38216b1, 0x3c8c, 0x4833,
|
||||
DEFINE_GUID(CLSID_D3D12DeviceRemovedExtendedData, 0x4a75bbc4, 0x9ff4, 0x4ad8, 0x9f, 0x18, 0xab, 0xae, 0x84, 0xdc, 0x5f, 0xf2);
|
||||
DEFINE_GUID(CLSID_D3D12SDKConfiguration, 0x7cda6aca, 0xa03e, 0x49c8, 0x94, 0x58, 0x03, 0x34, 0xd2, 0x0e, 0x07, 0xce);
|
||||
DEFINE_GUID(CLSID_D3D12DeviceFactory, 0x114863bf, 0xc386, 0x4aee, 0xb3, 0x9d, 0x8f, 0x0b, 0xbb, 0x06, 0x29, 0x55);
|
||||
DEFINE_GUID(CLSID_D3D12DSRDeviceFactory, 0xbb6dd27e, 0x94a9, 0x41a6, 0x9f, 0x1b, 0x13, 0x37, 0x72, 0x17, 0x24, 0x28);
|
||||
|
||||
typedef HRESULT (WINAPI* PFN_D3D12_GET_INTERFACE)( _In_ REFCLSID, _In_ REFIID, _COM_Outptr_opt_ void** );
|
||||
|
||||
@@ -28770,8 +29103,8 @@ HRESULT WINAPI D3D12GetInterface( _In_ REFCLSID rclsid, _In_ REFIID riid, _COM_O
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0062_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0062_v0_0_s_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0065_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0065_v0_0_s_ifspec;
|
||||
|
||||
#ifndef __ID3D12SDKConfiguration_INTERFACE_DEFINED__
|
||||
#define __ID3D12SDKConfiguration_INTERFACE_DEFINED__
|
||||
@@ -28966,7 +29299,7 @@ EXTERN_C const IID IID_ID3D12SDKConfiguration1;
|
||||
#endif /* __ID3D12SDKConfiguration1_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d12_0000_0064 */
|
||||
/* interface __MIDL_itf_d3d12_0000_0067 */
|
||||
/* [local] */
|
||||
|
||||
typedef
|
||||
@@ -28981,8 +29314,8 @@ enum D3D12_DEVICE_FACTORY_FLAGS
|
||||
DEFINE_ENUM_FLAG_OPERATORS( D3D12_DEVICE_FACTORY_FLAGS )
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0064_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0064_v0_0_s_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0067_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0067_v0_0_s_ifspec;
|
||||
|
||||
#ifndef __ID3D12DeviceFactory_INTERFACE_DEFINED__
|
||||
#define __ID3D12DeviceFactory_INTERFACE_DEFINED__
|
||||
@@ -29143,7 +29476,7 @@ EXTERN_C const IID IID_ID3D12DeviceFactory;
|
||||
#endif /* __ID3D12DeviceFactory_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d12_0000_0065 */
|
||||
/* interface __MIDL_itf_d3d12_0000_0068 */
|
||||
/* [local] */
|
||||
|
||||
typedef
|
||||
@@ -29174,8 +29507,8 @@ typedef struct D3D12_DEVICE_CONFIGURATION_DESC
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0065_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0065_v0_0_s_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0068_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0068_v0_0_s_ifspec;
|
||||
|
||||
#ifndef __ID3D12DeviceConfiguration_INTERFACE_DEFINED__
|
||||
#define __ID3D12DeviceConfiguration_INTERFACE_DEFINED__
|
||||
@@ -29463,7 +29796,7 @@ EXTERN_C const IID IID_ID3D12DeviceConfiguration1;
|
||||
#endif /* __ID3D12DeviceConfiguration1_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d12_0000_0067 */
|
||||
/* interface __MIDL_itf_d3d12_0000_0070 */
|
||||
/* [local] */
|
||||
|
||||
typedef
|
||||
@@ -29503,8 +29836,8 @@ enum D3D12_SHADING_RATE_COMBINER
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0067_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0067_v0_0_s_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0070_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0070_v0_0_s_ifspec;
|
||||
|
||||
#ifndef __ID3D12GraphicsCommandList5_INTERFACE_DEFINED__
|
||||
#define __ID3D12GraphicsCommandList5_INTERFACE_DEFINED__
|
||||
@@ -30339,7 +30672,7 @@ EXTERN_C const IID IID_ID3D12GraphicsCommandList5;
|
||||
#endif /* __ID3D12GraphicsCommandList5_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d12_0000_0068 */
|
||||
/* interface __MIDL_itf_d3d12_0000_0071 */
|
||||
/* [local] */
|
||||
|
||||
typedef struct D3D12_DISPATCH_MESH_ARGUMENTS
|
||||
@@ -30351,8 +30684,8 @@ typedef struct D3D12_DISPATCH_MESH_ARGUMENTS
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0068_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0068_v0_0_s_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0071_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0071_v0_0_s_ifspec;
|
||||
|
||||
#ifndef __ID3D12GraphicsCommandList6_INTERFACE_DEFINED__
|
||||
#define __ID3D12GraphicsCommandList6_INTERFACE_DEFINED__
|
||||
@@ -34691,6 +35024,95 @@ EXTERN_C const IID IID_ID3D12GraphicsCommandList10;
|
||||
#endif /* __ID3D12GraphicsCommandList10_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __ID3D12DSRDeviceFactory_INTERFACE_DEFINED__
|
||||
#define __ID3D12DSRDeviceFactory_INTERFACE_DEFINED__
|
||||
|
||||
/* interface ID3D12DSRDeviceFactory */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_ID3D12DSRDeviceFactory;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("f343d1a0-afe3-439f-b13d-cd87a43b70ca")
|
||||
ID3D12DSRDeviceFactory : public IUnknown
|
||||
{
|
||||
public:
|
||||
virtual HRESULT STDMETHODCALLTYPE CreateDSRDevice(
|
||||
ID3D12Device *pD3D12Device,
|
||||
UINT NodeMask,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvDSRDevice) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct ID3D12DSRDeviceFactoryVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
ID3D12DSRDeviceFactory * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
ID3D12DSRDeviceFactory * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
ID3D12DSRDeviceFactory * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(ID3D12DSRDeviceFactory, CreateDSRDevice)
|
||||
HRESULT ( STDMETHODCALLTYPE *CreateDSRDevice )(
|
||||
ID3D12DSRDeviceFactory * This,
|
||||
ID3D12Device *pD3D12Device,
|
||||
UINT NodeMask,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvDSRDevice);
|
||||
|
||||
END_INTERFACE
|
||||
} ID3D12DSRDeviceFactoryVtbl;
|
||||
|
||||
interface ID3D12DSRDeviceFactory
|
||||
{
|
||||
CONST_VTBL struct ID3D12DSRDeviceFactoryVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define ID3D12DSRDeviceFactory_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define ID3D12DSRDeviceFactory_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define ID3D12DSRDeviceFactory_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#define ID3D12DSRDeviceFactory_CreateDSRDevice(This,pD3D12Device,NodeMask,riid,ppvDSRDevice) \
|
||||
( (This)->lpVtbl -> CreateDSRDevice(This,pD3D12Device,NodeMask,riid,ppvDSRDevice) )
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __ID3D12DSRDeviceFactory_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __ID3D12GBVDiagnostics_INTERFACE_DEFINED__
|
||||
#define __ID3D12GBVDiagnostics_INTERFACE_DEFINED__
|
||||
|
||||
@@ -34841,7 +35263,7 @@ EXTERN_C const IID IID_ID3D12GBVDiagnostics;
|
||||
#endif /* __ID3D12GBVDiagnostics_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d12_0000_0074 */
|
||||
/* interface __MIDL_itf_d3d12_0000_0078 */
|
||||
/* [local] */
|
||||
|
||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */
|
||||
@@ -34908,6 +35330,9 @@ DEFINE_GUID(IID_ID3D12Device13,0x14eecffc,0x4df8,0x40f7,0xa1,0x18,0x5c,0x81,0x6f
|
||||
DEFINE_GUID(IID_ID3D12Device14,0x5f6e592d,0xd895,0x44c2,0x8e,0x4a,0x88,0xad,0x49,0x26,0xd3,0x23);
|
||||
DEFINE_GUID(IID_ID3D12VirtualizationGuestDevice,0xbc66d368,0x7373,0x4943,0x87,0x57,0xfc,0x87,0xdc,0x79,0xe4,0x76);
|
||||
DEFINE_GUID(IID_ID3D12Tools,0x7071e1f0,0xe84b,0x4b33,0x97,0x4f,0x12,0xfa,0x49,0xde,0x65,0xc5);
|
||||
DEFINE_GUID(IID_ID3D12Tools1,0xe4fbc019,0xdd3c,0x43e1,0x8f,0x32,0x7f,0x64,0x95,0x75,0xf0,0xa0);
|
||||
DEFINE_GUID(IID_ID3D12PageableTools,0x8f1359db,0xd8d1,0x42f9,0xb5,0xcf,0x79,0xf4,0xcb,0xad,0x0d,0x3d);
|
||||
DEFINE_GUID(IID_ID3D12DeviceTools,0x2ea68e9c,0x19c3,0x4e47,0xa1,0x09,0x6c,0xda,0xdf,0xf0,0xac,0xa9);
|
||||
DEFINE_GUID(IID_ID3D12SDKConfiguration,0xe9eb5314,0x33aa,0x42b2,0xa7,0x18,0xd7,0x7f,0x58,0xb1,0xf1,0xc7);
|
||||
DEFINE_GUID(IID_ID3D12SDKConfiguration1,0x8aaf9303,0xad25,0x48b9,0x9a,0x57,0xd9,0xc3,0x7e,0x00,0x9d,0x9f);
|
||||
DEFINE_GUID(IID_ID3D12DeviceFactory,0x61f307d3,0xd34e,0x4e7c,0x83,0x74,0x3b,0xa4,0xde,0x23,0xcc,0xcb);
|
||||
@@ -34919,11 +35344,12 @@ DEFINE_GUID(IID_ID3D12GraphicsCommandList7,0xdd171223,0x8b61,0x4769,0x90,0xe3,0x
|
||||
DEFINE_GUID(IID_ID3D12GraphicsCommandList8,0xee936ef9,0x599d,0x4d28,0x93,0x8e,0x23,0xc4,0xad,0x05,0xce,0x51);
|
||||
DEFINE_GUID(IID_ID3D12GraphicsCommandList9,0x34ed2808,0xffe6,0x4c2b,0xb1,0x1a,0xca,0xbd,0x2b,0x0c,0x59,0xe1);
|
||||
DEFINE_GUID(IID_ID3D12GraphicsCommandList10,0x7013c015,0xd161,0x4b63,0xa0,0x8c,0x23,0x85,0x52,0xdd,0x8a,0xcc);
|
||||
DEFINE_GUID(IID_ID3D12DSRDeviceFactory,0xf343d1a0,0xafe3,0x439f,0xb1,0x3d,0xcd,0x87,0xa4,0x3b,0x70,0xca);
|
||||
DEFINE_GUID(IID_ID3D12GBVDiagnostics,0x597985ab,0x9b75,0x4dbb,0xbe,0x23,0x07,0x61,0x19,0x5b,0xeb,0xee);
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0074_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0074_v0_0_s_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0078_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12_0000_0078_v0_0_s_ifspec;
|
||||
|
||||
/* Additional Prototypes for ALL interfaces */
|
||||
|
||||
@@ -293,7 +293,7 @@ const UINT D3D12_OS_RESERVED_REGISTER_SPACE_VALUES_END = 0xffffffff;
|
||||
const UINT D3D12_OS_RESERVED_REGISTER_SPACE_VALUES_START = 0xfffffff8;
|
||||
const UINT D3D12_PACKED_TILE = 0xffffffff;
|
||||
const UINT D3D12_PIXEL_ADDRESS_RANGE_BIT_COUNT = 15;
|
||||
const UINT D3D12_PREVIEW_SDK_VERSION = 714;
|
||||
const UINT D3D12_PREVIEW_SDK_VERSION = 716;
|
||||
const UINT D3D12_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT = 16;
|
||||
const UINT D3D12_PS_CS_UAV_REGISTER_COMPONENTS = 1;
|
||||
const UINT D3D12_PS_CS_UAV_REGISTER_COUNT = 8;
|
||||
@@ -361,7 +361,7 @@ const UINT D3D12_REQ_TEXTURECUBE_DIMENSION = 16384;
|
||||
const UINT D3D12_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL = 0;
|
||||
const UINT D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES = 0xffffffff;
|
||||
const UINT D3D12_RS_SET_SHADING_RATE_COMBINER_COUNT = 2;
|
||||
const UINT D3D12_SDK_VERSION = 614;
|
||||
const UINT D3D12_SDK_VERSION = 615;
|
||||
const UINT D3D12_SHADER_IDENTIFIER_SIZE_IN_BYTES = 32;
|
||||
const UINT D3D12_SHADER_MAJOR_VERSION = 5;
|
||||
const UINT D3D12_SHADER_MAX_INSTANCES = 65535;
|
||||
@@ -573,6 +573,19 @@ typedef struct D3D12_BOX
|
||||
UINT back;
|
||||
} D3D12_BOX;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// The system LUID struct isn't defined in wtypes, so we repeat it here just
|
||||
// for the MIDL compiler.
|
||||
cpp_quote("#ifdef __midl")
|
||||
cpp_quote("#ifndef LUID_DEFINED")
|
||||
cpp_quote("#define LUID_DEFINED 1")
|
||||
typedef struct __LUID {
|
||||
DWORD LowPart;
|
||||
LONG HighPart;
|
||||
} LUID, * PLUID;
|
||||
cpp_quote("#endif")
|
||||
cpp_quote("#endif")
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -1031,6 +1044,7 @@ typedef enum D3D12_FEATURE
|
||||
D3D12_FEATURE_PLACED_RESOURCE_SUPPORT_INFO = 51,
|
||||
D3D12_FEATURE_HARDWARE_COPY = 52,
|
||||
D3D12_FEATURE_D3D12_OPTIONS21 = 53,
|
||||
D3D12_FEATURE_BYTECODE_BYPASS_HASH_SUPPORTED = 57,
|
||||
} D3D12_FEATURE;
|
||||
|
||||
typedef enum D3D12_SHADER_MIN_PRECISION_SUPPORT
|
||||
@@ -1155,11 +1169,13 @@ typedef enum D3D12_VIEW_INSTANCING_TIER
|
||||
D3D12_VIEW_INSTANCING_TIER_3 = 3,
|
||||
} D3D12_VIEW_INSTANCING_TIER;
|
||||
|
||||
|
||||
typedef enum D3D12_WORK_GRAPHS_TIER {
|
||||
D3D12_WORK_GRAPHS_TIER_NOT_SUPPORTED = 0,
|
||||
D3D12_WORK_GRAPHS_TIER_1_0 = 10,
|
||||
} D3D12_WORK_GRAPHS_TIER;
|
||||
|
||||
|
||||
// D3D12_FEATURE_D3D12_OPTIONS
|
||||
typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS
|
||||
{
|
||||
@@ -1611,6 +1627,7 @@ typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS21
|
||||
} D3D12_FEATURE_DATA_D3D12_OPTIONS21;
|
||||
|
||||
|
||||
|
||||
typedef struct D3D12_FEATURE_DATA_PREDICATION
|
||||
{
|
||||
[annotation("_Out_")] BOOL Supported;
|
||||
@@ -1622,6 +1639,11 @@ typedef struct D3D12_FEATURE_DATA_HARDWARE_COPY
|
||||
} D3D12_FEATURE_DATA_HARDWARE_COPY;
|
||||
|
||||
|
||||
typedef struct D3D12_FEATURE_DATA_BYTECODE_BYPASS_HASH_SUPPORTED
|
||||
{
|
||||
[annotation("_Out_")] BOOL Supported;
|
||||
} D3D12_FEATURE_DATA_BYTECODE_BYPASS_HASH_SUPPORTED;
|
||||
|
||||
typedef struct D3D12_RESOURCE_ALLOCATION_INFO
|
||||
{
|
||||
UINT64 SizeInBytes;
|
||||
@@ -2973,8 +2995,20 @@ cpp_quote( " _In_ SIZE_T SrcDataSizeInBytes,
|
||||
cpp_quote( " _In_ REFIID pRootSignatureDeserializerInterface," )
|
||||
cpp_quote( " _Out_ void** ppRootSignatureDeserializer);" )
|
||||
cpp_quote( "" )
|
||||
|
||||
|
||||
cpp_quote("typedef HRESULT (WINAPI* PFN_D3D12_CREATE_VERSIONED_ROOT_SIGNATURE_DESERIALIZER_FROM_SUBOBJECT_IN_LIBRARY)(")
|
||||
cpp_quote(" _In_reads_bytes_(SrcDataSizeInBytes) LPCVOID pSrcData,")
|
||||
cpp_quote(" _In_ SIZE_T SrcDataSizeInBytes,")
|
||||
cpp_quote(" _In_ LPCWSTR RootSignatureSubobjectName,")
|
||||
cpp_quote(" _In_ REFIID pRootSignatureDeserializerInterface,")
|
||||
cpp_quote(" _Out_ void** ppRootSignatureDeserializer);")
|
||||
cpp_quote("")
|
||||
cpp_quote("HRESULT WINAPI D3D12CreateVersionedRootSignatureDeserializerFromSubobjectInLibrary(")
|
||||
cpp_quote(" _In_reads_bytes_(SrcDataSizeInBytes) LPCVOID pSrcData,")
|
||||
cpp_quote(" _In_ SIZE_T SrcDataSizeInBytes,")
|
||||
cpp_quote(" _In_opt_ LPCWSTR RootSignatureSubobjectName,")
|
||||
cpp_quote(" _In_ REFIID pRootSignatureDeserializerInterface,")
|
||||
cpp_quote(" _Out_ void** ppRootSignatureDeserializer);")
|
||||
cpp_quote("")
|
||||
|
||||
typedef struct D3D12_CPU_DESCRIPTOR_HANDLE
|
||||
{
|
||||
@@ -3290,6 +3324,7 @@ interface ID3D12Fence1
|
||||
D3D12_FENCE_FLAGS GetCreationFlags();
|
||||
};
|
||||
|
||||
|
||||
[ uuid( 765a30f3-f624-4c6f-a828-ace948622445 ), object, local, pointer_default( unique ) ]
|
||||
interface ID3D12PipelineState
|
||||
: ID3D12Pageable
|
||||
@@ -3748,19 +3783,6 @@ interface ID3D12CommandQueue
|
||||
D3D12_COMMAND_QUEUE_DESC GetDesc();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// The system LUID struct isn't defined in wtypes, so we repeat it here just
|
||||
// for the MIDL compiler.
|
||||
cpp_quote("#ifdef __midl")
|
||||
cpp_quote("#ifndef LUID_DEFINED")
|
||||
cpp_quote("#define LUID_DEFINED 1")
|
||||
typedef struct __LUID {
|
||||
DWORD LowPart;
|
||||
LONG HighPart;
|
||||
} LUID, *PLUID;
|
||||
cpp_quote("#endif")
|
||||
cpp_quote("#endif")
|
||||
|
||||
[ uuid( 189819f1-1db6-4b57-be54-1821339b85f7 ), object, local, pointer_default( unique ) ]
|
||||
interface ID3D12Device
|
||||
: ID3D12Object
|
||||
@@ -5045,6 +5067,7 @@ typedef enum D3D12_AUTO_BREADCRUMB_OP
|
||||
D3D12_AUTO_BREADCRUMB_OP_BEGIN_COMMAND_LIST = 46,
|
||||
D3D12_AUTO_BREADCRUMB_OP_DISPATCHGRAPH = 47,
|
||||
D3D12_AUTO_BREADCRUMB_OP_SETPROGRAM = 48,
|
||||
D3D12_AUTO_BREADCRUMB_OP_PROCESSFRAMES2 = 52,
|
||||
} D3D12_AUTO_BREADCRUMB_OP;
|
||||
|
||||
typedef struct D3D12_AUTO_BREADCRUMB_NODE
|
||||
@@ -6092,6 +6115,33 @@ interface ID3D12Tools
|
||||
BOOL ShaderInstrumentationEnabled();
|
||||
}
|
||||
|
||||
[uuid(e4fbc019-dd3c-43e1-8f32-7f649575f0a0), object, local, pointer_default(unique)]
|
||||
interface ID3D12Tools1
|
||||
: ID3D12Tools
|
||||
{
|
||||
HRESULT ReserveGPUVARangesAtCreate(
|
||||
[annotation("_In_reads_(uiNumRanges)")] D3D12_GPU_VIRTUAL_ADDRESS_RANGE* pRanges,
|
||||
[annotation("_In_")] UINT uiNumRanges);
|
||||
void ClearReservedGPUVARangesList();
|
||||
}
|
||||
|
||||
|
||||
[uuid(8f1359db-d8d1-42f9-b5cf-79f4cbad0d3d), object, local, pointer_default(unique)]
|
||||
interface ID3D12PageableTools
|
||||
: IUnknown
|
||||
{
|
||||
HRESULT GetAllocation(
|
||||
[annotation("_Inout_")] D3D12_GPU_VIRTUAL_ADDRESS_RANGE* pAllocation);
|
||||
}
|
||||
|
||||
[uuid(2ea68e9c-19c3-4e47-a109-6cdadff0aca9), object, local, pointer_default(unique)]
|
||||
interface ID3D12DeviceTools
|
||||
: IUnknown
|
||||
{
|
||||
void SetNextAllocationAddress(
|
||||
[annotation("_In_")] D3D12_GPU_VIRTUAL_ADDRESS nextAllocationVirtualAddress);
|
||||
}
|
||||
|
||||
|
||||
typedef struct D3D12_SUBRESOURCE_DATA
|
||||
{
|
||||
@@ -6213,6 +6263,21 @@ cpp_quote(" 0xa81a,")
|
||||
cpp_quote(" 0x4f56,")
|
||||
cpp_quote(" { 0x8c, 0x5b, 0xc5, 0x10, 0x39, 0xd6, 0x94, 0xfb }")
|
||||
cpp_quote("};")
|
||||
cpp_quote("// --------------------------------------------------------------------------------------------------------------------------------")
|
||||
cpp_quote("// Experimental Feature: D3D12GPUUploadHeapsOnUnsupportedOS")
|
||||
cpp_quote("//")
|
||||
cpp_quote("// Use with D3D12EnableExperimentalFeatures to enable GPU upload heaps support on an unsupported OS, ")
|
||||
cpp_quote("// driver support is still required for this feature.")
|
||||
cpp_quote("//")
|
||||
cpp_quote("// Enabling D3D12GPUUploadHeapsOnUnsupportedOS needs no configuration struct, pass NULL in the pConfigurationStructs array.")
|
||||
cpp_quote("//")
|
||||
cpp_quote("// --------------------------------------------------------------------------------------------------------------------------------")
|
||||
cpp_quote("static const UUID D3D12GPUUploadHeapsOnUnsupportedOS = { /* 45dc51f3-767f-4588-b206-0baa2b16fbae */")
|
||||
cpp_quote(" 0x45dc51f3,")
|
||||
cpp_quote(" 0x767f,")
|
||||
cpp_quote(" 0x4588,")
|
||||
cpp_quote(" { 0xb2, 0x06, 0x0b, 0xaa, 0x2b, 0x16, 0xfb, 0xae }")
|
||||
cpp_quote("};")
|
||||
|
||||
cpp_quote("// --------------------------------------------------------------------------------------------------------------------------------")
|
||||
cpp_quote("// D3D12GetInterface")
|
||||
@@ -6225,6 +6290,7 @@ cpp_quote("DEFINE_GUID(CLSID_D3D12Tools, 0xe38216b1, 0x3c
|
||||
cpp_quote("DEFINE_GUID(CLSID_D3D12DeviceRemovedExtendedData, 0x4a75bbc4, 0x9ff4, 0x4ad8, 0x9f, 0x18, 0xab, 0xae, 0x84, 0xdc, 0x5f, 0xf2);")
|
||||
cpp_quote("DEFINE_GUID(CLSID_D3D12SDKConfiguration, 0x7cda6aca, 0xa03e, 0x49c8, 0x94, 0x58, 0x03, 0x34, 0xd2, 0x0e, 0x07, 0xce);")
|
||||
cpp_quote("DEFINE_GUID(CLSID_D3D12DeviceFactory, 0x114863bf, 0xc386, 0x4aee, 0xb3, 0x9d, 0x8f, 0x0b, 0xbb, 0x06, 0x29, 0x55);")
|
||||
cpp_quote("DEFINE_GUID(CLSID_D3D12DSRDeviceFactory, 0xbb6dd27e, 0x94a9, 0x41a6, 0x9f, 0x1b, 0x13, 0x37, 0x72, 0x17, 0x24, 0x28);")
|
||||
cpp_quote("")
|
||||
cpp_quote("typedef HRESULT (WINAPI* PFN_D3D12_GET_INTERFACE)( _In_ REFCLSID, _In_ REFIID, _COM_Outptr_opt_ void** );")
|
||||
cpp_quote("")
|
||||
@@ -6458,6 +6524,15 @@ interface ID3D12GraphicsCommandList10 : ID3D12GraphicsCommandList9
|
||||
};
|
||||
|
||||
|
||||
[uuid(f343d1a0-afe3-439f-b13d-cd87a43b70ca), object, local, pointer_default(unique)]
|
||||
interface ID3D12DSRDeviceFactory : IUnknown
|
||||
{
|
||||
HRESULT CreateDSRDevice(
|
||||
[in] ID3D12Device *pD3D12Device,
|
||||
[in] UINT NodeMask,
|
||||
[in] REFIID riid, // Expected IDSRDevice
|
||||
[out, iid_is(riid), annotation("_COM_Outptr_")] void** ppvDSRDevice);
|
||||
}
|
||||
|
||||
[uuid(597985ab-9b75-4dbb-be23-0761195bebee), object, local, pointer_default(unique)]
|
||||
interface ID3D12GBVDiagnostics
|
||||
@@ -6544,6 +6619,9 @@ cpp_quote( "DEFINE_GUID(IID_ID3D12Device13,0x14eecffc,0x4df8,0x40f7,0xa1,0x18,0x
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12Device14,0x5f6e592d,0xd895,0x44c2,0x8e,0x4a,0x88,0xad,0x49,0x26,0xd3,0x23);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12VirtualizationGuestDevice,0xbc66d368,0x7373,0x4943,0x87,0x57,0xfc,0x87,0xdc,0x79,0xe4,0x76);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12Tools,0x7071e1f0,0xe84b,0x4b33,0x97,0x4f,0x12,0xfa,0x49,0xde,0x65,0xc5);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12Tools1,0xe4fbc019,0xdd3c,0x43e1,0x8f,0x32,0x7f,0x64,0x95,0x75,0xf0,0xa0);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12PageableTools,0x8f1359db,0xd8d1,0x42f9,0xb5,0xcf,0x79,0xf4,0xcb,0xad,0x0d,0x3d);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12DeviceTools,0x2ea68e9c,0x19c3,0x4e47,0xa1,0x09,0x6c,0xda,0xdf,0xf0,0xac,0xa9);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12SDKConfiguration,0xe9eb5314,0x33aa,0x42b2,0xa7,0x18,0xd7,0x7f,0x58,0xb1,0xf1,0xc7);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12SDKConfiguration1,0x8aaf9303,0xad25,0x48b9,0x9a,0x57,0xd9,0xc3,0x7e,0x00,0x9d,0x9f);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12DeviceFactory,0x61f307d3,0xd34e,0x4e7c,0x83,0x74,0x3b,0xa4,0xde,0x23,0xcc,0xcb);" )
|
||||
@@ -6555,4 +6633,5 @@ cpp_quote( "DEFINE_GUID(IID_ID3D12GraphicsCommandList7,0xdd171223,0x8b61,0x4769,
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12GraphicsCommandList8,0xee936ef9,0x599d,0x4d28,0x93,0x8e,0x23,0xc4,0xad,0x05,0xce,0x51);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12GraphicsCommandList9,0x34ed2808,0xffe6,0x4c2b,0xb1,0x1a,0xca,0xbd,0x2b,0x0c,0x59,0xe1);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12GraphicsCommandList10,0x7013c015,0xd161,0x4b63,0xa0,0x8c,0x23,0x85,0x52,0xdd,0x8a,0xcc);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12DSRDeviceFactory,0xf343d1a0,0xafe3,0x439f,0xb1,0x3d,0xcd,0x87,0xa4,0x3b,0x70,0xca);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12GBVDiagnostics,0x597985ab,0x9b75,0x4dbb,0xbe,0x23,0x07,0x61,0x19,0x5b,0xeb,0xee);" )
|
||||
@@ -108,6 +108,13 @@ typedef interface DirectMLPyTorchCreatorID DirectMLPyTorchCreatorID;
|
||||
#endif /* __DirectMLPyTorchCreatorID_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __DirectMLWebNNCreatorID_FWD_DEFINED__
|
||||
#define __DirectMLWebNNCreatorID_FWD_DEFINED__
|
||||
typedef interface DirectMLWebNNCreatorID DirectMLWebNNCreatorID;
|
||||
|
||||
#endif /* __DirectMLWebNNCreatorID_FWD_DEFINED__ */
|
||||
|
||||
|
||||
/* header files for imported files */
|
||||
#include "oaidl.h"
|
||||
#include "ocidl.h"
|
||||
@@ -788,7 +795,79 @@ EXTERN_C const IID IID_DirectMLPyTorchCreatorID;
|
||||
#endif /* __DirectMLPyTorchCreatorID_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d12compatibility_0000_0008 */
|
||||
#ifndef __DirectMLWebNNCreatorID_INTERFACE_DEFINED__
|
||||
#define __DirectMLWebNNCreatorID_INTERFACE_DEFINED__
|
||||
|
||||
/* interface DirectMLWebNNCreatorID */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_DirectMLWebNNCreatorID;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("fdf01a76-1e11-450f-902b-74f04ea08094")
|
||||
DirectMLWebNNCreatorID : public IUnknown
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct DirectMLWebNNCreatorIDVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
DirectMLWebNNCreatorID * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
DirectMLWebNNCreatorID * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
DirectMLWebNNCreatorID * This);
|
||||
|
||||
END_INTERFACE
|
||||
} DirectMLWebNNCreatorIDVtbl;
|
||||
|
||||
interface DirectMLWebNNCreatorID
|
||||
{
|
||||
CONST_VTBL struct DirectMLWebNNCreatorIDVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define DirectMLWebNNCreatorID_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define DirectMLWebNNCreatorID_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define DirectMLWebNNCreatorID_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __DirectMLWebNNCreatorID_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d12compatibility_0000_0009 */
|
||||
/* [local] */
|
||||
|
||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */
|
||||
@@ -801,10 +880,11 @@ DEFINE_GUID(IID_OpenCLOn12CreatorID,0x3f76bb74,0x91b5,0x4a88,0xb1,0x26,0x20,0xca
|
||||
DEFINE_GUID(IID_VulkanOn12CreatorID,0xbc806e01,0x3052,0x406c,0xa3,0xe8,0x9f,0xc0,0x7f,0x04,0x8f,0x98);
|
||||
DEFINE_GUID(IID_DirectMLTensorFlowCreatorID,0xcb7490ac,0x8a0f,0x44ec,0x9b,0x7b,0x6f,0x4c,0xaf,0xe8,0xe9,0xab);
|
||||
DEFINE_GUID(IID_DirectMLPyTorchCreatorID,0xaf029192,0xfba1,0x4b05,0x91,0x16,0x23,0x5e,0x06,0x56,0x03,0x54);
|
||||
DEFINE_GUID(IID_DirectMLWebNNCreatorID,0xfdf01a76,0x1e11,0x450f,0x90,0x2b,0x74,0xf0,0x4e,0xa0,0x80,0x94);
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0008_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0008_v0_0_s_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0009_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0009_v0_0_s_ifspec;
|
||||
|
||||
/* Additional Prototypes for ALL interfaces */
|
||||
|
||||
@@ -82,6 +82,9 @@ interface DirectMLTensorFlowCreatorID : IUnknown { };
|
||||
[uuid(af029192-fba1-4b05-9116-235e06560354), object, local, pointer_default(unique)]
|
||||
interface DirectMLPyTorchCreatorID : IUnknown { };
|
||||
|
||||
[uuid(fdf01a76-1e11-450f-902b-74f04ea08094), object, local, pointer_default(unique)]
|
||||
interface DirectMLWebNNCreatorID : IUnknown { };
|
||||
|
||||
|
||||
cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */")
|
||||
#pragma endregion
|
||||
@@ -94,3 +97,4 @@ cpp_quote( "DEFINE_GUID(IID_OpenCLOn12CreatorID,0x3f76bb74,0x91b5,0x4a88,0xb1,0x
|
||||
cpp_quote( "DEFINE_GUID(IID_VulkanOn12CreatorID,0xbc806e01,0x3052,0x406c,0xa3,0xe8,0x9f,0xc0,0x7f,0x04,0x8f,0x98);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_DirectMLTensorFlowCreatorID,0xcb7490ac,0x8a0f,0x44ec,0x9b,0x7b,0x6f,0x4c,0xaf,0xe8,0xe9,0xab);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_DirectMLPyTorchCreatorID,0xaf029192,0xfba1,0x4b05,0x91,0x16,0x23,0x5e,0x06,0x56,0x03,0x54);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_DirectMLWebNNCreatorID,0xfdf01a76,0x1e11,0x450f,0x90,0x2b,0x74,0xf0,0x4e,0xa0,0x80,0x94);" )
|
||||
@@ -999,7 +999,8 @@ enum D3D12_DEBUG_DEVICE_PARAMETER_TYPE
|
||||
{
|
||||
D3D12_DEBUG_DEVICE_PARAMETER_FEATURE_FLAGS = 0,
|
||||
D3D12_DEBUG_DEVICE_PARAMETER_GPU_BASED_VALIDATION_SETTINGS = ( D3D12_DEBUG_DEVICE_PARAMETER_FEATURE_FLAGS + 1 ) ,
|
||||
D3D12_DEBUG_DEVICE_PARAMETER_GPU_SLOWDOWN_PERFORMANCE_FACTOR = ( D3D12_DEBUG_DEVICE_PARAMETER_GPU_BASED_VALIDATION_SETTINGS + 1 )
|
||||
D3D12_DEBUG_DEVICE_PARAMETER_GPU_SLOWDOWN_PERFORMANCE_FACTOR = ( D3D12_DEBUG_DEVICE_PARAMETER_GPU_BASED_VALIDATION_SETTINGS + 1 ) ,
|
||||
D3D12_DEBUG_DEVICE_PARAMETER_BYTECODE_VALIDATION_MODE = ( D3D12_DEBUG_DEVICE_PARAMETER_GPU_SLOWDOWN_PERFORMANCE_FACTOR + 1 )
|
||||
} D3D12_DEBUG_DEVICE_PARAMETER_TYPE;
|
||||
|
||||
typedef
|
||||
@@ -1046,6 +1047,15 @@ typedef struct D3D12_DEBUG_DEVICE_GPU_SLOWDOWN_PERFORMANCE_FACTOR
|
||||
FLOAT SlowdownFactor;
|
||||
} D3D12_DEBUG_DEVICE_GPU_SLOWDOWN_PERFORMANCE_FACTOR;
|
||||
|
||||
typedef
|
||||
enum D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_MODE
|
||||
{
|
||||
D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_DISABLED = 0,
|
||||
D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_WHEN_HASH_BYPASSED = ( D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_DISABLED + 1 ) ,
|
||||
D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_ALL_BYTECODE = ( D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_WHEN_HASH_BYPASSED + 1 ) ,
|
||||
D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_MODE_DEFAULT = D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_WHEN_HASH_BYPASSED
|
||||
} D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_MODE;
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12sdklayers_0000_0007_v0_0_c_ifspec;
|
||||
@@ -3346,7 +3356,10 @@ enum D3D12_MESSAGE_ID
|
||||
D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INSTANCE_COUNT_ZERO = 1418,
|
||||
D3D12_MESSAGE_ID_DESCRIPTOR_HEAP_NOT_SET_BEFORE_ROOT_SIGNATURE_WITH_DIRECTLY_INDEXED_FLAG = 1419,
|
||||
D3D12_MESSAGE_ID_DIFFERENT_DESCRIPTOR_HEAP_SET_AFTER_ROOT_SIGNATURE_WITH_DIRECTLY_INDEXED_FLAG = 1420,
|
||||
D3D12_MESSAGE_ID_D3D12_MESSAGES_END = ( D3D12_MESSAGE_ID_DIFFERENT_DESCRIPTOR_HEAP_SET_AFTER_ROOT_SIGNATURE_WITH_DIRECTLY_INDEXED_FLAG + 1 )
|
||||
D3D12_MESSAGE_ID_APPLICATION_SPECIFIC_DRIVER_STATE_NOT_SUPPORTED = 1421,
|
||||
D3D12_MESSAGE_ID_RENDER_TARGET_OR_DEPTH_STENCIL_RESOUCE_NOT_INITIALIZED = 1422,
|
||||
D3D12_MESSAGE_ID_BYTECODE_VALIDATION_ERROR = 1423,
|
||||
D3D12_MESSAGE_ID_D3D12_MESSAGES_END = ( D3D12_MESSAGE_ID_BYTECODE_VALIDATION_ERROR + 1 )
|
||||
} D3D12_MESSAGE_ID;
|
||||
|
||||
typedef struct D3D12_MESSAGE
|
||||
@@ -100,6 +100,7 @@ typedef enum D3D12_DEBUG_DEVICE_PARAMETER_TYPE
|
||||
D3D12_DEBUG_DEVICE_PARAMETER_FEATURE_FLAGS,
|
||||
D3D12_DEBUG_DEVICE_PARAMETER_GPU_BASED_VALIDATION_SETTINGS,
|
||||
D3D12_DEBUG_DEVICE_PARAMETER_GPU_SLOWDOWN_PERFORMANCE_FACTOR,
|
||||
D3D12_DEBUG_DEVICE_PARAMETER_BYTECODE_VALIDATION_MODE
|
||||
} D3D12_DEBUG_DEVICE_PARAMETER_TYPE;
|
||||
|
||||
typedef enum D3D12_DEBUG_FEATURE
|
||||
@@ -145,6 +146,15 @@ typedef struct D3D12_DEBUG_DEVICE_GPU_SLOWDOWN_PERFORMANCE_FACTOR
|
||||
FLOAT SlowdownFactor;
|
||||
} D3D12_DEBUG_DEVICE_GPU_SLOWDOWN_PERFORMANCE_FACTOR;
|
||||
|
||||
typedef enum D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_MODE
|
||||
{
|
||||
D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_DISABLED,
|
||||
D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_WHEN_HASH_BYPASSED,
|
||||
D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_ALL_BYTECODE,
|
||||
D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_MODE_DEFAULT =
|
||||
D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_WHEN_HASH_BYPASSED
|
||||
} D3D12_DEBUG_DEVICE_BYTECODE_VALIDATION_MODE;
|
||||
|
||||
[uuid(a9b71770-d099-4a65-a698-3dee10020f88), object, local, pointer_default(unique)]
|
||||
interface ID3D12DebugDevice1
|
||||
: IUnknown
|
||||
@@ -1495,6 +1505,9 @@ typedef enum D3D12_MESSAGE_ID {
|
||||
D3D12_MESSAGE_ID_COMMAND_LIST_DRAW_INSTANCE_COUNT_ZERO = 1418,
|
||||
D3D12_MESSAGE_ID_DESCRIPTOR_HEAP_NOT_SET_BEFORE_ROOT_SIGNATURE_WITH_DIRECTLY_INDEXED_FLAG = 1419,
|
||||
D3D12_MESSAGE_ID_DIFFERENT_DESCRIPTOR_HEAP_SET_AFTER_ROOT_SIGNATURE_WITH_DIRECTLY_INDEXED_FLAG = 1420,
|
||||
D3D12_MESSAGE_ID_APPLICATION_SPECIFIC_DRIVER_STATE_NOT_SUPPORTED = 1421,
|
||||
D3D12_MESSAGE_ID_RENDER_TARGET_OR_DEPTH_STENCIL_RESOUCE_NOT_INITIALIZED = 1422,
|
||||
D3D12_MESSAGE_ID_BYTECODE_VALIDATION_ERROR = 1423,
|
||||
D3D12_MESSAGE_ID_D3D12_MESSAGES_END
|
||||
} D3D12_MESSAGE_ID;
|
||||
|
||||
@@ -7563,7 +7563,10 @@ enum D3D12_VIDEO_ENCODER_VALIDATION_FLAGS
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_SUBREGION_LAYOUT_MODE_NOT_SUPPORTED = 0x100,
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_RESOLUTION_NOT_SUPPORTED_IN_LIST = 0x200,
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_GOP_STRUCTURE_NOT_SUPPORTED = 0x800,
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_SUBREGION_LAYOUT_DATA_NOT_SUPPORTED = 0x1000
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_SUBREGION_LAYOUT_DATA_NOT_SUPPORTED = 0x1000,
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_QPMAP_NOT_SUPPORTED = 0x2000,
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_DIRTY_REGIONS_NOT_SUPPORTED = 0x4000,
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_MOTION_SEARCH_NOT_SUPPORTED = 0x8000
|
||||
} D3D12_VIDEO_ENCODER_VALIDATION_FLAGS;
|
||||
|
||||
DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_ENCODER_VALIDATION_FLAGS)
|
||||
@@ -2517,6 +2517,7 @@ typedef enum D3D12_VIDEO_ENCODER_SUPPORT_FLAGS
|
||||
D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RATE_CONTROL_EXTENSION1_SUPPORT = 0x2000,
|
||||
D3D12_VIDEO_ENCODER_SUPPORT_FLAG_RATE_CONTROL_QUALITY_VS_SPEED_AVAILABLE = 0x4000,
|
||||
D3D12_VIDEO_ENCODER_SUPPORT_FLAG_READABLE_RECONSTRUCTED_PICTURE_LAYOUT_AVAILABLE = 0x8000,
|
||||
|
||||
} D3D12_VIDEO_ENCODER_SUPPORT_FLAGS;
|
||||
cpp_quote("DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_ENCODER_SUPPORT_FLAGS)")
|
||||
|
||||
@@ -2624,6 +2625,9 @@ typedef enum D3D12_VIDEO_ENCODER_VALIDATION_FLAGS
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_RESOLUTION_NOT_SUPPORTED_IN_LIST = 0x200,
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_GOP_STRUCTURE_NOT_SUPPORTED = 0x800,
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_SUBREGION_LAYOUT_DATA_NOT_SUPPORTED = 0x1000,
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_QPMAP_NOT_SUPPORTED = 0x2000,
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_DIRTY_REGIONS_NOT_SUPPORTED = 0x4000,
|
||||
D3D12_VIDEO_ENCODER_VALIDATION_FLAG_MOTION_SEARCH_NOT_SUPPORTED = 0x8000,
|
||||
} D3D12_VIDEO_ENCODER_VALIDATION_FLAGS;
|
||||
cpp_quote("DEFINE_ENUM_FLAG_OPERATORS(D3D12_VIDEO_ENCODER_VALIDATION_FLAGS)")
|
||||
|
||||
@@ -1464,7 +1464,7 @@ inline const CD3DX12_RESOURCE_DESC1* D3DX12ConditionallyExpandAPIDesc(
|
||||
}
|
||||
return uiRet;
|
||||
};
|
||||
auto Max = [](UINT64 const & a, UINT64 const & b)
|
||||
auto Max = [](UINT64 const& a, UINT64 const& b)
|
||||
{
|
||||
return (a < b) ? b : a;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -62,8 +62,10 @@ public:
|
||||
static LPCSTR GetName (DXGI_FORMAT Format, bool bHideInternalFormats = true);
|
||||
static bool IsSRGBFormat (DXGI_FORMAT Format);
|
||||
static UINT GetBitsPerStencil (DXGI_FORMAT Format);
|
||||
static UINT GetBitsPerDepth (DXGI_FORMAT Format);
|
||||
static void GetFormatReturnTypes (DXGI_FORMAT Format, D3D_FORMAT_COMPONENT_INTERPRETATION* pInterpretations); // return array of 4 components
|
||||
static UINT GetNumComponentsInFormat(DXGI_FORMAT Format);
|
||||
static UINT GetMinNumComponentsInFormats(DXGI_FORMAT FormatA, DXGI_FORMAT FormatB);
|
||||
|
||||
// Converts the sequential component index (range from 0 to GetNumComponentsInFormat()) to
|
||||
// the absolute component index (range 0 to 3).
|
||||
@@ -116,6 +118,8 @@ public:
|
||||
static UINT GetDetailTableIndex (DXGI_FORMAT Format);
|
||||
static UINT GetDetailTableIndexNoThrow (DXGI_FORMAT Format);
|
||||
static UINT GetDetailTableIndexThrow (DXGI_FORMAT Format);
|
||||
static bool SupportsDepth (DXGI_FORMAT Format);
|
||||
static bool SupportsStencil (DXGI_FORMAT Format);
|
||||
private:
|
||||
static const FORMAT_DETAIL* GetFormatDetail (DXGI_FORMAT Format);
|
||||
|
||||
@@ -460,7 +460,7 @@ inline bool D3DX12GetCopyableFootprints(
|
||||
UINT32 MinPlanePitchWidth, PlaneWidth, PlaneHeight;
|
||||
D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::GetPlaneSubsampledSizeAndFormatForCopyableLayout(PlaneSlice, Format, (UINT)Width, Height, /*_Out_*/ PlaneFormat, /*_Out_*/ MinPlanePitchWidth, /* _Out_ */ PlaneWidth, /*_Out_*/ PlaneHeight);
|
||||
|
||||
D3D12_SUBRESOURCE_FOOTPRINT LocalPlacement;
|
||||
D3D12_SUBRESOURCE_FOOTPRINT LocalPlacement = {};
|
||||
auto& Placement = pLayouts ? pLayouts[uSubRes].Footprint : LocalPlacement;
|
||||
Placement.Format = PlaneFormat;
|
||||
Placement.Width = PlaneWidth;
|
||||
@@ -600,3 +600,4 @@ inline bool D3DX12GetCopyableFootprints(
|
||||
}
|
||||
|
||||
#endif // D3D12_SDK_VERSION >= 606
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user