Initial commit
Flemme
This commit is contained in:
71
.clang-format
Normal file
71
.clang-format
Normal file
@@ -0,0 +1,71 @@
|
||||
---
|
||||
Language: Cpp
|
||||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
AlignConsecutiveAssignments:
|
||||
Enabled: true
|
||||
AlignConsecutiveDeclarations:
|
||||
Enabled: true
|
||||
AlignOperands: Align
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: WithoutElse
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: true
|
||||
BeforeWhile: true
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBraces: Custom
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakTemplateDeclarations: Yes
|
||||
ColumnLimit: 120
|
||||
ConstructorInitializerIndentWidth: 2
|
||||
Cpp11BracedListStyle: false
|
||||
IncludeCategories:
|
||||
- Regex: '^<.*'
|
||||
Priority: 1
|
||||
- Regex: '^".*'
|
||||
Priority: 2
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseBlocks: true
|
||||
IndentWidth: 4
|
||||
InsertNewlineAtEOF: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
NamespaceIndentation: All
|
||||
ObjCSpaceAfterProperty: true
|
||||
PenaltyBreakBeforeFirstCallParameter: 100
|
||||
PenaltyBreakComment: 100
|
||||
PenaltyBreakFirstLessLess: 0
|
||||
PenaltyBreakString: 100
|
||||
PenaltyExcessCharacter: 1
|
||||
PenaltyReturnTypeOnItsOwnLine: 1000
|
||||
PointerAlignment: Left
|
||||
SortIncludes: CaseInsensitive
|
||||
SpacesInAngles: Never
|
||||
SpacesInContainerLiterals: false
|
||||
Standard: Cpp11
|
||||
StatementMacros:
|
||||
- UPROPERTY
|
||||
- UCLASS
|
||||
- USTRUCT
|
||||
- GENERATED_BODY
|
||||
- UENUM
|
||||
TabWidth: 4
|
||||
...
|
||||
169
.gitattributes
vendored
Normal file
169
.gitattributes
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
* text=auto
|
||||
|
||||
# Unity files
|
||||
*.meta -text merge=unityyamlmerge diff
|
||||
*.unity -text merge=unityyamlmerge diff
|
||||
*.asset -text merge=unityyamlmerge diff
|
||||
*.prefab -text merge=unityyamlmerge diff
|
||||
*.mat -text merge=unityyamlmerge diff
|
||||
*.anim -text merge=unityyamlmerge diff
|
||||
*.controller -text merge=unityyamlmerge diff
|
||||
*.overrideController -text merge=unityyamlmerge diff
|
||||
*.physicMaterial -text merge=unityyamlmerge diff
|
||||
*.physicsMaterial2D -text merge=unityyamlmerge diff
|
||||
*.playable -text merge=unityyamlmerge diff
|
||||
*.mask -text merge=unityyamlmerge diff
|
||||
*.brush -text merge=unityyamlmerge diff
|
||||
*.flare -text merge=unityyamlmerge diff
|
||||
*.fontsettings -text merge=unityyamlmerge diff
|
||||
*.guiskin -text merge=unityyamlmerge diff
|
||||
*.giparams -text merge=unityyamlmerge diff
|
||||
*.renderTexture -text merge=unityyamlmerge diff
|
||||
*.spriteatlas -text merge=unityyamlmerge diff
|
||||
*.terrainlayer -text merge=unityyamlmerge diff
|
||||
*.mixer -text merge=unityyamlmerge diff
|
||||
*.shadervariants -text merge=unityyamlmerge diff
|
||||
|
||||
# Unreal files
|
||||
*.locres filter=lfs diff=lfs merge=lfs -text
|
||||
*.locmeta filter=lfs diff=lfs merge=lfs -text
|
||||
*.ico filter=lfs diff=lfs merge=lfs -text
|
||||
*.uasset filter=lfs diff=lfs merge=lfs -text
|
||||
*.umap filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
*.3DS filter=lfs diff=lfs merge=lfs -text
|
||||
*.3ds filter=lfs diff=lfs merge=lfs -text
|
||||
*.ABC filter=lfs diff=lfs merge=lfs -text
|
||||
*.AEP filter=lfs diff=lfs merge=lfs -text
|
||||
*.AFDESIGN filter=lfs diff=lfs merge=lfs -text
|
||||
*.AFPHOTO filter=lfs diff=lfs merge=lfs -text
|
||||
*.AI filter=lfs diff=lfs merge=lfs -text
|
||||
*.AIF filter=lfs diff=lfs merge=lfs -text
|
||||
*.AVI filter=lfs diff=lfs merge=lfs -text
|
||||
*.BGEO filter=lfs diff=lfs merge=lfs -text
|
||||
*.BIN filter=lfs diff=lfs merge=lfs -text
|
||||
*.BLEND filter=lfs diff=lfs merge=lfs -text
|
||||
*.BMP filter=lfs diff=lfs merge=lfs -text
|
||||
*.BPOLY filter=lfs diff=lfs merge=lfs -text
|
||||
*.C4D filter=lfs diff=lfs merge=lfs -text
|
||||
*.DOC filter=lfs diff=lfs merge=lfs -text
|
||||
*.DOCX filter=lfs diff=lfs merge=lfs -text
|
||||
*.DWG filter=lfs diff=lfs merge=lfs -text
|
||||
*.DXF filter=lfs diff=lfs merge=lfs -text
|
||||
*.EXR filter=lfs diff=lfs merge=lfs -text
|
||||
*.FBX filter=lfs diff=lfs merge=lfs -text
|
||||
*.GEO filter=lfs diff=lfs merge=lfs -text
|
||||
*.GI filter=lfs diff=lfs merge=lfs -text
|
||||
*.GI2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.GIF filter=lfs diff=lfs merge=lfs -text
|
||||
*.GLB filter=lfs diff=lfs merge=lfs -text
|
||||
*.GLTF filter=lfs diff=lfs merge=lfs -text
|
||||
*.HDR filter=lfs diff=lfs merge=lfs -text
|
||||
*.HIP filter=lfs diff=lfs merge=lfs -text
|
||||
*.HIPLC filter=lfs diff=lfs merge=lfs -text
|
||||
*.HIPNC filter=lfs diff=lfs merge=lfs -text
|
||||
*.JPEG filter=lfs diff=lfs merge=lfs -text
|
||||
*.JPG filter=lfs diff=lfs merge=lfs -text
|
||||
*.MA filter=lfs diff=lfs merge=lfs -text
|
||||
*.MAX filter=lfs diff=lfs merge=lfs -text
|
||||
*.MB filter=lfs diff=lfs merge=lfs -text
|
||||
*.MOV filter=lfs diff=lfs merge=lfs -text
|
||||
*.MP3 filter=lfs diff=lfs merge=lfs -text
|
||||
*.MP4 filter=lfs diff=lfs merge=lfs -text
|
||||
*.MPEG filter=lfs diff=lfs merge=lfs -text
|
||||
*.MPG filter=lfs diff=lfs merge=lfs -text
|
||||
*.OBJ filter=lfs diff=lfs merge=lfs -text
|
||||
*.PDF filter=lfs diff=lfs merge=lfs -text
|
||||
*.PFM filter=lfs diff=lfs merge=lfs -text
|
||||
*.PIC filter=lfs diff=lfs merge=lfs -text
|
||||
*.PMB filter=lfs diff=lfs merge=lfs -text
|
||||
*.PNG filter=lfs diff=lfs merge=lfs -text
|
||||
*.POLY filter=lfs diff=lfs merge=lfs -text
|
||||
*.PPT filter=lfs diff=lfs merge=lfs -text
|
||||
*.PPTX filter=lfs diff=lfs merge=lfs -text
|
||||
*.PROFRAW filter=lfs diff=lfs merge=lfs -text
|
||||
*.PRPROJ filter=lfs diff=lfs merge=lfs -text
|
||||
*.PSB filter=lfs diff=lfs merge=lfs -text
|
||||
*.PSD filter=lfs diff=lfs merge=lfs -text
|
||||
*.RAT filter=lfs diff=lfs merge=lfs -text
|
||||
*.RIB filter=lfs diff=lfs merge=lfs -text
|
||||
*.SKETCH filter=lfs diff=lfs merge=lfs -text
|
||||
*.STL filter=lfs diff=lfs merge=lfs -text
|
||||
*.TAR filter=lfs diff=lfs merge=lfs -text
|
||||
*.TIF filter=lfs diff=lfs merge=lfs -text
|
||||
*.TIFF filter=lfs diff=lfs merge=lfs -text
|
||||
*.USD filter=lfs diff=lfs merge=lfs -text
|
||||
*.USDC filter=lfs diff=lfs merge=lfs -text
|
||||
*.USDZ filter=lfs diff=lfs merge=lfs -text
|
||||
*.VDB filter=lfs diff=lfs merge=lfs -text
|
||||
*.WAV filter=lfs diff=lfs merge=lfs -text
|
||||
*.XLS filter=lfs diff=lfs merge=lfs -text
|
||||
*.XLSX filter=lfs diff=lfs merge=lfs -text
|
||||
*.ZIP filter=lfs diff=lfs merge=lfs -text
|
||||
*.abc filter=lfs diff=lfs merge=lfs -text
|
||||
*.aep filter=lfs diff=lfs merge=lfs -text
|
||||
*.afdesign filter=lfs diff=lfs merge=lfs -text
|
||||
*.afphoto filter=lfs diff=lfs merge=lfs -text
|
||||
*.ai filter=lfs diff=lfs merge=lfs -text
|
||||
*.aif filter=lfs diff=lfs merge=lfs -text
|
||||
*.avi filter=lfs diff=lfs merge=lfs -text
|
||||
*.bgeo filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.blend filter=lfs diff=lfs merge=lfs -text
|
||||
*.bmp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bpoly filter=lfs diff=lfs merge=lfs -text
|
||||
*.c4d filter=lfs diff=lfs merge=lfs -text
|
||||
*.doc filter=lfs diff=lfs merge=lfs -text
|
||||
*.docx filter=lfs diff=lfs merge=lfs -text
|
||||
*.dwg filter=lfs diff=lfs merge=lfs -text
|
||||
*.dxf filter=lfs diff=lfs merge=lfs -text
|
||||
*.exr filter=lfs diff=lfs merge=lfs -text
|
||||
*.fbx filter=lfs diff=lfs merge=lfs -text
|
||||
*.geo filter=lfs diff=lfs merge=lfs -text
|
||||
*.gi filter=lfs diff=lfs merge=lfs -text
|
||||
*.gi2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gif filter=lfs diff=lfs merge=lfs -text
|
||||
*.glb filter=lfs diff=lfs merge=lfs -text
|
||||
*.gltf filter=lfs diff=lfs merge=lfs -text
|
||||
*.hdr filter=lfs diff=lfs merge=lfs -text
|
||||
*.hip filter=lfs diff=lfs merge=lfs -text
|
||||
*.hiplc filter=lfs diff=lfs merge=lfs -text
|
||||
*.hipnc filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.ma filter=lfs diff=lfs merge=lfs -text
|
||||
*.max filter=lfs diff=lfs merge=lfs -text
|
||||
*.mb filter=lfs diff=lfs merge=lfs -text
|
||||
*.mov filter=lfs diff=lfs merge=lfs -text
|
||||
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
||||
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
||||
*.mpeg filter=lfs diff=lfs merge=lfs -text
|
||||
*.mpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.obj filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.pfm filter=lfs diff=lfs merge=lfs -text
|
||||
*.pic filter=lfs diff=lfs merge=lfs -text
|
||||
*.pmb filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.poly filter=lfs diff=lfs merge=lfs -text
|
||||
*.ppt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pptx filter=lfs diff=lfs merge=lfs -text
|
||||
*.profraw filter=lfs diff=lfs merge=lfs -text
|
||||
*.prproj filter=lfs diff=lfs merge=lfs -text
|
||||
*.psb filter=lfs diff=lfs merge=lfs -text
|
||||
*.psd filter=lfs diff=lfs merge=lfs -text
|
||||
*.rat filter=lfs diff=lfs merge=lfs -text
|
||||
*.rib filter=lfs diff=lfs merge=lfs -text
|
||||
*.sketch filter=lfs diff=lfs merge=lfs -text
|
||||
*.stl filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.tif filter=lfs diff=lfs merge=lfs -text
|
||||
*.tiff filter=lfs diff=lfs merge=lfs -text
|
||||
*.usd filter=lfs diff=lfs merge=lfs -text
|
||||
*.usdc filter=lfs diff=lfs merge=lfs -text
|
||||
*.usdz filter=lfs diff=lfs merge=lfs -text
|
||||
*.vdb filter=lfs diff=lfs merge=lfs -text
|
||||
*.wav filter=lfs diff=lfs merge=lfs -text
|
||||
*.xls filter=lfs diff=lfs merge=lfs -text
|
||||
*.xlsx filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
14
.gitignore
vendored
14
.gitignore
vendored
@@ -1,4 +1,18 @@
|
||||
# ---> C++
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# Binaries
|
||||
[Bb]in/
|
||||
[Ll]ib/
|
||||
.idea/
|
||||
.vs
|
||||
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
|
||||
6
Directory.build.props
Normal file
6
Directory.build.props
Normal file
@@ -0,0 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<LLVMInstallDir>C:\Program Files\LLVM</LLVMInstallDir>
|
||||
<LLVMToolsVersion>19.1.0</LLVMToolsVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
31
Juliet.sln
Normal file
31
Juliet.sln
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.12.35506.116
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Juliet", "Juliet\Juliet.vcxproj", "{1BBC0B92-E4D8-4838-974B-439C5C501E82}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JulietApp", "JulietApp\JulietApp.vcxproj", "{4B2A0F9C-5F78-4BC9-BEE9-1E58BB85FA79}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{1BBC0B92-E4D8-4838-974B-439C5C501E82} = {1BBC0B92-E4D8-4838-974B-439C5C501E82}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1BBC0B92-E4D8-4838-974B-439C5C501E82}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{1BBC0B92-E4D8-4838-974B-439C5C501E82}.Debug|x64.Build.0 = Debug|x64
|
||||
{1BBC0B92-E4D8-4838-974B-439C5C501E82}.Release|x64.ActiveCfg = Release|x64
|
||||
{1BBC0B92-E4D8-4838-974B-439C5C501E82}.Release|x64.Build.0 = Release|x64
|
||||
{4B2A0F9C-5F78-4BC9-BEE9-1E58BB85FA79}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
284
Juliet/Juliet.vcxproj
Normal file
284
Juliet/Juliet.vcxproj
Normal file
@@ -0,0 +1,284 @@
|
||||
<?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>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{1bbc0b92-e4d8-4838-974b-439c5c501e82}</ProjectGuid>
|
||||
<RootNamespace>Juliet</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>ClangCL</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</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'">
|
||||
<OutDir>$(SolutionDir)\lib\$(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>
|
||||
</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>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;JULIET_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>
|
||||
</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;JULIET_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>
|
||||
</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\Core\Application\ApplicationManager.h"/>
|
||||
<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\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\Container\Vector.h"/>
|
||||
<ClInclude Include="include\Core\HAL\Display\Display.h"/>
|
||||
<ClInclude Include="include\Core\HAL\Event\SystemEvent.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\JulietInit.h"/>
|
||||
<ClInclude Include="include\Core\Logging\LogManager.h"/>
|
||||
<ClInclude Include="include\Core\Logging\LogTypes.h"/>
|
||||
<ClInclude Include="include\Core\Memory\Allocator.h"/>
|
||||
<ClInclude Include="include\Core\Memory\Utils.h"/>
|
||||
<ClInclude Include="include\Core\Networking\IPAddress.h"/>
|
||||
<ClInclude Include="include\Core\Networking\NetworkPacket.h"/>
|
||||
<ClInclude Include="include\Core\Networking\Socket.h"/>
|
||||
<ClInclude Include="include\Core\Networking\SocketHandle.h"/>
|
||||
<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\Engine.h"/>
|
||||
<ClInclude Include="include\Graphics\Graphics.h"/>
|
||||
<ClInclude Include="include\Graphics\GraphicsConfig.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"/>
|
||||
<ClInclude Include="src\Core\HAL\Event\KeyboardMapping.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Event\Keyboard_Private.h"/>
|
||||
<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\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"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Core\Application\ApplicationManager.cpp"/>
|
||||
<ClCompile Include="src\Core\Common\CoreUtils.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\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\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">
|
||||
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SupportJustMyCode>true</SupportJustMyCode>
|
||||
<AssemblerOutput>NoListing</AssemblerOutput>
|
||||
<AssemblerListingLocation>W:\Classified\RomeoAndJuliet\Intermediate\Juliet\x64\Debug\</AssemblerListingLocation>
|
||||
<UndefineAllPreprocessorDefinitions>false</UndefineAllPreprocessorDefinitions>
|
||||
<BrowseInformationFile>W:\Classified\RomeoAndJuliet\Intermediate\Juliet\x64\Debug\</BrowseInformationFile>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<ConformanceMode>Default</ConformanceMode>
|
||||
<DiagnosticsFormat>Column</DiagnosticsFormat>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<EnableASAN>false</EnableASAN>
|
||||
<EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>false</IntrinsicFunctions>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<LanguageStandard_C>Default</LanguageStandard_C>
|
||||
<ModuleDependenciesFile>W:\Classified\RomeoAndJuliet\Intermediate\Juliet\x64\Debug\</ModuleDependenciesFile>
|
||||
<OmitDefaultLibName>false</OmitDefaultLibName>
|
||||
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
|
||||
<ObjectFileName>W:\Classified\RomeoAndJuliet\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>
|
||||
<PreprocessToFile>false</PreprocessToFile>
|
||||
<PreprocessKeepComments>false</PreprocessKeepComments>
|
||||
<PreprocessSuppressLineNumbers>false</PreprocessSuppressLineNumbers>
|
||||
<ScanSourceForModuleDependencies>false</ScanSourceForModuleDependencies>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
<SourceDependenciesFile>W:\Classified\RomeoAndJuliet\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>
|
||||
<MinimalRebuildFromTracking>true</MinimalRebuildFromTracking>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<XMLDocumentationFileName>W:\Classified\RomeoAndJuliet\Intermediate\Juliet\x64\Debug\</XMLDocumentationFileName>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<IntelJCCErratum>false</IntelJCCErratum>
|
||||
<BuildStlModules>false</BuildStlModules>
|
||||
<TreatExternalTemplatesAsInternal>true</TreatExternalTemplatesAsInternal>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;JULIET_WIN32;_UNICODE;UNICODE;</PreprocessorDefinitions>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<LibCompiled>true</LibCompiled>
|
||||
<ClangClMode>true</ClangClMode>
|
||||
<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\"/>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
75
Juliet/Juliet.vcxproj.filters
Normal file
75
Juliet/Juliet.vcxproj.filters
Normal file
@@ -0,0 +1,75 @@
|
||||
<?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;c++;cppm;ixx;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;h++;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>
|
||||
<Filter Include="Header Files\Core">
|
||||
<UniqueIdentifier>{04f78748-69ab-4ed6-9a09-6c5803b9349d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Core\Platform">
|
||||
<UniqueIdentifier>{31dfc257-b706-4ff0-9e42-6eaed85e98fd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Core\Platform\Win32">
|
||||
<UniqueIdentifier>{4b8741bf-1fb9-4a70-9306-580c83cc0a6f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Core">
|
||||
<UniqueIdentifier>{aa0d4fbd-e094-4319-a06a-cc2c01dc20b5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Core\Platform">
|
||||
<UniqueIdentifier>{a210c51b-2a2a-4230-b78f-2aa7ed60963c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Core\Platform\Win32">
|
||||
<UniqueIdentifier>{7a443547-1774-4b54-b7f5-33569cb78ac9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Core\Application">
|
||||
<UniqueIdentifier>{866a221e-ead3-4274-9ea6-16fc33bbfa97}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Core\Application">
|
||||
<UniqueIdentifier>{fb5b80c0-3192-4fa8-927e-754264313c6f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Engine">
|
||||
<UniqueIdentifier>{e0c8b73d-66bc-446a-906f-e0e69fc74e25}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Header Files\Engine">
|
||||
<UniqueIdentifier>{caf51413-0c34-4b09-81db-9194fe3b244c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\Core\Application\IApplication.h">
|
||||
<Filter>Header Files\Core\Application</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Application\ApplicationManager.h">
|
||||
<Filter>Header Files\Core\Application</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Engine\Engine.h">
|
||||
<Filter>Header Files\Engine</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\Core\Platform\Win32\Win32.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Core\Application\ApplicationManager.cpp">
|
||||
<Filter>Source Files\Core\Application</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Engine\Engine.cpp">
|
||||
<Filter>Source Files\Engine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
9
Juliet/include/Core/Application/ApplicationManager.h
Normal file
9
Juliet/include/Core/Application/ApplicationManager.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Application/IApplication.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
enum class JulietInit_Flags : uint8;
|
||||
void StartApplication(IApplication& app, JulietInit_Flags flags);
|
||||
} // namespace Juliet
|
||||
14
Juliet/include/Core/Application/IApplication.h
Normal file
14
Juliet/include/Core/Application/IApplication.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
class IApplication
|
||||
{
|
||||
public:
|
||||
virtual ~IApplication() = default;
|
||||
virtual void Init() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
virtual void Update() = 0;
|
||||
virtual bool IsRunning() = 0;
|
||||
};
|
||||
} // namespace Juliet
|
||||
27
Juliet/include/Core/Common/CoreTypes.h
Normal file
27
Juliet/include/Core/Common/CoreTypes.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
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
|
||||
{
|
||||
const byte* Data;
|
||||
size_t Size;
|
||||
};
|
||||
} // namespace Juliet
|
||||
22
Juliet/include/Core/Common/CoreUtils.h
Normal file
22
Juliet/include/Core/Common/CoreUtils.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#if _DEBUG
|
||||
#define Assert(expression) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expression)) \
|
||||
{ \
|
||||
JulietAssert("Assertion Failed: " #expression); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#else
|
||||
#define Assert(Expression)
|
||||
#endif
|
||||
|
||||
void JulietAssert(const char* expression);
|
||||
91
Juliet/include/Core/Common/EnumUtils.h
Normal file
91
Juliet/include/Core/Common/EnumUtils.h
Normal file
@@ -0,0 +1,91 @@
|
||||
#pragma once
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
|
||||
template <typename E>
|
||||
requires std::is_enum_v<E>
|
||||
E operator~(E lhs)
|
||||
{
|
||||
using underlying = std::underlying_type_t<E>;
|
||||
return static_cast<E>(~static_cast<underlying>(lhs));
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
requires std::is_enum_v<E>
|
||||
E operator|(E lhs, E rhs)
|
||||
{
|
||||
using underlying = std::underlying_type_t<E>;
|
||||
return static_cast<E>(static_cast<underlying>(lhs) | static_cast<underlying>(rhs));
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
requires std::is_enum_v<E>
|
||||
E& operator|=(E& lhs, E rhs)
|
||||
{
|
||||
return lhs = lhs | rhs;
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
requires std::is_enum_v<E>
|
||||
E operator&(E lhs, E rhs)
|
||||
{
|
||||
using underlying = std::underlying_type_t<E>;
|
||||
return static_cast<E>(static_cast<underlying>(lhs) & static_cast<underlying>(rhs));
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
requires std::is_enum_v<E>
|
||||
E& operator&=(E& lhs, E rhs)
|
||||
{
|
||||
return lhs = lhs & rhs;
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
requires std::is_enum_v<E>
|
||||
E operator+(const E& lhs, const E& rhs)
|
||||
{
|
||||
using underlying = std::underlying_type_t<E>;
|
||||
return static_cast<E>(static_cast<underlying>(lhs) + static_cast<underlying>(rhs));
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
requires std::is_enum_v<E>
|
||||
E operator-(const E& lhs, const E& rhs)
|
||||
{
|
||||
using underlying = std::underlying_type_t<E>;
|
||||
return static_cast<E>(static_cast<underlying>(lhs) - static_cast<underlying>(rhs));
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
requires std::is_enum_v<E>
|
||||
E operator^(const E& lhs, const E& rhs)
|
||||
{
|
||||
using underlying = std::underlying_type_t<E>;
|
||||
return static_cast<E>(static_cast<underlying>(lhs) ^ static_cast<underlying>(rhs));
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
requires std::is_enum_v<E>
|
||||
E& operator^=(E& lhs, const E& rhs)
|
||||
{
|
||||
return lhs = lhs ^ rhs;
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
requires std::is_enum_v<E>
|
||||
constexpr std::underlying_type_t<E> ToUnderlying(E enm)
|
||||
{
|
||||
using underlying = std::underlying_type_t<E>;
|
||||
return static_cast<underlying>(enm);
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
requires std::is_enum_v<E>
|
||||
constexpr E ToEnum(std::underlying_type_t<E> value)
|
||||
{
|
||||
return static_cast<E>(value);
|
||||
}
|
||||
} // namespace Juliet
|
||||
14
Juliet/include/Core/Common/NonCopyable.h
Normal file
14
Juliet/include/Core/Common/NonCopyable.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
class NonCopyable
|
||||
{
|
||||
public:
|
||||
NonCopyable() = default;
|
||||
virtual ~NonCopyable() = default;
|
||||
|
||||
NonCopyable(const NonCopyable&) = delete;
|
||||
const NonCopyable& operator=(const NonCopyable&) = delete;
|
||||
};
|
||||
} // namespace Juliet
|
||||
14
Juliet/include/Core/Common/NonMovable.h
Normal file
14
Juliet/include/Core/Common/NonMovable.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
class NonMovable
|
||||
{
|
||||
public:
|
||||
NonMovable() = default;
|
||||
virtual ~NonMovable() = default;
|
||||
|
||||
NonMovable(const NonMovable&&) = delete;
|
||||
const NonMovable& operator=(const NonMovable&&) = delete;
|
||||
};
|
||||
} // namespace Juliet
|
||||
108
Juliet/include/Core/Common/NonNullPtr.h
Normal file
108
Juliet/include/Core/Common/NonNullPtr.h
Normal file
@@ -0,0 +1,108 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/CoreUtils.h>
|
||||
#include <type_traits>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
template <typename Type, typename OtherType>
|
||||
concept NonNullPtr_Convertible = std::is_convertible_v<OtherType*, Type*>;
|
||||
|
||||
template <typename Type, typename OtherType>
|
||||
concept NonNullPtr_SameType = std::is_same_v<OtherType*, Type*>;
|
||||
|
||||
template <typename Type>
|
||||
class NonNullPtr
|
||||
{
|
||||
public:
|
||||
NonNullPtr(Type* ptr)
|
||||
: InternalPtr(ptr)
|
||||
{
|
||||
Assert(ptr && "Tried to initialize a NonNullPtr with a null pointer");
|
||||
}
|
||||
|
||||
template <typename OtherType>
|
||||
requires NonNullPtr_Convertible<OtherType*, Type*>
|
||||
NonNullPtr(const NonNullPtr<OtherType>& otherPtr)
|
||||
: InternalPtr(otherPtr.Get())
|
||||
{
|
||||
Assert(InternalPtr && "Fatal Error: Assigned a non null ptr using another NonNullPtr but its was null.");
|
||||
}
|
||||
|
||||
// Assignment
|
||||
NonNullPtr& operator=(Type* ptr)
|
||||
{
|
||||
Assert(ptr && "Tried to assign a null pointer to a NonNullPtr!");
|
||||
InternalPtr = ptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename OtherType>
|
||||
requires NonNullPtr_Convertible<OtherType*, Type*>
|
||||
NonNullPtr& operator=(const NonNullPtr<OtherType>& otherPtr)
|
||||
{
|
||||
InternalPtr = otherPtr.Get();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Accessors
|
||||
operator Type*() const
|
||||
{
|
||||
Assert(InternalPtr && "NonNullPtr: Internal Pointer is Null");
|
||||
return InternalPtr;
|
||||
}
|
||||
|
||||
Type* Get() const
|
||||
{
|
||||
Assert(InternalPtr && "NonNullPtr: Internal Pointer is Null");
|
||||
return InternalPtr;
|
||||
}
|
||||
|
||||
Type& operator*() const
|
||||
{
|
||||
Assert(InternalPtr && "NonNullPtr: Internal Pointer is Null");
|
||||
return *InternalPtr;
|
||||
}
|
||||
|
||||
Type* operator->() const
|
||||
{
|
||||
Assert(InternalPtr && "NonNullPtr: Internal Pointer is Null");
|
||||
return InternalPtr;
|
||||
}
|
||||
|
||||
// Comparisons
|
||||
bool operator==(const NonNullPtr& otherPtr) const { return InternalPtr == otherPtr.InternalPtr; }
|
||||
|
||||
template <typename OtherType>
|
||||
requires NonNullPtr_SameType<Type, OtherType>
|
||||
bool operator==(OtherType* otherRawPtr) const
|
||||
{
|
||||
return InternalPtr == otherRawPtr;
|
||||
}
|
||||
|
||||
template <typename OtherType>
|
||||
requires NonNullPtr_SameType<Type, OtherType>
|
||||
friend bool operator==(OtherType* otherRawPtr, const NonNullPtr& nonNullPtr)
|
||||
{
|
||||
return otherRawPtr == nonNullPtr.InternalPtr;
|
||||
}
|
||||
|
||||
// Forbid assigning a nullptr at compile time
|
||||
NonNullPtr(std::nullptr_t)
|
||||
: InternalPtr(nullptr)
|
||||
{
|
||||
static_assert(sizeof(Type) == 0, "Trying to initialize a NonNullPtr with a nullptr value");
|
||||
}
|
||||
|
||||
NonNullPtr& operator=(std::nullptr_t)
|
||||
{
|
||||
static_assert(sizeof(Type) == 0, "Trying to assign a NonNullPtr with a nullptr value");
|
||||
return *this;
|
||||
}
|
||||
|
||||
explicit operator bool() const { return true; };
|
||||
|
||||
private:
|
||||
Type* InternalPtr;
|
||||
};
|
||||
} // namespace Juliet
|
||||
79
Juliet/include/Core/Common/Singleton.h
Normal file
79
Juliet/include/Core/Common/Singleton.h
Normal file
@@ -0,0 +1,79 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/NonCopyable.h>
|
||||
#include <Core/Common/NonMovable.h>
|
||||
#include <Core/Common/NonNullPtr.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Two usages : Inherit from Singleton or use the static methods to register to it when you want.
|
||||
// 1)
|
||||
// class IThing {};
|
||||
// class Thing : public Singleton::AutoRegister<IThing> {};
|
||||
template <typename Type>
|
||||
class Singleton final : public NonMovable, public NonCopyable
|
||||
{
|
||||
public:
|
||||
static void Register(NonNullPtr<Type> type);
|
||||
static void Unregister(NonNullPtr<Type> type);
|
||||
static Type* Get();
|
||||
|
||||
class AutoRegister : public Type
|
||||
{
|
||||
public:
|
||||
AutoRegister();
|
||||
virtual ~AutoRegister();
|
||||
};
|
||||
|
||||
private:
|
||||
static Type* sInstance;
|
||||
static bool sIsRegistered;
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
bool Singleton<Type>::sIsRegistered = false;
|
||||
|
||||
template <typename Type>
|
||||
Type* Singleton<Type>::sInstance = nullptr;
|
||||
|
||||
template <typename Type>
|
||||
void Singleton<Type>::Register(NonNullPtr<Type> type)
|
||||
{
|
||||
Assert(!Get() && "Singleton is already registered. Make sure to only register it once");
|
||||
sInstance = type.Get();
|
||||
sIsRegistered = true;
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
void Singleton<Type>::Unregister(NonNullPtr<Type> type)
|
||||
{
|
||||
Assert(sIsRegistered && "Trying to unregister a singleton that is not registered");
|
||||
Assert(sInstance == type &&
|
||||
"Trying to unregister an instance that is different from the one currently registered");
|
||||
|
||||
sInstance = nullptr;
|
||||
sIsRegistered = false;
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
Type* Singleton<Type>::Get()
|
||||
{
|
||||
if (sIsRegistered)
|
||||
{
|
||||
return sInstance;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
Singleton<Type>::AutoRegister::AutoRegister()
|
||||
{
|
||||
Singleton<Type>::Register(this);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
Singleton<Type>::AutoRegister::~AutoRegister()
|
||||
{
|
||||
Singleton<Type>::Unregister(this);
|
||||
}
|
||||
} // namespace Juliet
|
||||
11
Juliet/include/Core/Container/Vector.h
Normal file
11
Juliet/include/Core/Container/Vector.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
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>
|
||||
{
|
||||
};
|
||||
} // namespace Juliet
|
||||
18
Juliet/include/Core/HAL/Display/Display.h
Normal file
18
Juliet/include/Core/HAL/Display/Display.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/CoreTypes.h>
|
||||
#include <core/Common/NonNullPtr.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 void ShowWindow(NonNullPtr<Window> window);
|
||||
extern void HideWindow(NonNullPtr<Window> window);
|
||||
|
||||
extern WindowID GetWindowID(NonNullPtr<Window> window);
|
||||
} // namespace Juliet
|
||||
120
Juliet/include/Core/HAL/Event/SystemEvent.h
Normal file
120
Juliet/include/Core/HAL/Event/SystemEvent.h
Normal file
@@ -0,0 +1,120 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/HAL/Display/Display.h>
|
||||
#include <Core/HAL/Keyboard/Keyboard.h>
|
||||
#include <Core/HAL/Keyboard/KeyCode.h>
|
||||
#include <Core/HAL/Mouse/Mouse.h>
|
||||
|
||||
// Handles all events from systems handling the Hardware
|
||||
// Very inspired by SDL3
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
enum class EventType : uint32
|
||||
{
|
||||
None = 0,
|
||||
First = None,
|
||||
|
||||
// Application Events
|
||||
// User querying an exit
|
||||
Application_Exit = 100,
|
||||
// OS terminating the application
|
||||
Application_OS_Terminate,
|
||||
Application_Begin = Application_Exit,
|
||||
Application_End = Application_OS_Terminate,
|
||||
|
||||
// Window Events
|
||||
Window_Close_Request = 200,
|
||||
Window_Begin = Window_Close_Request,
|
||||
Window_End = Window_Close_Request,
|
||||
|
||||
// Keyboard Event
|
||||
Key_Down = 300,
|
||||
Key_Up,
|
||||
Keyboard_Begin = Key_Down,
|
||||
Keyboard_End = Key_Up,
|
||||
|
||||
// Mouse Event
|
||||
Mouse_Move = 400,
|
||||
Mouse_ButtonPressed,
|
||||
Mouse_ButtonReleased,
|
||||
|
||||
Mouse_Begin = Mouse_Move,
|
||||
Mouse_End = Mouse_ButtonReleased,
|
||||
|
||||
Last // Get value from the previous one
|
||||
};
|
||||
|
||||
struct WindowEvent
|
||||
{
|
||||
WindowID AssociatedWindowID;
|
||||
uint32 DataPadding[2]; // TODO : define how much data param we need
|
||||
};
|
||||
|
||||
struct KeyboardEvent
|
||||
{
|
||||
KeyboardID AssociatedKeyboardID;
|
||||
WindowID WindowID;
|
||||
Key Key;
|
||||
KeyState KeyState;
|
||||
KeyMod KeyModeState;
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// Mouse Events
|
||||
// =====================================================
|
||||
struct MouseMovementEvent
|
||||
{
|
||||
MouseID AssociatedMouseID;
|
||||
WindowID WindowID;
|
||||
float X;
|
||||
float Y;
|
||||
float X_Displacement;
|
||||
float Y_Displacement;
|
||||
MouseButton ButtonState;
|
||||
};
|
||||
|
||||
struct MouseButtonEvent
|
||||
{
|
||||
MouseID AssociatedMouseID;
|
||||
WindowID WindowID;
|
||||
float X;
|
||||
float Y;
|
||||
MouseButton ButtonState;
|
||||
bool IsPressed : 1;
|
||||
};
|
||||
|
||||
// Tagged union representing ALL possible system events + a bit of data for custom event if needed
|
||||
union AllSystemEventUnion
|
||||
{
|
||||
WindowEvent Window;
|
||||
KeyboardEvent Keyboard;
|
||||
MouseMovementEvent MouseMovement;
|
||||
MouseButtonEvent MouseButton;
|
||||
uint8 Padding[128]; // Make sure that the union is fixed in size and big enough on all platforms.
|
||||
};
|
||||
// Make sure we do not bust the union size
|
||||
static_assert(sizeof(AllSystemEventUnion) == sizeof(((AllSystemEventUnion*)nullptr)->Padding));
|
||||
|
||||
struct SystemEvent
|
||||
{
|
||||
EventType Type;
|
||||
uint64 Timestamp;
|
||||
AllSystemEventUnion Data;
|
||||
};
|
||||
|
||||
// Poll for any event, return false if no event is available.
|
||||
// Equivalent to WaitEvent(event, 0);
|
||||
// Will not block
|
||||
extern 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);
|
||||
|
||||
// Add an event onto the event queue.
|
||||
// TODO : support array of events
|
||||
extern bool AddEvent(SystemEvent& event);
|
||||
} // namespace Juliet
|
||||
191
Juliet/include/Core/HAL/Keyboard/KeyCode.h
Normal file
191
Juliet/include/Core/HAL/Keyboard/KeyCode.h
Normal file
@@ -0,0 +1,191 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Represents a Virtual Key corresponding to the Physical key, but localized using the keyboard layout
|
||||
// ScanCode reprensent US ASCII Keyboard
|
||||
// WASD Scan codes are ZQSD in KeyCode for French keyboard
|
||||
// We use the ASCII value of the generated character as value, when possible.
|
||||
// Keys that do not produce a character are converted to an abritrary value high enough to not conflict
|
||||
// Reference: https://www.asciitable.com/
|
||||
// Reference: https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-6.0/aa299374(v=vs.60)
|
||||
enum class KeyCode : uint32
|
||||
{
|
||||
Unknown = 0x0, // 0
|
||||
Unsupported = 0x0, // 0
|
||||
Return = 0X0Du, // '\r'
|
||||
Escape = 0X1Bu, // '\X1B'
|
||||
Backspace = 0X08u, // '\b'
|
||||
Tab = 0X09u, // '\t'
|
||||
Space = 0X20u, // ' '
|
||||
ExclamationPoint = 0X21u, // '!'
|
||||
DoubleApostrophe = 0X22u, // '"'
|
||||
Hash = 0X23u, // '#'
|
||||
Dollar = 0X24u, // '$'
|
||||
Percent = 0X25u, // '%'
|
||||
Ampersand = 0X26u, // '&'
|
||||
Apostrophe = 0X27u, // '\''
|
||||
LeftParenthesis = 0X28u, // '('
|
||||
RightParenthesis = 0X29u, // ')'
|
||||
Asterisk = 0X2Au, // '*'
|
||||
Plus = 0X2Bu, // '+'
|
||||
Comma = 0X2Cu, // ','
|
||||
Minus = 0X2Du, // '-'
|
||||
Period = 0X2Eu, // '.'
|
||||
Slash = 0X2Fu, // '/'
|
||||
Num0 = 0X30u, // '0'
|
||||
Num1 = 0X31u, // '1'
|
||||
Num2 = 0X32u, // '2'
|
||||
Num3 = 0X33u, // '3'
|
||||
Num4 = 0X34u, // '4'
|
||||
Num5 = 0X35u, // '5'
|
||||
Num6 = 0X36u, // '6'
|
||||
Num7 = 0X37u, // '7'
|
||||
Num8 = 0X38u, // '8'
|
||||
Num9 = 0X39u, // '9'
|
||||
Colon = 0X3Au, // ':'
|
||||
Semicolon = 0X3Bu, // ';'
|
||||
LessThan = 0X3Cu, // '<'
|
||||
Equals = 0X3Du, // '='
|
||||
GreaterThan = 0X3Eu, // '>'
|
||||
QuestionMark = 0X3Fu, // '?'
|
||||
CommercialAt = 0x40u, // '@'
|
||||
LeftBracket = 0X5Bu, // '['
|
||||
Backslash = 0X5Cu, // '\\'
|
||||
RightBracket = 0X5DU, // ']'
|
||||
Caret = 0X5Eu, // '^'
|
||||
Underscore = 0X5Fu, // '_'
|
||||
GraveAccent = 0X60u, // '`'
|
||||
A = 0x61u, // 'a'
|
||||
B = 0x62u, // 'b'
|
||||
C = 0x63u, // 'c'
|
||||
D = 0x64u, // 'd'
|
||||
E = 0x65u, // 'e'
|
||||
F = 0x66u, // 'f'
|
||||
G = 0x67u, // 'g'
|
||||
H = 0x68u, // 'h'
|
||||
I = 0x69u, // 'i'
|
||||
J = 0x6Au, // 'j'
|
||||
K = 0x6Bu, // 'k'
|
||||
L = 0x6CU, // 'l'
|
||||
M = 0x6DU, // 'm'
|
||||
N = 0x6Eu, // 'n'
|
||||
O = 0x6Fu, // 'o'
|
||||
P = 0x70u, // 'p'
|
||||
Q = 0x71u, // 'q'
|
||||
R = 0x72u, // 'r'
|
||||
S = 0x73u, // 's'
|
||||
T = 0x74u, // 't'
|
||||
U = 0x75u, // 'y'
|
||||
V = 0x76u, // 'v'
|
||||
W = 0x77u, // 'w'
|
||||
X = 0x78u, // 'x'
|
||||
Y = 0x79u, // 'y'
|
||||
Z = 0x7Au, // 'z'
|
||||
LeftBrace = 0x7BU, // '{'
|
||||
Pipe = 0x7CU, // '|'
|
||||
RightBrace = 0x7DU, // '}'
|
||||
Tilde = 0x7Eu, // '~'
|
||||
Delete = 0x7Fu, // '\x7F'
|
||||
PlusMinus = 0xb1u, // '\xB1'
|
||||
|
||||
// Keys not producing a character
|
||||
// Based on SDL Algo: ScanCode | 0x40000000
|
||||
CapsLock = 0x40000039u,
|
||||
F1 = 0x4000003Au,
|
||||
F2 = 0x4000003Bu,
|
||||
F3 = 0x4000003CU,
|
||||
F4 = 0x4000003DU,
|
||||
F5 = 0x4000003Eu,
|
||||
F6 = 0x4000003Fu,
|
||||
F7 = 0x40000040u,
|
||||
F8 = 0x40000041u,
|
||||
F9 = 0x40000042u,
|
||||
F10 = 0x40000043u,
|
||||
F11 = 0x40000044u,
|
||||
F12 = 0x40000045u,
|
||||
PrintScreen = 0x40000046u,
|
||||
ScrollLock = 0x40000047u,
|
||||
Pause = 0x40000048u,
|
||||
Insert = 0x40000049u,
|
||||
Home = 0x4000004Au,
|
||||
PageUp = 0x4000004Bu,
|
||||
End = 0x4000004DU,
|
||||
PageDown = 0x4000004Eu,
|
||||
RightArrow = 0x4000004Fu,
|
||||
LeftArrow = 0x40000050u,
|
||||
DownArrow = 0x40000051u,
|
||||
UpArrow = 0x40000052u,
|
||||
NumlockClear = 0x40000053u,
|
||||
KeyPad_Divide = 0x40000054u,
|
||||
KeyPad_Multiply = 0x40000055u,
|
||||
KeyPad_Minus = 0x40000056u,
|
||||
KeyPad_Plus = 0x40000057u,
|
||||
KeyPad_Enter = 0x40000058u,
|
||||
KeyPad_Num1 = 0x40000059u,
|
||||
KeyPad_Num2 = 0x4000005Au,
|
||||
KeyPad_Num3 = 0x4000005Bu,
|
||||
KeyPad_Num4 = 0x4000005Cu,
|
||||
KeyPad_Num5 = 0x4000005Du,
|
||||
KeyPad_Num6 = 0x4000005Eu,
|
||||
KeyPad_Num7 = 0x4000005Fu,
|
||||
KeyPad_Num8 = 0x40000060u,
|
||||
KeyPad_Num9 = 0x40000061u,
|
||||
KeyPad_Num0 = 0x40000062u,
|
||||
KeyPad_Period = 0x40000063u,
|
||||
Power = 0x40000066u,
|
||||
KeyPad_Equals = 0x40000067u,
|
||||
F13 = 0x40000068u,
|
||||
F14 = 0x40000069u,
|
||||
F15 = 0x4000006Au,
|
||||
F16 = 0x4000006Bu,
|
||||
F17 = 0x4000006Cu,
|
||||
F18 = 0x4000006Du,
|
||||
F19 = 0x4000006Eu,
|
||||
F20 = 0x4000006Fu,
|
||||
F21 = 0x40000070u,
|
||||
F22 = 0x40000071u,
|
||||
F23 = 0x40000072u,
|
||||
F24 = 0x40000073u,
|
||||
Mute = 0x4000007Fu,
|
||||
VolumeUp = 0x40000080u,
|
||||
VolumeDown = 0x40000081u,
|
||||
KeyPad_Comma = 0x40000085u,
|
||||
LeftControl = 0x400000E0u,
|
||||
LeftShift = 0x400000E1u,
|
||||
LeftAlt = 0x400000E2u,
|
||||
LeftOSCommand = 0x400000E3u,
|
||||
RightControl = 0x400000E4u,
|
||||
RightShift = 0x400000E5u,
|
||||
RightAlt = 0x400000E6u,
|
||||
RightOSCommand = 0x400000E7u,
|
||||
Sleep = 0x40000102u,
|
||||
WakeUp = 0x40000103u,
|
||||
Media_NextTrack = 0x4000010Bu,
|
||||
Media_PreviousTrack = 0x4000010Cu,
|
||||
Media_Stop = 0x4000010Du,
|
||||
Media_Eject = 0x4000010Eu,
|
||||
Media_PlayPause = 0x4000010Fu,
|
||||
Media_Select = 0x40000110u,
|
||||
};
|
||||
|
||||
enum class KeyMod : uint16
|
||||
{
|
||||
None = 0b0,
|
||||
LeftShift = 0b0000'0000'0001u,
|
||||
RightShift = 0b0000'0000'0010u,
|
||||
LeftControl = 0b0000'0000'0100u,
|
||||
RightControl = 0b0000'0000'1000u,
|
||||
LeftAlt = 0b0000'0001'000u,
|
||||
RightAlt = 0b0000'0010'0000u,
|
||||
LeftOSCommand = 0b0000'0100'0000u,
|
||||
RightOSCommand = 0b0000'1000'0000u,
|
||||
NumLock = 0b0001'0000'0000u,
|
||||
CapsLock = 0b0010'0000'0000u,
|
||||
ScrollLock = 0b0100'0000'0000u,
|
||||
Control = LeftControl | RightControl,
|
||||
Shift = LeftShift | RightShift,
|
||||
Alt = LeftAlt | RightAlt,
|
||||
OSCommand = LeftOSCommand | RightOSCommand,
|
||||
};
|
||||
} // namespace Juliet
|
||||
27
Juliet/include/Core/HAL/Keyboard/Keyboard.h
Normal file
27
Juliet/include/Core/HAL/Keyboard/Keyboard.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/HAL/Keyboard/KeyCode.h>
|
||||
#include <Core/HAL/Keyboard/ScanCode.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
using KeyboardID = uint8;
|
||||
|
||||
enum class KeyState : bool
|
||||
{
|
||||
Up = false,
|
||||
Down = true
|
||||
};
|
||||
|
||||
struct Key
|
||||
{
|
||||
ScanCode ScanCode;
|
||||
KeyCode KeyCode;
|
||||
uint16 Raw;
|
||||
};
|
||||
|
||||
extern bool IsKeyDown(ScanCode scanCode);
|
||||
|
||||
extern KeyMod GetKeyModState();
|
||||
extern KeyCode GetKeyCodeFromScanCode(ScanCode scanCode, KeyMod keyModState);
|
||||
} // namespace Juliet
|
||||
186
Juliet/include/Core/HAL/Keyboard/ScanCode.h
Normal file
186
Juliet/include/Core/HAL/Keyboard/ScanCode.h
Normal file
@@ -0,0 +1,186 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Follow the HID Usage page for USB
|
||||
// https://usb.org/sites/default/files/hut1_5.pdf
|
||||
// 0 to 256 Is dedicated to Keyboard Usage Page (0x07)
|
||||
// 257 to 286 Is dedicated to Consumer Usage Page (0xC)
|
||||
// 287 to 511 Is not implemented. Could be used for Mobile or Consoles
|
||||
// ScanCode reprensent Physical Keys and Buttons
|
||||
enum class ScanCode : uint16
|
||||
{
|
||||
Unknown = 0,
|
||||
Unsupported = 0,
|
||||
|
||||
A = 4,
|
||||
B = 5,
|
||||
C = 6,
|
||||
D = 7,
|
||||
E = 8,
|
||||
F = 9,
|
||||
G = 10,
|
||||
H = 11,
|
||||
I = 12,
|
||||
J = 13,
|
||||
K = 14,
|
||||
L = 15,
|
||||
M = 16,
|
||||
N = 17,
|
||||
O = 18,
|
||||
P = 19,
|
||||
Q = 20,
|
||||
R = 21,
|
||||
S = 22,
|
||||
T = 23,
|
||||
U = 24,
|
||||
V = 25,
|
||||
W = 26,
|
||||
X = 27,
|
||||
Y = 28,
|
||||
Z = 29,
|
||||
|
||||
Num1 = 30,
|
||||
Num2 = 31,
|
||||
Num3 = 32,
|
||||
Num4 = 33,
|
||||
Num5 = 34,
|
||||
Num6 = 35,
|
||||
Num7 = 36,
|
||||
Num8 = 37,
|
||||
Num9 = 38,
|
||||
Num0 = 39,
|
||||
|
||||
Return = 40,
|
||||
Escape = 41,
|
||||
Backspace = 42,
|
||||
Tab = 43,
|
||||
Space = 44,
|
||||
|
||||
Minus = 45,
|
||||
Equals = 46,
|
||||
LeftBracket = 47,
|
||||
RightBracket = 48,
|
||||
Backslash = 49,
|
||||
NonUSHash = 50, // Same as 49 but for ISO keyboards
|
||||
Semicolon = 51,
|
||||
Apostrophe = 52,
|
||||
GraveAccent = 53,
|
||||
Comma = 54,
|
||||
Period = 55,
|
||||
Slash = 56,
|
||||
CapsLock = 57,
|
||||
|
||||
F1 = 58,
|
||||
F2 = 59,
|
||||
F3 = 60,
|
||||
F4 = 61,
|
||||
F5 = 62,
|
||||
F6 = 63,
|
||||
F7 = 64,
|
||||
F8 = 65,
|
||||
F9 = 66,
|
||||
F10 = 67,
|
||||
F11 = 68,
|
||||
F12 = 69,
|
||||
|
||||
PrintScreen = 70,
|
||||
ScrollLock = 71,
|
||||
Pause = 72,
|
||||
Insert = 73,
|
||||
|
||||
Home = 74,
|
||||
PageUp = 75,
|
||||
Delete = 76,
|
||||
End = 77,
|
||||
PageDown = 78,
|
||||
RightArrow = 79,
|
||||
LeftArrow = 80,
|
||||
DownArrow = 81,
|
||||
UpArrow = 82,
|
||||
|
||||
NumlockClear = 83, // Pc = Numlock / Mac = Clear
|
||||
|
||||
KeyPad_Divide = 84,
|
||||
KeyPad_Multiply = 85,
|
||||
KeyPad_Minus = 86,
|
||||
KeyPad_Plus = 87,
|
||||
KeyPad_Enter = 88,
|
||||
KeyPad_Num1 = 89,
|
||||
KeyPad_Num2 = 90,
|
||||
KeyPad_Num3 = 91,
|
||||
KeyPad_Num4 = 92,
|
||||
KeyPad_Num5 = 93,
|
||||
KeyPad_Num6 = 94,
|
||||
KeyPad_Num7 = 95,
|
||||
KeyPad_Num8 = 96,
|
||||
KeyPad_Num9 = 97,
|
||||
KeyPad_Num0 = 98,
|
||||
KeyPad_Period = 99,
|
||||
|
||||
NonUSBackslash = 100, // ISO keyboards only
|
||||
Power = 102, // Some mac have a Power key
|
||||
|
||||
KeyPad_Equals = 103,
|
||||
F13 = 104,
|
||||
F14 = 105,
|
||||
F15 = 106,
|
||||
F16 = 107,
|
||||
F17 = 108,
|
||||
F18 = 109,
|
||||
F19 = 110,
|
||||
F20 = 111,
|
||||
F21 = 112,
|
||||
F22 = 113,
|
||||
F23 = 114,
|
||||
F24 = 115,
|
||||
|
||||
Mute = 127,
|
||||
VolumeUp = 128,
|
||||
VolumeDown = 129,
|
||||
|
||||
KeyPad_Comma = 133,
|
||||
|
||||
International1 = 135, // Mostly used on Asian keyboards
|
||||
International2 = 136,
|
||||
International3 = 137, // Yen Symbol
|
||||
International4 = 138,
|
||||
International5 = 139,
|
||||
International6 = 140,
|
||||
International7 = 141,
|
||||
International8 = 142,
|
||||
International9 = 143,
|
||||
Lang1 = 144, // Hangul (Korean)
|
||||
Lang2 = 145, // Hanja (Korean)
|
||||
Lang3 = 146, // Katakana (Japanese)
|
||||
Lang4 = 147, // Hiragana (Japanese)
|
||||
Lang5 = 148, // Zenkaku/Hankaku (Japanese)
|
||||
Lang6 = 149, // Unused
|
||||
Lang7 = 150, // Unused
|
||||
Lang8 = 151, // Unused
|
||||
Lang9 = 152, // Unused
|
||||
|
||||
LeftControl = 224,
|
||||
LeftShift = 225,
|
||||
LeftAlt = 226, // Alt for PC, Option for Mac
|
||||
LeftOSCommand = 227, // Window key for PC, Command for Mac
|
||||
RightControl = 228,
|
||||
RightShift = 229,
|
||||
RightAlt = 230, // Alt Gr for PC, Option for Mac
|
||||
RightOSCommand = 231, // Window key for PC, Command for Mac
|
||||
|
||||
Sleep = 258,
|
||||
WakeUp = 259,
|
||||
|
||||
Media_NextTrack = 267,
|
||||
Media_PreviousTrack = 268,
|
||||
Media_Stop = 269,
|
||||
Media_Eject = 270,
|
||||
Media_PlayPause = 271,
|
||||
Media_Select = 272,
|
||||
|
||||
Reserved = 287,
|
||||
|
||||
Count = 512
|
||||
};
|
||||
} // namespace Juliet
|
||||
27
Juliet/include/Core/HAL/Mouse/Mouse.h
Normal file
27
Juliet/include/Core/HAL/Mouse/Mouse.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
using MouseID = uint8;
|
||||
|
||||
enum class MouseButton : uint8
|
||||
{
|
||||
None = 0,
|
||||
Left = 1 << 0,
|
||||
Right = 1 << 1,
|
||||
Middle = 1 << 2,
|
||||
Button1 = 1 << 3,
|
||||
Button2 = 1 << 4,
|
||||
};
|
||||
|
||||
// TODO : Replace by Vector2f
|
||||
struct MousePosition
|
||||
{
|
||||
float X;
|
||||
float Y;
|
||||
};
|
||||
|
||||
extern bool IsMouseButtonDown(MouseButton button);
|
||||
extern MousePosition GetMousePosition();
|
||||
extern MouseButton GetMouseButtonState();
|
||||
} // namespace Juliet
|
||||
18
Juliet/include/Core/JulietInit.h
Normal file
18
Juliet/include/Core/JulietInit.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/CoreTypes.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
enum class JulietInit_Flags : uint8
|
||||
{
|
||||
None = 0,
|
||||
Display = 1 << 0,
|
||||
Audio = 1 << 1,
|
||||
Count = Audio,
|
||||
All = 0xFb
|
||||
};
|
||||
|
||||
void JulietInit(JulietInit_Flags flags);
|
||||
void JulietShutdown();
|
||||
} // namespace Juliet
|
||||
43
Juliet/include/Core/Logging/LogManager.h
Normal file
43
Juliet/include/Core/Logging/LogManager.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
// TODO : Juliet strings
|
||||
#include <string>
|
||||
// TODO Juliet Containers + Allocators...
|
||||
#include <deque>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
enum class LogLevel : uint8;
|
||||
enum class LogCategory : uint8;
|
||||
|
||||
class LogManager final
|
||||
{
|
||||
public:
|
||||
LogManager();
|
||||
|
||||
void Init();
|
||||
void Shutdown();
|
||||
bool GetIsInitialized() const { return IsInitialized; }
|
||||
|
||||
private:
|
||||
struct Entry
|
||||
{
|
||||
std::string Value;
|
||||
uint64_t Time;
|
||||
LogLevel Level;
|
||||
LogCategory Category;
|
||||
|
||||
Entry(std::string& value, LogLevel level, LogCategory category);
|
||||
};
|
||||
std::deque<Entry> Entries;
|
||||
bool IsInitialized : 1;
|
||||
|
||||
friend void Log(LogLevel level, LogCategory category, const char* fmt, ...);
|
||||
void AddEntry(Entry&& entry);
|
||||
static void OutputLog(Entry& entry);
|
||||
};
|
||||
|
||||
void InitializeLogManager();
|
||||
void ShutdownLogManager();
|
||||
void Log(LogLevel level, LogCategory category, const char* fmt, ...);
|
||||
} // namespace Juliet
|
||||
20
Juliet/include/Core/Logging/LogTypes.h
Normal file
20
Juliet/include/Core/Logging/LogTypes.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
enum class LogLevel : uint8
|
||||
{
|
||||
Message = 0,
|
||||
Warning = 1,
|
||||
Error = 2,
|
||||
};
|
||||
|
||||
enum class LogCategory : uint8
|
||||
{
|
||||
Core = 0,
|
||||
Networking = 1,
|
||||
Engine = 2,
|
||||
Editor = 3,
|
||||
Game = 4,
|
||||
};
|
||||
} // namespace Juliet
|
||||
28
Juliet/include/Core/Memory/Allocator.h
Normal file
28
Juliet/include/Core/Memory/Allocator.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <core/Common/CoreTypes.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Uninitialized allocation
|
||||
void* Malloc(size_t nb_elem, 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);
|
||||
|
||||
// Free
|
||||
template <typename Type>
|
||||
void Free(Type* memory)
|
||||
{
|
||||
Assert(memory);
|
||||
free(memory);
|
||||
}
|
||||
// Free and Set the ptr to nullptr
|
||||
template <typename Type>
|
||||
void SafeFree(Type*& memory)
|
||||
{
|
||||
Assert(memory);
|
||||
free(memory);
|
||||
memory = nullptr;
|
||||
}
|
||||
} // namespace Juliet
|
||||
3
Juliet/include/Core/Memory/Utils.h
Normal file
3
Juliet/include/Core/Memory/Utils.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define ArraySize(array) (sizeof(array) / sizeof(array[0]))
|
||||
11
Juliet/include/Core/Networking/IPAddress.h
Normal file
11
Juliet/include/Core/Networking/IPAddress.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/CoreTypes.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// TODO : Do something better.
|
||||
constexpr uint32 kLocalhost = (127 << 3) | (0 << 2) | (0 << 1) | 1;
|
||||
constexpr uint32 kAnyIp = 0;
|
||||
constexpr uint32 kBroadcastIp = (255 << 3) | (255 << 2) | (255 << 1) | 255;
|
||||
} // namespace Juliet
|
||||
35
Juliet/include/Core/Networking/NetworkPacket.h
Normal file
35
Juliet/include/Core/Networking/NetworkPacket.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <core/Common/CoreTypes.h>
|
||||
#include <Core/Container/Vector.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
class NetworkPacket
|
||||
{
|
||||
public:
|
||||
NetworkPacket();
|
||||
virtual ~NetworkPacket();
|
||||
NetworkPacket(NetworkPacket&);
|
||||
NetworkPacket& operator=(const NetworkPacket&);
|
||||
NetworkPacket(NetworkPacket&&) noexcept;
|
||||
NetworkPacket& operator=(NetworkPacket&&) noexcept;
|
||||
|
||||
ByteBuffer GetRawData();
|
||||
|
||||
// Unpack
|
||||
|
||||
// Pack
|
||||
NetworkPacket& operator<<(uint32 value);
|
||||
NetworkPacket& operator<<(const char* data);
|
||||
|
||||
protected:
|
||||
void Append(ByteBuffer buffer);
|
||||
|
||||
friend class TcpSocket;
|
||||
|
||||
private:
|
||||
Vector<byte> Data;
|
||||
size_t PartialSendIndex = 0;
|
||||
};
|
||||
} // namespace Juliet
|
||||
54
Juliet/include/Core/Networking/Socket.h
Normal file
54
Juliet/include/Core/Networking/Socket.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/NonCopyable.h>
|
||||
#include <Core/Networking/SocketHandle.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
class Socket : NonCopyable
|
||||
{
|
||||
public:
|
||||
~Socket() override;
|
||||
|
||||
Socket(Socket&& other) noexcept;
|
||||
Socket& operator=(Socket&& socket) noexcept;
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
enum class Status : uint8
|
||||
{
|
||||
Done,
|
||||
Partial,
|
||||
Ready,
|
||||
NotReady,
|
||||
Disconnected,
|
||||
Error
|
||||
};
|
||||
|
||||
protected:
|
||||
enum class Protocol : uint8
|
||||
{
|
||||
TCP,
|
||||
UDP
|
||||
};
|
||||
|
||||
// To store the result of a send/receive on the socket
|
||||
struct RequestStatus
|
||||
{
|
||||
Status Status = Status::Done;
|
||||
size_t Length = 0;
|
||||
};
|
||||
|
||||
explicit Socket(Protocol protocol);
|
||||
|
||||
SocketHandle GetHandle() const { return Handle; }
|
||||
|
||||
void Create();
|
||||
void CreateFromHandle(SocketHandle handle);
|
||||
void Close();
|
||||
|
||||
private:
|
||||
SocketHandle Handle;
|
||||
Protocol ProtocolType;
|
||||
};
|
||||
} // namespace Juliet
|
||||
14
Juliet/include/Core/Networking/SocketHandle.h
Normal file
14
Juliet/include/Core/Networking/SocketHandle.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#if JULIET_WIN32
|
||||
#include <basetsd.h>
|
||||
#endif
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
#if JULIET_WIN32
|
||||
using SocketHandle = UINT_PTR;
|
||||
#else
|
||||
using SocketHandle = int;
|
||||
#endif
|
||||
} // namespace Juliet
|
||||
18
Juliet/include/Core/Networking/TcpListener.h
Normal file
18
Juliet/include/Core/Networking/TcpListener.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Networking/IPAddress.h>
|
||||
#include <Core/Networking/Socket.h>
|
||||
#include <Core/Networking/TcpSocket.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
class TcpListener : public Socket
|
||||
{
|
||||
public:
|
||||
TcpListener();
|
||||
|
||||
Status Listen(uint16 port, uint32 address = kAnyIp);
|
||||
Status Accept(TcpSocket& socket);
|
||||
void Close();
|
||||
};
|
||||
} // namespace Juliet
|
||||
21
Juliet/include/Core/Networking/TcpSocket.h
Normal file
21
Juliet/include/Core/Networking/TcpSocket.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Networking/Socket.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
class NetworkPacket;
|
||||
|
||||
class TcpSocket : public Socket
|
||||
{
|
||||
public:
|
||||
TcpSocket();
|
||||
|
||||
RequestStatus Send(NetworkPacket& packet);
|
||||
RequestStatus Send(ByteBuffer buffer);
|
||||
Status Receive(NetworkPacket& outPacket);
|
||||
|
||||
private:
|
||||
friend class TcpListener;
|
||||
};
|
||||
} // namespace Juliet
|
||||
9
Juliet/include/Core/Thread/Mutex.h
Normal file
9
Juliet/include/Core/Thread/Mutex.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
using Mutex = std::mutex;
|
||||
using LockGuard = std::lock_guard<Mutex>;
|
||||
} // namespace Juliet
|
||||
8
Juliet/include/Core/Thread/Thread.h
Normal file
8
Juliet/include/Core/Thread/Thread.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <thread>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
using Thread = std::thread;
|
||||
}
|
||||
21
Juliet/include/Engine/Engine.h
Normal file
21
Juliet/include/Engine/Engine.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Application/IApplication.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
enum class JulietInit_Flags : uint8;
|
||||
|
||||
struct Engine
|
||||
{
|
||||
IApplication* Application = nullptr;
|
||||
};
|
||||
|
||||
void InitializeEngine(JulietInit_Flags flags);
|
||||
void ShutdownEngine();
|
||||
|
||||
void LoadApplication(IApplication& app);
|
||||
void UnloadApplication();
|
||||
|
||||
void RunEngine();
|
||||
} // namespace Juliet
|
||||
9
Juliet/include/Graphics/Graphics.h
Normal file
9
Juliet/include/Graphics/Graphics.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <Graphics/GraphicsConfig.h>
|
||||
|
||||
// Graphics Interface
|
||||
namespace Juliet::Graphics
|
||||
{
|
||||
// Add functions to create windows, device, attach to the window etc...
|
||||
} // namespace Juliet::Graphics
|
||||
14
Juliet/include/Graphics/GraphicsConfig.h
Normal file
14
Juliet/include/Graphics/GraphicsConfig.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
enum class RendererType
|
||||
{
|
||||
DX12 = 0
|
||||
};
|
||||
|
||||
struct GraphicsConfig
|
||||
{
|
||||
RendererType Renderer = RendererType::DX12;
|
||||
};
|
||||
}
|
||||
15
Juliet/include/pch.h
Normal file
15
Juliet/include/pch.h
Normal file
@@ -0,0 +1,15 @@
|
||||
// pch.h: This is a precompiled header file.
|
||||
// Files listed below are compiled only once, improving build performance for future builds.
|
||||
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
||||
#include <Core/Common/CoreTypes.h>
|
||||
#include <Core/Common/CoreUtils.h>
|
||||
#include <Core/Logging/LogManager.h>
|
||||
#include <Core/Logging/LogTypes.h>
|
||||
|
||||
#endif // PCH_H
|
||||
22
Juliet/src/Core/Application/ApplicationManager.cpp
Normal file
22
Juliet/src/Core/Application/ApplicationManager.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Application/ApplicationManager.h>
|
||||
#include <Core/JulietInit.h>
|
||||
|
||||
#include <Engine/Engine.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
void StartApplication(IApplication& app, JulietInit_Flags flags)
|
||||
{
|
||||
InitializeEngine(flags);
|
||||
|
||||
LoadApplication(app);
|
||||
|
||||
RunEngine();
|
||||
|
||||
UnloadApplication();
|
||||
|
||||
ShutdownEngine();
|
||||
}
|
||||
} // namespace Juliet
|
||||
7
Juliet/src/Core/Common/CoreUtils.cpp
Normal file
7
Juliet/src/Core/Common/CoreUtils.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <pch.h>
|
||||
|
||||
void JulietAssert(const char* expression)
|
||||
{
|
||||
Juliet::Log(Juliet::LogLevel::Error, Juliet::LogCategory::Core, expression);
|
||||
__debugbreak();
|
||||
}
|
||||
119
Juliet/src/Core/HAL/Display/Display.cpp
Normal file
119
Juliet/src/Core/HAL/Display/Display.cpp
Normal file
@@ -0,0 +1,119 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/HAL/Display/Display_Private.h>
|
||||
#include <Core/HAL/Display/DisplayDevice.h>
|
||||
#include <Core/Memory/Allocator.h>
|
||||
#include <format>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
namespace
|
||||
{
|
||||
DisplayDevice* CurrentDisplayDevice = nullptr;
|
||||
|
||||
constexpr DisplayDeviceFactory* Factories[] = { &Win32DisplayDeviceFactory, nullptr };
|
||||
} // namespace
|
||||
|
||||
void InitializeDisplaySystem()
|
||||
{
|
||||
Assert(!CurrentDisplayDevice);
|
||||
|
||||
DisplayDevice* candidateDevice = nullptr;
|
||||
DisplayDeviceFactory* candidateFactory = nullptr;
|
||||
for (DisplayDeviceFactory* factory : Factories)
|
||||
{
|
||||
if (factory)
|
||||
{
|
||||
candidateDevice = factory->CreateDevice();
|
||||
if (candidateDevice)
|
||||
{
|
||||
candidateFactory = factory;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO : handle error instead of crashing
|
||||
Assert(candidateDevice);
|
||||
|
||||
CurrentDisplayDevice = candidateDevice;
|
||||
CurrentDisplayDevice->Name = candidateFactory->Name;
|
||||
|
||||
if (!CurrentDisplayDevice->Initialize(CurrentDisplayDevice))
|
||||
{
|
||||
ShutdownDisplaySystem();
|
||||
}
|
||||
}
|
||||
|
||||
void ShutdownDisplaySystem()
|
||||
{
|
||||
if (!CurrentDisplayDevice)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Destroy all Windows that are still alive
|
||||
DestroyPlatformWindow(CurrentDisplayDevice->MainWindow);
|
||||
|
||||
CurrentDisplayDevice->Shutdown(CurrentDisplayDevice);
|
||||
// Free anything that was freed by the shutdown and then free the display
|
||||
// no op for now
|
||||
CurrentDisplayDevice->Free(CurrentDisplayDevice);
|
||||
CurrentDisplayDevice = nullptr;
|
||||
}
|
||||
|
||||
Window* CreatePlatformWindow(const char* title, uint16 width, uint16 height, int flags /* = 0 unused */)
|
||||
{
|
||||
Assert(CurrentDisplayDevice->CreatePlatformWindow);
|
||||
|
||||
auto window = static_cast<Window*>(Calloc(1, sizeof(Window)));
|
||||
if (!window)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
window->Width = width;
|
||||
window->Height = height;
|
||||
|
||||
CurrentDisplayDevice->MainWindow = window;
|
||||
if (!CurrentDisplayDevice->CreatePlatformWindow(CurrentDisplayDevice, window))
|
||||
{
|
||||
// TODO : Destroy
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// TODO : make SHOW optional on creation with a flag
|
||||
CurrentDisplayDevice->ShowWindow(CurrentDisplayDevice, window);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
void DestroyPlatformWindow(NonNullPtr<Window> window)
|
||||
{
|
||||
HideWindow(window);
|
||||
|
||||
CurrentDisplayDevice->DestroyPlatformWindow(CurrentDisplayDevice, window);
|
||||
|
||||
Free(window.Get());
|
||||
}
|
||||
|
||||
void ShowWindow(NonNullPtr<Window> window)
|
||||
{
|
||||
CurrentDisplayDevice->ShowWindow(CurrentDisplayDevice, window);
|
||||
}
|
||||
|
||||
void HideWindow(NonNullPtr<Window> window)
|
||||
{
|
||||
CurrentDisplayDevice->HideWindow(CurrentDisplayDevice, window);
|
||||
}
|
||||
|
||||
WindowID GetWindowID(NonNullPtr<Window> window)
|
||||
{
|
||||
return window->ID;
|
||||
}
|
||||
|
||||
// Display Device Utils. Not exposed in the API
|
||||
DisplayDevice* GetDisplayDevice()
|
||||
{
|
||||
return CurrentDisplayDevice;
|
||||
}
|
||||
} // namespace Juliet
|
||||
44
Juliet/src/Core/HAL/Display/DisplayDevice.h
Normal file
44
Juliet/src/Core/HAL/Display/DisplayDevice.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/NonNullPtr.h>
|
||||
#include <Core/HAL/Display/Window.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Driver to the display device.
|
||||
// Functions ptr will be set by the chosen factory
|
||||
// Acts as a singleton after Initialize has been called and is freed in Shutdown.
|
||||
struct DisplayDevice
|
||||
{
|
||||
const char* Name = "Unknown";
|
||||
|
||||
// Initialize all subsystems needed for the device to works
|
||||
bool (*Initialize)(NonNullPtr<DisplayDevice> self);
|
||||
void (*Shutdown)(NonNullPtr<DisplayDevice> self);
|
||||
void (*Free)(NonNullPtr<DisplayDevice> self);
|
||||
|
||||
// Window management
|
||||
bool (*CreatePlatformWindow)(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window);
|
||||
void (*DestroyPlatformWindow)(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window);
|
||||
void (*ShowWindow)(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window);
|
||||
void (*HideWindow)(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window);
|
||||
|
||||
// Events
|
||||
void (*PumpEvents)(NonNullPtr<DisplayDevice> self);
|
||||
|
||||
// TODO : Use vector
|
||||
Window* MainWindow = nullptr;
|
||||
};
|
||||
|
||||
struct DisplayDeviceFactory
|
||||
{
|
||||
const char* Name = "Unknown";
|
||||
DisplayDevice* (*CreateDevice)(void);
|
||||
};
|
||||
|
||||
// TODO : Support more platforms
|
||||
extern DisplayDeviceFactory Win32DisplayDeviceFactory;
|
||||
|
||||
// Utils
|
||||
extern DisplayDevice* GetDisplayDevice();
|
||||
} // namespace Juliet
|
||||
7
Juliet/src/Core/HAL/Display/Display_Private.h
Normal file
7
Juliet/src/Core/HAL/Display/Display_Private.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
void InitializeDisplaySystem();
|
||||
void ShutdownDisplaySystem();
|
||||
} // namespace Juliet
|
||||
52
Juliet/src/Core/HAL/Display/Win32/Win32DisplayDevice.cpp
Normal file
52
Juliet/src/Core/HAL/Display/Win32/Win32DisplayDevice.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#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>
|
||||
|
||||
namespace Juliet::Win32
|
||||
{
|
||||
namespace
|
||||
{
|
||||
bool Initialize(NonNullPtr<DisplayDevice> self)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
void Shutdown(NonNullPtr<DisplayDevice> self) {}
|
||||
void Free(NonNullPtr<DisplayDevice> self)
|
||||
{
|
||||
Juliet::Free(self.Get());
|
||||
}
|
||||
|
||||
DisplayDevice* CreateDevice()
|
||||
{
|
||||
auto device = static_cast<DisplayDevice*>(Calloc(1, sizeof(DisplayDevice)));
|
||||
if (!device)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
device->Initialize = Initialize;
|
||||
device->Shutdown = Shutdown;
|
||||
device->Free = Free;
|
||||
|
||||
device->CreatePlatformWindow = CreatePlatformWindow;
|
||||
device->DestroyPlatformWindow = DestroyPlatformWindow;
|
||||
device->ShowWindow = ShowWindow;
|
||||
device->HideWindow = HideWindow;
|
||||
|
||||
device->PumpEvents = PumpEvents;
|
||||
|
||||
return device;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
} // namespace Juliet::Win32
|
||||
|
||||
// Factory cannot be in an anonymous/unknown namespace
|
||||
namespace Juliet
|
||||
{
|
||||
DisplayDeviceFactory Win32DisplayDeviceFactory = { .Name = "Win32", .CreateDevice = Win32::CreateDevice };
|
||||
}
|
||||
6
Juliet/src/Core/HAL/Display/Win32/Win32DisplayDevice.h
Normal file
6
Juliet/src/Core/HAL/Display/Win32/Win32DisplayDevice.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet::Win32
|
||||
{
|
||||
|
||||
}
|
||||
272
Juliet/src/Core/HAL/Display/Win32/Win32DisplayEvent.cpp
Normal file
272
Juliet/src/Core/HAL/Display/Win32/Win32DisplayEvent.cpp
Normal file
@@ -0,0 +1,272 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Common/EnumUtils.h>
|
||||
#include <Core/HAL/Display/DisplayDevice.h>
|
||||
#include <Core/HAL/Display/Win32/Win32DisplayEvent.h>
|
||||
#include <Core/HAL/Display/Win32/Win32Window.h>
|
||||
#include <Core/HAL/Event/Keyboard_Private.h>
|
||||
#include <Core/HAL/Event/Mouse_Private.h>
|
||||
#include <Core/HAL/Event/SystemEvent.h>
|
||||
#include <Core/HAL/Event/Win32ScanCode.h>
|
||||
#include <Core/HAL/Event/WindowEvent.h>
|
||||
#include <Core/HAL/Keyboard/KeyCode.h>
|
||||
#include <Core/HAL/Win32.h>
|
||||
#include <Core/Memory/Utils.h>
|
||||
|
||||
// For GET_X_LPARAM, GET_Y_LPARAM.
|
||||
#include <windowsx.h>
|
||||
|
||||
namespace Juliet::Win32
|
||||
{
|
||||
namespace
|
||||
{
|
||||
constexpr uint8 kPeekMessageLimit = 3;
|
||||
|
||||
// Win32 Display Utils
|
||||
Window32State* GetWindowStateFromHandle(HWND handle)
|
||||
{
|
||||
if (auto* displayDevice = GetDisplayDevice())
|
||||
{
|
||||
auto* window = displayDevice->MainWindow;
|
||||
// TODO : use a vector
|
||||
// for (Window* window : displayDevice->MainWindow)
|
||||
{
|
||||
if (window)
|
||||
{
|
||||
auto state = reinterpret_cast<Window32State*>(window->State);
|
||||
if (state && state->Handle == handle)
|
||||
{
|
||||
return state;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Win32 Keyboard Utils
|
||||
Key GetScanScodeFromWinScanCode(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
Key key = {};
|
||||
|
||||
uint16 flags = HIWORD(lParam);
|
||||
uint16 scanCode = LOBYTE(flags);
|
||||
|
||||
if (scanCode != 0)
|
||||
{
|
||||
// Use extended keyboard
|
||||
if ((flags & KF_EXTENDED) == KF_EXTENDED)
|
||||
{
|
||||
// Transforms into the range of our scancodes
|
||||
scanCode = MAKEWORD(scanCode, 0xe0);
|
||||
}
|
||||
else if (scanCode == 0x45)
|
||||
{
|
||||
// Pause scancode in win32 is 0xE11D45 (for raw input) or 0x0045 for legacy KeyDown (which is the
|
||||
// one we use) Break is 0x0046 (Ctrl + Pause). We merge it into one because nobody cares.
|
||||
scanCode = 0x46;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert(false && "Virtual Key : Unimplemented");
|
||||
// uint16 virtualKey = LOWORD(wParam);
|
||||
}
|
||||
|
||||
// Pack the scancode to have everything within one byte.
|
||||
// Because scancode low byte are never bigger than 0x7F
|
||||
// We can use the most significant bit to store anything that is in the High Byte of the scancode
|
||||
uint8 index = LOBYTE(scanCode) | (HIBYTE(scanCode) ? 0x80 : 0x00);
|
||||
key.ScanCode = Win32ToHIDUsagePageTable[index];
|
||||
key.Raw = scanCode;
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
static_assert(ArraySize(Win32ToHIDUsagePageTable) > sizeof(uint8));
|
||||
|
||||
void ExtractMouseButtonState(uint64 timestamp, bool buttonPressed, MouseButton buttonFlag, bool swapButtons,
|
||||
NonNullPtr<Window32State> windowState, MouseButton button, MouseID mouseID)
|
||||
{
|
||||
if (swapButtons)
|
||||
{
|
||||
if (button == MouseButton::Left)
|
||||
{
|
||||
button = MouseButton::Right;
|
||||
}
|
||||
else if (button == MouseButton::Right)
|
||||
{
|
||||
button = MouseButton::Left;
|
||||
}
|
||||
}
|
||||
|
||||
if (buttonPressed && ((buttonFlag & button) == MouseButton::None))
|
||||
{
|
||||
SendMouseButton(timestamp, windowState->Window, mouseID, button, true);
|
||||
}
|
||||
else if (!buttonPressed && ((buttonFlag & button) != MouseButton::None))
|
||||
{
|
||||
SendMouseButton(timestamp, windowState->Window, mouseID, button, false);
|
||||
}
|
||||
}
|
||||
|
||||
WPARAM LastFrameButtonState = -1;
|
||||
void ExtractAllMouseButtonState(uint64 timestamp, WPARAM wParam, NonNullPtr<Window32State> windowState, MouseID mouseID)
|
||||
{
|
||||
if (wParam != LastFrameButtonState)
|
||||
{
|
||||
MouseButton buttonFlags = GetMouseButtonState();
|
||||
ExtractMouseButtonState(timestamp, (wParam & MK_LBUTTON), buttonFlags, false, windowState, MouseButton::Left, mouseID);
|
||||
ExtractMouseButtonState(timestamp, (wParam & MK_MBUTTON), buttonFlags, false, windowState,
|
||||
MouseButton::Middle, mouseID);
|
||||
ExtractMouseButtonState(timestamp, (wParam & MK_RBUTTON), buttonFlags, false, windowState, MouseButton::Right, mouseID);
|
||||
ExtractMouseButtonState(timestamp, (wParam & MK_XBUTTON1), buttonFlags, false, windowState,
|
||||
MouseButton::Button1, mouseID);
|
||||
ExtractMouseButtonState(timestamp, (wParam & MK_XBUTTON2), buttonFlags, false, windowState,
|
||||
MouseButton::Button2, mouseID);
|
||||
LastFrameButtonState = wParam;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void PumpEvents(NonNullPtr<DisplayDevice> self)
|
||||
{
|
||||
uint8 peekedMessageCount = 0;
|
||||
MSG message = {};
|
||||
while (PeekMessage(&message, nullptr, 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&message);
|
||||
DispatchMessage(&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)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK Win32MainWindowCallback(HWND handle, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LRESULT returnCode = -1;
|
||||
|
||||
// Wait until the window state is created before doing anything
|
||||
auto* windowState = GetWindowStateFromHandle(handle);
|
||||
if (!windowState)
|
||||
{
|
||||
return CallWindowProcA(DefWindowProcA, handle, message, wParam, lParam);
|
||||
}
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_CLOSE:
|
||||
{
|
||||
SendWindowEvent(windowState->Window, EventType::Window_Close_Request);
|
||||
returnCode = 0;
|
||||
break;
|
||||
}
|
||||
case WM_DESTROY:
|
||||
{
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_SYSKEYDOWN:
|
||||
case WM_KEYDOWN:
|
||||
{
|
||||
Key key = GetScanScodeFromWinScanCode(wParam, lParam);
|
||||
|
||||
// Catch Alt+F4 and close the window immediately
|
||||
if (key.ScanCode == ScanCode::F4 && ((GetKeyModState() & KeyMod::Alt) != KeyMod::None))
|
||||
{
|
||||
SendWindowEvent(windowState->Window, EventType::Window_Close_Request);
|
||||
}
|
||||
|
||||
SendKeyboardKey(1, kGlobalKeyboardID, key, KeyState::Down);
|
||||
|
||||
returnCode = 0;
|
||||
break;
|
||||
}
|
||||
case WM_SYSKEYUP:
|
||||
case WM_KEYUP:
|
||||
{
|
||||
Key key = GetScanScodeFromWinScanCode(wParam, lParam);
|
||||
SendKeyboardKey(1, kGlobalKeyboardID, key, KeyState::Up);
|
||||
|
||||
returnCode = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_MOUSEMOVE:
|
||||
{
|
||||
if (!windowState->IsMouseTracked)
|
||||
{
|
||||
TRACKMOUSEEVENT MouseEvent;
|
||||
MouseEvent.cbSize = sizeof(TRACKMOUSEEVENT);
|
||||
MouseEvent.hwndTrack = windowState->Handle;
|
||||
MouseEvent.dwFlags = TME_LEAVE;
|
||||
TrackMouseEvent(&MouseEvent);
|
||||
|
||||
windowState->IsMouseTracked = true;
|
||||
}
|
||||
|
||||
SendMouseMotion(1, windowState->Window, kGlobalMouseID, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_LBUTTONUP:
|
||||
case WM_RBUTTONUP:
|
||||
case WM_MBUTTONUP:
|
||||
case WM_XBUTTONUP:
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_LBUTTONDBLCLK:
|
||||
case WM_RBUTTONDOWN:
|
||||
case WM_RBUTTONDBLCLK:
|
||||
case WM_MBUTTONDOWN:
|
||||
case WM_MBUTTONDBLCLK:
|
||||
case WM_XBUTTONDOWN:
|
||||
case WM_XBUTTONDBLCLK:
|
||||
{
|
||||
ExtractAllMouseButtonState(1, wParam, windowState, kGlobalMouseID);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_MOUSELEAVE:
|
||||
{
|
||||
// TODO : Check focus
|
||||
const bool isNotMinimized = !IsIconic(handle);
|
||||
if (isNotMinimized)
|
||||
{
|
||||
POINT cursorPos;
|
||||
GetCursorPos(&cursorPos);
|
||||
ScreenToClient(handle, &cursorPos);
|
||||
SendMouseMotion(1, windowState->Window, kGlobalMouseID, static_cast<float>(cursorPos.x),
|
||||
static_cast<float>(cursorPos.y));
|
||||
}
|
||||
|
||||
windowState->IsMouseTracked = false;
|
||||
|
||||
returnCode = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT Paint;
|
||||
BeginPaint(handle, &Paint);
|
||||
EndPaint(handle, &Paint);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (returnCode >= 0)
|
||||
{
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
return CallWindowProcA(DefWindowProcA, handle, message, wParam, lParam);
|
||||
}
|
||||
} // namespace Juliet::Win32
|
||||
15
Juliet/src/Core/HAL/Display/Win32/Win32DisplayEvent.h
Normal file
15
Juliet/src/Core/HAL/Display/Win32/Win32DisplayEvent.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/NonNullPtr.h>
|
||||
#include <Core/HAL/Win32.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
struct DisplayDevice;
|
||||
}
|
||||
|
||||
namespace Juliet::Win32
|
||||
{
|
||||
extern void PumpEvents(NonNullPtr<DisplayDevice> self);
|
||||
extern LRESULT CALLBACK Win32MainWindowCallback(HWND Handle, UINT Message, WPARAM WParam, LPARAM LParam);
|
||||
} // namespace Juliet::Win32
|
||||
166
Juliet/src/Core/HAL/Display/Win32/Win32Window.cpp
Normal file
166
Juliet/src/Core/HAL/Display/Win32/Win32Window.cpp
Normal file
@@ -0,0 +1,166 @@
|
||||
#include <pch.h>
|
||||
|
||||
#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;
|
||||
|
||||
bool SetupWindowState(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window, HWND handle)
|
||||
{
|
||||
auto state = static_cast<Window32State*>(Calloc(1, sizeof(Window32State)));
|
||||
window->State = state;
|
||||
state->Handle = handle;
|
||||
state->Window = window;
|
||||
state->HDC = GetDC(handle);
|
||||
|
||||
state->IsMouseTracked = false;
|
||||
|
||||
// TODO Use SetProp to associate data to the window handle. Could be used to fetch it from the WinProc
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CleanUpWindowState(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window)
|
||||
{
|
||||
if (auto* state = reinterpret_cast<Window32State*>(window->State))
|
||||
{
|
||||
ReleaseDC(state->Handle, state->HDC);
|
||||
DestroyWindow(state->Handle);
|
||||
|
||||
Free(state);
|
||||
}
|
||||
window->State = nullptr;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
bool CreatePlatformWindow(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window)
|
||||
{
|
||||
// TODO : save the instance in app state or something
|
||||
HINSTANCE instance = GetModuleHandle(NULL);
|
||||
|
||||
// TODO : Put outside, we should not create a new class for each new window
|
||||
WNDCLASSEX WindowClass = {};
|
||||
WindowClass.cbSize = sizeof(WNDCLASSEX);
|
||||
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 (!RegisterClassEx(&WindowClass))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD style = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_OVERLAPPEDWINDOW;
|
||||
DWORD styleEx = 0;
|
||||
|
||||
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);
|
||||
|
||||
PumpEvents(self);
|
||||
|
||||
if (!SetupWindowState(self, window, handle))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Assert(window->State);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DestroyPlatformWindow(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window)
|
||||
{
|
||||
CleanUpWindowState(self, window);
|
||||
}
|
||||
|
||||
void ShowWindow(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window)
|
||||
{
|
||||
Assert(window);
|
||||
Assert(window->State);
|
||||
|
||||
auto& win32State = reinterpret_cast<Window32State&>(*window->State);
|
||||
::ShowWindow(win32State.Handle, SW_SHOW);
|
||||
}
|
||||
|
||||
void HideWindow(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window)
|
||||
{
|
||||
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
|
||||
27
Juliet/src/Core/HAL/Display/Win32/Win32Window.h
Normal file
27
Juliet/src/Core/HAL/Display/Win32/Win32Window.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/NonNullPtr.h>
|
||||
#include <Core/HAL/Display/Window.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
struct DisplayDevice;
|
||||
struct Window;
|
||||
} // namespace Juliet
|
||||
|
||||
namespace Juliet::Win32
|
||||
{
|
||||
// TODO : Evaluate if its worth the burden of casting to Window32State all the time
|
||||
struct Window32State : WindowState
|
||||
{
|
||||
HWND Handle;
|
||||
HDC HDC;
|
||||
|
||||
bool IsMouseTracked : 1;
|
||||
};
|
||||
|
||||
extern bool CreatePlatformWindow(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window);
|
||||
extern void DestroyPlatformWindow(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window);
|
||||
extern void ShowWindow(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window);
|
||||
extern void HideWindow(NonNullPtr<DisplayDevice> self, NonNullPtr<Window> window);
|
||||
} // namespace Juliet::Win32
|
||||
21
Juliet/src/Core/HAL/Display/Window.h
Normal file
21
Juliet/src/Core/HAL/Display/Window.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/HAL/Display/Display.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
struct Window;
|
||||
struct WindowState
|
||||
{
|
||||
Window* Window;
|
||||
};
|
||||
|
||||
struct Window
|
||||
{
|
||||
WindowID ID;
|
||||
WindowState* State;
|
||||
|
||||
int32 Width;
|
||||
int32 Height;
|
||||
};
|
||||
} // namespace Juliet
|
||||
139
Juliet/src/Core/HAL/Event/Keyboard.cpp
Normal file
139
Juliet/src/Core/HAL/Event/Keyboard.cpp
Normal file
@@ -0,0 +1,139 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Common/EnumUtils.h>
|
||||
#include <Core/HAL/Event/Keyboard_Private.h>
|
||||
#include <Core/HAL/Event/KeyboardMapping.h>
|
||||
#include <Core/HAL/Event/SystemEvent.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
constexpr KeyboardID kGlobalKeyboardID = 0;
|
||||
|
||||
namespace
|
||||
{
|
||||
struct KeyboardState
|
||||
{
|
||||
KeyState KeyState[ToUnderlying(ScanCode::Count)];
|
||||
KeyMod KeyModState;
|
||||
} KeyboardState;
|
||||
|
||||
bool SendKeyboardKey_Internal(uint64 timestamp, KeyboardID ID, Key key, KeyState keyState)
|
||||
{
|
||||
Assert(key.KeyCode == KeyCode::Unknown); // At this point Keycode is not yet extracted
|
||||
|
||||
auto& keyboardState = KeyboardState; // Needed because MSVC debugger ignores variable in anonymouse namespace
|
||||
|
||||
auto type = EventType::None;
|
||||
const bool isKeyDown = keyState == KeyState::Down;
|
||||
if (isKeyDown)
|
||||
{
|
||||
type = EventType::Key_Down;
|
||||
}
|
||||
else
|
||||
{
|
||||
type = EventType::Key_Up;
|
||||
}
|
||||
|
||||
bool isKeyRepeat = false;
|
||||
if (key.ScanCode > ScanCode::Unknown && key.ScanCode < ScanCode::Count)
|
||||
{
|
||||
auto& currentKeyState = keyboardState.KeyState[ToUnderlying(key.ScanCode)];
|
||||
|
||||
// If state didn't change, this is a key repeat
|
||||
if (isKeyDown)
|
||||
{
|
||||
if (currentKeyState == KeyState::Down)
|
||||
{
|
||||
isKeyRepeat = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentKeyState == KeyState::Up)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
keyboardState.KeyState[ToUnderlying(key.ScanCode)] = keyState;
|
||||
key.KeyCode = GetKeyCodeFromScanCode(key.ScanCode, keyboardState.KeyModState);
|
||||
}
|
||||
else if (key.Raw == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isKeyRepeat)
|
||||
{
|
||||
KeyMod newModifier = {};
|
||||
|
||||
switch (key.KeyCode)
|
||||
{
|
||||
case KeyCode::LeftControl: newModifier = KeyMod::LeftControl; break;
|
||||
case KeyCode::RightControl: newModifier = KeyMod::RightControl; break;
|
||||
case KeyCode::LeftShift: newModifier = KeyMod::LeftShift; break;
|
||||
case KeyCode::RightShift: newModifier = KeyMod::RightShift; break;
|
||||
case KeyCode::LeftAlt: newModifier = KeyMod::LeftAlt; break;
|
||||
case KeyCode::RightAlt: newModifier = KeyMod::RightAlt; break;
|
||||
case KeyCode::LeftOSCommand: newModifier = KeyMod::LeftOSCommand; break;
|
||||
case KeyCode::RightOSCommand: newModifier = KeyMod::RightOSCommand; break;
|
||||
default: newModifier = KeyMod::None; break;
|
||||
}
|
||||
if (type == EventType::Key_Down)
|
||||
{
|
||||
switch (key.KeyCode)
|
||||
{
|
||||
case KeyCode::NumlockClear: newModifier ^= KeyMod::NumLock; break;
|
||||
case KeyCode::CapsLock: newModifier ^= KeyMod::CapsLock; break;
|
||||
case KeyCode::ScrollLock: newModifier ^= KeyMod::ScrollLock; break;
|
||||
default: keyboardState.KeyModState |= newModifier;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove from any keymod not pressed from the modifier
|
||||
keyboardState.KeyModState &= ~newModifier;
|
||||
}
|
||||
}
|
||||
|
||||
SystemEvent evt;
|
||||
evt.Timestamp = timestamp;
|
||||
evt.Type = type;
|
||||
evt.Data.Keyboard.AssociatedKeyboardID = kGlobalKeyboardID;
|
||||
evt.Data.Keyboard.Key = key;
|
||||
evt.Data.Keyboard.KeyState = keyState;
|
||||
evt.Data.Keyboard.KeyModeState = keyboardState.KeyModState;
|
||||
|
||||
bool evtPosted = AddEvent(evt);
|
||||
|
||||
return evtPosted;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
bool SendKeyboardKey(uint64 timestamp, KeyboardID ID, Key key, KeyState keyState)
|
||||
{
|
||||
return SendKeyboardKey_Internal(timestamp, ID, key, keyState);
|
||||
}
|
||||
|
||||
bool IsKeyDown(ScanCode scanCode)
|
||||
{
|
||||
return KeyboardState.KeyState[ToUnderlying(scanCode)] == KeyState::Down;
|
||||
}
|
||||
|
||||
KeyMod GetKeyModState()
|
||||
{
|
||||
auto& keyboardState = KeyboardState;
|
||||
return keyboardState.KeyModState;
|
||||
}
|
||||
|
||||
KeyCode GetKeyCodeFromScanCode(ScanCode scanCode, KeyMod keyModState)
|
||||
{
|
||||
return GetKeyCodeFromDefaultMapping(scanCode, keyModState);
|
||||
}
|
||||
|
||||
static_assert(sizeof(KeyState) == sizeof(bool));
|
||||
static_assert(ToUnderlying(KeyState::Down) == true);
|
||||
static_assert(ToUnderlying(KeyState::Up) == false);
|
||||
static_assert(sizeof(ScanCode) == sizeof(uint16));
|
||||
static_assert(ToUnderlying(ScanCode::Count) == 512);
|
||||
} // namespace Juliet
|
||||
205
Juliet/src/Core/HAL/Event/KeyboardMapping.cpp
Normal file
205
Juliet/src/Core/HAL/Event/KeyboardMapping.cpp
Normal file
@@ -0,0 +1,205 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Common/EnumUtils.h>
|
||||
#include <Core/HAL/Event/KeyboardMapping.h>
|
||||
#include <Core/HAL/Keyboard/KeyCode.h>
|
||||
#include <Core/HAL/Keyboard/ScanCode.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
namespace
|
||||
{
|
||||
// clang-format off
|
||||
KeyCode UnshiftedDefaultSymbols[] = {
|
||||
KeyCode::Num1,
|
||||
KeyCode::Num2,
|
||||
KeyCode::Num3,
|
||||
KeyCode::Num4,
|
||||
KeyCode::Num5,
|
||||
KeyCode::Num6,
|
||||
KeyCode::Num7,
|
||||
KeyCode::Num8,
|
||||
KeyCode::Num9,
|
||||
KeyCode::Num0,
|
||||
KeyCode::Return,
|
||||
KeyCode::Escape,
|
||||
KeyCode::Backspace,
|
||||
KeyCode::Tab,
|
||||
KeyCode::Space,
|
||||
KeyCode::Minus,
|
||||
KeyCode::Equals,
|
||||
KeyCode::LeftBracket,
|
||||
KeyCode::RightBracket,
|
||||
KeyCode::Backslash,
|
||||
KeyCode::Hash,
|
||||
KeyCode::Semicolon,
|
||||
KeyCode::Apostrophe,
|
||||
KeyCode::GraveAccent,
|
||||
KeyCode::Comma,
|
||||
KeyCode::Period,
|
||||
KeyCode::Slash,
|
||||
};
|
||||
|
||||
KeyCode ShiftedDefaultSymbols[] = {
|
||||
KeyCode::ExclamationPoint,
|
||||
KeyCode::CommercialAt,
|
||||
KeyCode::Hash,
|
||||
KeyCode::Dollar,
|
||||
KeyCode::Percent,
|
||||
KeyCode::Caret,
|
||||
KeyCode::Ampersand,
|
||||
KeyCode::Asterisk,
|
||||
KeyCode::LeftParenthesis,
|
||||
KeyCode::RightParenthesis,
|
||||
KeyCode::Return,
|
||||
KeyCode::Escape,
|
||||
KeyCode::Backspace,
|
||||
KeyCode::Tab,
|
||||
KeyCode::Space,
|
||||
KeyCode::Underscore,
|
||||
KeyCode::Plus,
|
||||
KeyCode::LeftBrace,
|
||||
KeyCode::RightBrace,
|
||||
KeyCode::Pipe,
|
||||
KeyCode::Hash,
|
||||
KeyCode::Colon,
|
||||
KeyCode::DoubleApostrophe,
|
||||
KeyCode::Tilde,
|
||||
KeyCode::LessThan,
|
||||
KeyCode::GreaterThan,
|
||||
KeyCode::QuestionMark,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
KeyCode GetNonPrintableKeys(ScanCode scanCode)
|
||||
{
|
||||
switch (scanCode)
|
||||
{
|
||||
case ScanCode::Delete: return KeyCode::Delete;
|
||||
case ScanCode::CapsLock: return KeyCode::CapsLock;
|
||||
case ScanCode::F1: return KeyCode::F1;
|
||||
case ScanCode::F2: return KeyCode::F2;
|
||||
case ScanCode::F3: return KeyCode::F3;
|
||||
case ScanCode::F4: return KeyCode::F4;
|
||||
case ScanCode::F5: return KeyCode::F5;
|
||||
case ScanCode::F6: return KeyCode::F6;
|
||||
case ScanCode::F7: return KeyCode::F7;
|
||||
case ScanCode::F8: return KeyCode::F8;
|
||||
case ScanCode::F9: return KeyCode::F9;
|
||||
case ScanCode::F10: return KeyCode::F10;
|
||||
case ScanCode::F11: return KeyCode::F11;
|
||||
case ScanCode::F12: return KeyCode::F12;
|
||||
case ScanCode::PrintScreen: return KeyCode::PrintScreen;
|
||||
case ScanCode::ScrollLock: return KeyCode::ScrollLock;
|
||||
case ScanCode::Pause: return KeyCode::Pause;
|
||||
case ScanCode::Insert: return KeyCode::Insert;
|
||||
case ScanCode::Home: return KeyCode::Home;
|
||||
case ScanCode::PageUp: return KeyCode::PageUp;
|
||||
case ScanCode::End: return KeyCode::End;
|
||||
case ScanCode::PageDown: return KeyCode::PageDown;
|
||||
case ScanCode::RightArrow: return KeyCode::RightArrow;
|
||||
case ScanCode::LeftArrow: return KeyCode::LeftArrow;
|
||||
case ScanCode::DownArrow: return KeyCode::DownArrow;
|
||||
case ScanCode::UpArrow: return KeyCode::UpArrow;
|
||||
case ScanCode::NumlockClear: return KeyCode::NumlockClear;
|
||||
case ScanCode::KeyPad_Divide: return KeyCode::KeyPad_Divide;
|
||||
case ScanCode::KeyPad_Multiply: return KeyCode::KeyPad_Multiply;
|
||||
case ScanCode::KeyPad_Minus: return KeyCode::KeyPad_Minus;
|
||||
case ScanCode::KeyPad_Plus: return KeyCode::KeyPad_Plus;
|
||||
case ScanCode::KeyPad_Enter: return KeyCode::KeyPad_Enter;
|
||||
case ScanCode::KeyPad_Num1: return KeyCode::KeyPad_Num1;
|
||||
case ScanCode::KeyPad_Num2: return KeyCode::KeyPad_Num2;
|
||||
case ScanCode::KeyPad_Num3: return KeyCode::KeyPad_Num3;
|
||||
case ScanCode::KeyPad_Num4: return KeyCode::KeyPad_Num4;
|
||||
case ScanCode::KeyPad_Num5: return KeyCode::KeyPad_Num5;
|
||||
case ScanCode::KeyPad_Num6: return KeyCode::KeyPad_Num6;
|
||||
case ScanCode::KeyPad_Num7: return KeyCode::KeyPad_Num7;
|
||||
case ScanCode::KeyPad_Num8: return KeyCode::KeyPad_Num8;
|
||||
case ScanCode::KeyPad_Num9: return KeyCode::KeyPad_Num9;
|
||||
case ScanCode::KeyPad_Num0: return KeyCode::KeyPad_Num0;
|
||||
case ScanCode::KeyPad_Period: return KeyCode::KeyPad_Period;
|
||||
case ScanCode::Power: return KeyCode::Power;
|
||||
case ScanCode::KeyPad_Equals: return KeyCode::KeyPad_Equals;
|
||||
case ScanCode::F13: return KeyCode::F13;
|
||||
case ScanCode::F14: return KeyCode::F14;
|
||||
case ScanCode::F15: return KeyCode::F15;
|
||||
case ScanCode::F16: return KeyCode::F16;
|
||||
case ScanCode::F17: return KeyCode::F17;
|
||||
case ScanCode::F18: return KeyCode::F18;
|
||||
case ScanCode::F19: return KeyCode::F19;
|
||||
case ScanCode::F20: return KeyCode::F20;
|
||||
case ScanCode::F21: return KeyCode::F21;
|
||||
case ScanCode::F22: return KeyCode::F22;
|
||||
case ScanCode::F23: return KeyCode::F23;
|
||||
case ScanCode::F24: return KeyCode::F24;
|
||||
case ScanCode::Mute: return KeyCode::Mute;
|
||||
case ScanCode::VolumeUp: return KeyCode::VolumeUp;
|
||||
case ScanCode::VolumeDown: return KeyCode::VolumeDown;
|
||||
case ScanCode::KeyPad_Comma: return KeyCode::KeyPad_Comma;
|
||||
case ScanCode::LeftControl: return KeyCode::LeftControl;
|
||||
case ScanCode::LeftShift: return KeyCode::LeftShift;
|
||||
case ScanCode::LeftAlt: return KeyCode::LeftAlt;
|
||||
case ScanCode::LeftOSCommand: return KeyCode::LeftOSCommand;
|
||||
case ScanCode::RightControl: return KeyCode::RightControl;
|
||||
case ScanCode::RightShift: return KeyCode::RightShift;
|
||||
case ScanCode::RightAlt: return KeyCode::RightAlt;
|
||||
case ScanCode::RightOSCommand: return KeyCode::RightOSCommand;
|
||||
case ScanCode::Sleep: return KeyCode::Sleep;
|
||||
case ScanCode::WakeUp: return KeyCode::WakeUp;
|
||||
case ScanCode::Media_NextTrack: return KeyCode::Media_NextTrack;
|
||||
case ScanCode::Media_PreviousTrack: return KeyCode::Media_PreviousTrack;
|
||||
case ScanCode::Media_Stop: return KeyCode::Media_Stop;
|
||||
case ScanCode::Media_Eject: return KeyCode::Media_Eject;
|
||||
case ScanCode::Media_PlayPause: return KeyCode::Media_PlayPause;
|
||||
case ScanCode::Media_Select: return KeyCode::Media_Select;
|
||||
default: return KeyCode::Unknown;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
KeyCode GetKeyCodeFromDefaultMapping(ScanCode scanCode, KeyMod keyModState)
|
||||
{
|
||||
if (scanCode <= ScanCode::Unknown || scanCode > ScanCode::Count)
|
||||
{
|
||||
Assert(false && "Unsupported KeyCode (out of bounds)");
|
||||
return KeyCode::Unknown;
|
||||
}
|
||||
|
||||
if (scanCode < ScanCode::A)
|
||||
{
|
||||
return KeyCode::Unknown;
|
||||
}
|
||||
|
||||
// Handles A-Z characters
|
||||
if (scanCode <= ScanCode::Z)
|
||||
{
|
||||
const auto index = ToUnderlying(scanCode - ScanCode::A);
|
||||
bool isShiftPressed = (keyModState & KeyMod::Shift) != KeyMod::None;
|
||||
if ((keyModState & KeyMod::CapsLock) != KeyMod::None)
|
||||
{
|
||||
isShiftPressed = !isShiftPressed;
|
||||
}
|
||||
|
||||
if (isShiftPressed)
|
||||
{
|
||||
return ToEnum<KeyCode>('A' + index);
|
||||
}
|
||||
return ToEnum<KeyCode>('a' + index);
|
||||
}
|
||||
|
||||
// Handles Num1 to Num0
|
||||
if (scanCode <= ScanCode::Num0)
|
||||
{
|
||||
const auto index = ToUnderlying<>(scanCode - ScanCode::Num1);
|
||||
const bool isShiftPressed = (keyModState & KeyMod::Shift) != KeyMod::None;
|
||||
if (isShiftPressed)
|
||||
{
|
||||
return ShiftedDefaultSymbols[index];
|
||||
}
|
||||
return UnshiftedDefaultSymbols[index];
|
||||
}
|
||||
|
||||
// Handle everything else (characters that do not convert to ASCII code)
|
||||
return GetNonPrintableKeys(scanCode);
|
||||
}
|
||||
} // namespace Juliet
|
||||
10
Juliet/src/Core/HAL/Event/KeyboardMapping.h
Normal file
10
Juliet/src/Core/HAL/Event/KeyboardMapping.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/HAL/Keyboard/KeyCode.h>
|
||||
#include <Core/HAL/Keyboard/ScanCode.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Transforms ScanCode into KeyCode using the default US ASCII Mapping
|
||||
extern KeyCode GetKeyCodeFromDefaultMapping(ScanCode scanCode, KeyMod keyModState);
|
||||
} // namespace Juliet
|
||||
11
Juliet/src/Core/HAL/Event/Keyboard_Private.h
Normal file
11
Juliet/src/Core/HAL/Event/Keyboard_Private.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/HAL/Keyboard/Keyboard.h>
|
||||
#include <Core/HAL/Keyboard/KeyCode.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
extern bool SendKeyboardKey(uint64 timestamp, KeyboardID ID, Key key, KeyState keyState);
|
||||
|
||||
extern const KeyboardID kGlobalKeyboardID;
|
||||
} // namespace Juliet
|
||||
144
Juliet/src/Core/HAL/Event/Mouse.cpp
Normal file
144
Juliet/src/Core/HAL/Event/Mouse.cpp
Normal file
@@ -0,0 +1,144 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Common/EnumUtils.h>
|
||||
#include <Core/HAL/Display/Window.h>
|
||||
#include <Core/HAL/Event/Mouse_Private.h>
|
||||
#include <Core/HAL/Event/SystemEvent.h>
|
||||
#include <Core/HAL/Mouse/Mouse.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
namespace
|
||||
{
|
||||
Mouse MouseState;
|
||||
|
||||
void ConstraintMousePositionToWindow(Mouse& mouseState, Window* window, float& x, float& y)
|
||||
{
|
||||
float x_min = 0.f, x_max = (float)(window->Width - 1);
|
||||
float y_min = 0.f, y_max = (float)(window->Height - 1);
|
||||
|
||||
if (x >= (x_max + 1))
|
||||
{
|
||||
x = std::max(x_max, mouseState.X_Previous);
|
||||
}
|
||||
x = std::max(x, x_min);
|
||||
|
||||
if (y >= (y_max + 1))
|
||||
{
|
||||
y = std::max(y_max, mouseState.Y_Previous);
|
||||
}
|
||||
y = std::max(y, y_min);
|
||||
}
|
||||
|
||||
void SendMouseMotion_Internal(uint64 timestamp, Window* window, MouseID mouseID, float x, float y)
|
||||
{
|
||||
auto& mouseState = GetMouseState();
|
||||
float xDisplacement = 0.0f;
|
||||
float yDisplacement = 0.0f;
|
||||
|
||||
ConstraintMousePositionToWindow(mouseState, window, x, y);
|
||||
|
||||
if (mouseState.HasPosition)
|
||||
{
|
||||
xDisplacement = x - mouseState.X_Previous;
|
||||
yDisplacement = y - mouseState.Y_Previous;
|
||||
}
|
||||
|
||||
if (mouseState.HasPosition && xDisplacement == 0.0f && yDisplacement == 0.0f)
|
||||
{
|
||||
// Skip it because state didnt change
|
||||
return;
|
||||
}
|
||||
|
||||
mouseState.X = x;
|
||||
mouseState.Y = y;
|
||||
mouseState.HasPosition = true;
|
||||
|
||||
mouseState.X_Previous = x;
|
||||
mouseState.Y_Previous = y;
|
||||
|
||||
SystemEvent evt;
|
||||
evt.Type = EventType::Mouse_Move;
|
||||
evt.Timestamp = timestamp;
|
||||
evt.Data.MouseMovement.WindowID = window->ID;
|
||||
evt.Data.MouseMovement.AssociatedMouseID = mouseID;
|
||||
evt.Data.MouseMovement.X = x;
|
||||
evt.Data.MouseMovement.Y = y;
|
||||
evt.Data.MouseMovement.X_Displacement = xDisplacement;
|
||||
evt.Data.MouseMovement.Y_Displacement = yDisplacement;
|
||||
evt.Data.MouseMovement.ButtonState = mouseState.ButtonState;
|
||||
AddEvent(evt);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
constexpr MouseID kGlobalMouseID = 0;
|
||||
|
||||
Mouse& GetMouseState()
|
||||
{
|
||||
return MouseState;
|
||||
}
|
||||
|
||||
void SendMouseMotion(uint64 timestamp, NonNullPtr<Window> window, MouseID ID, float x, float y)
|
||||
{
|
||||
// TODO : Update Mouse focus and send Mouse Enter / Mouse Leave event
|
||||
|
||||
SendMouseMotion_Internal(timestamp, window, ID, x, y);
|
||||
}
|
||||
|
||||
void SendMouseButton(uint64 timestamp, NonNullPtr<Window> window, MouseID mouseID, MouseButton button, bool pressed)
|
||||
{
|
||||
Mouse& mouseState = GetMouseState();
|
||||
MouseButton flags = mouseState.ButtonState;
|
||||
|
||||
auto type = EventType::None;
|
||||
if (pressed)
|
||||
{
|
||||
type = EventType::Mouse_ButtonPressed;
|
||||
flags |= button;
|
||||
}
|
||||
else
|
||||
{
|
||||
type = EventType::Mouse_ButtonReleased;
|
||||
flags = flags & ~button;
|
||||
}
|
||||
|
||||
if (flags == mouseState.ButtonState)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mouseState.ButtonState = flags;
|
||||
|
||||
// TODO : Send Event!
|
||||
SystemEvent evt;
|
||||
evt.Timestamp = timestamp;
|
||||
evt.Type = type;
|
||||
evt.Data.MouseButton.AssociatedMouseID = mouseID;
|
||||
evt.Data.MouseButton.WindowID = window->ID;
|
||||
evt.Data.MouseButton.ButtonState = button;
|
||||
evt.Data.MouseButton.X = mouseState.X;
|
||||
evt.Data.MouseButton.Y = mouseState.Y;
|
||||
evt.Data.MouseButton.IsPressed = pressed;
|
||||
AddEvent(evt);
|
||||
}
|
||||
|
||||
bool IsMouseButtonDown(MouseButton button)
|
||||
{
|
||||
auto& mouseState = GetMouseState();
|
||||
return (mouseState.ButtonState & button) != MouseButton::None;
|
||||
}
|
||||
|
||||
MousePosition GetMousePosition()
|
||||
{
|
||||
auto& mouseState = GetMouseState();
|
||||
return { .X = mouseState.X, .Y = mouseState.Y };
|
||||
}
|
||||
|
||||
MouseButton GetMouseButtonState()
|
||||
{
|
||||
const auto& mouseState = GetMouseState();
|
||||
return mouseState.ButtonState;
|
||||
}
|
||||
|
||||
} // namespace Juliet
|
||||
28
Juliet/src/Core/HAL/Event/Mouse_Private.h
Normal file
28
Juliet/src/Core/HAL/Event/Mouse_Private.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/HAL/Mouse/Mouse.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
struct Window;
|
||||
|
||||
struct Mouse
|
||||
{
|
||||
float X;
|
||||
float Y;
|
||||
|
||||
float X_Previous;
|
||||
float Y_Previous;
|
||||
|
||||
MouseButton ButtonState;
|
||||
|
||||
bool HasPosition : 1;
|
||||
};
|
||||
|
||||
Mouse& GetMouseState();
|
||||
|
||||
extern void SendMouseMotion(uint64 timestamp, NonNullPtr<Window> window, MouseID ID, float x, float y);
|
||||
extern void SendMouseButton(uint64 timestamp, NonNullPtr<Window> window, MouseID mouseID, MouseButton button, bool pressed);
|
||||
|
||||
extern const MouseID kGlobalMouseID;
|
||||
} // namespace Juliet
|
||||
69
Juliet/src/Core/HAL/Event/SystemEvent.cpp
Normal file
69
Juliet/src/Core/HAL/Event/SystemEvent.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
#include <pch.h>
|
||||
#include <queue>
|
||||
|
||||
#include <Core/HAL/Display/DisplayDevice.h>
|
||||
#include <Core/HAL/Event/SystemEvent.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
namespace
|
||||
{
|
||||
// TODO : make my own queue / using vector
|
||||
std::queue<SystemEvent> eventQueue;
|
||||
|
||||
// Update all systems event loops and gather events into the main queue
|
||||
void PumpEvents()
|
||||
{
|
||||
if (DisplayDevice* displayDevice = GetDisplayDevice())
|
||||
{
|
||||
displayDevice->PumpEvents(displayDevice);
|
||||
}
|
||||
}
|
||||
|
||||
bool AddEvent_Internal(const SystemEvent& event)
|
||||
{
|
||||
auto& newEvent = eventQueue.emplace();
|
||||
newEvent = event;
|
||||
|
||||
// TODO : Logs
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
bool GetEvent(SystemEvent& event)
|
||||
{
|
||||
return WaitEvent(event, 0);
|
||||
}
|
||||
|
||||
// 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
|
||||
bool WaitEvent(SystemEvent& event, int32 timeoutInNS /* = -1 */)
|
||||
{
|
||||
PumpEvents();
|
||||
|
||||
if (eventQueue.empty())
|
||||
{
|
||||
// TODO : Infinite loop here to wait for event if timeout > 0
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
event = eventQueue.front();
|
||||
eventQueue.pop();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AddEvent(SystemEvent& event)
|
||||
{
|
||||
if (event.Timestamp == 0)
|
||||
{
|
||||
event.Timestamp = 1; // TODO : Clock::Now();
|
||||
}
|
||||
|
||||
return AddEvent_Internal(event);
|
||||
}
|
||||
} // namespace Juliet
|
||||
270
Juliet/src/Core/HAL/Event/Win32ScanCode.h
Normal file
270
Juliet/src/Core/HAL/Event/Win32ScanCode.h
Normal file
@@ -0,0 +1,270 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/HAL/Keyboard/ScanCode.h>
|
||||
|
||||
namespace Juliet::Win32
|
||||
{
|
||||
// Conversion table from Win32 scan code to HID Usage Page (see Keyboard.h)
|
||||
// https://learn.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input#extended-key-flag
|
||||
// clang-format off
|
||||
static constexpr ScanCode Win32ToHIDUsagePageTable[] = {
|
||||
ScanCode::Unknown, // 0x00
|
||||
ScanCode::Escape, // 0x01
|
||||
ScanCode::Num1, // 0x02
|
||||
ScanCode::Num2, // 0x03
|
||||
ScanCode::Num3, // 0x04
|
||||
ScanCode::Num4, // 0x05
|
||||
ScanCode::Num5, // 0x06
|
||||
ScanCode::Num6, // 0x07
|
||||
ScanCode::Num7, // 0x08
|
||||
ScanCode::Num8, // 0x09
|
||||
ScanCode::Num9, // 0x0A
|
||||
ScanCode::Num0, // 0x0B
|
||||
ScanCode::Minus, // 0x0C
|
||||
ScanCode::Equals, // 0x0D
|
||||
ScanCode::Backspace, // 0x0E
|
||||
ScanCode::Tab, // 0x0F
|
||||
ScanCode::Q, // 0x10
|
||||
ScanCode::W, // 0x11
|
||||
ScanCode::E, // 0x12
|
||||
ScanCode::R, // 0x13
|
||||
ScanCode::T, // 0x14
|
||||
ScanCode::Y, // 0x15
|
||||
ScanCode::U, // 0x16
|
||||
ScanCode::I, // 0x17
|
||||
ScanCode::O, // 0x18
|
||||
ScanCode::P, // 0x19
|
||||
ScanCode::LeftBracket, // 0x1A
|
||||
ScanCode::RightBracket, // 0x1B
|
||||
ScanCode::Return, // 0x1C
|
||||
ScanCode::LeftControl, // 0x1D
|
||||
ScanCode::A, // 0x1E
|
||||
ScanCode::S, // 0x1F
|
||||
ScanCode::D, // 0x20
|
||||
ScanCode::F, // 0x21
|
||||
ScanCode::G, // 0x22
|
||||
ScanCode::H, // 0x23
|
||||
ScanCode::J, // 0x24
|
||||
ScanCode::K, // 0x25
|
||||
ScanCode::L, // 0x26
|
||||
ScanCode::Semicolon, // 0x27
|
||||
ScanCode::Apostrophe, // 0x28
|
||||
ScanCode::GraveAccent, // 0x29
|
||||
ScanCode::LeftShift, // 0x2A
|
||||
ScanCode::Backslash, // 0x2B
|
||||
ScanCode::Z, // 0x2C
|
||||
ScanCode::X, // 0x2D
|
||||
ScanCode::C, // 0x2E
|
||||
ScanCode::V, // 0x2F
|
||||
ScanCode::B, // 0x30
|
||||
ScanCode::N, // 0x31
|
||||
ScanCode::M, // 0x32
|
||||
ScanCode::Comma, // 0x33
|
||||
ScanCode::Period, // 0x34
|
||||
ScanCode::Slash, // 0x35
|
||||
ScanCode::RightShift, // 0x36
|
||||
ScanCode::KeyPad_Multiply, // 0x37
|
||||
ScanCode::LeftAlt, // 0x38
|
||||
ScanCode::Space, // 0x39
|
||||
ScanCode::CapsLock, // 0x3A
|
||||
ScanCode::F1, // 0x3B
|
||||
ScanCode::F2, // 0x3C
|
||||
ScanCode::F3, // 0x3D
|
||||
ScanCode::F4, // 0x3E
|
||||
ScanCode::F5, // 0x3F
|
||||
ScanCode::F6, // 0x40
|
||||
ScanCode::F7, // 0x41
|
||||
ScanCode::F8, // 0x42
|
||||
ScanCode::F9, // 0x43
|
||||
ScanCode::F10, // 0x44
|
||||
ScanCode::NumlockClear, // 0x45
|
||||
ScanCode::ScrollLock, // 0x46
|
||||
ScanCode::KeyPad_Num7, // 0x47
|
||||
ScanCode::KeyPad_Num8, // 0x48
|
||||
ScanCode::KeyPad_Num9, // 0x49
|
||||
ScanCode::KeyPad_Minus, // 0x4A
|
||||
ScanCode::KeyPad_Num4, // 0x4B
|
||||
ScanCode::KeyPad_Num5, // 0x4C
|
||||
ScanCode::KeyPad_Num6, // 0x4D
|
||||
ScanCode::KeyPad_Plus, // 0x4E
|
||||
ScanCode::KeyPad_Num1, // 0x4F
|
||||
ScanCode::KeyPad_Num2, // 0x50
|
||||
ScanCode::KeyPad_Num3, // 0x51
|
||||
ScanCode::KeyPad_Num0, // 0x52
|
||||
ScanCode::KeyPad_Period, // 0x53
|
||||
ScanCode::Unknown, // 0x54
|
||||
ScanCode::Unknown, // 0x55
|
||||
ScanCode::NonUSBackslash, // 0x56
|
||||
ScanCode::F11, // 0x57
|
||||
ScanCode::F12, // 0x58
|
||||
ScanCode::KeyPad_Equals, // 0x59
|
||||
ScanCode::Unknown, // 0x5A
|
||||
ScanCode::Unknown, // 0x5B
|
||||
ScanCode::International6, // 0x5C
|
||||
ScanCode::Unknown, // 0x5D
|
||||
ScanCode::Unknown, // 0x5E
|
||||
ScanCode::Unknown, // 0x5F
|
||||
ScanCode::Unknown, // 0x60
|
||||
ScanCode::Unknown, // 0x61
|
||||
ScanCode::Unknown, // 0x62
|
||||
ScanCode::Unknown, // 0x63
|
||||
ScanCode::F13, // 0x64
|
||||
ScanCode::F14, // 0x65
|
||||
ScanCode::F15, // 0x66
|
||||
ScanCode::F16, // 0x67
|
||||
ScanCode::F17, // 0x68
|
||||
ScanCode::F18, // 0x69
|
||||
ScanCode::F19, // 0x6A
|
||||
ScanCode::F20, // 0x6B
|
||||
ScanCode::F21, // 0x6C
|
||||
ScanCode::F22, // 0x6D
|
||||
ScanCode::F23, // 0x6E
|
||||
ScanCode::Unknown, // 0x6F
|
||||
ScanCode::International2, // 0x70
|
||||
ScanCode::Lang2, // 0x71
|
||||
ScanCode::Lang1, // 0x72
|
||||
ScanCode::International1, // 0x73
|
||||
ScanCode::Unknown, // 0x74
|
||||
ScanCode::Unknown, // 0x75
|
||||
ScanCode::F24, // 0x76
|
||||
ScanCode::Lang4, // 0x77
|
||||
ScanCode::Lang3, // 0x78
|
||||
ScanCode::International4, // 0x79
|
||||
ScanCode::Unknown, // 0x7A
|
||||
ScanCode::International5, // 0x7B
|
||||
ScanCode::Unknown, // 0x7C
|
||||
ScanCode::International3, // 0x7D
|
||||
ScanCode::KeyPad_Comma, // 0x7E
|
||||
ScanCode::Unknown, // 0x7F
|
||||
ScanCode::Unknown, // 0xe000
|
||||
ScanCode::Unknown, // 0xe001
|
||||
ScanCode::Unknown, // 0xe002
|
||||
ScanCode::Unknown, // 0xe003
|
||||
ScanCode::Unknown, // 0xe004
|
||||
ScanCode::Unknown, // 0xe005
|
||||
ScanCode::Unknown, // 0xe006
|
||||
ScanCode::Unknown, // 0xe007
|
||||
ScanCode::Unknown, // 0xe008
|
||||
ScanCode::Unknown, // 0xe009
|
||||
ScanCode::Unsupported, // 0xe00A Unsupported Application Paste
|
||||
ScanCode::Unknown, // 0xe00B
|
||||
ScanCode::Unknown, // 0xe00C
|
||||
ScanCode::Unknown, // 0xe00D
|
||||
ScanCode::Unknown, // 0xe00E
|
||||
ScanCode::Unknown, // 0xe00F
|
||||
ScanCode::Media_PreviousTrack, // 0xe010
|
||||
ScanCode::Unknown, // 0xe011
|
||||
ScanCode::Unknown, // 0xe012
|
||||
ScanCode::Unknown, // 0xe013
|
||||
ScanCode::Unknown, // 0xe014
|
||||
ScanCode::Unknown, // 0xe015
|
||||
ScanCode::Unknown, // 0xe016
|
||||
ScanCode::Unsupported, // 0xe017 Unsupported Application Cut
|
||||
ScanCode::Unsupported, // 0xe018 Unsupported Application Copy
|
||||
ScanCode::Media_NextTrack, // 0xe019
|
||||
ScanCode::Unknown, // 0xe01A
|
||||
ScanCode::Unknown, // 0xe01B
|
||||
ScanCode::KeyPad_Enter, // 0xe01C
|
||||
ScanCode::RightControl, // 0xe01D
|
||||
ScanCode::Unknown, // 0xe01E
|
||||
ScanCode::Unknown, // 0xe01F
|
||||
ScanCode::Mute, // 0xe020
|
||||
ScanCode::Unsupported, // 0xe021 // Unsupported LaunchApp2
|
||||
ScanCode::Media_PlayPause, // 0xe022
|
||||
ScanCode::Unknown, // 0xe023
|
||||
ScanCode::Media_Stop, // 0xe024
|
||||
ScanCode::Unknown, // 0xe025
|
||||
ScanCode::Unknown, // 0xe026
|
||||
ScanCode::Unknown, // 0xe027
|
||||
ScanCode::Unknown, // 0xe028
|
||||
ScanCode::Unknown, // 0xe029
|
||||
ScanCode::Unknown, // 0xe02A
|
||||
ScanCode::Unknown, // 0xe02B
|
||||
ScanCode::Media_Eject, // 0xe02C
|
||||
ScanCode::Unknown, // 0xe02D
|
||||
ScanCode::VolumeDown, // 0xe02E
|
||||
ScanCode::Unknown, // 0xe02F
|
||||
ScanCode::VolumeUp, // 0xe030
|
||||
ScanCode::Unknown, // 0xe031
|
||||
ScanCode::Unsupported, // 0xe032 Unsupported Application Home
|
||||
ScanCode::Unknown, // 0xe033
|
||||
ScanCode::Unknown, // 0xe034
|
||||
ScanCode::KeyPad_Divide, // 0xe035
|
||||
ScanCode::Unknown, // 0xe036
|
||||
ScanCode::PrintScreen, // 0xe037
|
||||
ScanCode::RightAlt, // 0xe038
|
||||
ScanCode::Unknown, // 0xe039
|
||||
ScanCode::Unknown, // 0xe03A
|
||||
ScanCode::Unsupported, // 0xe03B Unsupported Application Help
|
||||
ScanCode::Unknown, // 0xe03C
|
||||
ScanCode::Unknown, // 0xe03D
|
||||
ScanCode::Unknown, // 0xe03E
|
||||
ScanCode::Unknown, // 0xe03F
|
||||
ScanCode::Unknown, // 0xe040
|
||||
ScanCode::Unknown, // 0xe041
|
||||
ScanCode::Unknown, // 0xe042
|
||||
ScanCode::Unknown, // 0xe043
|
||||
ScanCode::Unknown, // 0xe044
|
||||
ScanCode::NumlockClear, // 0xe045
|
||||
ScanCode::Pause, // 0xe046
|
||||
ScanCode::Home, // 0xe047
|
||||
ScanCode::UpArrow, // 0xe048
|
||||
ScanCode::PageUp, // 0xe049
|
||||
ScanCode::Unknown, // 0xe04A
|
||||
ScanCode::LeftArrow, // 0xe04B
|
||||
ScanCode::Unknown, // 0xe04C
|
||||
ScanCode::RightArrow, // 0xe04D
|
||||
ScanCode::Unknown, // 0xe04E
|
||||
ScanCode::End, // 0xe04F
|
||||
ScanCode::DownArrow, // 0xe050
|
||||
ScanCode::PageDown, // 0xe051
|
||||
ScanCode::Insert, // 0xe052
|
||||
ScanCode::Delete, // 0xe053
|
||||
ScanCode::Unknown, // 0xe054
|
||||
ScanCode::Unknown, // 0xe055
|
||||
ScanCode::Unknown, // 0xe056
|
||||
ScanCode::Unknown, // 0xe057
|
||||
ScanCode::Unknown, // 0xe058
|
||||
ScanCode::Unknown, // 0xe059
|
||||
ScanCode::Unknown, // 0xe05A
|
||||
ScanCode::LeftOSCommand, // 0xe05B
|
||||
ScanCode::RightOSCommand, // 0xe05C
|
||||
ScanCode::Unsupported, // 0xe05D Unsupported Application context
|
||||
ScanCode::Power, // 0xe05E
|
||||
ScanCode::Sleep, // 0xe05F
|
||||
ScanCode::Unknown, // 0xe060
|
||||
ScanCode::Unknown, // 0xe061
|
||||
ScanCode::Unknown, // 0xe062
|
||||
ScanCode::Unknown, // 0xe063
|
||||
ScanCode::Unknown, // 0xe064
|
||||
ScanCode::Unsupported, // 0xe065 Unsupported:Application Search
|
||||
ScanCode::Unsupported, // 0xe066 Unsupported:Application Bookmarks
|
||||
ScanCode::Unsupported, // 0xe067 Unsupported:Application Refresh
|
||||
ScanCode::Unsupported, // 0xe068 Unsupported:Application Stop
|
||||
ScanCode::Unsupported, // 0xe069 Unsupported:Application Forward
|
||||
ScanCode::Unsupported, // 0xe06A Unsupported:Application Back
|
||||
ScanCode::Unsupported, // 0xe06B Unsupported:LaunchApp1
|
||||
ScanCode::Unsupported, // 0xe06C Unsupported:LaunchMail
|
||||
ScanCode::Media_Select, // 0xe06D
|
||||
ScanCode::Unknown, // 0xe06E
|
||||
ScanCode::Unknown, // 0xe06F
|
||||
ScanCode::Unknown, // 0xe070
|
||||
ScanCode::Unknown, // 0xe071
|
||||
ScanCode::Unknown, // 0xe072
|
||||
ScanCode::Unknown, // 0xe073
|
||||
ScanCode::Unknown, // 0xe074
|
||||
ScanCode::Unknown, // 0xe075
|
||||
ScanCode::Unknown, // 0xe076
|
||||
ScanCode::Unknown, // 0xe077
|
||||
ScanCode::Unknown, // 0xe078
|
||||
ScanCode::Unknown, // 0xe079
|
||||
ScanCode::Unknown, // 0xe07A
|
||||
ScanCode::Unknown, // 0xe07B
|
||||
ScanCode::Unknown, // 0xe07C
|
||||
ScanCode::Unknown, // 0xe07D
|
||||
ScanCode::Unknown, // 0xe07E
|
||||
ScanCode::Unknown // 0xe07F
|
||||
|
||||
};
|
||||
// clang-format on
|
||||
} // namespace Juliet::Win32
|
||||
23
Juliet/src/Core/HAL/Event/WindowEvent.cpp
Normal file
23
Juliet/src/Core/HAL/Event/WindowEvent.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/HAL/Display/Window.h>
|
||||
#include <Core/HAL/Event/SystemEvent.h>
|
||||
#include <Core/HAL/Event/WindowEvent.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
bool SendWindowEvent(Window* window, EventType type)
|
||||
{
|
||||
Assert(window);
|
||||
|
||||
SystemEvent evt;
|
||||
evt.Timestamp = 0;
|
||||
evt.Type = type;
|
||||
evt.Data.Window.AssociatedWindowID = window->ID;
|
||||
|
||||
bool evtPosted = AddEvent(evt);
|
||||
|
||||
return evtPosted;
|
||||
}
|
||||
|
||||
} // namespace Juliet
|
||||
9
Juliet/src/Core/HAL/Event/WindowEvent.h
Normal file
9
Juliet/src/Core/HAL/Event/WindowEvent.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
struct Window;
|
||||
enum class EventType : uint32;
|
||||
|
||||
extern bool SendWindowEvent(Window* window, EventType type);
|
||||
} // namespace Juliet
|
||||
54
Juliet/src/Core/HAL/Win32.h
Normal file
54
Juliet/src/Core/HAL/Win32.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
// Slim version of windows.h header
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#ifndef WIN32_EXTRA_LEAN
|
||||
#define WIN32_EXTRA_LEAN
|
||||
#endif
|
||||
|
||||
#ifndef UNICODE
|
||||
#define UNICODE
|
||||
#endif
|
||||
|
||||
#define NOIME
|
||||
#define NOWINRES
|
||||
#define NOGDICAPMASKS
|
||||
#define NOVIRTUALKEYCODES
|
||||
#define NOSYSMETRICS
|
||||
#define NOMENUS
|
||||
#define NOICONS
|
||||
#define NOSYSCOMMANDS
|
||||
#define NORASTEROPS
|
||||
#define OEMRESOURCE
|
||||
#define NOATOM
|
||||
#define NOCLIPBOARD
|
||||
#define NOCOLOR
|
||||
#define NOCTLMGR
|
||||
#define NODRAWTEXT
|
||||
#define NOMEMMGR
|
||||
#define NOMETAFILE
|
||||
#define NOMINMAX
|
||||
#define NOOPENFILE
|
||||
#define NOSCROLL
|
||||
#define NOSERVICE
|
||||
#define NOSOUND
|
||||
#define NOTEXTMETRIC
|
||||
#define NOWH
|
||||
#define NOCOMM
|
||||
#define NOKANJI
|
||||
#define NOHELP
|
||||
#define NOPROFILER
|
||||
#define NODEFERWINDOWPOS
|
||||
#define NOMCX
|
||||
#define NOIME
|
||||
#define NOPROXYSTUB
|
||||
#define NOIMAGE
|
||||
#define NO
|
||||
#define NOTAPE
|
||||
#define ANSI_ONLY
|
||||
|
||||
#include <Windows.h>
|
||||
60
Juliet/src/Core/Juliet.cpp
Normal file
60
Juliet/src/Core/Juliet.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Common/EnumUtils.h>
|
||||
#include <Core/HAL/Display/Display_Private.h>
|
||||
#include <Core/JulietInit.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
namespace
|
||||
{
|
||||
bool IsQuitting = false;
|
||||
uint8 SystemInitRefCount[ToUnderlying(JulietInit_Flags::Count)];
|
||||
|
||||
void IncrementSystemRefCount(JulietInit_Flags flag)
|
||||
{
|
||||
Assert(flag != JulietInit_Flags::None);
|
||||
++SystemInitRefCount[ToUnderlying(flag)];
|
||||
}
|
||||
|
||||
void DecrementSystemRefCount(JulietInit_Flags flag)
|
||||
{
|
||||
Assert(flag != JulietInit_Flags::None);
|
||||
Assert(SystemInitRefCount[ToUnderlying(flag)] != 0 && "Trying to decrement ref count but its already 0");
|
||||
|
||||
if (IsQuitting)
|
||||
{
|
||||
SystemInitRefCount[ToUnderlying(flag)] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
--SystemInitRefCount[ToUnderlying(flag)];
|
||||
}
|
||||
}
|
||||
|
||||
bool IsInitialized(JulietInit_Flags flag)
|
||||
{
|
||||
return SystemInitRefCount[ToUnderlying(flag)] != 0;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void JulietInit(JulietInit_Flags flags)
|
||||
{
|
||||
if ((flags | JulietInit_Flags::Display) != JulietInit_Flags::None)
|
||||
{
|
||||
InitializeDisplaySystem();
|
||||
IncrementSystemRefCount(JulietInit_Flags::Display);
|
||||
}
|
||||
}
|
||||
|
||||
void JulietShutdown()
|
||||
{
|
||||
IsQuitting = true;
|
||||
if (IsInitialized(JulietInit_Flags::Display))
|
||||
{
|
||||
DecrementSystemRefCount(JulietInit_Flags::Display);
|
||||
ShutdownDisplaySystem();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Juliet
|
||||
106
Juliet/src/Core/Logging/LogManager.cpp
Normal file
106
Juliet/src/Core/Logging/LogManager.cpp
Normal file
@@ -0,0 +1,106 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Logging/LogManager.h>
|
||||
#include <Core/Logging/LogTypes.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdarg>
|
||||
|
||||
// Begin Todo JULIET debug output
|
||||
#include <Core/HAL/Win32.h>
|
||||
#include <debugapi.h>
|
||||
// End Todo
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
namespace
|
||||
{
|
||||
LogManager LogManagerSingleton;
|
||||
constexpr size_t kLogBufferSize = 1024;
|
||||
} // namespace
|
||||
|
||||
LogManager::Entry::Entry(std::string& value, LogLevel level, LogCategory category)
|
||||
: Value(value)
|
||||
, Level(level)
|
||||
, Category(category)
|
||||
{
|
||||
// TODO Juliet clock
|
||||
Time = std::chrono::system_clock::now().time_since_epoch().count();
|
||||
}
|
||||
|
||||
LogManager::LogManager()
|
||||
: IsInitialized(false)
|
||||
{
|
||||
}
|
||||
|
||||
void LogManager::Init()
|
||||
{
|
||||
IsInitialized = true;
|
||||
|
||||
Log(LogLevel::Message, LogCategory::Engine, "Initializing Log Manager");
|
||||
}
|
||||
|
||||
void LogManager::Shutdown()
|
||||
{
|
||||
Log(LogLevel::Message, LogCategory::Engine, "Shutting down Log Manager");
|
||||
|
||||
Entries.clear();
|
||||
|
||||
IsInitialized = false;
|
||||
}
|
||||
|
||||
void LogManager::AddEntry(Entry&& entry)
|
||||
{
|
||||
if (Entries.size() >= kLogBufferSize)
|
||||
{
|
||||
Entries.pop_front();
|
||||
}
|
||||
|
||||
Entries.push_back(std::move(entry));
|
||||
}
|
||||
|
||||
void LogManager::OutputLog(Entry& entry)
|
||||
{
|
||||
// TODO Juliet Output io for each platform
|
||||
OutputDebugStringA((entry.Value + "\n").c_str());
|
||||
printf("%s", (entry.Value + "\n").c_str());
|
||||
}
|
||||
|
||||
void InitializeLogManager()
|
||||
{
|
||||
LogManagerSingleton.Init();
|
||||
}
|
||||
|
||||
void ShutdownLogManager()
|
||||
{
|
||||
LogManagerSingleton.Shutdown();
|
||||
}
|
||||
|
||||
void Log(LogLevel level, LogCategory category, const char* fmt, ...)
|
||||
{
|
||||
// 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);
|
||||
|
||||
std::stringstream ss(formattedText);
|
||||
std::string individualLine;
|
||||
|
||||
while (std::getline(ss, individualLine, '\n'))
|
||||
{
|
||||
LogManager::Entry entry(individualLine, level, category);
|
||||
LogManagerSingleton.OutputLog(entry);
|
||||
|
||||
if (LogManagerSingleton.GetIsInitialized())
|
||||
{
|
||||
LogManagerSingleton.AddEntry(std::move(entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Juliet
|
||||
52
Juliet/src/Core/Memory/Allocator.cpp
Normal file
52
Juliet/src/Core/Memory/Allocator.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <core/Memory/Allocator.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
// Uninitialized allocation
|
||||
void* Malloc(size_t total_size)
|
||||
{
|
||||
// Cant allocate 0
|
||||
if (!total_size)
|
||||
{
|
||||
total_size = 1;
|
||||
}
|
||||
|
||||
void* retMemory = malloc(total_size);
|
||||
Assert(retMemory && "Out of memory");
|
||||
|
||||
return retMemory;
|
||||
}
|
||||
|
||||
// Initialized to 0 allocation
|
||||
void* Calloc(size_t nb_elem, size_t elem_size)
|
||||
{
|
||||
// cant allocate 0
|
||||
if (!nb_elem || !elem_size)
|
||||
{
|
||||
nb_elem = 1;
|
||||
elem_size = 1;
|
||||
}
|
||||
|
||||
void* retMemory = calloc(nb_elem, elem_size);
|
||||
Assert(retMemory && "Out of memory");
|
||||
|
||||
return retMemory;
|
||||
}
|
||||
|
||||
void* Realloc(void* memory, size_t newSize)
|
||||
{
|
||||
if (!newSize)
|
||||
{
|
||||
newSize = 1;
|
||||
}
|
||||
|
||||
void* retMemory = realloc(memory, newSize);
|
||||
Assert(retMemory && "Out of memory");
|
||||
|
||||
return retMemory;
|
||||
}
|
||||
|
||||
void Free(void* memory) {}
|
||||
} // namespace Juliet
|
||||
62
Juliet/src/Core/Networking/NetworkPacket.cpp
Normal file
62
Juliet/src/Core/Networking/NetworkPacket.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Networking/NetworkPacket.h>
|
||||
#include <Core/Networking/SocketPlatformImpl.h>
|
||||
|
||||
#define TO_BUFFER(ptr) reinterpret_cast<const byte*>(ptr)
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
NetworkPacket::NetworkPacket() = default;
|
||||
NetworkPacket::~NetworkPacket() = default;
|
||||
NetworkPacket::NetworkPacket(NetworkPacket&) = default;
|
||||
NetworkPacket& NetworkPacket::operator=(const NetworkPacket&) = default;
|
||||
NetworkPacket::NetworkPacket(NetworkPacket&&) noexcept = default;
|
||||
NetworkPacket& NetworkPacket::operator=(NetworkPacket&&) noexcept = default;
|
||||
|
||||
ByteBuffer NetworkPacket::GetRawData()
|
||||
{
|
||||
ByteBuffer buffer{};
|
||||
buffer.Data = Data.data();
|
||||
buffer.Size = Data.size();
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// Begin - Unpack
|
||||
|
||||
// End - Unpack
|
||||
// Begin - Pack
|
||||
NetworkPacket& NetworkPacket::operator<<(uint32 value)
|
||||
{
|
||||
const uint32 toWrite = htonl(value);
|
||||
Append({ TO_BUFFER(&toWrite), sizeof(toWrite) });
|
||||
return *this;
|
||||
}
|
||||
|
||||
NetworkPacket& NetworkPacket::operator<<(const char* data)
|
||||
{
|
||||
Assert(data && "NetworkPacket::operator<< Data must not be null");
|
||||
|
||||
// First insert string length in network byte order
|
||||
const uint32 length = static_cast<uint32>(std::strlen(data));
|
||||
*this << length;
|
||||
|
||||
// Then insert the chars
|
||||
Append({ TO_BUFFER(data), length * sizeof(char) });
|
||||
|
||||
return *this;
|
||||
}
|
||||
// End - Pack
|
||||
|
||||
void NetworkPacket::Append(ByteBuffer buffer)
|
||||
{
|
||||
if (buffer.Data && (buffer.Size > 0))
|
||||
{
|
||||
const auto* begin = reinterpret_cast<const std::byte*>(buffer.Data);
|
||||
const auto* end = begin + buffer.Size;
|
||||
Data.insert(Data.end(), begin, end);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Juliet
|
||||
82
Juliet/src/Core/Networking/Socket.cpp
Normal file
82
Juliet/src/Core/Networking/Socket.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Logging/LogManager.h>
|
||||
#include <Core/Logging/LogTypes.h>
|
||||
#include <Core/Networking/Socket.h>
|
||||
#include <Core/Networking/SocketPlatformImpl.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
Socket::Socket(Protocol protocol) : Handle(SocketImpl::GetInvalidSocketHandle()), ProtocolType(protocol) {}
|
||||
|
||||
Socket::~Socket()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
Socket::Socket(Socket&& other) noexcept
|
||||
{
|
||||
Assert(false); // Unimplemented
|
||||
}
|
||||
|
||||
Socket& Socket::operator=(Socket&& socket) noexcept
|
||||
{
|
||||
Assert(false); // Unimplemented
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool Socket::IsValid() const
|
||||
{
|
||||
return Handle != SocketImpl::GetInvalidSocketHandle();
|
||||
}
|
||||
|
||||
void Socket::Create()
|
||||
{
|
||||
if (Handle != SocketImpl::GetInvalidSocketHandle())
|
||||
{
|
||||
Log(LogLevel::Message, LogCategory::Networking, "Socket already created");
|
||||
return;
|
||||
}
|
||||
|
||||
const SocketHandle handle = socket(PF_INET, ProtocolType == Protocol::TCP ? SOCK_STREAM : SOCK_DGRAM, 0);
|
||||
if (handle == SocketImpl::GetInvalidSocketHandle())
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Networking, "Failed to create socket. Error [%s]", SocketImpl::GetErrorString());
|
||||
return;
|
||||
}
|
||||
|
||||
CreateFromHandle(handle);
|
||||
}
|
||||
void Socket::CreateFromHandle(SocketHandle handle)
|
||||
{
|
||||
if (Handle != SocketImpl::GetInvalidSocketHandle())
|
||||
{
|
||||
Log(LogLevel::Message, LogCategory::Networking, "Socket already created");
|
||||
return;
|
||||
}
|
||||
|
||||
Handle = handle;
|
||||
|
||||
if (ProtocolType == Protocol::TCP)
|
||||
{
|
||||
int yes = 1;
|
||||
if (setsockopt(Handle, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<char*>(&yes), sizeof(yes)) == -1)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Networking, "Cant set TCP_NODELAY.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert(false); // Unimplemented
|
||||
}
|
||||
}
|
||||
|
||||
void Socket::Close()
|
||||
{
|
||||
if (Handle != SocketImpl::GetInvalidSocketHandle())
|
||||
{
|
||||
SocketImpl::Close(Handle);
|
||||
Handle = SocketImpl::GetInvalidSocketHandle();
|
||||
}
|
||||
}
|
||||
} // namespace Juliet
|
||||
25
Juliet/src/Core/Networking/SocketPlatformImpl.h
Normal file
25
Juliet/src/Core/Networking/SocketPlatformImpl.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Networking/Socket.h>
|
||||
|
||||
// Windows uses a non standard header to define its socket types.
|
||||
// Because of that we need to include those in this header.
|
||||
// TODO : implement for other platforms
|
||||
#if JULIET_WIN32
|
||||
|
||||
#include <winsock2.h>
|
||||
|
||||
#else
|
||||
// UNIMPLEMENT_SOCKETS
|
||||
#endif
|
||||
|
||||
namespace Juliet::SocketImpl
|
||||
{
|
||||
using MessageLenghtType = int;
|
||||
|
||||
sockaddr_in CreateAddress(uint32 address, uint16 port);
|
||||
SOCKET GetInvalidSocketHandle();
|
||||
void Close(SOCKET socketHandle);
|
||||
const char* GetErrorString();
|
||||
Socket::Status GetErrorStatus();
|
||||
} // namespace Juliet::SocketImpl
|
||||
68
Juliet/src/Core/Networking/TcpListener.cpp
Normal file
68
Juliet/src/Core/Networking/TcpListener.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Logging/LogManager.h>
|
||||
#include <Core/Logging/LogTypes.h>
|
||||
#include <Core/Networking/SocketPlatformImpl.h>
|
||||
#include <Core/Networking/TcpListener.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
TcpListener::TcpListener() : Socket(Protocol::TCP) {}
|
||||
|
||||
Socket::Status TcpListener::Listen(uint16 port, uint32 address)
|
||||
{
|
||||
// Unbind the internal socket.
|
||||
// Allow reusing the same listener but switch port and addres
|
||||
Close();
|
||||
|
||||
Create();
|
||||
|
||||
// Cant listen on broadcast
|
||||
if (address == kBroadcastIp)
|
||||
{
|
||||
return Status::Error;
|
||||
}
|
||||
|
||||
sockaddr_in socketAddr = SocketImpl::CreateAddress(address, port);
|
||||
if (bind(GetHandle(), reinterpret_cast<sockaddr*>(&socketAddr), sizeof(socketAddr)) == -1)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Networking, "Failed to bind TcpListener to port %d", port);
|
||||
return Status::Error;
|
||||
}
|
||||
|
||||
if (listen(GetHandle(), SOMAXCONN) == -1)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Networking, "Failed to listen TcpListener to port %d", port);
|
||||
return Status::Error;
|
||||
}
|
||||
|
||||
return Status::Ready;
|
||||
}
|
||||
|
||||
Socket::Status TcpListener::Accept(TcpSocket& socket)
|
||||
{
|
||||
if (!IsValid())
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Networking, "Cannot accept connection because the socket is not listening");
|
||||
return Status::Error;
|
||||
}
|
||||
|
||||
SocketHandle client = ::accept(GetHandle(), nullptr, nullptr);
|
||||
if (client == SocketImpl::GetInvalidSocketHandle())
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Networking, "Failed to accept a new connection. Error [%s]",
|
||||
SocketImpl::GetErrorString());
|
||||
return Status::Error;
|
||||
}
|
||||
|
||||
socket.Close();
|
||||
socket.CreateFromHandle(client);
|
||||
|
||||
return Status::Ready;
|
||||
}
|
||||
|
||||
void TcpListener::Close()
|
||||
{
|
||||
Socket::Close();
|
||||
}
|
||||
} // namespace Juliet
|
||||
90
Juliet/src/Core/Networking/TcpSocket.cpp
Normal file
90
Juliet/src/Core/Networking/TcpSocket.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Logging/LogManager.h>
|
||||
#include <Core/Logging/LogTypes.h>
|
||||
#include <Core/Networking/NetworkPacket.h>
|
||||
#include <core/Networking/SocketPlatformImpl.h>
|
||||
#include <Core/Networking/TcpSocket.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
TcpSocket::TcpSocket() : Socket(Protocol::TCP) {}
|
||||
|
||||
Socket::RequestStatus TcpSocket::Send(NetworkPacket& packet)
|
||||
{
|
||||
ByteBuffer buffer = packet.GetRawData();
|
||||
|
||||
if (buffer.Size == 0 || buffer.Data == nullptr)
|
||||
{
|
||||
Log(LogLevel::Error, LogCategory::Networking, "No data inside the network packet.");
|
||||
return { Status::Error };
|
||||
}
|
||||
|
||||
// Tcp socket opens a stream of data.
|
||||
// Send function do not guarantee how the data will be sent and received.
|
||||
// The receiver has no way to know the message stream has ended
|
||||
// Because of that we will send the size of the packet first before sending the data.
|
||||
|
||||
// TODO Use scratch allocator.
|
||||
Vector<byte> scratchVector;
|
||||
scratchVector.resize(buffer.Size + sizeof(uint32));
|
||||
|
||||
// htonl converts uint32 from host byte order to network byte order
|
||||
uint32 nlSize = htonl(static_cast<uint32>(buffer.Size));
|
||||
|
||||
memcpy(scratchVector.data(), &nlSize, sizeof(nlSize));
|
||||
memcpy(scratchVector.data() + sizeof(nlSize), buffer.Data, buffer.Size);
|
||||
|
||||
// TODO : Save within the packet the total size + make the ByteBuffer use the PartialSendIndex variable directly
|
||||
// instead of memcopying the whole packet and ignoring part of it
|
||||
ByteBuffer packetToSend{ .Data = scratchVector.data() + packet.PartialSendIndex,
|
||||
.Size = scratchVector.size() - packet.PartialSendIndex };
|
||||
auto messageStatus = Send(packetToSend);
|
||||
|
||||
if (messageStatus.Status == Status::Partial)
|
||||
{
|
||||
packet.PartialSendIndex += messageStatus.Length;
|
||||
}
|
||||
else if (messageStatus.Status == Status::Done)
|
||||
{
|
||||
packet.PartialSendIndex = 0;
|
||||
}
|
||||
|
||||
return messageStatus;
|
||||
}
|
||||
|
||||
Socket::RequestStatus TcpSocket::Send(ByteBuffer buffer)
|
||||
{
|
||||
RequestStatus request = {};
|
||||
|
||||
constexpr int sendFlags = 0;
|
||||
int result = 0;
|
||||
for (request.Length = 0; request.Length < buffer.Size; request.Length += static_cast<size_t>(result))
|
||||
{
|
||||
result = ::send(GetHandle(), reinterpret_cast<const char*>(buffer.Data + request.Length),
|
||||
static_cast<SocketImpl::MessageLenghtType>(buffer.Size) - request.Length, sendFlags);
|
||||
|
||||
// Results is -1 when an error occured.
|
||||
// https://pubs.opengroup.org/onlinepubs/000095399/functions/send.html
|
||||
if (result < 0)
|
||||
{
|
||||
request.Status = SocketImpl::GetErrorStatus();
|
||||
|
||||
if ((request.Status == Status::NotReady) && (request.Length > 0))
|
||||
{
|
||||
request.Status = Status::Partial;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
Socket::Status TcpSocket::Receive(NetworkPacket& outPacket)
|
||||
{
|
||||
return Status::Done;
|
||||
}
|
||||
|
||||
} // namespace Juliet
|
||||
85
Juliet/src/Core/Networking/Win32/Win32SocketPlatformImpl.cpp
Normal file
85
Juliet/src/Core/Networking/Win32/Win32SocketPlatformImpl.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Logging/LogManager.h>
|
||||
#include <Core/Logging/LogTypes.h>
|
||||
#include <Core/Networking/Socket.h>
|
||||
#include <Core/Networking/SocketPlatformImpl.h>
|
||||
|
||||
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())
|
||||
{
|
||||
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()
|
||||
{
|
||||
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 gWSAautoRelease;
|
||||
} // namespace Juliet
|
||||
58
Juliet/src/Engine/Engine.cpp
Normal file
58
Juliet/src/Engine/Engine.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Logging/LogManager.h>
|
||||
#include <Engine/Engine.h>
|
||||
|
||||
#include <Core/JulietInit.h>
|
||||
#include <time.h>
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
namespace
|
||||
{
|
||||
Engine EngineInstance;
|
||||
}
|
||||
|
||||
void InitializeEngine(JulietInit_Flags flags)
|
||||
{
|
||||
InitializeLogManager();
|
||||
JulietInit(flags);
|
||||
}
|
||||
|
||||
void ShutdownEngine()
|
||||
{
|
||||
JulietShutdown();
|
||||
ShutdownLogManager();
|
||||
}
|
||||
|
||||
void LoadApplication(IApplication& app)
|
||||
{
|
||||
EngineInstance.Application = &app;
|
||||
EngineInstance.Application->Init();
|
||||
}
|
||||
|
||||
void UnloadApplication()
|
||||
{
|
||||
EngineInstance.Application->Shutdown();
|
||||
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
|
||||
8
Juliet/src/Graphics/Graphics.cpp
Normal file
8
Juliet/src/Graphics/Graphics.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Graphics/Graphics.h>
|
||||
|
||||
namespace Juliet::Graphics
|
||||
{
|
||||
|
||||
} // namespace Juliet::Graphics
|
||||
File diff suppressed because it is too large
Load Diff
2651
Juliet/src/Graphics/RHI/DX12/D3D12/directx/DirectML.h
Normal file
2651
Juliet/src/Graphics/RHI/DX12/D3D12/directx/DirectML.h
Normal file
File diff suppressed because it is too large
Load Diff
34938
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12.h
Normal file
34938
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12.h
Normal file
File diff suppressed because it is too large
Load Diff
6558
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12.idl
Normal file
6558
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12.idl
Normal file
File diff suppressed because it is too large
Load Diff
819
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12compatibility.h
Normal file
819
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12compatibility.h
Normal file
@@ -0,0 +1,819 @@
|
||||
/*-------------------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
* Licensed under the MIT license
|
||||
*
|
||||
*-------------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
|
||||
|
||||
|
||||
/* File created by MIDL compiler version 8.01.0628 */
|
||||
|
||||
|
||||
|
||||
/* verify that the <rpcndr.h> version is high enough to compile this file*/
|
||||
#ifndef __REQUIRED_RPCNDR_H_VERSION__
|
||||
#define __REQUIRED_RPCNDR_H_VERSION__ 500
|
||||
#endif
|
||||
|
||||
/* verify that the <rpcsal.h> version is high enough to compile this file*/
|
||||
#ifndef __REQUIRED_RPCSAL_H_VERSION__
|
||||
#define __REQUIRED_RPCSAL_H_VERSION__ 100
|
||||
#endif
|
||||
|
||||
#include "rpc.h"
|
||||
#include "rpcndr.h"
|
||||
|
||||
#ifndef __RPCNDR_H_VERSION__
|
||||
#error this stub requires an updated version of <rpcndr.h>
|
||||
#endif /* __RPCNDR_H_VERSION__ */
|
||||
|
||||
#ifndef COM_NO_WINDOWS_H
|
||||
#include "windows.h"
|
||||
#include "ole2.h"
|
||||
#endif /*COM_NO_WINDOWS_H*/
|
||||
|
||||
#ifndef __d3d12compatibility_h__
|
||||
#define __d3d12compatibility_h__
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef DECLSPEC_XFGVIRT
|
||||
#if defined(_CONTROL_FLOW_GUARD_XFG)
|
||||
#define DECLSPEC_XFGVIRT(base, func) __declspec(xfg_virtual(base, func))
|
||||
#else
|
||||
#define DECLSPEC_XFGVIRT(base, func)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Forward Declarations */
|
||||
|
||||
#ifndef __ID3D12CompatibilityDevice_FWD_DEFINED__
|
||||
#define __ID3D12CompatibilityDevice_FWD_DEFINED__
|
||||
typedef interface ID3D12CompatibilityDevice ID3D12CompatibilityDevice;
|
||||
|
||||
#endif /* __ID3D12CompatibilityDevice_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __D3D11On12CreatorID_FWD_DEFINED__
|
||||
#define __D3D11On12CreatorID_FWD_DEFINED__
|
||||
typedef interface D3D11On12CreatorID D3D11On12CreatorID;
|
||||
|
||||
#endif /* __D3D11On12CreatorID_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __D3D9On12CreatorID_FWD_DEFINED__
|
||||
#define __D3D9On12CreatorID_FWD_DEFINED__
|
||||
typedef interface D3D9On12CreatorID D3D9On12CreatorID;
|
||||
|
||||
#endif /* __D3D9On12CreatorID_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __OpenGLOn12CreatorID_FWD_DEFINED__
|
||||
#define __OpenGLOn12CreatorID_FWD_DEFINED__
|
||||
typedef interface OpenGLOn12CreatorID OpenGLOn12CreatorID;
|
||||
|
||||
#endif /* __OpenGLOn12CreatorID_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __OpenCLOn12CreatorID_FWD_DEFINED__
|
||||
#define __OpenCLOn12CreatorID_FWD_DEFINED__
|
||||
typedef interface OpenCLOn12CreatorID OpenCLOn12CreatorID;
|
||||
|
||||
#endif /* __OpenCLOn12CreatorID_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __VulkanOn12CreatorID_FWD_DEFINED__
|
||||
#define __VulkanOn12CreatorID_FWD_DEFINED__
|
||||
typedef interface VulkanOn12CreatorID VulkanOn12CreatorID;
|
||||
|
||||
#endif /* __VulkanOn12CreatorID_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __DirectMLTensorFlowCreatorID_FWD_DEFINED__
|
||||
#define __DirectMLTensorFlowCreatorID_FWD_DEFINED__
|
||||
typedef interface DirectMLTensorFlowCreatorID DirectMLTensorFlowCreatorID;
|
||||
|
||||
#endif /* __DirectMLTensorFlowCreatorID_FWD_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __DirectMLPyTorchCreatorID_FWD_DEFINED__
|
||||
#define __DirectMLPyTorchCreatorID_FWD_DEFINED__
|
||||
typedef interface DirectMLPyTorchCreatorID DirectMLPyTorchCreatorID;
|
||||
|
||||
#endif /* __DirectMLPyTorchCreatorID_FWD_DEFINED__ */
|
||||
|
||||
|
||||
/* header files for imported files */
|
||||
#include "oaidl.h"
|
||||
#include "ocidl.h"
|
||||
#include "d3d11on12.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d12compatibility_0000_0000 */
|
||||
/* [local] */
|
||||
|
||||
#include <winapifamily.h>
|
||||
#pragma region Desktop Family
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES)
|
||||
typedef
|
||||
enum D3D12_COMPATIBILITY_SHARED_FLAGS
|
||||
{
|
||||
D3D12_COMPATIBILITY_SHARED_FLAG_NONE = 0,
|
||||
D3D12_COMPATIBILITY_SHARED_FLAG_NON_NT_HANDLE = 0x1,
|
||||
D3D12_COMPATIBILITY_SHARED_FLAG_KEYED_MUTEX = 0x2,
|
||||
D3D12_COMPATIBILITY_SHARED_FLAG_9_ON_12 = 0x4
|
||||
} D3D12_COMPATIBILITY_SHARED_FLAGS;
|
||||
|
||||
DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMPATIBILITY_SHARED_FLAGS )
|
||||
typedef
|
||||
enum D3D12_REFLECT_SHARED_PROPERTY
|
||||
{
|
||||
D3D12_REFLECT_SHARED_PROPERTY_D3D11_RESOURCE_FLAGS = 0,
|
||||
D3D12_REFELCT_SHARED_PROPERTY_COMPATIBILITY_SHARED_FLAGS = ( D3D12_REFLECT_SHARED_PROPERTY_D3D11_RESOURCE_FLAGS + 1 ) ,
|
||||
D3D12_REFLECT_SHARED_PROPERTY_NON_NT_SHARED_HANDLE = ( D3D12_REFELCT_SHARED_PROPERTY_COMPATIBILITY_SHARED_FLAGS + 1 )
|
||||
} D3D12_REFLECT_SHARED_PROPERTY;
|
||||
|
||||
|
||||
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0000_v0_0_c_ifspec;
|
||||
extern RPC_IF_HANDLE __MIDL_itf_d3d12compatibility_0000_0000_v0_0_s_ifspec;
|
||||
|
||||
#ifndef __ID3D12CompatibilityDevice_INTERFACE_DEFINED__
|
||||
#define __ID3D12CompatibilityDevice_INTERFACE_DEFINED__
|
||||
|
||||
/* interface ID3D12CompatibilityDevice */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_ID3D12CompatibilityDevice;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("8f1c0e3c-fae3-4a82-b098-bfe1708207ff")
|
||||
ID3D12CompatibilityDevice : public IUnknown
|
||||
{
|
||||
public:
|
||||
virtual HRESULT STDMETHODCALLTYPE CreateSharedResource(
|
||||
_In_ const D3D12_HEAP_PROPERTIES *pHeapProperties,
|
||||
D3D12_HEAP_FLAGS HeapFlags,
|
||||
_In_ const D3D12_RESOURCE_DESC *pDesc,
|
||||
D3D12_RESOURCE_STATES InitialResourceState,
|
||||
_In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue,
|
||||
_In_opt_ const D3D11_RESOURCE_FLAGS *pFlags11,
|
||||
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
|
||||
_In_opt_ ID3D12LifetimeTracker *pLifetimeTracker,
|
||||
_In_opt_ ID3D12SwapChainAssistant *pOwningSwapchain,
|
||||
REFIID riid,
|
||||
_COM_Outptr_opt_ void **ppResource) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE CreateSharedHeap(
|
||||
_In_ const D3D12_HEAP_DESC *pHeapDesc,
|
||||
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
|
||||
REFIID riid,
|
||||
_COM_Outptr_opt_ void **ppHeap) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE ReflectSharedProperties(
|
||||
_In_ ID3D12Object *pHeapOrResource,
|
||||
D3D12_REFLECT_SHARED_PROPERTY ReflectType,
|
||||
_Out_writes_bytes_(DataSize) void *pData,
|
||||
UINT DataSize) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct ID3D12CompatibilityDeviceVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
ID3D12CompatibilityDevice * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
ID3D12CompatibilityDevice * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
ID3D12CompatibilityDevice * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(ID3D12CompatibilityDevice, CreateSharedResource)
|
||||
HRESULT ( STDMETHODCALLTYPE *CreateSharedResource )(
|
||||
ID3D12CompatibilityDevice * This,
|
||||
_In_ const D3D12_HEAP_PROPERTIES *pHeapProperties,
|
||||
D3D12_HEAP_FLAGS HeapFlags,
|
||||
_In_ const D3D12_RESOURCE_DESC *pDesc,
|
||||
D3D12_RESOURCE_STATES InitialResourceState,
|
||||
_In_opt_ const D3D12_CLEAR_VALUE *pOptimizedClearValue,
|
||||
_In_opt_ const D3D11_RESOURCE_FLAGS *pFlags11,
|
||||
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
|
||||
_In_opt_ ID3D12LifetimeTracker *pLifetimeTracker,
|
||||
_In_opt_ ID3D12SwapChainAssistant *pOwningSwapchain,
|
||||
REFIID riid,
|
||||
_COM_Outptr_opt_ void **ppResource);
|
||||
|
||||
DECLSPEC_XFGVIRT(ID3D12CompatibilityDevice, CreateSharedHeap)
|
||||
HRESULT ( STDMETHODCALLTYPE *CreateSharedHeap )(
|
||||
ID3D12CompatibilityDevice * This,
|
||||
_In_ const D3D12_HEAP_DESC *pHeapDesc,
|
||||
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
|
||||
REFIID riid,
|
||||
_COM_Outptr_opt_ void **ppHeap);
|
||||
|
||||
DECLSPEC_XFGVIRT(ID3D12CompatibilityDevice, ReflectSharedProperties)
|
||||
HRESULT ( STDMETHODCALLTYPE *ReflectSharedProperties )(
|
||||
ID3D12CompatibilityDevice * This,
|
||||
_In_ ID3D12Object *pHeapOrResource,
|
||||
D3D12_REFLECT_SHARED_PROPERTY ReflectType,
|
||||
_Out_writes_bytes_(DataSize) void *pData,
|
||||
UINT DataSize);
|
||||
|
||||
END_INTERFACE
|
||||
} ID3D12CompatibilityDeviceVtbl;
|
||||
|
||||
interface ID3D12CompatibilityDevice
|
||||
{
|
||||
CONST_VTBL struct ID3D12CompatibilityDeviceVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define ID3D12CompatibilityDevice_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define ID3D12CompatibilityDevice_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define ID3D12CompatibilityDevice_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#define ID3D12CompatibilityDevice_CreateSharedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pFlags11,CompatibilityFlags,pLifetimeTracker,pOwningSwapchain,riid,ppResource) \
|
||||
( (This)->lpVtbl -> CreateSharedResource(This,pHeapProperties,HeapFlags,pDesc,InitialResourceState,pOptimizedClearValue,pFlags11,CompatibilityFlags,pLifetimeTracker,pOwningSwapchain,riid,ppResource) )
|
||||
|
||||
#define ID3D12CompatibilityDevice_CreateSharedHeap(This,pHeapDesc,CompatibilityFlags,riid,ppHeap) \
|
||||
( (This)->lpVtbl -> CreateSharedHeap(This,pHeapDesc,CompatibilityFlags,riid,ppHeap) )
|
||||
|
||||
#define ID3D12CompatibilityDevice_ReflectSharedProperties(This,pHeapOrResource,ReflectType,pData,DataSize) \
|
||||
( (This)->lpVtbl -> ReflectSharedProperties(This,pHeapOrResource,ReflectType,pData,DataSize) )
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __ID3D12CompatibilityDevice_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __D3D11On12CreatorID_INTERFACE_DEFINED__
|
||||
#define __D3D11On12CreatorID_INTERFACE_DEFINED__
|
||||
|
||||
/* interface D3D11On12CreatorID */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_D3D11On12CreatorID;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("edbf5678-2960-4e81-8429-99d4b2630c4e")
|
||||
D3D11On12CreatorID : public IUnknown
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct D3D11On12CreatorIDVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
D3D11On12CreatorID * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
D3D11On12CreatorID * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
D3D11On12CreatorID * This);
|
||||
|
||||
END_INTERFACE
|
||||
} D3D11On12CreatorIDVtbl;
|
||||
|
||||
interface D3D11On12CreatorID
|
||||
{
|
||||
CONST_VTBL struct D3D11On12CreatorIDVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define D3D11On12CreatorID_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define D3D11On12CreatorID_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define D3D11On12CreatorID_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __D3D11On12CreatorID_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __D3D9On12CreatorID_INTERFACE_DEFINED__
|
||||
#define __D3D9On12CreatorID_INTERFACE_DEFINED__
|
||||
|
||||
/* interface D3D9On12CreatorID */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_D3D9On12CreatorID;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("fffcbb7f-15d3-42a2-841e-9d8d32f37ddd")
|
||||
D3D9On12CreatorID : public IUnknown
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct D3D9On12CreatorIDVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
D3D9On12CreatorID * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
D3D9On12CreatorID * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
D3D9On12CreatorID * This);
|
||||
|
||||
END_INTERFACE
|
||||
} D3D9On12CreatorIDVtbl;
|
||||
|
||||
interface D3D9On12CreatorID
|
||||
{
|
||||
CONST_VTBL struct D3D9On12CreatorIDVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define D3D9On12CreatorID_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define D3D9On12CreatorID_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define D3D9On12CreatorID_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __D3D9On12CreatorID_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __OpenGLOn12CreatorID_INTERFACE_DEFINED__
|
||||
#define __OpenGLOn12CreatorID_INTERFACE_DEFINED__
|
||||
|
||||
/* interface OpenGLOn12CreatorID */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_OpenGLOn12CreatorID;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("6bb3cd34-0d19-45ab-97ed-d720ba3dfc80")
|
||||
OpenGLOn12CreatorID : public IUnknown
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct OpenGLOn12CreatorIDVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
OpenGLOn12CreatorID * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
OpenGLOn12CreatorID * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
OpenGLOn12CreatorID * This);
|
||||
|
||||
END_INTERFACE
|
||||
} OpenGLOn12CreatorIDVtbl;
|
||||
|
||||
interface OpenGLOn12CreatorID
|
||||
{
|
||||
CONST_VTBL struct OpenGLOn12CreatorIDVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define OpenGLOn12CreatorID_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define OpenGLOn12CreatorID_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define OpenGLOn12CreatorID_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __OpenGLOn12CreatorID_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __OpenCLOn12CreatorID_INTERFACE_DEFINED__
|
||||
#define __OpenCLOn12CreatorID_INTERFACE_DEFINED__
|
||||
|
||||
/* interface OpenCLOn12CreatorID */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_OpenCLOn12CreatorID;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("3f76bb74-91b5-4a88-b126-20ca0331cd60")
|
||||
OpenCLOn12CreatorID : public IUnknown
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct OpenCLOn12CreatorIDVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
OpenCLOn12CreatorID * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
OpenCLOn12CreatorID * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
OpenCLOn12CreatorID * This);
|
||||
|
||||
END_INTERFACE
|
||||
} OpenCLOn12CreatorIDVtbl;
|
||||
|
||||
interface OpenCLOn12CreatorID
|
||||
{
|
||||
CONST_VTBL struct OpenCLOn12CreatorIDVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define OpenCLOn12CreatorID_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define OpenCLOn12CreatorID_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define OpenCLOn12CreatorID_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __OpenCLOn12CreatorID_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __VulkanOn12CreatorID_INTERFACE_DEFINED__
|
||||
#define __VulkanOn12CreatorID_INTERFACE_DEFINED__
|
||||
|
||||
/* interface VulkanOn12CreatorID */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_VulkanOn12CreatorID;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("bc806e01-3052-406c-a3e8-9fc07f048f98")
|
||||
VulkanOn12CreatorID : public IUnknown
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct VulkanOn12CreatorIDVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
VulkanOn12CreatorID * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
VulkanOn12CreatorID * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
VulkanOn12CreatorID * This);
|
||||
|
||||
END_INTERFACE
|
||||
} VulkanOn12CreatorIDVtbl;
|
||||
|
||||
interface VulkanOn12CreatorID
|
||||
{
|
||||
CONST_VTBL struct VulkanOn12CreatorIDVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define VulkanOn12CreatorID_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define VulkanOn12CreatorID_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define VulkanOn12CreatorID_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __VulkanOn12CreatorID_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __DirectMLTensorFlowCreatorID_INTERFACE_DEFINED__
|
||||
#define __DirectMLTensorFlowCreatorID_INTERFACE_DEFINED__
|
||||
|
||||
/* interface DirectMLTensorFlowCreatorID */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_DirectMLTensorFlowCreatorID;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("cb7490ac-8a0f-44ec-9b7b-6f4cafe8e9ab")
|
||||
DirectMLTensorFlowCreatorID : public IUnknown
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct DirectMLTensorFlowCreatorIDVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
DirectMLTensorFlowCreatorID * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
DirectMLTensorFlowCreatorID * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
DirectMLTensorFlowCreatorID * This);
|
||||
|
||||
END_INTERFACE
|
||||
} DirectMLTensorFlowCreatorIDVtbl;
|
||||
|
||||
interface DirectMLTensorFlowCreatorID
|
||||
{
|
||||
CONST_VTBL struct DirectMLTensorFlowCreatorIDVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define DirectMLTensorFlowCreatorID_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define DirectMLTensorFlowCreatorID_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define DirectMLTensorFlowCreatorID_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __DirectMLTensorFlowCreatorID_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
#ifndef __DirectMLPyTorchCreatorID_INTERFACE_DEFINED__
|
||||
#define __DirectMLPyTorchCreatorID_INTERFACE_DEFINED__
|
||||
|
||||
/* interface DirectMLPyTorchCreatorID */
|
||||
/* [unique][local][object][uuid] */
|
||||
|
||||
|
||||
EXTERN_C const IID IID_DirectMLPyTorchCreatorID;
|
||||
|
||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||
|
||||
MIDL_INTERFACE("af029192-fba1-4b05-9116-235e06560354")
|
||||
DirectMLPyTorchCreatorID : public IUnknown
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
|
||||
#else /* C style interface */
|
||||
|
||||
typedef struct DirectMLPyTorchCreatorIDVtbl
|
||||
{
|
||||
BEGIN_INTERFACE
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, QueryInterface)
|
||||
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
|
||||
DirectMLPyTorchCreatorID * This,
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void **ppvObject);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, AddRef)
|
||||
ULONG ( STDMETHODCALLTYPE *AddRef )(
|
||||
DirectMLPyTorchCreatorID * This);
|
||||
|
||||
DECLSPEC_XFGVIRT(IUnknown, Release)
|
||||
ULONG ( STDMETHODCALLTYPE *Release )(
|
||||
DirectMLPyTorchCreatorID * This);
|
||||
|
||||
END_INTERFACE
|
||||
} DirectMLPyTorchCreatorIDVtbl;
|
||||
|
||||
interface DirectMLPyTorchCreatorID
|
||||
{
|
||||
CONST_VTBL struct DirectMLPyTorchCreatorIDVtbl *lpVtbl;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef COBJMACROS
|
||||
|
||||
|
||||
#define DirectMLPyTorchCreatorID_QueryInterface(This,riid,ppvObject) \
|
||||
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
|
||||
|
||||
#define DirectMLPyTorchCreatorID_AddRef(This) \
|
||||
( (This)->lpVtbl -> AddRef(This) )
|
||||
|
||||
#define DirectMLPyTorchCreatorID_Release(This) \
|
||||
( (This)->lpVtbl -> Release(This) )
|
||||
|
||||
|
||||
#endif /* COBJMACROS */
|
||||
|
||||
|
||||
#endif /* C style interface */
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __DirectMLPyTorchCreatorID_INTERFACE_DEFINED__ */
|
||||
|
||||
|
||||
/* interface __MIDL_itf_d3d12compatibility_0000_0008 */
|
||||
/* [local] */
|
||||
|
||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */
|
||||
#pragma endregion
|
||||
DEFINE_GUID(IID_ID3D12CompatibilityDevice,0x8f1c0e3c,0xfae3,0x4a82,0xb0,0x98,0xbf,0xe1,0x70,0x82,0x07,0xff);
|
||||
DEFINE_GUID(IID_D3D11On12CreatorID,0xedbf5678,0x2960,0x4e81,0x84,0x29,0x99,0xd4,0xb2,0x63,0x0c,0x4e);
|
||||
DEFINE_GUID(IID_D3D9On12CreatorID,0xfffcbb7f,0x15d3,0x42a2,0x84,0x1e,0x9d,0x8d,0x32,0xf3,0x7d,0xdd);
|
||||
DEFINE_GUID(IID_OpenGLOn12CreatorID,0x6bb3cd34,0x0d19,0x45ab,0x97,0xed,0xd7,0x20,0xba,0x3d,0xfc,0x80);
|
||||
DEFINE_GUID(IID_OpenCLOn12CreatorID,0x3f76bb74,0x91b5,0x4a88,0xb1,0x26,0x20,0xca,0x03,0x31,0xcd,0x60);
|
||||
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);
|
||||
|
||||
|
||||
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;
|
||||
|
||||
/* Additional Prototypes for ALL interfaces */
|
||||
|
||||
/* end of Additional Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/*-------------------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
* Licensed under the MIT license
|
||||
*
|
||||
*-------------------------------------------------------------------------------------*/
|
||||
import "oaidl.idl";
|
||||
import "ocidl.idl";
|
||||
|
||||
import "d3d11on12.idl";
|
||||
|
||||
cpp_quote("#include <winapifamily.h>")
|
||||
|
||||
#pragma region Desktop Family
|
||||
cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES)")
|
||||
|
||||
typedef enum D3D12_COMPATIBILITY_SHARED_FLAGS
|
||||
{
|
||||
D3D12_COMPATIBILITY_SHARED_FLAG_NONE = 0,
|
||||
D3D12_COMPATIBILITY_SHARED_FLAG_NON_NT_HANDLE = 0x1,
|
||||
D3D12_COMPATIBILITY_SHARED_FLAG_KEYED_MUTEX = 0x2,
|
||||
D3D12_COMPATIBILITY_SHARED_FLAG_9_ON_12 = 0x4,
|
||||
|
||||
} D3D12_COMPATIBILITY_SHARED_FLAGS;
|
||||
cpp_quote( "DEFINE_ENUM_FLAG_OPERATORS( D3D12_COMPATIBILITY_SHARED_FLAGS )" )
|
||||
|
||||
typedef enum D3D12_REFLECT_SHARED_PROPERTY
|
||||
{
|
||||
D3D12_REFLECT_SHARED_PROPERTY_D3D11_RESOURCE_FLAGS, // D3D11_RESOURCE_FLAGS
|
||||
D3D12_REFELCT_SHARED_PROPERTY_COMPATIBILITY_SHARED_FLAGS, // D3D12_COMPATIBILITY_SHARED_FLAGS
|
||||
D3D12_REFLECT_SHARED_PROPERTY_NON_NT_SHARED_HANDLE, // HANDLE
|
||||
} D3D12_REFLECT_SHARED_PROPERTY;
|
||||
|
||||
[ uuid( 8f1c0e3c-fae3-4a82-b098-bfe1708207ff ), object, local, pointer_default( unique ) ]
|
||||
interface ID3D12CompatibilityDevice
|
||||
: IUnknown
|
||||
{
|
||||
HRESULT CreateSharedResource(
|
||||
[annotation("_In_")] const D3D12_HEAP_PROPERTIES* pHeapProperties,
|
||||
D3D12_HEAP_FLAGS HeapFlags,
|
||||
[annotation("_In_")] const D3D12_RESOURCE_DESC* pDesc,
|
||||
D3D12_RESOURCE_STATES InitialResourceState,
|
||||
[annotation("_In_opt_")] const D3D12_CLEAR_VALUE* pOptimizedClearValue,
|
||||
[annotation("_In_opt_")] const D3D11_RESOURCE_FLAGS* pFlags11,
|
||||
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
|
||||
[annotation("_In_opt_")] ID3D12LifetimeTracker* pLifetimeTracker,
|
||||
[annotation("_In_opt_")] ID3D12SwapChainAssistant* pOwningSwapchain,
|
||||
REFIID riid,
|
||||
[out, iid_is(riid), annotation("_COM_Outptr_opt_")] void** ppResource);
|
||||
|
||||
HRESULT CreateSharedHeap(
|
||||
[annotation("_In_")] const D3D12_HEAP_DESC* pHeapDesc,
|
||||
D3D12_COMPATIBILITY_SHARED_FLAGS CompatibilityFlags,
|
||||
REFIID riid,
|
||||
[out, iid_is(riid), annotation("_COM_Outptr_opt_")] void** ppHeap);
|
||||
|
||||
HRESULT ReflectSharedProperties(
|
||||
[annotation("_In_")] ID3D12Object* pHeapOrResource,
|
||||
D3D12_REFLECT_SHARED_PROPERTY ReflectType,
|
||||
[annotation("_Out_writes_bytes_(DataSize)")] void* pData,
|
||||
UINT DataSize);
|
||||
}
|
||||
|
||||
[uuid(edbf5678-2960-4e81-8429-99d4b2630c4e), object, local, pointer_default(unique)]
|
||||
interface D3D11On12CreatorID : IUnknown { };
|
||||
|
||||
[uuid(fffcbb7f-15d3-42a2-841e-9d8d32f37ddd), object, local, pointer_default(unique)]
|
||||
interface D3D9On12CreatorID : IUnknown { };
|
||||
|
||||
[uuid(6bb3cd34-0d19-45ab-97ed-d720ba3dfc80), object, local, pointer_default(unique)]
|
||||
interface OpenGLOn12CreatorID : IUnknown { };
|
||||
|
||||
[uuid(3f76bb74-91b5-4a88-b126-20ca0331cd60), object, local, pointer_default(unique)]
|
||||
interface OpenCLOn12CreatorID : IUnknown { };
|
||||
|
||||
[uuid(bc806e01-3052-406c-a3e8-9fc07f048f98), object, local, pointer_default(unique)]
|
||||
interface VulkanOn12CreatorID : IUnknown { };
|
||||
|
||||
[uuid(cb7490ac-8a0f-44ec-9b7b-6f4cafe8e9ab), object, local, pointer_default(unique)]
|
||||
interface DirectMLTensorFlowCreatorID : IUnknown { };
|
||||
|
||||
[uuid(af029192-fba1-4b05-9116-235e06560354), object, local, pointer_default(unique)]
|
||||
interface DirectMLPyTorchCreatorID : IUnknown { };
|
||||
|
||||
|
||||
cpp_quote("#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_GAMES) */")
|
||||
#pragma endregion
|
||||
|
||||
cpp_quote( "DEFINE_GUID(IID_ID3D12CompatibilityDevice,0x8f1c0e3c,0xfae3,0x4a82,0xb0,0x98,0xbf,0xe1,0x70,0x82,0x07,0xff);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_D3D11On12CreatorID,0xedbf5678,0x2960,0x4e81,0x84,0x29,0x99,0xd4,0xb2,0x63,0x0c,0x4e);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_D3D9On12CreatorID,0xfffcbb7f,0x15d3,0x42a2,0x84,0x1e,0x9d,0x8d,0x32,0xf3,0x7d,0xdd);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_OpenGLOn12CreatorID,0x6bb3cd34,0x0d19,0x45ab,0x97,0xed,0xd7,0x20,0xba,0x3d,0xfc,0x80);" )
|
||||
cpp_quote( "DEFINE_GUID(IID_OpenCLOn12CreatorID,0x3f76bb74,0x91b5,0x4a88,0xb1,0x26,0x20,0xca,0x03,0x31,0xcd,0x60);" )
|
||||
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);" )
|
||||
4263
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12sdklayers.h
Normal file
4263
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12sdklayers.h
Normal file
File diff suppressed because it is too large
Load Diff
1843
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12sdklayers.idl
Normal file
1843
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12sdklayers.idl
Normal file
File diff suppressed because it is too large
Load Diff
494
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12shader.h
Normal file
494
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12shader.h
Normal file
@@ -0,0 +1,494 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT license.
|
||||
//
|
||||
// File: D3D12Shader.h
|
||||
// Content: D3D12 Shader Types and APIs
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __D3D12SHADER_H__
|
||||
#define __D3D12SHADER_H__
|
||||
|
||||
#include "d3dcommon.h"
|
||||
|
||||
typedef enum D3D12_SHADER_VERSION_TYPE
|
||||
{
|
||||
D3D12_SHVER_PIXEL_SHADER = 0,
|
||||
D3D12_SHVER_VERTEX_SHADER = 1,
|
||||
D3D12_SHVER_GEOMETRY_SHADER = 2,
|
||||
|
||||
// D3D11 Shaders
|
||||
D3D12_SHVER_HULL_SHADER = 3,
|
||||
D3D12_SHVER_DOMAIN_SHADER = 4,
|
||||
D3D12_SHVER_COMPUTE_SHADER = 5,
|
||||
|
||||
// D3D12 Shaders
|
||||
D3D12_SHVER_LIBRARY = 6,
|
||||
|
||||
D3D12_SHVER_RAY_GENERATION_SHADER = 7,
|
||||
D3D12_SHVER_INTERSECTION_SHADER = 8,
|
||||
D3D12_SHVER_ANY_HIT_SHADER = 9,
|
||||
D3D12_SHVER_CLOSEST_HIT_SHADER = 10,
|
||||
D3D12_SHVER_MISS_SHADER = 11,
|
||||
D3D12_SHVER_CALLABLE_SHADER = 12,
|
||||
|
||||
D3D12_SHVER_MESH_SHADER = 13,
|
||||
D3D12_SHVER_AMPLIFICATION_SHADER = 14,
|
||||
|
||||
D3D12_SHVER_NODE_SHADER = 15,
|
||||
|
||||
D3D12_SHVER_RESERVED0 = 0xFFF0,
|
||||
} D3D12_SHADER_VERSION_TYPE;
|
||||
|
||||
#define D3D12_SHVER_GET_TYPE(_Version) \
|
||||
(((_Version) >> 16) & 0xffff)
|
||||
#define D3D12_SHVER_GET_MAJOR(_Version) \
|
||||
(((_Version) >> 4) & 0xf)
|
||||
#define D3D12_SHVER_GET_MINOR(_Version) \
|
||||
(((_Version) >> 0) & 0xf)
|
||||
|
||||
// Slot ID for library function return
|
||||
#define D3D_RETURN_PARAMETER_INDEX (-1)
|
||||
|
||||
typedef D3D_RESOURCE_RETURN_TYPE D3D12_RESOURCE_RETURN_TYPE;
|
||||
|
||||
typedef D3D_CBUFFER_TYPE D3D12_CBUFFER_TYPE;
|
||||
|
||||
|
||||
typedef struct _D3D12_SIGNATURE_PARAMETER_DESC
|
||||
{
|
||||
LPCSTR SemanticName; // Name of the semantic
|
||||
UINT SemanticIndex; // Index of the semantic
|
||||
UINT Register; // Number of member variables
|
||||
D3D_NAME SystemValueType;// A predefined system value, or D3D_NAME_UNDEFINED if not applicable
|
||||
D3D_REGISTER_COMPONENT_TYPE ComponentType; // Scalar type (e.g. uint, float, etc.)
|
||||
BYTE Mask; // Mask to indicate which components of the register
|
||||
// are used (combination of D3D10_COMPONENT_MASK values)
|
||||
BYTE ReadWriteMask; // Mask to indicate whether a given component is
|
||||
// never written (if this is an output signature) or
|
||||
// always read (if this is an input signature).
|
||||
// (combination of D3D_MASK_* values)
|
||||
UINT Stream; // Stream index
|
||||
D3D_MIN_PRECISION MinPrecision; // Minimum desired interpolation precision
|
||||
} D3D12_SIGNATURE_PARAMETER_DESC;
|
||||
|
||||
typedef struct _D3D12_SHADER_BUFFER_DESC
|
||||
{
|
||||
LPCSTR Name; // Name of the constant buffer
|
||||
D3D_CBUFFER_TYPE Type; // Indicates type of buffer content
|
||||
UINT Variables; // Number of member variables
|
||||
UINT Size; // Size of CB (in bytes)
|
||||
UINT uFlags; // Buffer description flags
|
||||
} D3D12_SHADER_BUFFER_DESC;
|
||||
|
||||
typedef struct _D3D12_SHADER_VARIABLE_DESC
|
||||
{
|
||||
LPCSTR Name; // Name of the variable
|
||||
UINT StartOffset; // Offset in constant buffer's backing store
|
||||
UINT Size; // Size of variable (in bytes)
|
||||
UINT uFlags; // Variable flags
|
||||
LPVOID DefaultValue; // Raw pointer to default value
|
||||
UINT StartTexture; // First texture index (or -1 if no textures used)
|
||||
UINT TextureSize; // Number of texture slots possibly used.
|
||||
UINT StartSampler; // First sampler index (or -1 if no textures used)
|
||||
UINT SamplerSize; // Number of sampler slots possibly used.
|
||||
} D3D12_SHADER_VARIABLE_DESC;
|
||||
|
||||
typedef struct _D3D12_SHADER_TYPE_DESC
|
||||
{
|
||||
D3D_SHADER_VARIABLE_CLASS Class; // Variable class (e.g. object, matrix, etc.)
|
||||
D3D_SHADER_VARIABLE_TYPE Type; // Variable type (e.g. float, sampler, etc.)
|
||||
UINT Rows; // Number of rows (for matrices, 1 for other numeric, 0 if not applicable)
|
||||
UINT Columns; // Number of columns (for vectors & matrices, 1 for other numeric, 0 if not applicable)
|
||||
UINT Elements; // Number of elements (0 if not an array)
|
||||
UINT Members; // Number of members (0 if not a structure)
|
||||
UINT Offset; // Offset from the start of structure (0 if not a structure member)
|
||||
LPCSTR Name; // Name of type, can be NULL
|
||||
} D3D12_SHADER_TYPE_DESC;
|
||||
|
||||
typedef D3D_TESSELLATOR_DOMAIN D3D12_TESSELLATOR_DOMAIN;
|
||||
|
||||
typedef D3D_TESSELLATOR_PARTITIONING D3D12_TESSELLATOR_PARTITIONING;
|
||||
|
||||
typedef D3D_TESSELLATOR_OUTPUT_PRIMITIVE D3D12_TESSELLATOR_OUTPUT_PRIMITIVE;
|
||||
|
||||
typedef struct _D3D12_SHADER_DESC
|
||||
{
|
||||
UINT Version; // Shader version
|
||||
LPCSTR Creator; // Creator string
|
||||
UINT Flags; // Shader compilation/parse flags
|
||||
|
||||
UINT ConstantBuffers; // Number of constant buffers
|
||||
UINT BoundResources; // Number of bound resources
|
||||
UINT InputParameters; // Number of parameters in the input signature
|
||||
UINT OutputParameters; // Number of parameters in the output signature
|
||||
|
||||
UINT InstructionCount; // Number of emitted instructions
|
||||
UINT TempRegisterCount; // Number of temporary registers used
|
||||
UINT TempArrayCount; // Number of temporary arrays used
|
||||
UINT DefCount; // Number of constant defines
|
||||
UINT DclCount; // Number of declarations (input + output)
|
||||
UINT TextureNormalInstructions; // Number of non-categorized texture instructions
|
||||
UINT TextureLoadInstructions; // Number of texture load instructions
|
||||
UINT TextureCompInstructions; // Number of texture comparison instructions
|
||||
UINT TextureBiasInstructions; // Number of texture bias instructions
|
||||
UINT TextureGradientInstructions; // Number of texture gradient instructions
|
||||
UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
|
||||
UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
|
||||
UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
|
||||
UINT StaticFlowControlCount; // Number of static flow control instructions used
|
||||
UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
|
||||
UINT MacroInstructionCount; // Number of macro instructions used
|
||||
UINT ArrayInstructionCount; // Number of array instructions used
|
||||
UINT CutInstructionCount; // Number of cut instructions used
|
||||
UINT EmitInstructionCount; // Number of emit instructions used
|
||||
D3D_PRIMITIVE_TOPOLOGY GSOutputTopology; // Geometry shader output topology
|
||||
UINT GSMaxOutputVertexCount; // Geometry shader maximum output vertex count
|
||||
D3D_PRIMITIVE InputPrimitive; // GS/HS input primitive
|
||||
UINT PatchConstantParameters; // Number of parameters in the patch constant signature
|
||||
UINT cGSInstanceCount; // Number of Geometry shader instances
|
||||
UINT cControlPoints; // Number of control points in the HS->DS stage
|
||||
D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive; // Primitive output by the tessellator
|
||||
D3D_TESSELLATOR_PARTITIONING HSPartitioning; // Partitioning mode of the tessellator
|
||||
D3D_TESSELLATOR_DOMAIN TessellatorDomain; // Domain of the tessellator (quad, tri, isoline)
|
||||
// instruction counts
|
||||
UINT cBarrierInstructions; // Number of barrier instructions in a compute shader
|
||||
UINT cInterlockedInstructions; // Number of interlocked instructions
|
||||
UINT cTextureStoreInstructions; // Number of texture writes
|
||||
} D3D12_SHADER_DESC;
|
||||
|
||||
typedef struct _D3D12_SHADER_INPUT_BIND_DESC
|
||||
{
|
||||
LPCSTR Name; // Name of the resource
|
||||
D3D_SHADER_INPUT_TYPE Type; // Type of resource (e.g. texture, cbuffer, etc.)
|
||||
UINT BindPoint; // Starting bind point
|
||||
UINT BindCount; // Number of contiguous bind points (for arrays)
|
||||
|
||||
UINT uFlags; // Input binding flags
|
||||
D3D_RESOURCE_RETURN_TYPE ReturnType; // Return type (if texture)
|
||||
D3D_SRV_DIMENSION Dimension; // Dimension (if texture)
|
||||
UINT NumSamples; // Number of samples (0 if not MS texture)
|
||||
UINT Space; // Register space
|
||||
UINT uID; // Range ID in the bytecode
|
||||
} D3D12_SHADER_INPUT_BIND_DESC;
|
||||
|
||||
#define D3D_SHADER_REQUIRES_DOUBLES 0x00000001
|
||||
#define D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL 0x00000002
|
||||
#define D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE 0x00000004
|
||||
#define D3D_SHADER_REQUIRES_64_UAVS 0x00000008
|
||||
#define D3D_SHADER_REQUIRES_MINIMUM_PRECISION 0x00000010
|
||||
#define D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS 0x00000020
|
||||
#define D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS 0x00000040
|
||||
#define D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING 0x00000080
|
||||
#define D3D_SHADER_REQUIRES_TILED_RESOURCES 0x00000100
|
||||
#define D3D_SHADER_REQUIRES_STENCIL_REF 0x00000200
|
||||
#define D3D_SHADER_REQUIRES_INNER_COVERAGE 0x00000400
|
||||
#define D3D_SHADER_REQUIRES_TYPED_UAV_LOAD_ADDITIONAL_FORMATS 0x00000800
|
||||
#define D3D_SHADER_REQUIRES_ROVS 0x00001000
|
||||
#define D3D_SHADER_REQUIRES_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER 0x00002000
|
||||
#define D3D_SHADER_REQUIRES_WAVE_OPS 0x00004000
|
||||
#define D3D_SHADER_REQUIRES_INT64_OPS 0x00008000
|
||||
#define D3D_SHADER_REQUIRES_VIEW_ID 0x00010000
|
||||
#define D3D_SHADER_REQUIRES_BARYCENTRICS 0x00020000
|
||||
#define D3D_SHADER_REQUIRES_NATIVE_16BIT_OPS 0x00040000
|
||||
#define D3D_SHADER_REQUIRES_SHADING_RATE 0x00080000
|
||||
#define D3D_SHADER_REQUIRES_RAYTRACING_TIER_1_1 0x00100000
|
||||
#define D3D_SHADER_REQUIRES_SAMPLER_FEEDBACK 0x00200000
|
||||
#define D3D_SHADER_REQUIRES_ATOMIC_INT64_ON_TYPED_RESOURCE 0x00400000
|
||||
#define D3D_SHADER_REQUIRES_ATOMIC_INT64_ON_GROUP_SHARED 0x00800000
|
||||
#define D3D_SHADER_REQUIRES_DERIVATIVES_IN_MESH_AND_AMPLIFICATION_SHADERS 0x01000000
|
||||
#define D3D_SHADER_REQUIRES_RESOURCE_DESCRIPTOR_HEAP_INDEXING 0x02000000
|
||||
#define D3D_SHADER_REQUIRES_SAMPLER_DESCRIPTOR_HEAP_INDEXING 0x04000000
|
||||
#define D3D_SHADER_REQUIRES_WAVE_MMA 0x08000000
|
||||
#define D3D_SHADER_REQUIRES_ATOMIC_INT64_ON_DESCRIPTOR_HEAP_RESOURCE 0x10000000
|
||||
#define D3D_SHADER_REQUIRES_ADVANCED_TEXTURE_OPS 0x20000000
|
||||
#define D3D_SHADER_REQUIRES_WRITEABLE_MSAA_TEXTURES 0x40000000
|
||||
#define D3D_SHADER_REQUIRES_SAMPLE_CMP_GRADIENT_OR_BIAS 0x80000000
|
||||
#define D3D_SHADER_REQUIRES_EXTENDED_COMMAND_INFO 0x100000000ull
|
||||
|
||||
|
||||
typedef struct _D3D12_LIBRARY_DESC
|
||||
{
|
||||
LPCSTR Creator; // The name of the originator of the library.
|
||||
UINT Flags; // Compilation flags.
|
||||
UINT FunctionCount; // Number of functions exported from the library.
|
||||
} D3D12_LIBRARY_DESC;
|
||||
|
||||
typedef struct _D3D12_FUNCTION_DESC
|
||||
{
|
||||
UINT Version; // Shader version
|
||||
LPCSTR Creator; // Creator string
|
||||
UINT Flags; // Shader compilation/parse flags
|
||||
|
||||
UINT ConstantBuffers; // Number of constant buffers
|
||||
UINT BoundResources; // Number of bound resources
|
||||
|
||||
UINT InstructionCount; // Number of emitted instructions
|
||||
UINT TempRegisterCount; // Number of temporary registers used
|
||||
UINT TempArrayCount; // Number of temporary arrays used
|
||||
UINT DefCount; // Number of constant defines
|
||||
UINT DclCount; // Number of declarations (input + output)
|
||||
UINT TextureNormalInstructions; // Number of non-categorized texture instructions
|
||||
UINT TextureLoadInstructions; // Number of texture load instructions
|
||||
UINT TextureCompInstructions; // Number of texture comparison instructions
|
||||
UINT TextureBiasInstructions; // Number of texture bias instructions
|
||||
UINT TextureGradientInstructions; // Number of texture gradient instructions
|
||||
UINT FloatInstructionCount; // Number of floating point arithmetic instructions used
|
||||
UINT IntInstructionCount; // Number of signed integer arithmetic instructions used
|
||||
UINT UintInstructionCount; // Number of unsigned integer arithmetic instructions used
|
||||
UINT StaticFlowControlCount; // Number of static flow control instructions used
|
||||
UINT DynamicFlowControlCount; // Number of dynamic flow control instructions used
|
||||
UINT MacroInstructionCount; // Number of macro instructions used
|
||||
UINT ArrayInstructionCount; // Number of array instructions used
|
||||
UINT MovInstructionCount; // Number of mov instructions used
|
||||
UINT MovcInstructionCount; // Number of movc instructions used
|
||||
UINT ConversionInstructionCount; // Number of type conversion instructions used
|
||||
UINT BitwiseInstructionCount; // Number of bitwise arithmetic instructions used
|
||||
D3D_FEATURE_LEVEL MinFeatureLevel; // Min target of the function byte code
|
||||
UINT64 RequiredFeatureFlags; // Required feature flags
|
||||
|
||||
LPCSTR Name; // Function name
|
||||
INT FunctionParameterCount; // Number of logical parameters in the function signature (not including return)
|
||||
BOOL HasReturn; // TRUE, if function returns a value, false - it is a subroutine
|
||||
BOOL Has10Level9VertexShader; // TRUE, if there is a 10L9 VS blob
|
||||
BOOL Has10Level9PixelShader; // TRUE, if there is a 10L9 PS blob
|
||||
} D3D12_FUNCTION_DESC;
|
||||
|
||||
typedef struct _D3D12_PARAMETER_DESC
|
||||
{
|
||||
LPCSTR Name; // Parameter name.
|
||||
LPCSTR SemanticName; // Parameter semantic name (+index).
|
||||
D3D_SHADER_VARIABLE_TYPE Type; // Element type.
|
||||
D3D_SHADER_VARIABLE_CLASS Class; // Scalar/Vector/Matrix.
|
||||
UINT Rows; // Rows are for matrix parameters.
|
||||
UINT Columns; // Components or Columns in matrix.
|
||||
D3D_INTERPOLATION_MODE InterpolationMode; // Interpolation mode.
|
||||
D3D_PARAMETER_FLAGS Flags; // Parameter modifiers.
|
||||
|
||||
UINT FirstInRegister; // The first input register for this parameter.
|
||||
UINT FirstInComponent; // The first input register component for this parameter.
|
||||
UINT FirstOutRegister; // The first output register for this parameter.
|
||||
UINT FirstOutComponent; // The first output register component for this parameter.
|
||||
} D3D12_PARAMETER_DESC;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Interfaces ////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef interface ID3D12ShaderReflectionType ID3D12ShaderReflectionType;
|
||||
typedef interface ID3D12ShaderReflectionType *LPD3D12SHADERREFLECTIONTYPE;
|
||||
|
||||
typedef interface ID3D12ShaderReflectionVariable ID3D12ShaderReflectionVariable;
|
||||
typedef interface ID3D12ShaderReflectionVariable *LPD3D12SHADERREFLECTIONVARIABLE;
|
||||
|
||||
typedef interface ID3D12ShaderReflectionConstantBuffer ID3D12ShaderReflectionConstantBuffer;
|
||||
typedef interface ID3D12ShaderReflectionConstantBuffer *LPD3D12SHADERREFLECTIONCONSTANTBUFFER;
|
||||
|
||||
typedef interface ID3D12ShaderReflection ID3D12ShaderReflection;
|
||||
typedef interface ID3D12ShaderReflection *LPD3D12SHADERREFLECTION;
|
||||
|
||||
typedef interface ID3D12LibraryReflection ID3D12LibraryReflection;
|
||||
typedef interface ID3D12LibraryReflection *LPD3D12LIBRARYREFLECTION;
|
||||
|
||||
typedef interface ID3D12FunctionReflection ID3D12FunctionReflection;
|
||||
typedef interface ID3D12FunctionReflection *LPD3D12FUNCTIONREFLECTION;
|
||||
|
||||
typedef interface ID3D12FunctionParameterReflection ID3D12FunctionParameterReflection;
|
||||
typedef interface ID3D12FunctionParameterReflection *LPD3D12FUNCTIONPARAMETERREFLECTION;
|
||||
|
||||
|
||||
// {E913C351-783D-48CA-A1D1-4F306284AD56}
|
||||
interface DECLSPEC_UUID("E913C351-783D-48CA-A1D1-4F306284AD56") ID3D12ShaderReflectionType;
|
||||
DEFINE_GUID(IID_ID3D12ShaderReflectionType,
|
||||
0xe913c351, 0x783d, 0x48ca, 0xa1, 0xd1, 0x4f, 0x30, 0x62, 0x84, 0xad, 0x56);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D12ShaderReflectionType
|
||||
|
||||
DECLARE_INTERFACE(ID3D12ShaderReflectionType)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_SHADER_TYPE_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D12ShaderReflectionType*, GetMemberTypeByIndex)(THIS_ _In_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D12ShaderReflectionType*, GetMemberTypeByName)(THIS_ _In_ LPCSTR Name) PURE;
|
||||
STDMETHOD_(LPCSTR, GetMemberTypeName)(THIS_ _In_ UINT Index) PURE;
|
||||
|
||||
STDMETHOD(IsEqual)(THIS_ _In_ ID3D12ShaderReflectionType* pType) PURE;
|
||||
STDMETHOD_(ID3D12ShaderReflectionType*, GetSubType)(THIS) PURE;
|
||||
STDMETHOD_(ID3D12ShaderReflectionType*, GetBaseClass)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetNumInterfaces)(THIS) PURE;
|
||||
STDMETHOD_(ID3D12ShaderReflectionType*, GetInterfaceByIndex)(THIS_ _In_ UINT uIndex) PURE;
|
||||
STDMETHOD(IsOfType)(THIS_ _In_ ID3D12ShaderReflectionType* pType) PURE;
|
||||
STDMETHOD(ImplementsInterface)(THIS_ _In_ ID3D12ShaderReflectionType* pBase) PURE;
|
||||
};
|
||||
|
||||
// {8337A8A6-A216-444A-B2F4-314733A73AEA}
|
||||
interface DECLSPEC_UUID("8337A8A6-A216-444A-B2F4-314733A73AEA") ID3D12ShaderReflectionVariable;
|
||||
DEFINE_GUID(IID_ID3D12ShaderReflectionVariable,
|
||||
0x8337a8a6, 0xa216, 0x444a, 0xb2, 0xf4, 0x31, 0x47, 0x33, 0xa7, 0x3a, 0xea);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D12ShaderReflectionVariable
|
||||
|
||||
DECLARE_INTERFACE(ID3D12ShaderReflectionVariable)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_SHADER_VARIABLE_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D12ShaderReflectionType*, GetType)(THIS) PURE;
|
||||
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetBuffer)(THIS) PURE;
|
||||
|
||||
STDMETHOD_(UINT, GetInterfaceSlot)(THIS_ _In_ UINT uArrayIndex) PURE;
|
||||
};
|
||||
|
||||
// {C59598B4-48B3-4869-B9B1-B1618B14A8B7}
|
||||
interface DECLSPEC_UUID("C59598B4-48B3-4869-B9B1-B1618B14A8B7") ID3D12ShaderReflectionConstantBuffer;
|
||||
DEFINE_GUID(IID_ID3D12ShaderReflectionConstantBuffer,
|
||||
0xc59598b4, 0x48b3, 0x4869, 0xb9, 0xb1, 0xb1, 0x61, 0x8b, 0x14, 0xa8, 0xb7);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D12ShaderReflectionConstantBuffer
|
||||
|
||||
DECLARE_INTERFACE(ID3D12ShaderReflectionConstantBuffer)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ D3D12_SHADER_BUFFER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D12ShaderReflectionVariable*, GetVariableByIndex)(THIS_ _In_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D12ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
|
||||
};
|
||||
|
||||
// The ID3D12ShaderReflection IID may change from SDK version to SDK version
|
||||
// if the reflection API changes. This prevents new code with the new API
|
||||
// from working with an old binary. Recompiling with the new header
|
||||
// will pick up the new IID.
|
||||
|
||||
// {5A58797D-A72C-478D-8BA2-EFC6B0EFE88E}
|
||||
interface DECLSPEC_UUID("5A58797D-A72C-478D-8BA2-EFC6B0EFE88E") ID3D12ShaderReflection;
|
||||
DEFINE_GUID(IID_ID3D12ShaderReflection,
|
||||
0x5a58797d, 0xa72c, 0x478d, 0x8b, 0xa2, 0xef, 0xc6, 0xb0, 0xef, 0xe8, 0x8e);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D12ShaderReflection
|
||||
|
||||
DECLARE_INTERFACE_(ID3D12ShaderReflection, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid,
|
||||
_Out_ LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_SHADER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetConstantBufferByIndex)(THIS_ _In_ UINT Index) PURE;
|
||||
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer*, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
|
||||
_Out_ D3D12_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD(GetInputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
|
||||
_Out_ D3D12_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
STDMETHOD(GetOutputParameterDesc)(THIS_ _In_ UINT ParameterIndex,
|
||||
_Out_ D3D12_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
STDMETHOD(GetPatchConstantParameterDesc)(THIS_ _In_ UINT ParameterIndex,
|
||||
_Out_ D3D12_SIGNATURE_PARAMETER_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D12ShaderReflectionVariable*, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
|
||||
_Out_ D3D12_SHADER_INPUT_BIND_DESC *pDesc) PURE;
|
||||
|
||||
STDMETHOD_(UINT, GetMovInstructionCount)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetMovcInstructionCount)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetConversionInstructionCount)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetBitwiseInstructionCount)(THIS) PURE;
|
||||
|
||||
STDMETHOD_(D3D_PRIMITIVE, GetGSInputPrimitive)(THIS) PURE;
|
||||
STDMETHOD_(BOOL, IsSampleFrequencyShader)(THIS) PURE;
|
||||
|
||||
STDMETHOD_(UINT, GetNumInterfaceSlots)(THIS) PURE;
|
||||
STDMETHOD(GetMinFeatureLevel)(THIS_ _Out_ enum D3D_FEATURE_LEVEL* pLevel) PURE;
|
||||
|
||||
STDMETHOD_(UINT, GetThreadGroupSize)(THIS_
|
||||
_Out_opt_ UINT* pSizeX,
|
||||
_Out_opt_ UINT* pSizeY,
|
||||
_Out_opt_ UINT* pSizeZ) PURE;
|
||||
|
||||
STDMETHOD_(UINT64, GetRequiresFlags)(THIS) PURE;
|
||||
};
|
||||
|
||||
// {8E349D19-54DB-4A56-9DC9-119D87BDB804}
|
||||
interface DECLSPEC_UUID("8E349D19-54DB-4A56-9DC9-119D87BDB804") ID3D12LibraryReflection;
|
||||
DEFINE_GUID(IID_ID3D12LibraryReflection,
|
||||
0x8e349d19, 0x54db, 0x4a56, 0x9d, 0xc9, 0x11, 0x9d, 0x87, 0xbd, 0xb8, 0x4);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D12LibraryReflection
|
||||
|
||||
DECLARE_INTERFACE_(ID3D12LibraryReflection, IUnknown)
|
||||
{
|
||||
STDMETHOD(QueryInterface)(THIS_ _In_ REFIID iid, _Out_ LPVOID * ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_LIBRARY_DESC * pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D12FunctionReflection *, GetFunctionByIndex)(THIS_ _In_ INT FunctionIndex) PURE;
|
||||
};
|
||||
|
||||
// {1108795C-2772-4BA9-B2A8-D464DC7E2799}
|
||||
interface DECLSPEC_UUID("1108795C-2772-4BA9-B2A8-D464DC7E2799") ID3D12FunctionReflection;
|
||||
DEFINE_GUID(IID_ID3D12FunctionReflection,
|
||||
0x1108795c, 0x2772, 0x4ba9, 0xb2, 0xa8, 0xd4, 0x64, 0xdc, 0x7e, 0x27, 0x99);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D12FunctionReflection
|
||||
|
||||
DECLARE_INTERFACE(ID3D12FunctionReflection)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_FUNCTION_DESC * pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer *, GetConstantBufferByIndex)(THIS_ _In_ UINT BufferIndex) PURE;
|
||||
STDMETHOD_(ID3D12ShaderReflectionConstantBuffer *, GetConstantBufferByName)(THIS_ _In_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDesc)(THIS_ _In_ UINT ResourceIndex,
|
||||
_Out_ D3D12_SHADER_INPUT_BIND_DESC * pDesc) PURE;
|
||||
|
||||
STDMETHOD_(ID3D12ShaderReflectionVariable *, GetVariableByName)(THIS_ _In_ LPCSTR Name) PURE;
|
||||
|
||||
STDMETHOD(GetResourceBindingDescByName)(THIS_ _In_ LPCSTR Name,
|
||||
_Out_ D3D12_SHADER_INPUT_BIND_DESC * pDesc) PURE;
|
||||
|
||||
// Use D3D_RETURN_PARAMETER_INDEX to get description of the return value.
|
||||
STDMETHOD_(ID3D12FunctionParameterReflection *, GetFunctionParameter)(THIS_ _In_ INT ParameterIndex) PURE;
|
||||
};
|
||||
|
||||
// {EC25F42D-7006-4F2B-B33E-02CC3375733F}
|
||||
interface DECLSPEC_UUID("EC25F42D-7006-4F2B-B33E-02CC3375733F") ID3D12FunctionParameterReflection;
|
||||
DEFINE_GUID(IID_ID3D12FunctionParameterReflection,
|
||||
0xec25f42d, 0x7006, 0x4f2b, 0xb3, 0x3e, 0x2, 0xcc, 0x33, 0x75, 0x73, 0x3f);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3D12FunctionParameterReflection
|
||||
|
||||
DECLARE_INTERFACE(ID3D12FunctionParameterReflection)
|
||||
{
|
||||
STDMETHOD(GetDesc)(THIS_ _Out_ D3D12_PARAMETER_DESC * pDesc) PURE;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// APIs //////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif //__D3D12SHADER_H__
|
||||
|
||||
9312
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12video.h
Normal file
9312
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12video.h
Normal file
File diff suppressed because it is too large
Load Diff
3168
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12video.idl
Normal file
3168
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3d12video.idl
Normal file
File diff suppressed because it is too large
Load Diff
1133
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dcommon.h
Normal file
1133
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dcommon.h
Normal file
File diff suppressed because it is too large
Load Diff
991
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dcommon.idl
Normal file
991
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dcommon.idl
Normal file
@@ -0,0 +1,991 @@
|
||||
/*-------------------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (c) Microsoft Corporation
|
||||
* Licensed under the MIT license
|
||||
*
|
||||
*-------------------------------------------------------------------------------------*/
|
||||
import "oaidl.idl";
|
||||
import "ocidl.idl";
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// D3D-version-neutral runtime information.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum D3D_DRIVER_TYPE
|
||||
{
|
||||
D3D_DRIVER_TYPE_UNKNOWN,
|
||||
D3D_DRIVER_TYPE_HARDWARE,
|
||||
D3D_DRIVER_TYPE_REFERENCE,
|
||||
D3D_DRIVER_TYPE_NULL,
|
||||
D3D_DRIVER_TYPE_SOFTWARE,
|
||||
D3D_DRIVER_TYPE_WARP,
|
||||
} D3D_DRIVER_TYPE;
|
||||
|
||||
typedef enum D3D_FEATURE_LEVEL
|
||||
{
|
||||
D3D_FEATURE_LEVEL_1_0_GENERIC = 0x100,
|
||||
D3D_FEATURE_LEVEL_1_0_CORE = 0x1000,
|
||||
D3D_FEATURE_LEVEL_9_1 = 0x9100,
|
||||
D3D_FEATURE_LEVEL_9_2 = 0x9200,
|
||||
D3D_FEATURE_LEVEL_9_3 = 0x9300,
|
||||
D3D_FEATURE_LEVEL_10_0 = 0xa000,
|
||||
D3D_FEATURE_LEVEL_10_1 = 0xa100,
|
||||
D3D_FEATURE_LEVEL_11_0 = 0xb000,
|
||||
D3D_FEATURE_LEVEL_11_1 = 0xb100,
|
||||
D3D_FEATURE_LEVEL_12_0 = 0xc000,
|
||||
D3D_FEATURE_LEVEL_12_1 = 0xc100,
|
||||
D3D_FEATURE_LEVEL_12_2 = 0xc200
|
||||
} D3D_FEATURE_LEVEL;
|
||||
|
||||
cpp_quote("#define D3D_FL9_1_REQ_TEXTURE1D_U_DIMENSION 2048")
|
||||
cpp_quote("#define D3D_FL9_3_REQ_TEXTURE1D_U_DIMENSION 4096")
|
||||
cpp_quote("#define D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION 2048")
|
||||
cpp_quote("#define D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION 4096")
|
||||
cpp_quote("#define D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION 512")
|
||||
cpp_quote("#define D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION 4096")
|
||||
cpp_quote("#define D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION 256")
|
||||
cpp_quote("#define D3D_FL9_1_DEFAULT_MAX_ANISOTROPY 2")
|
||||
cpp_quote("#define D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT 65535")
|
||||
cpp_quote("#define D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT 1048575")
|
||||
cpp_quote("#define D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT 1")
|
||||
cpp_quote("#define D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT 4")
|
||||
cpp_quote("#define D3D_FL9_1_MAX_TEXTURE_REPEAT 128")
|
||||
cpp_quote("#define D3D_FL9_2_MAX_TEXTURE_REPEAT 2048")
|
||||
cpp_quote("#define D3D_FL9_3_MAX_TEXTURE_REPEAT 8192")
|
||||
|
||||
typedef enum D3D_PRIMITIVE_TOPOLOGY
|
||||
{
|
||||
D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
|
||||
D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1,
|
||||
D3D_PRIMITIVE_TOPOLOGY_LINELIST = 2,
|
||||
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
|
||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
|
||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
|
||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLEFAN = 6,
|
||||
// Adjacency values should be equal to (0x8 & non-adjacency):
|
||||
D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
|
||||
D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
|
||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12,
|
||||
D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13,
|
||||
D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33,
|
||||
D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34,
|
||||
D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35,
|
||||
D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36,
|
||||
D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37,
|
||||
D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38,
|
||||
D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39,
|
||||
D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40,
|
||||
D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41,
|
||||
D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42,
|
||||
D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43,
|
||||
D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44,
|
||||
D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45,
|
||||
D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46,
|
||||
D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47,
|
||||
D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48,
|
||||
D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49,
|
||||
D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50,
|
||||
D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51,
|
||||
D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52,
|
||||
D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53,
|
||||
D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54,
|
||||
D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55,
|
||||
D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56,
|
||||
D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57,
|
||||
D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58,
|
||||
D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59,
|
||||
D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60,
|
||||
D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61,
|
||||
D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62,
|
||||
D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63,
|
||||
D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64,
|
||||
|
||||
D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ,
|
||||
D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ,
|
||||
|
||||
D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST,
|
||||
D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST
|
||||
} D3D_PRIMITIVE_TOPOLOGY;
|
||||
|
||||
typedef enum D3D_PRIMITIVE
|
||||
{
|
||||
D3D_PRIMITIVE_UNDEFINED = 0,
|
||||
D3D_PRIMITIVE_POINT = 1,
|
||||
D3D_PRIMITIVE_LINE = 2,
|
||||
D3D_PRIMITIVE_TRIANGLE = 3,
|
||||
// Adjacency values should be equal to (0x4 & non-adjacency):
|
||||
D3D_PRIMITIVE_LINE_ADJ = 6,
|
||||
D3D_PRIMITIVE_TRIANGLE_ADJ = 7,
|
||||
D3D_PRIMITIVE_1_CONTROL_POINT_PATCH = 8,
|
||||
D3D_PRIMITIVE_2_CONTROL_POINT_PATCH = 9,
|
||||
D3D_PRIMITIVE_3_CONTROL_POINT_PATCH = 10,
|
||||
D3D_PRIMITIVE_4_CONTROL_POINT_PATCH = 11,
|
||||
D3D_PRIMITIVE_5_CONTROL_POINT_PATCH = 12,
|
||||
D3D_PRIMITIVE_6_CONTROL_POINT_PATCH = 13,
|
||||
D3D_PRIMITIVE_7_CONTROL_POINT_PATCH = 14,
|
||||
D3D_PRIMITIVE_8_CONTROL_POINT_PATCH = 15,
|
||||
D3D_PRIMITIVE_9_CONTROL_POINT_PATCH = 16,
|
||||
D3D_PRIMITIVE_10_CONTROL_POINT_PATCH = 17,
|
||||
D3D_PRIMITIVE_11_CONTROL_POINT_PATCH = 18,
|
||||
D3D_PRIMITIVE_12_CONTROL_POINT_PATCH = 19,
|
||||
D3D_PRIMITIVE_13_CONTROL_POINT_PATCH = 20,
|
||||
D3D_PRIMITIVE_14_CONTROL_POINT_PATCH = 21,
|
||||
D3D_PRIMITIVE_15_CONTROL_POINT_PATCH = 22,
|
||||
D3D_PRIMITIVE_16_CONTROL_POINT_PATCH = 23,
|
||||
D3D_PRIMITIVE_17_CONTROL_POINT_PATCH = 24,
|
||||
D3D_PRIMITIVE_18_CONTROL_POINT_PATCH = 25,
|
||||
D3D_PRIMITIVE_19_CONTROL_POINT_PATCH = 26,
|
||||
D3D_PRIMITIVE_20_CONTROL_POINT_PATCH = 27,
|
||||
D3D_PRIMITIVE_21_CONTROL_POINT_PATCH = 28,
|
||||
D3D_PRIMITIVE_22_CONTROL_POINT_PATCH = 29,
|
||||
D3D_PRIMITIVE_23_CONTROL_POINT_PATCH = 30,
|
||||
D3D_PRIMITIVE_24_CONTROL_POINT_PATCH = 31,
|
||||
D3D_PRIMITIVE_25_CONTROL_POINT_PATCH = 32,
|
||||
D3D_PRIMITIVE_26_CONTROL_POINT_PATCH = 33,
|
||||
D3D_PRIMITIVE_27_CONTROL_POINT_PATCH = 34,
|
||||
D3D_PRIMITIVE_28_CONTROL_POINT_PATCH = 35,
|
||||
D3D_PRIMITIVE_29_CONTROL_POINT_PATCH = 36,
|
||||
D3D_PRIMITIVE_30_CONTROL_POINT_PATCH = 37,
|
||||
D3D_PRIMITIVE_31_CONTROL_POINT_PATCH = 38,
|
||||
D3D_PRIMITIVE_32_CONTROL_POINT_PATCH = 39,
|
||||
|
||||
D3D10_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED,
|
||||
D3D10_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT,
|
||||
D3D10_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE,
|
||||
D3D10_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE,
|
||||
D3D10_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ,
|
||||
D3D10_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ,
|
||||
|
||||
D3D11_PRIMITIVE_UNDEFINED = D3D_PRIMITIVE_UNDEFINED,
|
||||
D3D11_PRIMITIVE_POINT = D3D_PRIMITIVE_POINT,
|
||||
D3D11_PRIMITIVE_LINE = D3D_PRIMITIVE_LINE,
|
||||
D3D11_PRIMITIVE_TRIANGLE = D3D_PRIMITIVE_TRIANGLE,
|
||||
D3D11_PRIMITIVE_LINE_ADJ = D3D_PRIMITIVE_LINE_ADJ,
|
||||
D3D11_PRIMITIVE_TRIANGLE_ADJ = D3D_PRIMITIVE_TRIANGLE_ADJ,
|
||||
D3D11_PRIMITIVE_1_CONTROL_POINT_PATCH = D3D_PRIMITIVE_1_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_2_CONTROL_POINT_PATCH = D3D_PRIMITIVE_2_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_3_CONTROL_POINT_PATCH = D3D_PRIMITIVE_3_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_4_CONTROL_POINT_PATCH = D3D_PRIMITIVE_4_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_5_CONTROL_POINT_PATCH = D3D_PRIMITIVE_5_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_6_CONTROL_POINT_PATCH = D3D_PRIMITIVE_6_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_7_CONTROL_POINT_PATCH = D3D_PRIMITIVE_7_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_8_CONTROL_POINT_PATCH = D3D_PRIMITIVE_8_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_9_CONTROL_POINT_PATCH = D3D_PRIMITIVE_9_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_10_CONTROL_POINT_PATCH = D3D_PRIMITIVE_10_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_11_CONTROL_POINT_PATCH = D3D_PRIMITIVE_11_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_12_CONTROL_POINT_PATCH = D3D_PRIMITIVE_12_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_13_CONTROL_POINT_PATCH = D3D_PRIMITIVE_13_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_14_CONTROL_POINT_PATCH = D3D_PRIMITIVE_14_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_15_CONTROL_POINT_PATCH = D3D_PRIMITIVE_15_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_16_CONTROL_POINT_PATCH = D3D_PRIMITIVE_16_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_17_CONTROL_POINT_PATCH = D3D_PRIMITIVE_17_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_18_CONTROL_POINT_PATCH = D3D_PRIMITIVE_18_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_19_CONTROL_POINT_PATCH = D3D_PRIMITIVE_19_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_20_CONTROL_POINT_PATCH = D3D_PRIMITIVE_20_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_21_CONTROL_POINT_PATCH = D3D_PRIMITIVE_21_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_22_CONTROL_POINT_PATCH = D3D_PRIMITIVE_22_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_23_CONTROL_POINT_PATCH = D3D_PRIMITIVE_23_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_24_CONTROL_POINT_PATCH = D3D_PRIMITIVE_24_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_25_CONTROL_POINT_PATCH = D3D_PRIMITIVE_25_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_26_CONTROL_POINT_PATCH = D3D_PRIMITIVE_26_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_27_CONTROL_POINT_PATCH = D3D_PRIMITIVE_27_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_28_CONTROL_POINT_PATCH = D3D_PRIMITIVE_28_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_29_CONTROL_POINT_PATCH = D3D_PRIMITIVE_29_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_30_CONTROL_POINT_PATCH = D3D_PRIMITIVE_30_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_31_CONTROL_POINT_PATCH = D3D_PRIMITIVE_31_CONTROL_POINT_PATCH,
|
||||
D3D11_PRIMITIVE_32_CONTROL_POINT_PATCH = D3D_PRIMITIVE_32_CONTROL_POINT_PATCH,
|
||||
} D3D_PRIMITIVE;
|
||||
|
||||
typedef enum D3D_SRV_DIMENSION
|
||||
{
|
||||
D3D_SRV_DIMENSION_UNKNOWN = 0,
|
||||
D3D_SRV_DIMENSION_BUFFER = 1,
|
||||
D3D_SRV_DIMENSION_TEXTURE1D = 2,
|
||||
D3D_SRV_DIMENSION_TEXTURE1DARRAY = 3,
|
||||
D3D_SRV_DIMENSION_TEXTURE2D = 4,
|
||||
D3D_SRV_DIMENSION_TEXTURE2DARRAY = 5,
|
||||
D3D_SRV_DIMENSION_TEXTURE2DMS = 6,
|
||||
D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = 7,
|
||||
D3D_SRV_DIMENSION_TEXTURE3D = 8,
|
||||
D3D_SRV_DIMENSION_TEXTURECUBE = 9,
|
||||
D3D_SRV_DIMENSION_TEXTURECUBEARRAY = 10,
|
||||
D3D_SRV_DIMENSION_BUFFEREX = 11,
|
||||
|
||||
D3D10_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
|
||||
D3D10_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
|
||||
D3D10_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
|
||||
D3D10_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
|
||||
D3D10_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
|
||||
D3D10_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
|
||||
D3D10_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
|
||||
D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
|
||||
D3D10_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
|
||||
D3D10_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
|
||||
|
||||
D3D10_1_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
|
||||
D3D10_1_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
|
||||
D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY,
|
||||
|
||||
D3D11_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
|
||||
D3D11_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
|
||||
D3D11_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
|
||||
D3D11_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
|
||||
D3D11_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
|
||||
D3D11_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
|
||||
D3D11_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
|
||||
D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
|
||||
D3D11_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
|
||||
D3D11_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
|
||||
D3D11_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY,
|
||||
D3D11_SRV_DIMENSION_BUFFEREX = D3D_SRV_DIMENSION_BUFFEREX,
|
||||
} D3D_SRV_DIMENSION;
|
||||
|
||||
// Bits in shaders indicating features they use which the runtime checks against current device support:
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_DOUBLES 0x00001")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_COMPUTE_SHADERS_PLUS_RAW_AND_STRUCTURED_BUFFERS_VIA_SHADER_4_X 0x00002")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_UAVS_AT_EVERY_STAGE 0x00004")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_64_UAVS 0x00008")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_MINIMUM_PRECISION 0x00010")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_11_1_DOUBLE_EXTENSIONS 0x00020")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_11_1_SHADER_EXTENSIONS 0x00040")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_LEVEL_9_COMPARISON_FILTERING 0x00080")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_TILED_RESOURCES 0x00100")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_STENCIL_REF 0x00200")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_INNER_COVERAGE 0x00400")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_TYPED_UAV_LOAD_ADDITIONAL_FORMATS 0x00800")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_ROVS 0x01000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_VIEWPORT_AND_RT_ARRAY_INDEX_FROM_ANY_SHADER_FEEDING_RASTERIZER 0x02000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_WAVE_OPS 0x04000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_INT64_OPS 0x08000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_VIEW_ID 0x10000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_BARYCENTRICS 0x20000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_NATIVE_16BIT_OPS 0x40000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_SHADING_RATE 0x80000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_RAYTRACING_TIER_1_1 0x100000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_SAMPLER_FEEDBACK 0x200000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_ATOMIC_INT64_ON_TYPED_RESOURCE 0x400000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_ATOMIC_INT64_ON_GROUP_SHARED 0x800000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_DERIVATIVES_IN_MESH_AND_AMPLIFICATION_SHADERS 0x1000000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_RESOURCE_DESCRIPTOR_HEAP_INDEXING 0x2000000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_SAMPLER_DESCRIPTOR_HEAP_INDEXING 0x4000000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_WAVE_MMA 0x8000000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_ATOMIC_INT64_ON_DESCRIPTOR_HEAP_RESOURCE 0x10000000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_ADVANCED_TEXTURE_OPS 0x20000000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_WRITEABLE_MSAA_TEXTURES 0x40000000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_SAMPLE_CMP_GRADIENT_OR_BIAS 0x80000000")
|
||||
cpp_quote("#define D3D_SHADER_FEATURE_EXTENDED_COMMAND_INFO 0x100000000ull")
|
||||
|
||||
// This section is for flags that do not directly indicate a required feature,
|
||||
// but are used to indicate something about the shader.
|
||||
|
||||
// Flag for any derivative use. This allows call-graph validation
|
||||
// in the runtime to detect misuse of derivatives for an entry point that cannot
|
||||
// support it, or to determine when the flag
|
||||
// D3D_SHADER_FEATURE_DERIVATIVES_IN_MESH_AND_AMPLIFICATION_SHADERS is required.
|
||||
cpp_quote("#define D3D_OPT_SHADER_FEATURE_USES_DERIVATIVES 0x0000010000000000ull")
|
||||
|
||||
cpp_quote("#define D3D_OPT_SHADER_FEATURE_REQUIRES_GROUP 0x0000020000000000ull")
|
||||
|
||||
|
||||
// Additional internal shader feature flags are listed in dxbcutils.h (not relevant/useful for public to see)
|
||||
// When adding entries here, make sure they don't conflict with what's there.
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Shader compilation information.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// D3D_SHADER_MACRO:
|
||||
// ----------
|
||||
// Preprocessor macro definition. The application pass in a NULL-terminated
|
||||
// array of this structure to various D3D APIs. This enables the application
|
||||
// to #define tokens at runtime, before the file is parsed.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef struct _D3D_SHADER_MACRO
|
||||
{
|
||||
LPCSTR Name;
|
||||
LPCSTR Definition;
|
||||
} D3D_SHADER_MACRO, *LPD3D_SHADER_MACRO;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ID3DBlob:
|
||||
// ------------
|
||||
// The buffer object is used by D3D to return arbitrary size data.
|
||||
// For compatibility with D3D10 this interface is also called ID3D10Blob,
|
||||
// but the version-neutral form is preferred.
|
||||
//
|
||||
// GetBufferPointer -
|
||||
// Returns a pointer to the beginning of the buffer.
|
||||
//
|
||||
// GetBufferSize -
|
||||
// Returns the size of the buffer, in bytes.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// {8BA5FB08-5195-40e2-AC58-0D989C3A0102}
|
||||
cpp_quote("DEFINE_GUID(IID_ID3D10Blob, 0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2);")
|
||||
|
||||
[ uuid( 8BA5FB08-5195-40e2-AC58-0D989C3A0102 ), object, local, pointer_default( unique ) ]
|
||||
interface ID3D10Blob : IUnknown
|
||||
{
|
||||
LPVOID GetBufferPointer();
|
||||
SIZE_T GetBufferSize();
|
||||
};
|
||||
|
||||
cpp_quote("typedef interface ID3D10Blob* LPD3D10BLOB;")
|
||||
|
||||
typedef ID3D10Blob ID3DBlob;
|
||||
cpp_quote("typedef ID3DBlob* LPD3DBLOB;")
|
||||
cpp_quote("#define IID_ID3DBlob IID_ID3D10Blob")
|
||||
|
||||
// ID3DDestructionNotifier: An interface to QI for, to set a callback which is triggered when the object is fully destroyed
|
||||
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void* pData);
|
||||
|
||||
[uuid(a06eb39a-50da-425b-8c31-4eecd6c270f3), object, local, pointer_default(unique)]
|
||||
interface ID3DDestructionNotifier
|
||||
: IUnknown
|
||||
{
|
||||
HRESULT RegisterDestructionCallback(
|
||||
[annotation("_In_")] PFN_DESTRUCTION_CALLBACK callbackFn,
|
||||
[annotation("_In_")] void* pData,
|
||||
[annotation("_Out_")] UINT* pCallbackID
|
||||
);
|
||||
HRESULT UnregisterDestructionCallback(
|
||||
[annotation("_In_")] UINT callbackID
|
||||
);
|
||||
};
|
||||
|
||||
typedef enum _D3D_INCLUDE_TYPE
|
||||
{
|
||||
D3D_INCLUDE_LOCAL,
|
||||
D3D_INCLUDE_SYSTEM,
|
||||
|
||||
D3D10_INCLUDE_LOCAL = D3D_INCLUDE_LOCAL,
|
||||
D3D10_INCLUDE_SYSTEM = D3D_INCLUDE_SYSTEM,
|
||||
|
||||
// force 32-bit size enum
|
||||
D3D_INCLUDE_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_INCLUDE_TYPE;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// ID3DInclude:
|
||||
// -------------
|
||||
// This interface is intended to be implemented by the application, and can
|
||||
// be used by various D3D APIs. This enables application-specific handling
|
||||
// of #include directives in source files.
|
||||
//
|
||||
// Open()
|
||||
// Opens an include file. If successful, it should fill in ppData and
|
||||
// pBytes. The data pointer returned must remain valid until Close is
|
||||
// subsequently called. The name of the file is encoded in UTF-8 format.
|
||||
// Close()
|
||||
// Closes an include file. If Open was successful, Close is guaranteed
|
||||
// to be called before the API using this interface returns.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
cpp_quote("typedef interface ID3DInclude ID3DInclude;")
|
||||
|
||||
cpp_quote("#undef INTERFACE")
|
||||
cpp_quote("#define INTERFACE ID3DInclude")
|
||||
|
||||
cpp_quote("DECLARE_INTERFACE(ID3DInclude)")
|
||||
cpp_quote("{")
|
||||
cpp_quote(" STDMETHOD(Open)(THIS_ D3D_INCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE;")
|
||||
cpp_quote(" STDMETHOD(Close)(THIS_ LPCVOID pData) PURE;")
|
||||
cpp_quote("};")
|
||||
|
||||
cpp_quote("typedef ID3DInclude* LPD3DINCLUDE;")
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
// Shader reflection information.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
typedef enum _D3D_SHADER_VARIABLE_CLASS
|
||||
{
|
||||
D3D_SVC_SCALAR,
|
||||
D3D_SVC_VECTOR,
|
||||
D3D_SVC_MATRIX_ROWS,
|
||||
D3D_SVC_MATRIX_COLUMNS,
|
||||
D3D_SVC_OBJECT,
|
||||
D3D_SVC_STRUCT,
|
||||
D3D_SVC_INTERFACE_CLASS,
|
||||
D3D_SVC_INTERFACE_POINTER,
|
||||
|
||||
D3D10_SVC_SCALAR = D3D_SVC_SCALAR,
|
||||
D3D10_SVC_VECTOR = D3D_SVC_VECTOR,
|
||||
D3D10_SVC_MATRIX_ROWS = D3D_SVC_MATRIX_ROWS,
|
||||
D3D10_SVC_MATRIX_COLUMNS = D3D_SVC_MATRIX_COLUMNS,
|
||||
D3D10_SVC_OBJECT = D3D_SVC_OBJECT,
|
||||
D3D10_SVC_STRUCT = D3D_SVC_STRUCT,
|
||||
|
||||
D3D11_SVC_INTERFACE_CLASS = D3D_SVC_INTERFACE_CLASS,
|
||||
D3D11_SVC_INTERFACE_POINTER = D3D_SVC_INTERFACE_POINTER,
|
||||
|
||||
// force 32-bit size enum
|
||||
D3D_SVC_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_SHADER_VARIABLE_CLASS;
|
||||
|
||||
typedef enum _D3D_SHADER_VARIABLE_FLAGS
|
||||
{
|
||||
D3D_SVF_USERPACKED = 1,
|
||||
D3D_SVF_USED = 2,
|
||||
|
||||
D3D_SVF_INTERFACE_POINTER = 4,
|
||||
D3D_SVF_INTERFACE_PARAMETER = 8,
|
||||
|
||||
D3D10_SVF_USERPACKED = D3D_SVF_USERPACKED,
|
||||
D3D10_SVF_USED = D3D_SVF_USED,
|
||||
|
||||
D3D11_SVF_INTERFACE_POINTER = D3D_SVF_INTERFACE_POINTER,
|
||||
D3D11_SVF_INTERFACE_PARAMETER = D3D_SVF_INTERFACE_PARAMETER,
|
||||
|
||||
// force 32-bit size enum
|
||||
D3D_SVF_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_SHADER_VARIABLE_FLAGS;
|
||||
|
||||
typedef enum _D3D_SHADER_VARIABLE_TYPE
|
||||
{
|
||||
D3D_SVT_VOID = 0,
|
||||
D3D_SVT_BOOL = 1,
|
||||
D3D_SVT_INT = 2,
|
||||
D3D_SVT_FLOAT = 3,
|
||||
D3D_SVT_STRING = 4,
|
||||
D3D_SVT_TEXTURE = 5,
|
||||
D3D_SVT_TEXTURE1D = 6,
|
||||
D3D_SVT_TEXTURE2D = 7,
|
||||
D3D_SVT_TEXTURE3D = 8,
|
||||
D3D_SVT_TEXTURECUBE = 9,
|
||||
D3D_SVT_SAMPLER = 10,
|
||||
D3D_SVT_SAMPLER1D = 11,
|
||||
D3D_SVT_SAMPLER2D = 12,
|
||||
D3D_SVT_SAMPLER3D = 13,
|
||||
D3D_SVT_SAMPLERCUBE = 14,
|
||||
D3D_SVT_PIXELSHADER = 15,
|
||||
D3D_SVT_VERTEXSHADER = 16,
|
||||
D3D_SVT_PIXELFRAGMENT = 17,
|
||||
D3D_SVT_VERTEXFRAGMENT = 18,
|
||||
D3D_SVT_UINT = 19,
|
||||
D3D_SVT_UINT8 = 20,
|
||||
D3D_SVT_GEOMETRYSHADER = 21,
|
||||
D3D_SVT_RASTERIZER = 22,
|
||||
D3D_SVT_DEPTHSTENCIL = 23,
|
||||
D3D_SVT_BLEND = 24,
|
||||
D3D_SVT_BUFFER = 25,
|
||||
D3D_SVT_CBUFFER = 26,
|
||||
D3D_SVT_TBUFFER = 27,
|
||||
D3D_SVT_TEXTURE1DARRAY = 28,
|
||||
D3D_SVT_TEXTURE2DARRAY = 29,
|
||||
D3D_SVT_RENDERTARGETVIEW = 30,
|
||||
D3D_SVT_DEPTHSTENCILVIEW = 31,
|
||||
|
||||
D3D_SVT_TEXTURE2DMS = 32,
|
||||
D3D_SVT_TEXTURE2DMSARRAY = 33,
|
||||
|
||||
D3D_SVT_TEXTURECUBEARRAY = 34,
|
||||
|
||||
D3D_SVT_HULLSHADER = 35,
|
||||
D3D_SVT_DOMAINSHADER = 36,
|
||||
|
||||
D3D_SVT_INTERFACE_POINTER = 37,
|
||||
D3D_SVT_COMPUTESHADER = 38,
|
||||
|
||||
D3D_SVT_DOUBLE = 39,
|
||||
|
||||
D3D_SVT_RWTEXTURE1D = 40,
|
||||
D3D_SVT_RWTEXTURE1DARRAY = 41,
|
||||
D3D_SVT_RWTEXTURE2D = 42,
|
||||
D3D_SVT_RWTEXTURE2DARRAY = 43,
|
||||
D3D_SVT_RWTEXTURE3D = 44,
|
||||
D3D_SVT_RWBUFFER = 45,
|
||||
|
||||
D3D_SVT_BYTEADDRESS_BUFFER = 46,
|
||||
D3D_SVT_RWBYTEADDRESS_BUFFER = 47,
|
||||
D3D_SVT_STRUCTURED_BUFFER = 48,
|
||||
D3D_SVT_RWSTRUCTURED_BUFFER = 49,
|
||||
D3D_SVT_APPEND_STRUCTURED_BUFFER = 50,
|
||||
D3D_SVT_CONSUME_STRUCTURED_BUFFER = 51,
|
||||
|
||||
D3D_SVT_MIN8FLOAT = 52,
|
||||
D3D_SVT_MIN10FLOAT = 53,
|
||||
D3D_SVT_MIN16FLOAT = 54,
|
||||
D3D_SVT_MIN12INT = 55,
|
||||
D3D_SVT_MIN16INT = 56,
|
||||
D3D_SVT_MIN16UINT = 57,
|
||||
|
||||
D3D_SVT_INT16 = 58,
|
||||
D3D_SVT_UINT16 = 59,
|
||||
D3D_SVT_FLOAT16 = 60,
|
||||
D3D_SVT_INT64 = 61,
|
||||
D3D_SVT_UINT64 = 62,
|
||||
|
||||
D3D10_SVT_VOID = D3D_SVT_VOID,
|
||||
D3D10_SVT_BOOL = D3D_SVT_BOOL,
|
||||
D3D10_SVT_INT = D3D_SVT_INT,
|
||||
D3D10_SVT_FLOAT = D3D_SVT_FLOAT,
|
||||
D3D10_SVT_STRING = D3D_SVT_STRING,
|
||||
D3D10_SVT_TEXTURE = D3D_SVT_TEXTURE,
|
||||
D3D10_SVT_TEXTURE1D = D3D_SVT_TEXTURE1D,
|
||||
D3D10_SVT_TEXTURE2D = D3D_SVT_TEXTURE2D,
|
||||
D3D10_SVT_TEXTURE3D = D3D_SVT_TEXTURE3D,
|
||||
D3D10_SVT_TEXTURECUBE = D3D_SVT_TEXTURECUBE,
|
||||
D3D10_SVT_SAMPLER = D3D_SVT_SAMPLER,
|
||||
D3D10_SVT_SAMPLER1D = D3D_SVT_SAMPLER1D,
|
||||
D3D10_SVT_SAMPLER2D = D3D_SVT_SAMPLER2D,
|
||||
D3D10_SVT_SAMPLER3D = D3D_SVT_SAMPLER3D,
|
||||
D3D10_SVT_SAMPLERCUBE = D3D_SVT_SAMPLERCUBE,
|
||||
D3D10_SVT_PIXELSHADER = D3D_SVT_PIXELSHADER,
|
||||
D3D10_SVT_VERTEXSHADER = D3D_SVT_VERTEXSHADER,
|
||||
D3D10_SVT_PIXELFRAGMENT = D3D_SVT_PIXELFRAGMENT,
|
||||
D3D10_SVT_VERTEXFRAGMENT = D3D_SVT_VERTEXFRAGMENT,
|
||||
D3D10_SVT_UINT = D3D_SVT_UINT,
|
||||
D3D10_SVT_UINT8 = D3D_SVT_UINT8,
|
||||
D3D10_SVT_GEOMETRYSHADER = D3D_SVT_GEOMETRYSHADER,
|
||||
D3D10_SVT_RASTERIZER = D3D_SVT_RASTERIZER,
|
||||
D3D10_SVT_DEPTHSTENCIL = D3D_SVT_DEPTHSTENCIL,
|
||||
D3D10_SVT_BLEND = D3D_SVT_BLEND,
|
||||
D3D10_SVT_BUFFER = D3D_SVT_BUFFER,
|
||||
D3D10_SVT_CBUFFER = D3D_SVT_CBUFFER,
|
||||
D3D10_SVT_TBUFFER = D3D_SVT_TBUFFER,
|
||||
D3D10_SVT_TEXTURE1DARRAY = D3D_SVT_TEXTURE1DARRAY,
|
||||
D3D10_SVT_TEXTURE2DARRAY = D3D_SVT_TEXTURE2DARRAY,
|
||||
D3D10_SVT_RENDERTARGETVIEW = D3D_SVT_RENDERTARGETVIEW,
|
||||
D3D10_SVT_DEPTHSTENCILVIEW = D3D_SVT_DEPTHSTENCILVIEW,
|
||||
|
||||
D3D10_SVT_TEXTURE2DMS = D3D_SVT_TEXTURE2DMS,
|
||||
D3D10_SVT_TEXTURE2DMSARRAY = D3D_SVT_TEXTURE2DMSARRAY,
|
||||
|
||||
D3D10_SVT_TEXTURECUBEARRAY = D3D_SVT_TEXTURECUBEARRAY,
|
||||
|
||||
D3D11_SVT_HULLSHADER = D3D_SVT_HULLSHADER,
|
||||
D3D11_SVT_DOMAINSHADER = D3D_SVT_DOMAINSHADER,
|
||||
|
||||
D3D11_SVT_INTERFACE_POINTER = D3D_SVT_INTERFACE_POINTER,
|
||||
D3D11_SVT_COMPUTESHADER = D3D_SVT_COMPUTESHADER,
|
||||
|
||||
D3D11_SVT_DOUBLE = D3D_SVT_DOUBLE,
|
||||
|
||||
D3D11_SVT_RWTEXTURE1D = D3D_SVT_RWTEXTURE1D,
|
||||
D3D11_SVT_RWTEXTURE1DARRAY = D3D_SVT_RWTEXTURE1DARRAY,
|
||||
D3D11_SVT_RWTEXTURE2D = D3D_SVT_RWTEXTURE2D,
|
||||
D3D11_SVT_RWTEXTURE2DARRAY = D3D_SVT_RWTEXTURE2DARRAY,
|
||||
D3D11_SVT_RWTEXTURE3D = D3D_SVT_RWTEXTURE3D,
|
||||
D3D11_SVT_RWBUFFER = D3D_SVT_RWBUFFER,
|
||||
|
||||
D3D11_SVT_BYTEADDRESS_BUFFER = D3D_SVT_BYTEADDRESS_BUFFER,
|
||||
D3D11_SVT_RWBYTEADDRESS_BUFFER = D3D_SVT_RWBYTEADDRESS_BUFFER,
|
||||
D3D11_SVT_STRUCTURED_BUFFER = D3D_SVT_STRUCTURED_BUFFER,
|
||||
D3D11_SVT_RWSTRUCTURED_BUFFER = D3D_SVT_RWSTRUCTURED_BUFFER,
|
||||
D3D11_SVT_APPEND_STRUCTURED_BUFFER = D3D_SVT_APPEND_STRUCTURED_BUFFER,
|
||||
D3D11_SVT_CONSUME_STRUCTURED_BUFFER = D3D_SVT_CONSUME_STRUCTURED_BUFFER,
|
||||
|
||||
// force 32-bit size enum
|
||||
D3D_SVT_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_SHADER_VARIABLE_TYPE;
|
||||
|
||||
typedef enum _D3D_SHADER_INPUT_FLAGS
|
||||
{
|
||||
D3D_SIF_USERPACKED = 0x01,
|
||||
D3D_SIF_COMPARISON_SAMPLER = 0x02, // is this a comparison sampler?
|
||||
D3D_SIF_TEXTURE_COMPONENT_0 = 0x04, // this 2-bit value encodes c - 1, where c
|
||||
D3D_SIF_TEXTURE_COMPONENT_1 = 0x08, // is the number of components in the texture
|
||||
D3D_SIF_TEXTURE_COMPONENTS = 0x0c,
|
||||
D3D_SIF_UNUSED = 0x10,
|
||||
|
||||
D3D10_SIF_USERPACKED = D3D_SIF_USERPACKED,
|
||||
D3D10_SIF_COMPARISON_SAMPLER = D3D_SIF_COMPARISON_SAMPLER,
|
||||
D3D10_SIF_TEXTURE_COMPONENT_0 = D3D_SIF_TEXTURE_COMPONENT_0,
|
||||
D3D10_SIF_TEXTURE_COMPONENT_1 = D3D_SIF_TEXTURE_COMPONENT_1,
|
||||
D3D10_SIF_TEXTURE_COMPONENTS = D3D_SIF_TEXTURE_COMPONENTS,
|
||||
|
||||
// force 32-bit size enum
|
||||
D3D_SIF_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_SHADER_INPUT_FLAGS;
|
||||
|
||||
typedef enum _D3D_SHADER_INPUT_TYPE
|
||||
{
|
||||
D3D_SIT_CBUFFER,
|
||||
D3D_SIT_TBUFFER,
|
||||
D3D_SIT_TEXTURE,
|
||||
D3D_SIT_SAMPLER,
|
||||
D3D_SIT_UAV_RWTYPED,
|
||||
D3D_SIT_STRUCTURED,
|
||||
D3D_SIT_UAV_RWSTRUCTURED,
|
||||
D3D_SIT_BYTEADDRESS,
|
||||
D3D_SIT_UAV_RWBYTEADDRESS,
|
||||
D3D_SIT_UAV_APPEND_STRUCTURED,
|
||||
D3D_SIT_UAV_CONSUME_STRUCTURED,
|
||||
D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER,
|
||||
D3D_SIT_RTACCELERATIONSTRUCTURE,
|
||||
D3D_SIT_UAV_FEEDBACKTEXTURE,
|
||||
|
||||
D3D10_SIT_CBUFFER = D3D_SIT_CBUFFER,
|
||||
D3D10_SIT_TBUFFER = D3D_SIT_TBUFFER,
|
||||
D3D10_SIT_TEXTURE = D3D_SIT_TEXTURE,
|
||||
D3D10_SIT_SAMPLER = D3D_SIT_SAMPLER,
|
||||
|
||||
D3D11_SIT_UAV_RWTYPED = D3D_SIT_UAV_RWTYPED,
|
||||
D3D11_SIT_STRUCTURED = D3D_SIT_STRUCTURED,
|
||||
D3D11_SIT_UAV_RWSTRUCTURED = D3D_SIT_UAV_RWSTRUCTURED,
|
||||
D3D11_SIT_BYTEADDRESS = D3D_SIT_BYTEADDRESS,
|
||||
D3D11_SIT_UAV_RWBYTEADDRESS = D3D_SIT_UAV_RWBYTEADDRESS,
|
||||
D3D11_SIT_UAV_APPEND_STRUCTURED = D3D_SIT_UAV_APPEND_STRUCTURED,
|
||||
D3D11_SIT_UAV_CONSUME_STRUCTURED = D3D_SIT_UAV_CONSUME_STRUCTURED,
|
||||
D3D11_SIT_UAV_RWSTRUCTURED_WITH_COUNTER = D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER,
|
||||
} D3D_SHADER_INPUT_TYPE;
|
||||
|
||||
typedef enum _D3D_SHADER_CBUFFER_FLAGS
|
||||
{
|
||||
D3D_CBF_USERPACKED = 1,
|
||||
|
||||
D3D10_CBF_USERPACKED = D3D_CBF_USERPACKED,
|
||||
|
||||
// force 32-bit size enum
|
||||
D3D_CBF_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_SHADER_CBUFFER_FLAGS;
|
||||
|
||||
typedef enum _D3D_CBUFFER_TYPE
|
||||
{
|
||||
D3D_CT_CBUFFER,
|
||||
D3D_CT_TBUFFER,
|
||||
D3D_CT_INTERFACE_POINTERS,
|
||||
D3D_CT_RESOURCE_BIND_INFO,
|
||||
|
||||
D3D10_CT_CBUFFER = D3D_CT_CBUFFER,
|
||||
D3D10_CT_TBUFFER = D3D_CT_TBUFFER,
|
||||
|
||||
D3D11_CT_CBUFFER = D3D_CT_CBUFFER,
|
||||
D3D11_CT_TBUFFER = D3D_CT_TBUFFER,
|
||||
D3D11_CT_INTERFACE_POINTERS = D3D_CT_INTERFACE_POINTERS,
|
||||
D3D11_CT_RESOURCE_BIND_INFO = D3D_CT_RESOURCE_BIND_INFO,
|
||||
} D3D_CBUFFER_TYPE;
|
||||
|
||||
typedef enum D3D_NAME
|
||||
{
|
||||
D3D_NAME_UNDEFINED = 0,
|
||||
|
||||
// Names meaningful to both HLSL and hardware
|
||||
D3D_NAME_POSITION = 1,
|
||||
D3D_NAME_CLIP_DISTANCE = 2,
|
||||
D3D_NAME_CULL_DISTANCE = 3,
|
||||
D3D_NAME_RENDER_TARGET_ARRAY_INDEX = 4,
|
||||
D3D_NAME_VIEWPORT_ARRAY_INDEX = 5,
|
||||
D3D_NAME_VERTEX_ID = 6,
|
||||
D3D_NAME_PRIMITIVE_ID = 7,
|
||||
D3D_NAME_INSTANCE_ID = 8,
|
||||
D3D_NAME_IS_FRONT_FACE = 9,
|
||||
D3D_NAME_SAMPLE_INDEX = 10,
|
||||
D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR = 11,
|
||||
D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = 12,
|
||||
D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR = 13,
|
||||
D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR = 14,
|
||||
D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR = 15,
|
||||
D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR = 16,
|
||||
D3D_NAME_BARYCENTRICS = 23,
|
||||
D3D_NAME_SHADINGRATE = 24,
|
||||
D3D_NAME_CULLPRIMITIVE = 25,
|
||||
|
||||
// Names meaningful to HLSL only
|
||||
D3D_NAME_TARGET = 64,
|
||||
D3D_NAME_DEPTH = 65,
|
||||
D3D_NAME_COVERAGE = 66,
|
||||
D3D_NAME_DEPTH_GREATER_EQUAL = 67,
|
||||
D3D_NAME_DEPTH_LESS_EQUAL = 68,
|
||||
D3D_NAME_STENCIL_REF = 69,
|
||||
D3D_NAME_INNER_COVERAGE = 70,
|
||||
|
||||
D3D10_NAME_UNDEFINED = D3D_NAME_UNDEFINED,
|
||||
D3D10_NAME_POSITION = D3D_NAME_POSITION,
|
||||
D3D10_NAME_CLIP_DISTANCE = D3D_NAME_CLIP_DISTANCE,
|
||||
D3D10_NAME_CULL_DISTANCE = D3D_NAME_CULL_DISTANCE,
|
||||
D3D10_NAME_RENDER_TARGET_ARRAY_INDEX = D3D_NAME_RENDER_TARGET_ARRAY_INDEX,
|
||||
D3D10_NAME_VIEWPORT_ARRAY_INDEX = D3D_NAME_VIEWPORT_ARRAY_INDEX,
|
||||
D3D10_NAME_VERTEX_ID = D3D_NAME_VERTEX_ID,
|
||||
D3D10_NAME_PRIMITIVE_ID = D3D_NAME_PRIMITIVE_ID,
|
||||
D3D10_NAME_INSTANCE_ID = D3D_NAME_INSTANCE_ID,
|
||||
D3D10_NAME_IS_FRONT_FACE = D3D_NAME_IS_FRONT_FACE,
|
||||
D3D10_NAME_SAMPLE_INDEX = D3D_NAME_SAMPLE_INDEX,
|
||||
D3D10_NAME_TARGET = D3D_NAME_TARGET,
|
||||
D3D10_NAME_DEPTH = D3D_NAME_DEPTH,
|
||||
D3D10_NAME_COVERAGE = D3D_NAME_COVERAGE,
|
||||
|
||||
D3D11_NAME_FINAL_QUAD_EDGE_TESSFACTOR = D3D_NAME_FINAL_QUAD_EDGE_TESSFACTOR,
|
||||
D3D11_NAME_FINAL_QUAD_INSIDE_TESSFACTOR = D3D_NAME_FINAL_QUAD_INSIDE_TESSFACTOR,
|
||||
D3D11_NAME_FINAL_TRI_EDGE_TESSFACTOR = D3D_NAME_FINAL_TRI_EDGE_TESSFACTOR,
|
||||
D3D11_NAME_FINAL_TRI_INSIDE_TESSFACTOR = D3D_NAME_FINAL_TRI_INSIDE_TESSFACTOR,
|
||||
D3D11_NAME_FINAL_LINE_DETAIL_TESSFACTOR = D3D_NAME_FINAL_LINE_DETAIL_TESSFACTOR,
|
||||
D3D11_NAME_FINAL_LINE_DENSITY_TESSFACTOR = D3D_NAME_FINAL_LINE_DENSITY_TESSFACTOR,
|
||||
D3D11_NAME_DEPTH_GREATER_EQUAL = D3D_NAME_DEPTH_GREATER_EQUAL,
|
||||
D3D11_NAME_DEPTH_LESS_EQUAL = D3D_NAME_DEPTH_LESS_EQUAL,
|
||||
|
||||
D3D11_NAME_STENCIL_REF = D3D_NAME_STENCIL_REF,
|
||||
D3D11_NAME_INNER_COVERAGE = D3D_NAME_INNER_COVERAGE,
|
||||
|
||||
D3D12_NAME_BARYCENTRICS = D3D_NAME_BARYCENTRICS,
|
||||
D3D12_NAME_SHADINGRATE = D3D_NAME_SHADINGRATE,
|
||||
D3D12_NAME_CULLPRIMITIVE = D3D_NAME_CULLPRIMITIVE,
|
||||
} D3D_NAME;
|
||||
|
||||
typedef enum D3D_RESOURCE_RETURN_TYPE
|
||||
{
|
||||
D3D_RETURN_TYPE_UNORM = 1,
|
||||
D3D_RETURN_TYPE_SNORM = 2,
|
||||
D3D_RETURN_TYPE_SINT = 3,
|
||||
D3D_RETURN_TYPE_UINT = 4,
|
||||
D3D_RETURN_TYPE_FLOAT = 5,
|
||||
D3D_RETURN_TYPE_MIXED = 6,
|
||||
D3D_RETURN_TYPE_DOUBLE = 7,
|
||||
D3D_RETURN_TYPE_CONTINUED = 8,
|
||||
|
||||
D3D10_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM,
|
||||
D3D10_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM,
|
||||
D3D10_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT,
|
||||
D3D10_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT,
|
||||
D3D10_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT,
|
||||
D3D10_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED,
|
||||
|
||||
D3D11_RETURN_TYPE_UNORM = D3D_RETURN_TYPE_UNORM,
|
||||
D3D11_RETURN_TYPE_SNORM = D3D_RETURN_TYPE_SNORM,
|
||||
D3D11_RETURN_TYPE_SINT = D3D_RETURN_TYPE_SINT,
|
||||
D3D11_RETURN_TYPE_UINT = D3D_RETURN_TYPE_UINT,
|
||||
D3D11_RETURN_TYPE_FLOAT = D3D_RETURN_TYPE_FLOAT,
|
||||
D3D11_RETURN_TYPE_MIXED = D3D_RETURN_TYPE_MIXED,
|
||||
D3D11_RETURN_TYPE_DOUBLE = D3D_RETURN_TYPE_DOUBLE,
|
||||
D3D11_RETURN_TYPE_CONTINUED = D3D_RETURN_TYPE_CONTINUED,
|
||||
} D3D_RESOURCE_RETURN_TYPE;
|
||||
|
||||
typedef enum D3D_REGISTER_COMPONENT_TYPE
|
||||
{
|
||||
D3D_REGISTER_COMPONENT_UNKNOWN = 0,
|
||||
D3D_REGISTER_COMPONENT_UINT32 = 1,
|
||||
D3D_REGISTER_COMPONENT_SINT32 = 2,
|
||||
D3D_REGISTER_COMPONENT_FLOAT32 = 3,
|
||||
D3D_REGISTER_COMPONENT_UINT16 = 4,
|
||||
D3D_REGISTER_COMPONENT_SINT16 = 5,
|
||||
D3D_REGISTER_COMPONENT_FLOAT16 = 6,
|
||||
D3D_REGISTER_COMPONENT_UINT64 = 7,
|
||||
D3D_REGISTER_COMPONENT_SINT64 = 8,
|
||||
D3D_REGISTER_COMPONENT_FLOAT64 = 9,
|
||||
|
||||
D3D10_REGISTER_COMPONENT_UNKNOWN = D3D_REGISTER_COMPONENT_UNKNOWN,
|
||||
D3D10_REGISTER_COMPONENT_UINT32 = D3D_REGISTER_COMPONENT_UINT32,
|
||||
D3D10_REGISTER_COMPONENT_SINT32 = D3D_REGISTER_COMPONENT_SINT32,
|
||||
D3D10_REGISTER_COMPONENT_FLOAT32 = D3D_REGISTER_COMPONENT_FLOAT32,
|
||||
D3D10_REGISTER_COMPONENT_UINT16 = D3D_REGISTER_COMPONENT_UINT16,
|
||||
D3D10_REGISTER_COMPONENT_SINT16 = D3D_REGISTER_COMPONENT_SINT16,
|
||||
D3D10_REGISTER_COMPONENT_FLOAT16 = D3D_REGISTER_COMPONENT_FLOAT16,
|
||||
D3D10_REGISTER_COMPONENT_UINT64 = D3D_REGISTER_COMPONENT_UINT64,
|
||||
D3D10_REGISTER_COMPONENT_SINT64 = D3D_REGISTER_COMPONENT_SINT64,
|
||||
D3D10_REGISTER_COMPONENT_FLOAT64 = D3D_REGISTER_COMPONENT_FLOAT64,
|
||||
} D3D_REGISTER_COMPONENT_TYPE;
|
||||
|
||||
typedef enum D3D_TESSELLATOR_DOMAIN
|
||||
{
|
||||
D3D_TESSELLATOR_DOMAIN_UNDEFINED = 0,
|
||||
D3D_TESSELLATOR_DOMAIN_ISOLINE = 1,
|
||||
D3D_TESSELLATOR_DOMAIN_TRI = 2,
|
||||
D3D_TESSELLATOR_DOMAIN_QUAD = 3,
|
||||
|
||||
D3D11_TESSELLATOR_DOMAIN_UNDEFINED = D3D_TESSELLATOR_DOMAIN_UNDEFINED,
|
||||
D3D11_TESSELLATOR_DOMAIN_ISOLINE = D3D_TESSELLATOR_DOMAIN_ISOLINE,
|
||||
D3D11_TESSELLATOR_DOMAIN_TRI = D3D_TESSELLATOR_DOMAIN_TRI,
|
||||
D3D11_TESSELLATOR_DOMAIN_QUAD = D3D_TESSELLATOR_DOMAIN_QUAD,
|
||||
} D3D_TESSELLATOR_DOMAIN;
|
||||
|
||||
typedef enum D3D_TESSELLATOR_PARTITIONING
|
||||
{
|
||||
D3D_TESSELLATOR_PARTITIONING_UNDEFINED = 0,
|
||||
D3D_TESSELLATOR_PARTITIONING_INTEGER = 1,
|
||||
D3D_TESSELLATOR_PARTITIONING_POW2 = 2,
|
||||
D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = 3,
|
||||
D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = 4,
|
||||
|
||||
D3D11_TESSELLATOR_PARTITIONING_UNDEFINED = D3D_TESSELLATOR_PARTITIONING_UNDEFINED,
|
||||
D3D11_TESSELLATOR_PARTITIONING_INTEGER = D3D_TESSELLATOR_PARTITIONING_INTEGER,
|
||||
D3D11_TESSELLATOR_PARTITIONING_POW2 = D3D_TESSELLATOR_PARTITIONING_POW2,
|
||||
D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD,
|
||||
D3D11_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN = D3D_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN,
|
||||
} D3D_TESSELLATOR_PARTITIONING;
|
||||
|
||||
typedef enum D3D_TESSELLATOR_OUTPUT_PRIMITIVE
|
||||
{
|
||||
D3D_TESSELLATOR_OUTPUT_UNDEFINED = 0,
|
||||
D3D_TESSELLATOR_OUTPUT_POINT = 1,
|
||||
D3D_TESSELLATOR_OUTPUT_LINE = 2,
|
||||
D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW = 3,
|
||||
D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW = 4,
|
||||
|
||||
D3D11_TESSELLATOR_OUTPUT_UNDEFINED = D3D_TESSELLATOR_OUTPUT_UNDEFINED,
|
||||
D3D11_TESSELLATOR_OUTPUT_POINT = D3D_TESSELLATOR_OUTPUT_POINT,
|
||||
D3D11_TESSELLATOR_OUTPUT_LINE = D3D_TESSELLATOR_OUTPUT_LINE,
|
||||
D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CW,
|
||||
D3D11_TESSELLATOR_OUTPUT_TRIANGLE_CCW = D3D_TESSELLATOR_OUTPUT_TRIANGLE_CCW,
|
||||
} D3D_TESSELLATOR_OUTPUT_PRIMITIVE;
|
||||
|
||||
typedef enum D3D_MIN_PRECISION
|
||||
{
|
||||
D3D_MIN_PRECISION_DEFAULT = 0, // Default precision for the shader model
|
||||
D3D_MIN_PRECISION_FLOAT_16 = 1, // Min 16 bit/component float
|
||||
D3D_MIN_PRECISION_FLOAT_2_8 = 2, // Min 10(2.8)bit/comp. float
|
||||
D3D_MIN_PRECISION_RESERVED = 3, // Reserved for future use
|
||||
D3D_MIN_PRECISION_SINT_16 = 4, // Min 16 bit/comp. signed integer
|
||||
D3D_MIN_PRECISION_UINT_16 = 5, // Min 16 bit/comp. unsigned integer
|
||||
|
||||
// These values are abstractions of width only for use in situations
|
||||
// where a general width is needed instead of specific types. They
|
||||
// will never be used in shader operands.
|
||||
D3D_MIN_PRECISION_ANY_16 = 0xf0,
|
||||
D3D_MIN_PRECISION_ANY_10 = 0xf1,
|
||||
} D3D_MIN_PRECISION;
|
||||
|
||||
typedef enum D3D_INTERPOLATION_MODE
|
||||
{
|
||||
D3D_INTERPOLATION_UNDEFINED = 0,
|
||||
D3D_INTERPOLATION_CONSTANT = 1,
|
||||
D3D_INTERPOLATION_LINEAR = 2,
|
||||
D3D_INTERPOLATION_LINEAR_CENTROID = 3,
|
||||
D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE = 4,
|
||||
D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_CENTROID = 5,
|
||||
D3D_INTERPOLATION_LINEAR_SAMPLE = 6,
|
||||
D3D_INTERPOLATION_LINEAR_NOPERSPECTIVE_SAMPLE = 7,
|
||||
} D3D_INTERPOLATION_MODE;
|
||||
|
||||
// Parameter flags.
|
||||
typedef enum _D3D_PARAMETER_FLAGS
|
||||
{
|
||||
D3D_PF_NONE = 0x00000000,
|
||||
D3D_PF_IN = 0x00000001,
|
||||
D3D_PF_OUT = 0x00000002,
|
||||
D3D_PF_FORCE_DWORD = 0x7fffffff
|
||||
} D3D_PARAMETER_FLAGS;
|
||||
|
||||
// Format Layout Properties
|
||||
typedef enum D3D_FORMAT_LAYOUT
|
||||
{
|
||||
D3DFL_STANDARD = 0, // standard layout
|
||||
D3DFL_CUSTOM = -1 // custom layout
|
||||
// Note, 1 bit allocated for this in FORMAT_DETAIL below. If you add fields here, add bits...
|
||||
// NOTE SIGNED VALUES ARE USED SINCE COMPILER MAKES ENUMS SIGNED, AND BITFIELDS ARE SIGN EXTENDED ON READ
|
||||
} D3D_FORMAT_LAYOUT;
|
||||
|
||||
typedef enum D3D_FORMAT_TYPE_LEVEL
|
||||
{
|
||||
D3DFTL_NO_TYPE = 0,
|
||||
D3DFTL_PARTIAL_TYPE = -2,
|
||||
D3DFTL_FULL_TYPE = -1,
|
||||
// Note, 2 bits allocated for this in FORMAT_DETAIL below. If you add fields here, add bits...
|
||||
// NOTE SIGNED VALUES ARE USED SINCE COMPILER MAKES ENUMS SIGNED, AND BITFIELDS ARE SIGN EXTENDED ON READ
|
||||
} D3D_FORMAT_TYPE_LEVEL;
|
||||
|
||||
typedef enum D3D_FORMAT_COMPONENT_NAME
|
||||
{
|
||||
D3DFCN_R = -4,
|
||||
D3DFCN_G = -3,
|
||||
D3DFCN_B = -2,
|
||||
D3DFCN_A = -1,
|
||||
D3DFCN_D = 0,
|
||||
D3DFCN_S = 1,
|
||||
D3DFCN_X = 2,
|
||||
// Note, 3 bits allocated for this in FORMAT_DETAIL below. If you add fields here, add bits...
|
||||
// NOTE SIGNED VALUES ARE USED SINCE COMPILER MAKES ENUMS SIGNED, AND BITFIELDS ARE SIGN EXTENDED ON READ
|
||||
} D3D_FORMAT_COMPONENT_NAME;
|
||||
|
||||
typedef enum D3D_FORMAT_COMPONENT_INTERPRETATION
|
||||
{
|
||||
D3DFCI_TYPELESS = 0,
|
||||
D3DFCI_FLOAT = -4,
|
||||
D3DFCI_SNORM = -3,
|
||||
D3DFCI_UNORM = -2,
|
||||
D3DFCI_SINT = -1,
|
||||
D3DFCI_UINT = 1,
|
||||
D3DFCI_UNORM_SRGB = 2,
|
||||
D3DFCI_BIASED_FIXED_2_8 = 3,
|
||||
// Note, 3 bits allocated for this in FORMAT_DETAIL below. If you add fields here, add bits...
|
||||
// NOTE SIGNED VALUES ARE USED SINCE COMPILER MAKES ENUMS SIGNED, AND BITFIELDS ARE SIGN EXTENDED ON READ
|
||||
} D3D_FORMAT_COMPONENT_INTERPRETATION;
|
||||
|
||||
// Well-Known Private Data IDs (WKPDID_*):
|
||||
|
||||
// WKPDID_D3DDebugObjectName provides a unique name to objects in order to assist the developer during debugging.
|
||||
//
|
||||
// const char c_szName[] = "texture.jpg";
|
||||
// pObject->SetPrivateData( WKPDID_D3DDebugObjectName, sizeof( c_szName ) - 1, c_szName );
|
||||
cpp_quote("DEFINE_GUID(WKPDID_D3DDebugObjectName,0x429b8c22,0x9188,0x4b0c,0x87,0x42,0xac,0xb0,0xbf,0x85,0xc2,0x00);")
|
||||
cpp_quote("DEFINE_GUID(WKPDID_D3DDebugObjectNameW,0x4cca5fd8,0x921f,0x42c8,0x85,0x66,0x70,0xca,0xf2,0xa9,0xb7,0x41);")
|
||||
cpp_quote("DEFINE_GUID(WKPDID_CommentStringW,0xd0149dc0,0x90e8,0x4ec8,0x81, 0x44, 0xe9, 0x00, 0xad, 0x26, 0x6b, 0xb2);")
|
||||
cpp_quote("DEFINE_GUID(WKPDID_D3D12UniqueObjectId, 0x1b39de15, 0xec04, 0x4bae, 0xba, 0x4d, 0x8c, 0xef, 0x79, 0xfc, 0x04, 0xc1);")
|
||||
|
||||
cpp_quote("#define D3D_SET_OBJECT_NAME_N_A(pObject, Chars, pName) (pObject)->SetPrivateData(WKPDID_D3DDebugObjectName, Chars, pName)")
|
||||
cpp_quote("#define D3D_SET_OBJECT_NAME_A(pObject, pName) D3D_SET_OBJECT_NAME_N_A(pObject, lstrlenA(pName), pName)")
|
||||
cpp_quote("#define D3D_SET_OBJECT_NAME_N_W(pObject, Chars, pName) (pObject)->SetPrivateData(WKPDID_D3DDebugObjectNameW, Chars*2, pName)")
|
||||
cpp_quote("#define D3D_SET_OBJECT_NAME_W(pObject, pName) D3D_SET_OBJECT_NAME_N_W(pObject, wcslen(pName), pName)")
|
||||
|
||||
cpp_quote("#define D3D_COMPONENT_MASK_X 1")
|
||||
cpp_quote("#define D3D_COMPONENT_MASK_Y 2")
|
||||
cpp_quote("#define D3D_COMPONENT_MASK_Z 4")
|
||||
cpp_quote("#define D3D_COMPONENT_MASK_W 8")
|
||||
|
||||
cpp_quote("DEFINE_GUID(D3D_TEXTURE_LAYOUT_ROW_MAJOR,0xb5dc234f,0x72bb,0x4bec,0x97,0x05,0x8c,0xf2,0x58,0xdf,0x6b,0x6c);") // Feature_D3D1XDisplayable
|
||||
cpp_quote("DEFINE_GUID(D3D_TEXTURE_LAYOUT_64KB_STANDARD_SWIZZLE,0x4c0f29e3,0x3f5f,0x4d35,0x84,0xc9,0xbc,0x09,0x83,0xb6,0x2c,0x28);") // Feature_D3D1XDisplayable
|
||||
|
||||
35
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12.h
Normal file
35
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12.h
Normal file
@@ -0,0 +1,35 @@
|
||||
//*********************************************************
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License (MIT).
|
||||
//
|
||||
//*********************************************************
|
||||
|
||||
#ifndef __D3DX12_H__
|
||||
#define __D3DX12_H__
|
||||
|
||||
#include "d3d12.h"
|
||||
|
||||
#if defined( __cplusplus )
|
||||
|
||||
#include "d3dx12_barriers.h"
|
||||
#include "d3dx12_core.h"
|
||||
#include "d3dx12_default.h"
|
||||
#include "d3dx12_pipeline_state_stream.h"
|
||||
#include "d3dx12_render_pass.h"
|
||||
#include "d3dx12_resource_helpers.h"
|
||||
#include "d3dx12_root_signature.h"
|
||||
#include "d3dx12_property_format_table.h"
|
||||
|
||||
#ifndef D3DX12_NO_STATE_OBJECT_HELPERS
|
||||
#include "d3dx12_state_object.h"
|
||||
#endif // !D3DX12_NO_STATE_OBJECT_HELPERS
|
||||
|
||||
#ifndef D3DX12_NO_CHECK_FEATURE_SUPPORT_CLASS
|
||||
#include "d3dx12_check_feature_support.h"
|
||||
#endif // !D3DX12_NO_CHECK_FEATURE_SUPPORT_CLASS
|
||||
|
||||
#endif // defined( __cplusplus )
|
||||
|
||||
#endif //__D3DX12_H__
|
||||
|
||||
192
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12_barriers.h
Normal file
192
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12_barriers.h
Normal file
@@ -0,0 +1,192 @@
|
||||
//*********************************************************
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License (MIT).
|
||||
//
|
||||
//*********************************************************
|
||||
|
||||
#ifndef __D3DX12_BARRIERS_H__
|
||||
#define __D3DX12_BARRIERS_H__
|
||||
|
||||
#if defined( __cplusplus )
|
||||
|
||||
#include "d3d12.h"
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
struct CD3DX12_RESOURCE_BARRIER : public D3D12_RESOURCE_BARRIER
|
||||
{
|
||||
CD3DX12_RESOURCE_BARRIER() = default;
|
||||
explicit CD3DX12_RESOURCE_BARRIER(const D3D12_RESOURCE_BARRIER &o) noexcept :
|
||||
D3D12_RESOURCE_BARRIER(o)
|
||||
{}
|
||||
static inline CD3DX12_RESOURCE_BARRIER Transition(
|
||||
_In_ ID3D12Resource* pResource,
|
||||
D3D12_RESOURCE_STATES stateBefore,
|
||||
D3D12_RESOURCE_STATES stateAfter,
|
||||
UINT subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,
|
||||
D3D12_RESOURCE_BARRIER_FLAGS flags = D3D12_RESOURCE_BARRIER_FLAG_NONE) noexcept
|
||||
{
|
||||
CD3DX12_RESOURCE_BARRIER result = {};
|
||||
D3D12_RESOURCE_BARRIER &barrier = result;
|
||||
result.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
|
||||
result.Flags = flags;
|
||||
barrier.Transition.pResource = pResource;
|
||||
barrier.Transition.StateBefore = stateBefore;
|
||||
barrier.Transition.StateAfter = stateAfter;
|
||||
barrier.Transition.Subresource = subresource;
|
||||
return result;
|
||||
}
|
||||
static inline CD3DX12_RESOURCE_BARRIER Aliasing(
|
||||
_In_opt_ ID3D12Resource* pResourceBefore,
|
||||
_In_opt_ ID3D12Resource* pResourceAfter) noexcept
|
||||
{
|
||||
CD3DX12_RESOURCE_BARRIER result = {};
|
||||
D3D12_RESOURCE_BARRIER &barrier = result;
|
||||
result.Type = D3D12_RESOURCE_BARRIER_TYPE_ALIASING;
|
||||
barrier.Aliasing.pResourceBefore = pResourceBefore;
|
||||
barrier.Aliasing.pResourceAfter = pResourceAfter;
|
||||
return result;
|
||||
}
|
||||
static inline CD3DX12_RESOURCE_BARRIER UAV(
|
||||
_In_opt_ ID3D12Resource* pResource) noexcept
|
||||
{
|
||||
CD3DX12_RESOURCE_BARRIER result = {};
|
||||
D3D12_RESOURCE_BARRIER &barrier = result;
|
||||
result.Type = D3D12_RESOURCE_BARRIER_TYPE_UAV;
|
||||
barrier.UAV.pResource = pResource;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 608)
|
||||
|
||||
//================================================================================================
|
||||
// D3DX12 Enhanced Barrier Helpers
|
||||
//================================================================================================
|
||||
|
||||
class CD3DX12_BARRIER_SUBRESOURCE_RANGE : public D3D12_BARRIER_SUBRESOURCE_RANGE
|
||||
{
|
||||
public:
|
||||
CD3DX12_BARRIER_SUBRESOURCE_RANGE() = default;
|
||||
CD3DX12_BARRIER_SUBRESOURCE_RANGE(const D3D12_BARRIER_SUBRESOURCE_RANGE &o) noexcept :
|
||||
D3D12_BARRIER_SUBRESOURCE_RANGE(o)
|
||||
{}
|
||||
explicit CD3DX12_BARRIER_SUBRESOURCE_RANGE(UINT Subresource) noexcept :
|
||||
D3D12_BARRIER_SUBRESOURCE_RANGE{ Subresource, 0, 0, 0, 0, 0 }
|
||||
{}
|
||||
CD3DX12_BARRIER_SUBRESOURCE_RANGE(
|
||||
UINT firstMipLevel,
|
||||
UINT numMips,
|
||||
UINT firstArraySlice,
|
||||
UINT numArraySlices,
|
||||
UINT firstPlane = 0,
|
||||
UINT numPlanes = 1) noexcept :
|
||||
D3D12_BARRIER_SUBRESOURCE_RANGE
|
||||
{
|
||||
firstMipLevel,
|
||||
numMips,
|
||||
firstArraySlice,
|
||||
numArraySlices,
|
||||
firstPlane,
|
||||
numPlanes
|
||||
}
|
||||
{}
|
||||
};
|
||||
|
||||
class CD3DX12_GLOBAL_BARRIER : public D3D12_GLOBAL_BARRIER
|
||||
{
|
||||
public:
|
||||
CD3DX12_GLOBAL_BARRIER() = default;
|
||||
CD3DX12_GLOBAL_BARRIER(const D3D12_GLOBAL_BARRIER &o) noexcept : D3D12_GLOBAL_BARRIER(o){}
|
||||
CD3DX12_GLOBAL_BARRIER(
|
||||
D3D12_BARRIER_SYNC syncBefore,
|
||||
D3D12_BARRIER_SYNC syncAfter,
|
||||
D3D12_BARRIER_ACCESS accessBefore,
|
||||
D3D12_BARRIER_ACCESS accessAfter) noexcept : D3D12_GLOBAL_BARRIER {
|
||||
syncBefore,
|
||||
syncAfter,
|
||||
accessBefore,
|
||||
accessAfter
|
||||
}
|
||||
{}
|
||||
};
|
||||
|
||||
class CD3DX12_BUFFER_BARRIER : public D3D12_BUFFER_BARRIER
|
||||
{
|
||||
public:
|
||||
CD3DX12_BUFFER_BARRIER() = default;
|
||||
CD3DX12_BUFFER_BARRIER(const D3D12_BUFFER_BARRIER &o) noexcept : D3D12_BUFFER_BARRIER(o){}
|
||||
CD3DX12_BUFFER_BARRIER(
|
||||
D3D12_BARRIER_SYNC syncBefore,
|
||||
D3D12_BARRIER_SYNC syncAfter,
|
||||
D3D12_BARRIER_ACCESS accessBefore,
|
||||
D3D12_BARRIER_ACCESS accessAfter,
|
||||
ID3D12Resource *pRes) noexcept : D3D12_BUFFER_BARRIER {
|
||||
syncBefore,
|
||||
syncAfter,
|
||||
accessBefore,
|
||||
accessAfter,
|
||||
pRes,
|
||||
0, ULLONG_MAX
|
||||
}
|
||||
{}
|
||||
};
|
||||
|
||||
class CD3DX12_TEXTURE_BARRIER : public D3D12_TEXTURE_BARRIER
|
||||
{
|
||||
public:
|
||||
CD3DX12_TEXTURE_BARRIER() = default;
|
||||
CD3DX12_TEXTURE_BARRIER(const D3D12_TEXTURE_BARRIER &o) noexcept : D3D12_TEXTURE_BARRIER(o){}
|
||||
CD3DX12_TEXTURE_BARRIER(
|
||||
D3D12_BARRIER_SYNC syncBefore,
|
||||
D3D12_BARRIER_SYNC syncAfter,
|
||||
D3D12_BARRIER_ACCESS accessBefore,
|
||||
D3D12_BARRIER_ACCESS accessAfter,
|
||||
D3D12_BARRIER_LAYOUT layoutBefore,
|
||||
D3D12_BARRIER_LAYOUT layoutAfter,
|
||||
ID3D12Resource *pRes,
|
||||
const D3D12_BARRIER_SUBRESOURCE_RANGE &subresources,
|
||||
D3D12_TEXTURE_BARRIER_FLAGS flag = D3D12_TEXTURE_BARRIER_FLAG_NONE) noexcept : D3D12_TEXTURE_BARRIER {
|
||||
syncBefore,
|
||||
syncAfter,
|
||||
accessBefore,
|
||||
accessAfter,
|
||||
layoutBefore,
|
||||
layoutAfter,
|
||||
pRes,
|
||||
subresources,
|
||||
flag
|
||||
}
|
||||
{}
|
||||
};
|
||||
|
||||
class CD3DX12_BARRIER_GROUP : public D3D12_BARRIER_GROUP
|
||||
{
|
||||
public:
|
||||
CD3DX12_BARRIER_GROUP() = default;
|
||||
CD3DX12_BARRIER_GROUP(const D3D12_BARRIER_GROUP &o) noexcept : D3D12_BARRIER_GROUP(o){}
|
||||
CD3DX12_BARRIER_GROUP(UINT32 numBarriers, const D3D12_BUFFER_BARRIER *pBarriers) noexcept
|
||||
{
|
||||
Type = D3D12_BARRIER_TYPE_BUFFER;
|
||||
NumBarriers = numBarriers;
|
||||
pBufferBarriers = pBarriers;
|
||||
}
|
||||
CD3DX12_BARRIER_GROUP(UINT32 numBarriers, const D3D12_TEXTURE_BARRIER *pBarriers) noexcept
|
||||
{
|
||||
Type = D3D12_BARRIER_TYPE_TEXTURE;
|
||||
NumBarriers = numBarriers;
|
||||
pTextureBarriers = pBarriers;
|
||||
}
|
||||
CD3DX12_BARRIER_GROUP(UINT32 numBarriers, const D3D12_GLOBAL_BARRIER *pBarriers) noexcept
|
||||
{
|
||||
Type = D3D12_BARRIER_TYPE_GLOBAL;
|
||||
NumBarriers = numBarriers;
|
||||
pGlobalBarriers = pBarriers;
|
||||
}
|
||||
};
|
||||
#endif // D3D12_SDK_VERSION >= 608
|
||||
|
||||
|
||||
#endif // defined( __cplusplus )
|
||||
|
||||
#endif // __D3DX12_BARRIERS_H__
|
||||
File diff suppressed because it is too large
Load Diff
1537
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12_core.h
Normal file
1537
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12_core.h
Normal file
File diff suppressed because it is too large
Load Diff
12
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12_default.h
Normal file
12
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12_default.h
Normal file
@@ -0,0 +1,12 @@
|
||||
//*********************************************************
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License (MIT).
|
||||
//
|
||||
//*********************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
struct CD3DX12_DEFAULT {};
|
||||
extern const DECLSPEC_SELECTANY CD3DX12_DEFAULT D3D12_DEFAULT;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,124 @@
|
||||
//*********************************************************
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License (MIT).
|
||||
//
|
||||
//*********************************************************
|
||||
#ifndef __D3D12_PROPERTY_LAYOUT_FORMAT_TABLE_H__
|
||||
#define __D3D12_PROPERTY_LAYOUT_FORMAT_TABLE_H__
|
||||
#include "d3d12.h"
|
||||
#define MAP_ALIGN_REQUIREMENT 16 // Map is required to return 16-byte aligned addresses
|
||||
|
||||
struct D3D12_PROPERTY_LAYOUT_FORMAT_TABLE
|
||||
{
|
||||
public:
|
||||
// ----------------------------------------------------------------------------
|
||||
// Information describing everything about a D3D Resource Format
|
||||
// ----------------------------------------------------------------------------
|
||||
typedef struct FORMAT_DETAIL
|
||||
{
|
||||
DXGI_FORMAT DXGIFormat;
|
||||
DXGI_FORMAT ParentFormat;
|
||||
const DXGI_FORMAT* pDefaultFormatCastSet; // This is dependent on FL/driver version, but is here to save a lot of space
|
||||
UINT8 BitsPerComponent[4]; // only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
|
||||
UINT8 BitsPerUnit;
|
||||
BYTE SRGBFormat : 1;
|
||||
UINT WidthAlignment : 4; // number of texels to align to in a mip level.
|
||||
UINT HeightAlignment : 4; // Top level dimensions must be a multiple of these
|
||||
UINT DepthAlignment : 1; // values.
|
||||
D3D_FORMAT_LAYOUT Layout : 1;
|
||||
D3D_FORMAT_TYPE_LEVEL TypeLevel : 2;
|
||||
D3D_FORMAT_COMPONENT_NAME ComponentName0 : 3; // RED ... only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
|
||||
D3D_FORMAT_COMPONENT_NAME ComponentName1 : 3; // GREEN ... only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
|
||||
D3D_FORMAT_COMPONENT_NAME ComponentName2 : 3; // BLUE ... only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
|
||||
D3D_FORMAT_COMPONENT_NAME ComponentName3 : 3; // ALPHA ... only used for D3DFTL_PARTIAL_TYPE or FULL_TYPE
|
||||
D3D_FORMAT_COMPONENT_INTERPRETATION ComponentInterpretation0 : 3; // only used for D3DFTL_FULL_TYPE
|
||||
D3D_FORMAT_COMPONENT_INTERPRETATION ComponentInterpretation1 : 3; // only used for D3DFTL_FULL_TYPE
|
||||
D3D_FORMAT_COMPONENT_INTERPRETATION ComponentInterpretation2 : 3; // only used for D3DFTL_FULL_TYPE
|
||||
D3D_FORMAT_COMPONENT_INTERPRETATION ComponentInterpretation3 : 3; // only used for D3DFTL_FULL_TYPE
|
||||
bool bDX9VertexOrIndexFormat : 1;
|
||||
bool bDX9TextureFormat : 1;
|
||||
bool bFloatNormFormat : 1;
|
||||
bool bPlanar : 1;
|
||||
bool bYUV : 1;
|
||||
bool bDependantFormatCastSet : 1; // This indicates that the format cast set is dependent on FL/driver version
|
||||
bool bInternal : 1;
|
||||
} FORMAT_DETAIL;
|
||||
|
||||
private:
|
||||
static const FORMAT_DETAIL s_FormatDetail[];
|
||||
static const UINT s_NumFormats;
|
||||
static const LPCSTR s_FormatNames[]; // separate from above structure so it can be compiled out of runtime.
|
||||
public:
|
||||
static UINT GetNumFormats();
|
||||
static const FORMAT_DETAIL* GetFormatTable();
|
||||
static D3D_FEATURE_LEVEL GetHighestDefinedFeatureLevel();
|
||||
|
||||
static DXGI_FORMAT GetFormat (SIZE_T Index);
|
||||
static bool FormatExists (DXGI_FORMAT Format);
|
||||
static bool FormatExistsInHeader (DXGI_FORMAT Format, bool bExternalHeader = true);
|
||||
static UINT GetByteAlignment (DXGI_FORMAT Format);
|
||||
static bool IsBlockCompressFormat (DXGI_FORMAT Format);
|
||||
static LPCSTR GetName (DXGI_FORMAT Format, bool bHideInternalFormats = true);
|
||||
static bool IsSRGBFormat (DXGI_FORMAT Format);
|
||||
static UINT GetBitsPerStencil (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);
|
||||
|
||||
// Converts the sequential component index (range from 0 to GetNumComponentsInFormat()) to
|
||||
// the absolute component index (range 0 to 3).
|
||||
static UINT Sequential2AbsoluteComponentIndex (DXGI_FORMAT Format, UINT SequentialComponentIndex);
|
||||
static bool CanBeCastEvenFullyTyped (DXGI_FORMAT Format, D3D_FEATURE_LEVEL fl);
|
||||
static UINT8 GetAddressingBitsPerAlignedSize (DXGI_FORMAT Format);
|
||||
static DXGI_FORMAT GetParentFormat (DXGI_FORMAT Format);
|
||||
static const DXGI_FORMAT* GetFormatCastSet (DXGI_FORMAT Format);
|
||||
static D3D_FORMAT_LAYOUT GetLayout (DXGI_FORMAT Format);
|
||||
static D3D_FORMAT_TYPE_LEVEL GetTypeLevel (DXGI_FORMAT Format);
|
||||
static UINT GetBitsPerUnit (DXGI_FORMAT Format);
|
||||
static UINT GetBitsPerUnitThrow (DXGI_FORMAT Format);
|
||||
static UINT GetBitsPerElement (DXGI_FORMAT Format); // Legacy function used to support D3D10on9 only. Do not use.
|
||||
static UINT GetWidthAlignment (DXGI_FORMAT Format);
|
||||
static UINT GetHeightAlignment (DXGI_FORMAT Format);
|
||||
static UINT GetDepthAlignment (DXGI_FORMAT Format);
|
||||
static BOOL Planar (DXGI_FORMAT Format);
|
||||
static BOOL NonOpaquePlanar (DXGI_FORMAT Format);
|
||||
static BOOL YUV (DXGI_FORMAT Format);
|
||||
static BOOL Opaque (DXGI_FORMAT Format);
|
||||
static bool FamilySupportsStencil (DXGI_FORMAT Format);
|
||||
static UINT NonOpaquePlaneCount (DXGI_FORMAT Format);
|
||||
static BOOL DX9VertexOrIndexFormat (DXGI_FORMAT Format);
|
||||
static BOOL DX9TextureFormat (DXGI_FORMAT Format);
|
||||
static BOOL FloatNormTextureFormat (DXGI_FORMAT Format);
|
||||
static bool DepthOnlyFormat (DXGI_FORMAT format);
|
||||
static UINT8 GetPlaneCount (DXGI_FORMAT Format);
|
||||
static bool MotionEstimatorAllowedInputFormat (DXGI_FORMAT Format);
|
||||
static bool SupportsSamplerFeedback (DXGI_FORMAT Format);
|
||||
static bool DecodeHistogramAllowedForOutputFormatSupport(DXGI_FORMAT Format);
|
||||
static UINT8 GetPlaneSliceFromViewFormat (DXGI_FORMAT ResourceFormat, DXGI_FORMAT ViewFormat);
|
||||
static bool FloatAndNotFloatFormats (DXGI_FORMAT FormatA, DXGI_FORMAT FormatB);
|
||||
static bool SNORMAndUNORMFormats (DXGI_FORMAT FormatA, DXGI_FORMAT FormatB);
|
||||
static bool ValidCastToR32UAV (DXGI_FORMAT from, DXGI_FORMAT to);
|
||||
static bool IsSupportedTextureDisplayableFormat (DXGI_FORMAT, bool bMediaFormatOnly);
|
||||
static D3D_FORMAT_COMPONENT_INTERPRETATION GetFormatComponentInterpretation (DXGI_FORMAT Format, UINT AbsoluteComponentIndex);
|
||||
static UINT GetBitsPerComponent (DXGI_FORMAT Format, UINT AbsoluteComponentIndex);
|
||||
static D3D_FORMAT_COMPONENT_NAME GetComponentName (DXGI_FORMAT Format, UINT AbsoluteComponentIndex);
|
||||
static HRESULT CalculateExtraPlanarRows (DXGI_FORMAT format, UINT plane0Height, _Out_ UINT& totalHeight);
|
||||
static HRESULT CalculateMinimumRowMajorRowPitch (DXGI_FORMAT Format, UINT Width, _Out_ UINT& RowPitch);
|
||||
static HRESULT CalculateMinimumRowMajorSlicePitch (DXGI_FORMAT Format, UINT ContextBasedRowPitch, UINT Height, _Out_ UINT& SlicePitch);
|
||||
static void GetYCbCrChromaSubsampling (DXGI_FORMAT Format, _Out_ UINT& HorizontalSubsampling, _Out_ UINT& VerticalSubsampling);
|
||||
|
||||
static HRESULT CalculateResourceSize (UINT width, UINT height, UINT depth, DXGI_FORMAT format, UINT mipLevels, UINT subresources, _Out_ SIZE_T& totalByteSize, _Out_writes_opt_(subresources) D3D12_MEMCPY_DEST* pDst = nullptr);
|
||||
static void GetTileShape (D3D12_TILE_SHAPE* pTileShape, DXGI_FORMAT Format, D3D12_RESOURCE_DIMENSION Dimension, UINT SampleCount);
|
||||
static void Get4KTileShape (D3D12_TILE_SHAPE* pTileShape, DXGI_FORMAT Format, D3D12_RESOURCE_DIMENSION Dimension, UINT SampleCount);
|
||||
static void GetMipDimensions (UINT8 mipSlice, _Inout_ UINT64* pWidth, _Inout_opt_ UINT64* pHeight = nullptr, _Inout_opt_ UINT64* pDepth = nullptr);
|
||||
static void GetPlaneSubsampledSizeAndFormatForCopyableLayout(UINT PlaneSlice, DXGI_FORMAT Format, UINT Width, UINT Height, _Out_ DXGI_FORMAT& PlaneFormat, _Out_ UINT& MinPlanePitchWidth, _Out_ UINT& PlaneWidth, _Out_ UINT& PlaneHeight);
|
||||
|
||||
static UINT GetDetailTableIndex (DXGI_FORMAT Format);
|
||||
static UINT GetDetailTableIndexNoThrow (DXGI_FORMAT Format);
|
||||
static UINT GetDetailTableIndexThrow (DXGI_FORMAT Format);
|
||||
private:
|
||||
static const FORMAT_DETAIL* GetFormatDetail (DXGI_FORMAT Format);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
105
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12_render_pass.h
Normal file
105
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12_render_pass.h
Normal file
@@ -0,0 +1,105 @@
|
||||
//*********************************************************
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License (MIT).
|
||||
//
|
||||
//*********************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error D3DX12 requires C++
|
||||
#endif
|
||||
|
||||
#include "d3d12.h"
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
|
||||
inline bool operator==(const D3D12_RENDER_PASS_BEGINNING_ACCESS_PRESERVE_LOCAL_PARAMETERS& a, const D3D12_RENDER_PASS_ENDING_ACCESS_PRESERVE_LOCAL_PARAMETERS& b) noexcept
|
||||
{
|
||||
return ((a.AdditionalWidth == b.AdditionalWidth) && (a.AdditionalHeight == b.AdditionalHeight));
|
||||
}
|
||||
|
||||
inline bool operator==(const D3D12_RENDER_PASS_BEGINNING_ACCESS_PRESERVE_LOCAL_PARAMETERS& a, const D3D12_RENDER_PASS_BEGINNING_ACCESS_PRESERVE_LOCAL_PARAMETERS& b) noexcept
|
||||
{
|
||||
return ((a.AdditionalWidth == b.AdditionalWidth) && (a.AdditionalHeight == b.AdditionalHeight));
|
||||
}
|
||||
|
||||
inline bool operator==(const D3D12_RENDER_PASS_ENDING_ACCESS_PRESERVE_LOCAL_PARAMETERS& a, const D3D12_RENDER_PASS_ENDING_ACCESS_PRESERVE_LOCAL_PARAMETERS& b) noexcept
|
||||
{
|
||||
return ((a.AdditionalWidth == b.AdditionalWidth) && (a.AdditionalHeight == b.AdditionalHeight));
|
||||
}
|
||||
#endif
|
||||
|
||||
inline bool operator==( const D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS &a, const D3D12_RENDER_PASS_BEGINNING_ACCESS_CLEAR_PARAMETERS &b) noexcept
|
||||
{
|
||||
return a.ClearValue == b.ClearValue;
|
||||
}
|
||||
|
||||
inline bool operator==( const D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS &a, const D3D12_RENDER_PASS_ENDING_ACCESS_RESOLVE_PARAMETERS &b) noexcept
|
||||
{
|
||||
if (a.pSrcResource != b.pSrcResource) return false;
|
||||
if (a.pDstResource != b.pDstResource) return false;
|
||||
if (a.SubresourceCount != b.SubresourceCount) return false;
|
||||
if (a.Format != b.Format) return false;
|
||||
if (a.ResolveMode != b.ResolveMode) return false;
|
||||
if (a.PreserveResolveSource != b.PreserveResolveSource) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool operator==( const D3D12_RENDER_PASS_BEGINNING_ACCESS &a, const D3D12_RENDER_PASS_BEGINNING_ACCESS &b) noexcept
|
||||
{
|
||||
if (a.Type != b.Type) return false;
|
||||
switch (a.Type)
|
||||
{
|
||||
case D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_CLEAR:
|
||||
if (!(a.Clear == b.Clear)) return false;
|
||||
break;
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
|
||||
case D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE_LOCAL_RENDER:
|
||||
case D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE_LOCAL_SRV:
|
||||
case D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_PRESERVE_LOCAL_UAV:
|
||||
if (!(a.PreserveLocal == b.PreserveLocal)) return false;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool operator==(const D3D12_RENDER_PASS_ENDING_ACCESS& a, const D3D12_RENDER_PASS_ENDING_ACCESS& b) noexcept
|
||||
{
|
||||
if (a.Type != b.Type) return false;
|
||||
switch (a.Type)
|
||||
{
|
||||
case D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_RESOLVE:
|
||||
if (!(a.Resolve == b.Resolve)) return false;
|
||||
break;
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 609)
|
||||
case D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE_LOCAL_RENDER:
|
||||
case D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE_LOCAL_SRV:
|
||||
case D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE_LOCAL_UAV:
|
||||
if (!(a.PreserveLocal == b.PreserveLocal)) return false;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool operator==( const D3D12_RENDER_PASS_RENDER_TARGET_DESC &a, const D3D12_RENDER_PASS_RENDER_TARGET_DESC &b) noexcept
|
||||
{
|
||||
if (a.cpuDescriptor.ptr != b.cpuDescriptor.ptr) return false;
|
||||
if (!(a.BeginningAccess == b.BeginningAccess)) return false;
|
||||
if (!(a.EndingAccess == b.EndingAccess)) return false;
|
||||
return true;
|
||||
}
|
||||
inline bool operator==( const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC &a, const D3D12_RENDER_PASS_DEPTH_STENCIL_DESC &b) noexcept
|
||||
{
|
||||
if (a.cpuDescriptor.ptr != b.cpuDescriptor.ptr) return false;
|
||||
if (!(a.DepthBeginningAccess == b.DepthBeginningAccess)) return false;
|
||||
if (!(a.StencilBeginningAccess == b.StencilBeginningAccess)) return false;
|
||||
if (!(a.DepthEndingAccess == b.DepthEndingAccess)) return false;
|
||||
if (!(a.StencilEndingAccess == b.StencilEndingAccess)) return false;
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,602 @@
|
||||
//*********************************************************
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License (MIT).
|
||||
//
|
||||
//*********************************************************
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error D3DX12 requires C++
|
||||
#endif
|
||||
|
||||
#include "d3dx12_property_format_table.h"
|
||||
#include "d3d12.h"
|
||||
#include "d3dx12_core.h"
|
||||
//------------------------------------------------------------------------------------------------
|
||||
template <typename T, typename U, typename V>
|
||||
inline void D3D12DecomposeSubresource( UINT Subresource, UINT MipLevels, UINT ArraySize, _Out_ T& MipSlice, _Out_ U& ArraySlice, _Out_ V& PlaneSlice ) noexcept
|
||||
{
|
||||
MipSlice = static_cast<T>(Subresource % MipLevels);
|
||||
ArraySlice = static_cast<U>((Subresource / MipLevels) % ArraySize);
|
||||
PlaneSlice = static_cast<V>(Subresource / (MipLevels * ArraySize));
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// Row-by-row memcpy
|
||||
inline void MemcpySubresource(
|
||||
_In_ const D3D12_MEMCPY_DEST* pDest,
|
||||
_In_ const D3D12_SUBRESOURCE_DATA* pSrc,
|
||||
SIZE_T RowSizeInBytes,
|
||||
UINT NumRows,
|
||||
UINT NumSlices) noexcept
|
||||
{
|
||||
for (UINT z = 0; z < NumSlices; ++z)
|
||||
{
|
||||
auto pDestSlice = static_cast<BYTE*>(pDest->pData) + pDest->SlicePitch * z;
|
||||
auto pSrcSlice = static_cast<const BYTE*>(pSrc->pData) + pSrc->SlicePitch * LONG_PTR(z);
|
||||
for (UINT y = 0; y < NumRows; ++y)
|
||||
{
|
||||
memcpy(pDestSlice + pDest->RowPitch * y,
|
||||
pSrcSlice + pSrc->RowPitch * LONG_PTR(y),
|
||||
RowSizeInBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// Row-by-row memcpy
|
||||
inline void MemcpySubresource(
|
||||
_In_ const D3D12_MEMCPY_DEST* pDest,
|
||||
_In_ const void* pResourceData,
|
||||
_In_ const D3D12_SUBRESOURCE_INFO* pSrc,
|
||||
SIZE_T RowSizeInBytes,
|
||||
UINT NumRows,
|
||||
UINT NumSlices) noexcept
|
||||
{
|
||||
for (UINT z = 0; z < NumSlices; ++z)
|
||||
{
|
||||
auto pDestSlice = static_cast<BYTE*>(pDest->pData) + pDest->SlicePitch * z;
|
||||
auto pSrcSlice = (static_cast<const BYTE*>(pResourceData) + pSrc->Offset) + pSrc->DepthPitch * ULONG_PTR(z);
|
||||
for (UINT y = 0; y < NumRows; ++y)
|
||||
{
|
||||
memcpy(pDestSlice + pDest->RowPitch * y,
|
||||
pSrcSlice + pSrc->RowPitch * ULONG_PTR(y),
|
||||
RowSizeInBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// Returns required size of a buffer to be used for data upload
|
||||
inline UINT64 GetRequiredIntermediateSize(
|
||||
_In_ ID3D12Resource* pDestinationResource,
|
||||
_In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
|
||||
_In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources) noexcept
|
||||
{
|
||||
#if defined(_MSC_VER) || !defined(_WIN32)
|
||||
const auto Desc = pDestinationResource->GetDesc();
|
||||
#else
|
||||
D3D12_RESOURCE_DESC tmpDesc;
|
||||
const auto& Desc = *pDestinationResource->GetDesc(&tmpDesc);
|
||||
#endif
|
||||
UINT64 RequiredSize = 0;
|
||||
|
||||
ID3D12Device* pDevice = nullptr;
|
||||
pDestinationResource->GetDevice(IID_ID3D12Device, reinterpret_cast<void**>(&pDevice));
|
||||
pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, 0, nullptr, nullptr, nullptr, &RequiredSize);
|
||||
pDevice->Release();
|
||||
|
||||
return RequiredSize;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// All arrays must be populated (e.g. by calling GetCopyableFootprints)
|
||||
inline UINT64 UpdateSubresources(
|
||||
_In_ ID3D12GraphicsCommandList* pCmdList,
|
||||
_In_ ID3D12Resource* pDestinationResource,
|
||||
_In_ ID3D12Resource* pIntermediate,
|
||||
_In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
|
||||
_In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources,
|
||||
UINT64 RequiredSize,
|
||||
_In_reads_(NumSubresources) const D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts,
|
||||
_In_reads_(NumSubresources) const UINT* pNumRows,
|
||||
_In_reads_(NumSubresources) const UINT64* pRowSizesInBytes,
|
||||
_In_reads_(NumSubresources) const D3D12_SUBRESOURCE_DATA* pSrcData) noexcept
|
||||
{
|
||||
// Minor validation
|
||||
#if defined(_MSC_VER) || !defined(_WIN32)
|
||||
const auto IntermediateDesc = pIntermediate->GetDesc();
|
||||
const auto DestinationDesc = pDestinationResource->GetDesc();
|
||||
#else
|
||||
D3D12_RESOURCE_DESC tmpDesc1, tmpDesc2;
|
||||
const auto& IntermediateDesc = *pIntermediate->GetDesc(&tmpDesc1);
|
||||
const auto& DestinationDesc = *pDestinationResource->GetDesc(&tmpDesc2);
|
||||
#endif
|
||||
if (IntermediateDesc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER ||
|
||||
IntermediateDesc.Width < RequiredSize + pLayouts[0].Offset ||
|
||||
RequiredSize > SIZE_T(-1) ||
|
||||
(DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER &&
|
||||
(FirstSubresource != 0 || NumSubresources != 1)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BYTE* pData;
|
||||
HRESULT hr = pIntermediate->Map(0, nullptr, reinterpret_cast<void**>(&pData));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (UINT i = 0; i < NumSubresources; ++i)
|
||||
{
|
||||
if (pRowSizesInBytes[i] > SIZE_T(-1)) return 0;
|
||||
D3D12_MEMCPY_DEST DestData = { pData + pLayouts[i].Offset, pLayouts[i].Footprint.RowPitch, SIZE_T(pLayouts[i].Footprint.RowPitch) * SIZE_T(pNumRows[i]) };
|
||||
MemcpySubresource(&DestData, &pSrcData[i], static_cast<SIZE_T>(pRowSizesInBytes[i]), pNumRows[i], pLayouts[i].Footprint.Depth);
|
||||
}
|
||||
pIntermediate->Unmap(0, nullptr);
|
||||
|
||||
if (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
|
||||
{
|
||||
pCmdList->CopyBufferRegion(
|
||||
pDestinationResource, 0, pIntermediate, pLayouts[0].Offset, pLayouts[0].Footprint.Width);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (UINT i = 0; i < NumSubresources; ++i)
|
||||
{
|
||||
const CD3DX12_TEXTURE_COPY_LOCATION Dst(pDestinationResource, i + FirstSubresource);
|
||||
const CD3DX12_TEXTURE_COPY_LOCATION Src(pIntermediate, pLayouts[i]);
|
||||
pCmdList->CopyTextureRegion(&Dst, 0, 0, 0, &Src, nullptr);
|
||||
}
|
||||
}
|
||||
return RequiredSize;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// All arrays must be populated (e.g. by calling GetCopyableFootprints)
|
||||
inline UINT64 UpdateSubresources(
|
||||
_In_ ID3D12GraphicsCommandList* pCmdList,
|
||||
_In_ ID3D12Resource* pDestinationResource,
|
||||
_In_ ID3D12Resource* pIntermediate,
|
||||
_In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
|
||||
_In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources,
|
||||
UINT64 RequiredSize,
|
||||
_In_reads_(NumSubresources) const D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts,
|
||||
_In_reads_(NumSubresources) const UINT* pNumRows,
|
||||
_In_reads_(NumSubresources) const UINT64* pRowSizesInBytes,
|
||||
_In_ const void* pResourceData,
|
||||
_In_reads_(NumSubresources) const D3D12_SUBRESOURCE_INFO* pSrcData) noexcept
|
||||
{
|
||||
// Minor validation
|
||||
#if defined(_MSC_VER) || !defined(_WIN32)
|
||||
const auto IntermediateDesc = pIntermediate->GetDesc();
|
||||
const auto DestinationDesc = pDestinationResource->GetDesc();
|
||||
#else
|
||||
D3D12_RESOURCE_DESC tmpDesc1, tmpDesc2;
|
||||
const auto& IntermediateDesc = *pIntermediate->GetDesc(&tmpDesc1);
|
||||
const auto& DestinationDesc = *pDestinationResource->GetDesc(&tmpDesc2);
|
||||
#endif
|
||||
if (IntermediateDesc.Dimension != D3D12_RESOURCE_DIMENSION_BUFFER ||
|
||||
IntermediateDesc.Width < RequiredSize + pLayouts[0].Offset ||
|
||||
RequiredSize > SIZE_T(-1) ||
|
||||
(DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER &&
|
||||
(FirstSubresource != 0 || NumSubresources != 1)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BYTE* pData;
|
||||
HRESULT hr = pIntermediate->Map(0, nullptr, reinterpret_cast<void**>(&pData));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (UINT i = 0; i < NumSubresources; ++i)
|
||||
{
|
||||
if (pRowSizesInBytes[i] > SIZE_T(-1)) return 0;
|
||||
D3D12_MEMCPY_DEST DestData = { pData + pLayouts[i].Offset, pLayouts[i].Footprint.RowPitch, SIZE_T(pLayouts[i].Footprint.RowPitch) * SIZE_T(pNumRows[i]) };
|
||||
MemcpySubresource(&DestData, pResourceData, &pSrcData[i], static_cast<SIZE_T>(pRowSizesInBytes[i]), pNumRows[i], pLayouts[i].Footprint.Depth);
|
||||
}
|
||||
pIntermediate->Unmap(0, nullptr);
|
||||
|
||||
if (DestinationDesc.Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
|
||||
{
|
||||
pCmdList->CopyBufferRegion(
|
||||
pDestinationResource, 0, pIntermediate, pLayouts[0].Offset, pLayouts[0].Footprint.Width);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (UINT i = 0; i < NumSubresources; ++i)
|
||||
{
|
||||
const CD3DX12_TEXTURE_COPY_LOCATION Dst(pDestinationResource, i + FirstSubresource);
|
||||
const CD3DX12_TEXTURE_COPY_LOCATION Src(pIntermediate, pLayouts[i]);
|
||||
pCmdList->CopyTextureRegion(&Dst, 0, 0, 0, &Src, nullptr);
|
||||
}
|
||||
}
|
||||
return RequiredSize;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// Heap-allocating UpdateSubresources implementation
|
||||
inline UINT64 UpdateSubresources(
|
||||
_In_ ID3D12GraphicsCommandList* pCmdList,
|
||||
_In_ ID3D12Resource* pDestinationResource,
|
||||
_In_ ID3D12Resource* pIntermediate,
|
||||
UINT64 IntermediateOffset,
|
||||
_In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
|
||||
_In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources,
|
||||
_In_reads_(NumSubresources) const D3D12_SUBRESOURCE_DATA* pSrcData) noexcept
|
||||
{
|
||||
UINT64 RequiredSize = 0;
|
||||
const auto MemToAlloc = static_cast<UINT64>(sizeof(D3D12_PLACED_SUBRESOURCE_FOOTPRINT) + sizeof(UINT) + sizeof(UINT64)) * NumSubresources;
|
||||
if (MemToAlloc > SIZE_MAX)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void* pMem = HeapAlloc(GetProcessHeap(), 0, static_cast<SIZE_T>(MemToAlloc));
|
||||
if (pMem == nullptr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
auto pLayouts = static_cast<D3D12_PLACED_SUBRESOURCE_FOOTPRINT*>(pMem);
|
||||
auto pRowSizesInBytes = reinterpret_cast<UINT64*>(pLayouts + NumSubresources);
|
||||
auto pNumRows = reinterpret_cast<UINT*>(pRowSizesInBytes + NumSubresources);
|
||||
|
||||
#if defined(_MSC_VER) || !defined(_WIN32)
|
||||
const auto Desc = pDestinationResource->GetDesc();
|
||||
#else
|
||||
D3D12_RESOURCE_DESC tmpDesc;
|
||||
const auto& Desc = *pDestinationResource->GetDesc(&tmpDesc);
|
||||
#endif
|
||||
ID3D12Device* pDevice = nullptr;
|
||||
pDestinationResource->GetDevice(IID_ID3D12Device, reinterpret_cast<void**>(&pDevice));
|
||||
pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, pLayouts, pNumRows, pRowSizesInBytes, &RequiredSize);
|
||||
pDevice->Release();
|
||||
|
||||
const UINT64 Result = UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, pLayouts, pNumRows, pRowSizesInBytes, pSrcData);
|
||||
HeapFree(GetProcessHeap(), 0, pMem);
|
||||
return Result;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// Heap-allocating UpdateSubresources implementation
|
||||
inline UINT64 UpdateSubresources(
|
||||
_In_ ID3D12GraphicsCommandList* pCmdList,
|
||||
_In_ ID3D12Resource* pDestinationResource,
|
||||
_In_ ID3D12Resource* pIntermediate,
|
||||
UINT64 IntermediateOffset,
|
||||
_In_range_(0,D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
|
||||
_In_range_(0,D3D12_REQ_SUBRESOURCES-FirstSubresource) UINT NumSubresources,
|
||||
_In_ const void* pResourceData,
|
||||
_In_reads_(NumSubresources) const D3D12_SUBRESOURCE_INFO* pSrcData) noexcept
|
||||
{
|
||||
UINT64 RequiredSize = 0;
|
||||
const auto MemToAlloc = static_cast<UINT64>(sizeof(D3D12_PLACED_SUBRESOURCE_FOOTPRINT) + sizeof(UINT) + sizeof(UINT64)) * NumSubresources;
|
||||
if (MemToAlloc > SIZE_MAX)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
void* pMem = HeapAlloc(GetProcessHeap(), 0, static_cast<SIZE_T>(MemToAlloc));
|
||||
if (pMem == nullptr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
auto pLayouts = static_cast<D3D12_PLACED_SUBRESOURCE_FOOTPRINT*>(pMem);
|
||||
auto pRowSizesInBytes = reinterpret_cast<UINT64*>(pLayouts + NumSubresources);
|
||||
auto pNumRows = reinterpret_cast<UINT*>(pRowSizesInBytes + NumSubresources);
|
||||
|
||||
#if defined(_MSC_VER) || !defined(_WIN32)
|
||||
const auto Desc = pDestinationResource->GetDesc();
|
||||
#else
|
||||
D3D12_RESOURCE_DESC tmpDesc;
|
||||
const auto& Desc = *pDestinationResource->GetDesc(&tmpDesc);
|
||||
#endif
|
||||
ID3D12Device* pDevice = nullptr;
|
||||
pDestinationResource->GetDevice(IID_ID3D12Device, reinterpret_cast<void**>(&pDevice));
|
||||
pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, pLayouts, pNumRows, pRowSizesInBytes, &RequiredSize);
|
||||
pDevice->Release();
|
||||
|
||||
const UINT64 Result = UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, pLayouts, pNumRows, pRowSizesInBytes, pResourceData, pSrcData);
|
||||
HeapFree(GetProcessHeap(), 0, pMem);
|
||||
return Result;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// Stack-allocating UpdateSubresources implementation
|
||||
template <UINT MaxSubresources>
|
||||
inline UINT64 UpdateSubresources(
|
||||
_In_ ID3D12GraphicsCommandList* pCmdList,
|
||||
_In_ ID3D12Resource* pDestinationResource,
|
||||
_In_ ID3D12Resource* pIntermediate,
|
||||
UINT64 IntermediateOffset,
|
||||
_In_range_(0,MaxSubresources) UINT FirstSubresource,
|
||||
_In_range_(1,MaxSubresources-FirstSubresource) UINT NumSubresources,
|
||||
_In_reads_(NumSubresources) const D3D12_SUBRESOURCE_DATA* pSrcData) noexcept
|
||||
{
|
||||
UINT64 RequiredSize = 0;
|
||||
D3D12_PLACED_SUBRESOURCE_FOOTPRINT Layouts[MaxSubresources];
|
||||
UINT NumRows[MaxSubresources];
|
||||
UINT64 RowSizesInBytes[MaxSubresources];
|
||||
|
||||
#if defined(_MSC_VER) || !defined(_WIN32)
|
||||
const auto Desc = pDestinationResource->GetDesc();
|
||||
#else
|
||||
D3D12_RESOURCE_DESC tmpDesc;
|
||||
const auto& Desc = *pDestinationResource->GetDesc(&tmpDesc);
|
||||
#endif
|
||||
ID3D12Device* pDevice = nullptr;
|
||||
pDestinationResource->GetDevice(IID_ID3D12Device, reinterpret_cast<void**>(&pDevice));
|
||||
pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, Layouts, NumRows, RowSizesInBytes, &RequiredSize);
|
||||
pDevice->Release();
|
||||
|
||||
return UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, Layouts, NumRows, RowSizesInBytes, pSrcData);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// Stack-allocating UpdateSubresources implementation
|
||||
template <UINT MaxSubresources>
|
||||
inline UINT64 UpdateSubresources(
|
||||
_In_ ID3D12GraphicsCommandList* pCmdList,
|
||||
_In_ ID3D12Resource* pDestinationResource,
|
||||
_In_ ID3D12Resource* pIntermediate,
|
||||
UINT64 IntermediateOffset,
|
||||
_In_range_(0,MaxSubresources) UINT FirstSubresource,
|
||||
_In_range_(1,MaxSubresources-FirstSubresource) UINT NumSubresources,
|
||||
_In_ const void* pResourceData,
|
||||
_In_reads_(NumSubresources) const D3D12_SUBRESOURCE_INFO* pSrcData) noexcept
|
||||
{
|
||||
UINT64 RequiredSize = 0;
|
||||
D3D12_PLACED_SUBRESOURCE_FOOTPRINT Layouts[MaxSubresources];
|
||||
UINT NumRows[MaxSubresources];
|
||||
UINT64 RowSizesInBytes[MaxSubresources];
|
||||
|
||||
#if defined(_MSC_VER) || !defined(_WIN32)
|
||||
const auto Desc = pDestinationResource->GetDesc();
|
||||
#else
|
||||
D3D12_RESOURCE_DESC tmpDesc;
|
||||
const auto& Desc = *pDestinationResource->GetDesc(&tmpDesc);
|
||||
#endif
|
||||
ID3D12Device* pDevice = nullptr;
|
||||
pDestinationResource->GetDevice(IID_ID3D12Device, reinterpret_cast<void**>(&pDevice));
|
||||
pDevice->GetCopyableFootprints(&Desc, FirstSubresource, NumSubresources, IntermediateOffset, Layouts, NumRows, RowSizesInBytes, &RequiredSize);
|
||||
pDevice->Release();
|
||||
|
||||
return UpdateSubresources(pCmdList, pDestinationResource, pIntermediate, FirstSubresource, NumSubresources, RequiredSize, Layouts, NumRows, RowSizesInBytes, pResourceData, pSrcData);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
constexpr bool D3D12IsLayoutOpaque( D3D12_TEXTURE_LAYOUT Layout ) noexcept
|
||||
{ return Layout == D3D12_TEXTURE_LAYOUT_UNKNOWN || Layout == D3D12_TEXTURE_LAYOUT_64KB_UNDEFINED_SWIZZLE; }
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
template< typename T >
|
||||
inline T D3DX12Align(T uValue, T uAlign)
|
||||
{
|
||||
// Assert power of 2 alignment
|
||||
D3DX12_ASSERT(0 == (uAlign & (uAlign - 1)));
|
||||
T uMask = uAlign - 1;
|
||||
T uResult = (uValue + uMask) & ~uMask;
|
||||
D3DX12_ASSERT(uResult >= uValue);
|
||||
D3DX12_ASSERT(0 == (uResult % uAlign));
|
||||
return uResult;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
template< typename T >
|
||||
inline T D3DX12AlignAtLeast(T uValue, T uAlign)
|
||||
{
|
||||
T aligned = D3DX12Align(uValue, uAlign);
|
||||
return aligned > uAlign ? aligned : uAlign;
|
||||
}
|
||||
|
||||
inline const CD3DX12_RESOURCE_DESC1* D3DX12ConditionallyExpandAPIDesc(
|
||||
D3D12_RESOURCE_DESC1& LclDesc,
|
||||
const D3D12_RESOURCE_DESC1* pDesc)
|
||||
{
|
||||
return D3DX12ConditionallyExpandAPIDesc(static_cast<CD3DX12_RESOURCE_DESC1&>(LclDesc), static_cast<const CD3DX12_RESOURCE_DESC1*>(pDesc));
|
||||
}
|
||||
|
||||
#if defined(D3D12_SDK_VERSION) && (D3D12_SDK_VERSION >= 606)
|
||||
//------------------------------------------------------------------------------------------------
|
||||
// The difference between D3DX12GetCopyableFootprints and ID3D12Device::GetCopyableFootprints
|
||||
// is that this one loses a lot of error checking by assuming the arguments are correct
|
||||
inline bool D3DX12GetCopyableFootprints(
|
||||
_In_ const D3D12_RESOURCE_DESC1& ResourceDesc,
|
||||
_In_range_(0, D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
|
||||
_In_range_(0, D3D12_REQ_SUBRESOURCES - FirstSubresource) UINT NumSubresources,
|
||||
UINT64 BaseOffset,
|
||||
_Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts,
|
||||
_Out_writes_opt_(NumSubresources) UINT* pNumRows,
|
||||
_Out_writes_opt_(NumSubresources) UINT64* pRowSizeInBytes,
|
||||
_Out_opt_ UINT64* pTotalBytes)
|
||||
{
|
||||
constexpr UINT64 uint64_max = ~0ull;
|
||||
UINT64 TotalBytes = uint64_max;
|
||||
UINT uSubRes = 0;
|
||||
|
||||
bool bResourceOverflow = false;
|
||||
TotalBytes = 0;
|
||||
|
||||
const DXGI_FORMAT Format = ResourceDesc.Format;
|
||||
|
||||
CD3DX12_RESOURCE_DESC1 LresourceDesc;
|
||||
const CD3DX12_RESOURCE_DESC1& resourceDesc = *D3DX12ConditionallyExpandAPIDesc(LresourceDesc, &ResourceDesc);
|
||||
|
||||
// Check if its a valid format
|
||||
D3DX12_ASSERT(D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::FormatExists(Format));
|
||||
|
||||
const UINT WidthAlignment = D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::GetWidthAlignment( Format );
|
||||
const UINT HeightAlignment = D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::GetHeightAlignment( Format );
|
||||
const UINT16 DepthAlignment = UINT16( D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::GetDepthAlignment( Format ) );
|
||||
|
||||
for (; uSubRes < NumSubresources; ++uSubRes)
|
||||
{
|
||||
bool bOverflow = false;
|
||||
UINT Subresource = FirstSubresource + uSubRes;
|
||||
|
||||
D3DX12_ASSERT(resourceDesc.MipLevels != 0);
|
||||
UINT subresourceCount = resourceDesc.MipLevels * resourceDesc.ArraySize() * D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::GetPlaneCount(resourceDesc.Format);
|
||||
|
||||
if (Subresource > subresourceCount)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
TotalBytes = D3DX12Align< UINT64 >( TotalBytes, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT );
|
||||
|
||||
UINT MipLevel, ArraySlice, PlaneSlice;
|
||||
D3D12DecomposeSubresource(Subresource, resourceDesc.MipLevels, resourceDesc.ArraySize(), /*_Out_*/MipLevel, /*_Out_*/ArraySlice, /*_Out_*/PlaneSlice);
|
||||
|
||||
const UINT64 Width = D3DX12AlignAtLeast<UINT64>(resourceDesc.Width >> MipLevel, WidthAlignment);
|
||||
const UINT Height = D3DX12AlignAtLeast(resourceDesc.Height >> MipLevel, HeightAlignment);
|
||||
const UINT16 Depth = D3DX12AlignAtLeast<UINT16>(resourceDesc.Depth() >> MipLevel, DepthAlignment);
|
||||
|
||||
// Adjust for the current PlaneSlice. Most formats have only one plane.
|
||||
DXGI_FORMAT PlaneFormat;
|
||||
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;
|
||||
auto& Placement = pLayouts ? pLayouts[uSubRes].Footprint : LocalPlacement;
|
||||
Placement.Format = PlaneFormat;
|
||||
Placement.Width = PlaneWidth;
|
||||
Placement.Height = PlaneHeight;
|
||||
Placement.Depth = Depth;
|
||||
|
||||
// Calculate row pitch
|
||||
UINT MinPlaneRowPitch = 0;
|
||||
D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::CalculateMinimumRowMajorRowPitch(PlaneFormat, MinPlanePitchWidth, MinPlaneRowPitch);
|
||||
|
||||
// Formats with more than one plane choose a larger pitch alignment to ensure that each plane begins on the row
|
||||
// immediately following the previous plane while still adhering to subresource alignment restrictions.
|
||||
static_assert( D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT >= D3D12_TEXTURE_DATA_PITCH_ALIGNMENT
|
||||
&& ((D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT % D3D12_TEXTURE_DATA_PITCH_ALIGNMENT) == 0),
|
||||
"D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT must be >= and evenly divisible by D3D12_TEXTURE_DATA_PITCH_ALIGNMENT." );
|
||||
|
||||
Placement.RowPitch = D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::Planar(Format)
|
||||
? D3DX12Align< UINT >( MinPlaneRowPitch, D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT )
|
||||
: D3DX12Align< UINT >( MinPlaneRowPitch, D3D12_TEXTURE_DATA_PITCH_ALIGNMENT );
|
||||
|
||||
if (pRowSizeInBytes)
|
||||
{
|
||||
UINT PlaneRowSize = 0;
|
||||
D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::CalculateMinimumRowMajorRowPitch(PlaneFormat, PlaneWidth, PlaneRowSize);
|
||||
|
||||
pRowSizeInBytes[uSubRes] = PlaneRowSize;
|
||||
}
|
||||
|
||||
// Number of rows (accounting for block compression and additional planes)
|
||||
UINT NumRows = 0;
|
||||
if (D3D12_PROPERTY_LAYOUT_FORMAT_TABLE::Planar(Format))
|
||||
{
|
||||
NumRows = PlaneHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
D3DX12_ASSERT(Height % HeightAlignment == 0);
|
||||
NumRows = Height / HeightAlignment;
|
||||
}
|
||||
|
||||
if (pNumRows)
|
||||
{
|
||||
pNumRows[uSubRes] = NumRows;
|
||||
}
|
||||
|
||||
// Offsetting
|
||||
if (pLayouts)
|
||||
{
|
||||
pLayouts[uSubRes].Offset = (bOverflow ? uint64_max : TotalBytes + BaseOffset);
|
||||
}
|
||||
|
||||
const UINT16 NumSlices = Depth;
|
||||
const UINT64 SubresourceSize = (NumRows * NumSlices - 1) * Placement.RowPitch + MinPlaneRowPitch;
|
||||
|
||||
// uint64 addition with overflow checking
|
||||
TotalBytes = TotalBytes + SubresourceSize;
|
||||
if(TotalBytes < SubresourceSize)
|
||||
{
|
||||
TotalBytes = uint64_max;
|
||||
}
|
||||
bResourceOverflow = bResourceOverflow || bOverflow;
|
||||
}
|
||||
|
||||
// Overflow error
|
||||
if (bResourceOverflow)
|
||||
{
|
||||
TotalBytes = uint64_max;
|
||||
}
|
||||
|
||||
|
||||
if (pLayouts)
|
||||
{
|
||||
memset( pLayouts + uSubRes, -1, sizeof( *pLayouts ) * (NumSubresources - uSubRes) );
|
||||
}
|
||||
if (pNumRows)
|
||||
{
|
||||
memset(pNumRows + uSubRes, -1, sizeof(*pNumRows) * (NumSubresources - uSubRes));
|
||||
}
|
||||
if (pRowSizeInBytes)
|
||||
{
|
||||
memset(pRowSizeInBytes + uSubRes, -1, sizeof(*pRowSizeInBytes) * (NumSubresources - uSubRes));
|
||||
}
|
||||
if (pTotalBytes)
|
||||
{
|
||||
*pTotalBytes = TotalBytes;
|
||||
}
|
||||
if(TotalBytes == uint64_max)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
inline D3D12_RESOURCE_DESC1 D3DX12ResourceDesc0ToDesc1(D3D12_RESOURCE_DESC const& desc0)
|
||||
{
|
||||
D3D12_RESOURCE_DESC1 desc1;
|
||||
desc1.Dimension = desc0.Dimension;
|
||||
desc1.Alignment = desc0.Alignment;
|
||||
desc1.Width = desc0.Width;
|
||||
desc1.Height = desc0.Height;
|
||||
desc1.DepthOrArraySize = desc0.DepthOrArraySize;
|
||||
desc1.MipLevels = desc0.MipLevels;
|
||||
desc1.Format = desc0.Format;
|
||||
desc1.SampleDesc.Count = desc0.SampleDesc.Count;
|
||||
desc1.SampleDesc.Quality = desc0.SampleDesc.Quality;
|
||||
desc1.Layout = desc0.Layout;
|
||||
desc1.Flags = desc0.Flags;
|
||||
desc1.SamplerFeedbackMipRegion.Width = 0;
|
||||
desc1.SamplerFeedbackMipRegion.Height = 0;
|
||||
desc1.SamplerFeedbackMipRegion.Depth = 0;
|
||||
return desc1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
inline bool D3DX12GetCopyableFootprints(
|
||||
_In_ const D3D12_RESOURCE_DESC& pResourceDesc,
|
||||
_In_range_(0, D3D12_REQ_SUBRESOURCES) UINT FirstSubresource,
|
||||
_In_range_(0, D3D12_REQ_SUBRESOURCES - FirstSubresource) UINT NumSubresources,
|
||||
UINT64 BaseOffset,
|
||||
_Out_writes_opt_(NumSubresources) D3D12_PLACED_SUBRESOURCE_FOOTPRINT* pLayouts,
|
||||
_Out_writes_opt_(NumSubresources) UINT* pNumRows,
|
||||
_Out_writes_opt_(NumSubresources) UINT64* pRowSizeInBytes,
|
||||
_Out_opt_ UINT64* pTotalBytes)
|
||||
{
|
||||
// From D3D12_RESOURCE_DESC to D3D12_RESOURCE_DESC1
|
||||
D3D12_RESOURCE_DESC1 desc = D3DX12ResourceDesc0ToDesc1(pResourceDesc);
|
||||
return D3DX12GetCopyableFootprints(
|
||||
*static_cast<CD3DX12_RESOURCE_DESC1*>(&desc),// From D3D12_RESOURCE_DESC1 to CD3DX12_RESOURCE_DESC1
|
||||
FirstSubresource,
|
||||
NumSubresources,
|
||||
BaseOffset,
|
||||
pLayouts,
|
||||
pNumRows,
|
||||
pRowSizeInBytes,
|
||||
pTotalBytes);
|
||||
}
|
||||
|
||||
#endif // D3D12_SDK_VERSION >= 606
|
||||
1227
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12_root_signature.h
Normal file
1227
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12_root_signature.h
Normal file
File diff suppressed because it is too large
Load Diff
2210
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12_state_object.h
Normal file
2210
Juliet/src/Graphics/RHI/DX12/D3D12/directx/d3dx12_state_object.h
Normal file
File diff suppressed because it is too large
Load Diff
41
Juliet/src/Graphics/RHI/DX12/D3D12/directx/dxcore.h
Normal file
41
Juliet/src/Graphics/RHI/DX12/D3D12/directx/dxcore.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/************************************************************
|
||||
* *
|
||||
* Copyright (c) Microsoft Corporation. *
|
||||
* Licensed under the MIT license. *
|
||||
* *
|
||||
************************************************************/
|
||||
|
||||
#ifndef _DXCOREEXTMODULE_H_
|
||||
#define _DXCOREEXTMODULE_H_
|
||||
|
||||
#include <winapifamily.h>
|
||||
#include "dxcore_interface.h"
|
||||
|
||||
#pragma region Application Family or OneCore Family
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM)
|
||||
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
|
||||
|
||||
STDAPI
|
||||
DXCoreCreateAdapterFactory(
|
||||
REFIID riid,
|
||||
_COM_Outptr_ void** ppvFactory
|
||||
);
|
||||
|
||||
template <class T>
|
||||
HRESULT
|
||||
DXCoreCreateAdapterFactory(
|
||||
_COM_Outptr_ T** ppvFactory
|
||||
)
|
||||
{
|
||||
return DXCoreCreateAdapterFactory(IID_PPV_ARGS(ppvFactory));
|
||||
}
|
||||
|
||||
#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
|
||||
|
||||
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) */
|
||||
#pragma endregion
|
||||
|
||||
#endif // _DXCOREEXTMODULE_H_
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user