OpenGL rebuild project start!

This commit is contained in:
Nitload
2023-04-29 03:06:32 +08:00
parent 7dba067146
commit 4dd3f4f6d1
263 changed files with 51374 additions and 1522 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+31
View File
@@ -0,0 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StgSharpPerformance", "..\Performance\StgSharpPerformance.vcxproj", "{E74DED3A-4764-4129-BFB5-6BB5536E581E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Debug|x64.ActiveCfg = Debug|x64
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Debug|x64.Build.0 = Debug|x64
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Debug|x86.ActiveCfg = Debug|Win32
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Debug|x86.Build.0 = Debug|Win32
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Release|x64.ActiveCfg = Release|x64
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Release|x64.Build.0 = Release|x64
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Release|x86.ActiveCfg = Release|Win32
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC02A007-B18F-43E7-B0C3-BBB71062BB35}
EndGlobalSection
EndGlobal
+138
View File
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<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>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{a8db40c3-18b3-42ef-99b4-f7724ee6674b}</ProjectGuid>
<RootNamespace>Asm</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</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|Win32'">
<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|Win32'">
<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)'=='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" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</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;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup></ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<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="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
</Project>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
+18
View File
@@ -0,0 +1,18 @@
#include <stdio.h>
#include <xmmintrin.h>
__m128 sqrtss(float m)
{
__m128 mCache= {
.m128_f32[0]=m
};
return _mm_sqrt_ss(mCache);
}
void main()
{
float m = 25.0f;
scanf_s("%f",&m);
printf("%f",sqrtss(m).m128_f32[0]);
}
@@ -0,0 +1 @@
#pragma once
@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<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>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{e74ded3a-4764-4129-bfb5-6bb5536e581e}</ProjectGuid>
<RootNamespace>StgSharpPerformance</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</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|Win32'">
<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|Win32'">
<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)'=='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)\Dependency</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;STGSHARPPERFORMANCE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;STGSHARPPERFORMANCE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;STGSHARPPERFORMANCE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard_C>stdc11</LanguageStandard_C>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;STGSHARPPERFORMANCE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="SqtgShaqrpPerformance.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="SSE.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<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="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="SqtgShaqrpPerformance.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="SSE.c">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
</Project>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
+19
View File
@@ -0,0 +1,19 @@
// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
+5
View File
@@ -0,0 +1,5 @@
#pragma once
#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
// Windows 头文件
#include <windows.h>
+5
View File
@@ -0,0 +1,5 @@
// pch.cpp: 与预编译标头对应的源文件
#include "pch.h"
// 当使用预编译的头时,需要使用此源文件,编译才能成功。
+13
View File
@@ -0,0 +1,13 @@
// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
#include "framework.h"
#endif //PCH_H
@@ -0,0 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.33.31629:TargetPlatformVersion=10.0.19041.0:
Debug|x64|D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\Asm\|
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
+34
View File
@@ -7,20 +7,54 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharp", "StgSharp\StgSha
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StgSharpDebug", "StgSharpDebug\StgSharpDebug.csproj", "{467F2A1A-D7E2-4904-AAAD-A5998EE45C71}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StgSharpPerformance", "Performance\StgSharpPerformance.vcxproj", "{E74DED3A-4764-4129-BFB5-6BB5536E581E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EEC1D075-F8F4-43EA-914A-02B1339D2305}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EEC1D075-F8F4-43EA-914A-02B1339D2305}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EEC1D075-F8F4-43EA-914A-02B1339D2305}.Debug|x64.ActiveCfg = Debug|x64
{EEC1D075-F8F4-43EA-914A-02B1339D2305}.Debug|x64.Build.0 = Debug|x64
{EEC1D075-F8F4-43EA-914A-02B1339D2305}.Debug|x86.ActiveCfg = Debug|Any CPU
{EEC1D075-F8F4-43EA-914A-02B1339D2305}.Debug|x86.Build.0 = Debug|Any CPU
{EEC1D075-F8F4-43EA-914A-02B1339D2305}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EEC1D075-F8F4-43EA-914A-02B1339D2305}.Release|Any CPU.Build.0 = Release|Any CPU
{EEC1D075-F8F4-43EA-914A-02B1339D2305}.Release|x64.ActiveCfg = Release|x64
{EEC1D075-F8F4-43EA-914A-02B1339D2305}.Release|x64.Build.0 = Release|x64
{EEC1D075-F8F4-43EA-914A-02B1339D2305}.Release|x86.ActiveCfg = Release|Any CPU
{EEC1D075-F8F4-43EA-914A-02B1339D2305}.Release|x86.Build.0 = Release|Any CPU
{467F2A1A-D7E2-4904-AAAD-A5998EE45C71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{467F2A1A-D7E2-4904-AAAD-A5998EE45C71}.Debug|Any CPU.Build.0 = Debug|Any CPU
{467F2A1A-D7E2-4904-AAAD-A5998EE45C71}.Debug|x64.ActiveCfg = Debug|x64
{467F2A1A-D7E2-4904-AAAD-A5998EE45C71}.Debug|x64.Build.0 = Debug|x64
{467F2A1A-D7E2-4904-AAAD-A5998EE45C71}.Debug|x86.ActiveCfg = Debug|Any CPU
{467F2A1A-D7E2-4904-AAAD-A5998EE45C71}.Debug|x86.Build.0 = Debug|Any CPU
{467F2A1A-D7E2-4904-AAAD-A5998EE45C71}.Release|Any CPU.ActiveCfg = Release|Any CPU
{467F2A1A-D7E2-4904-AAAD-A5998EE45C71}.Release|Any CPU.Build.0 = Release|Any CPU
{467F2A1A-D7E2-4904-AAAD-A5998EE45C71}.Release|x64.ActiveCfg = Release|x64
{467F2A1A-D7E2-4904-AAAD-A5998EE45C71}.Release|x64.Build.0 = Release|x64
{467F2A1A-D7E2-4904-AAAD-A5998EE45C71}.Release|x86.ActiveCfg = Release|Any CPU
{467F2A1A-D7E2-4904-AAAD-A5998EE45C71}.Release|x86.Build.0 = Release|Any CPU
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Debug|Any CPU.ActiveCfg = Debug|x64
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Debug|Any CPU.Build.0 = Debug|x64
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Debug|x64.ActiveCfg = Debug|x64
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Debug|x64.Build.0 = Debug|x64
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Debug|x86.ActiveCfg = Debug|Win32
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Debug|x86.Build.0 = Debug|Win32
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Release|Any CPU.ActiveCfg = Release|x64
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Release|Any CPU.Build.0 = Release|x64
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Release|x64.ActiveCfg = Release|x64
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Release|x64.Build.0 = Release|x64
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Release|x86.ActiveCfg = Release|Win32
{E74DED3A-4764-4129-BFB5-6BB5536E581E}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphic
{
/// <summary>
/// Provides methods for querying available functions in a bindings context.
/// </summary>
public interface IBindingsContext
{
/// <summary>
/// Retrieves an unmanaged function pointer to the specified function on the specified bindings context.
/// </summary>
/// <param name="procName">An ASCII-encoded string that defines the name of the function.</param>
/// <returns>
/// A <see cref="System.IntPtr"/> that contains the address of procName or IntPtr.Zero,
/// if the function is not supported by the drivers.
/// </returns>
/// <remarks>
/// Note: some drivers are known to return non-zero values for unsupported functions.
/// Typical values include 1 and 2 - inheritors are advised to check for and ignore these
/// values.
/// </remarks>
IntPtr GetProcAddress(string procName);
}
}
@@ -0,0 +1,171 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Graphic.GL
{
/// <summary>
/// Provides a common foundation for all flat API bindings and implements the extension loading interface.
/// </summary>
public abstract class BindingsBase
{
/// <summary>
/// Constructs a new BindingsBase instance.
/// </summary>
public BindingsBase()
{
}
/// <summary>
/// Marshals a pointer to a null-terminated byte array to a new <c>System.String</c>.
/// This method supports OpenTK and is not intended to be called by user code.
/// </summary>
/// <param name="ptr">A pointer to a null-terminated byte array.</param>
/// <returns>
/// A <c>System.String</c> with the data from <paramref name="ptr"/>.
/// </returns>
protected static string MarshalPtrToString(IntPtr ptr)
{
if (ptr == IntPtr.Zero)
{
throw new ArgumentException("ptr");
}
unsafe
{
sbyte* str = (sbyte*)ptr;
int len = 0;
while (*str != 0)
{
++len;
++str;
}
return new string((sbyte*)ptr, 0, len, Encoding.UTF8);
}
}
/// <summary>
/// Marshal a <c>System.String</c> to unmanaged memory.
/// The resulting string is encoded in UTF8 and must be freed
/// with <c>FreeStringPtr</c>.
/// </summary>
/// <param name="str">The <c>System.String</c> to marshal.</param>
/// <returns>
/// An unmanaged pointer containing the marshalled string.
/// This pointer must be freed with <c>FreeStringPtr</c>
/// </returns>
protected static IntPtr MarshalStringToPtr(string str)
{
if (string.IsNullOrEmpty(str))
{
return IntPtr.Zero;
}
// Allocate a buffer big enough to hold the marshalled string.
// GetMaxByteCount() appears to allocate space for the final NUL
// character, but allocate an extra one just in case (who knows
// what old Mono version would do here.)
int max_count = Encoding.UTF8.GetMaxByteCount(str.Length) + 1;
IntPtr ptr = Marshal.AllocHGlobal(max_count);
if (ptr == IntPtr.Zero)
{
throw new OutOfMemoryException();
}
// Pin the managed string and convert it to UTF8 using
// the pointer overload of System.Encoding.UTF8.GetBytes().
unsafe
{
fixed (char* pstr = str)
{
int actual_count = Encoding.UTF8.GetBytes(pstr, str.Length, (byte*)ptr, max_count);
Marshal.WriteByte(ptr, actual_count, 0); // Append '\0' at the end of the string
return ptr;
}
}
}
/// <summary>
/// Frees a marshalled string that allocated by <c>MarshalStringToPtr</c>.
/// </summary>
/// <param name="ptr">An unmanaged pointer allocated with <c>MarshalStringToPtr</c></param>
protected static void FreeStringPtr(IntPtr ptr)
{
Marshal.FreeHGlobal(ptr);
}
/// <summary>
/// Marshals a <c>System.String</c> array to unmanaged memory by calling
/// Marshal.AllocHGlobal for each element.
/// </summary>
/// <returns>An unmanaged pointer to an array of null-terminated strings</returns>
/// <param name="str_array">The string array to marshal.</param>
protected static IntPtr MarshalStringArrayToPtr(string[] str_array)
{
IntPtr ptr = IntPtr.Zero;
if (str_array != null && str_array.Length != 0)
{
ptr = Marshal.AllocHGlobal(str_array.Length * IntPtr.Size);
if (ptr == IntPtr.Zero)
{
throw new OutOfMemoryException();
}
int i = 0;
try
{
for (i = 0; i < str_array.Length; i++)
{
IntPtr str = MarshalStringToPtr(str_array[i]);
Marshal.WriteIntPtr(ptr, i * IntPtr.Size, str);
}
}
catch (OutOfMemoryException)
{
for (i = i - 1; i >= 0; --i)
{
Marshal.FreeHGlobal(Marshal.ReadIntPtr(ptr, i * IntPtr.Size));
}
Marshal.FreeHGlobal(ptr);
throw;
}
}
return ptr;
}
/// <summary>
/// Frees a marshalled string that allocated by <c>MarshalStringArrayToPtr</c>.
/// </summary>
/// <param name="ptr">An unmanaged pointer allocated with <c>MarshalStringArrayToPtr</c></param>
/// <param name="length">The length of the string array.</param>
protected static void FreeStringArrayPtr(IntPtr ptr, int length)
{
for (int i = 0; i < length; i++)
{
Marshal.FreeHGlobal(Marshal.ReadIntPtr(ptr, i * IntPtr.Size));
}
Marshal.FreeHGlobal(ptr);
}
private protected static void InitializeDummyEntryPoints(IntPtr[] entryPoints)
{
var ptr = Marshal.GetFunctionPointerForDelegate(UninitializedDelegate);
for (var i = 0; i < entryPoints.Length; i++)
{
entryPoints[i] = ptr;
}
}
private static readonly Action UninitializedDelegate = Uninitialized;
private static void Uninitialized()
{
throw new InvalidOperationException("You need to initialize the OpenGL binding first by calling LoadBindings() or creating a compatible OpenGL window.");
}
}
}
+16
View File
@@ -0,0 +1,16 @@
using System;
namespace StgSharp.Graphic.GL
{
/// <summary>
/// A delegate used to receive debug information.
/// </summary>
/// <param name="source">The source of the callback.</param>
/// <param name="type">The type of the callback.</param>
/// <param name="id">The ID of the callback.</param>
/// <param name="severity">The severity of the callback.</param>
/// <param name="length">The length of the callback message.</param>
/// <param name="message">A pointer to the callback message.</param>
/// <param name="userParam">A user supplied pointer that will be passed on each callback.</param>
public delegate void DebugProc(DebugSource source, DebugType type, int id, DebugSeverity severity, int length, IntPtr message, IntPtr userParam);
}
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphic.GL
{
public struct CombinerPortionNV { }
public struct DebugProcAmd { }
public struct DebugProcArb { }
public struct DebugProcKhr { }
public struct ElementPointerTypeATI { }
public struct FragmentLightParameterSGIX { }
public struct IglooFunctionSelectSGIX { }
public struct IndexFunctionEXT { }
public struct MapTypeNV { }
public struct MatrixIndexPointerTypeARB { }
public struct ProgramFormat { }
public struct ProgramStringProperty { }
public struct ProgramTarget { }
public struct ReplacementCodeTypeSUN { }
public struct SecondaryColorPointerTypeIBM { }
public struct Struct_cl_context { }
public struct Struct_cl_event { }
public struct VertexShaderWriteMaskEXT { }
public struct VertexWeightPointerTypeEXT { }
public struct WeightPointerTypeARB { }
}
@@ -0,0 +1,33 @@
using System.Runtime.InteropServices;
namespace StgSharp.Graphic.GL
{
/// <summary>
/// Contains the library name of OpenGL.
/// </summary>
internal class LibraryNameContainer
{
/// <inheritdoc />
public static string Linux => "libGL.so";
/// <inheritdoc />
public static string MacOS => "/System/Library/Frameworks/OpenGL.framework/OpenGL";
/// <inheritdoc />
public static string Android => "libGL.so";
/// <inheritdoc />
public static string IOS => "/System/Library/Frameworks/OpenGL.framework/OpenGL";
/// <inheritdoc />
public static string Windows => "opengl32.dll";
public static string GetLibraryNameForCurrentPlatform()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) return Linux;
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return Windows;
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) return MacOS;
else return "unknown platform";
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,15 @@
namespace StgSharp.Graphic.Input
{
public enum HidConsumerUsage : ushort
{
/// <summary>
/// General consumer control device.
/// </summary>
ConsumerControl = 0x01,
/// <summary>
/// Set the horizontal offset of the display in the document.
/// </summary>
ACPan = 0x0238,
}
}
@@ -0,0 +1,258 @@
namespace StgSharp.Graphic.Input
{
public enum HidGenericDesktopUsage : ushort
{
/// <summary>
/// A collection of axes that generates a value to direct, indicate, or point
/// user intentions to an application.
/// </summary>
Pointer = 0x01,
/// <summary>
/// A hand-held, button-activated input device that when rolled along a flat surface,
/// directs an indicator to move correspondingly about a computer screen, allowing the
/// operator to move the indicator freely in select operations or to manipulate text or graphics.
/// </summary>
Mouse = 0x02,
// 0x03 // Reserved
/// <summary>
/// A manual control or cursor device.
/// </summary>
Joystick = 0x04,
/// <summary>
/// A manual control or cursor device.
/// </summary>
GamePad = 0x05,
/// <summary>
/// The primary computer input device.
/// </summary>
Keyboard = 0x06,
/// <summary>
/// Any keyboard configuration that does not meet the minimum requirements of the Boot Keyboard.
/// </summary>
Keypad = 0x07,
/// <summary>
/// An input device used to orient eyepoints and or objects in 3 dimensional space.
/// </summary>
MultiAxisController = 0x08,
// 0x09 - 0x2F // Reserved
/// <summary>
/// A linear translation in the X direction.
/// </summary>
X = 0x30,
/// <summary>
/// A linear translation in the Y direction.
/// </summary>
Y = 0x31,
/// <summary>
/// A linear translation in the Z direction.
/// </summary>
Z = 0x32,
/// <summary>
/// A rotation about the X axis. Angular position report values follow the righthand rule.
/// </summary>
RotationX = 0x33,
/// <summary>
/// A rotation about the Y axis. Angular position report values follow the righthand rule.
/// </summary>
RotationY = 0x34,
/// <summary>
/// A rotation about the Z axis. Angular position report values follow the righthand rule.
/// </summary>
RotationZ = 0x35,
/// <summary>
/// A linear control for generating a variable value, normally in the form of a thumb slide in a slot.
/// </summary>
Slider = 0x36,
/// <summary>
/// A rotary control for generating a variable value,
/// normally in the form of a knob spun by the index finger and thumb.
/// </summary>
Dial = 0x37,
/// <summary>
/// A rotary control for generating a variable value, normally rolled, unlike a dial.
/// </summary>
Wheel = 0x38,
/// <summary>
/// A specialized mechanical configuration of switches generating a variable value with a null state.
/// </summary>
Hatswitch = 0x39,
/// <summary>
/// Used with buffered –byte data to indicate the number of valid bytes in the buffered-byte field.
/// </summary>
CountedBuffer = 0x3A,
/// <summary>
/// Defines a report field that indicates the number of meaningful data bytes
/// in an associated buffered-byte field.
/// </summary>
ByteCount = 0x3B,
/// <summary>
/// Enables the generation of a USB remote wakeup when the device detects motion.
/// </summary>
MotionWakeup = 0x3C,
/// <summary>
/// Session start button.
/// </summary>
Start = 0x3D,
/// <summary>
/// Application option select button.
/// </summary>
Select = 0x3E,
// 0x3F // Reserved
/// <summary>
/// A vector in the X direction.
/// </summary>
VectorX = 0x40,
/// <summary>
/// A vector in the Y direction.
/// </summary>
VectorY = 0x41,
/// <summary>
/// A vector in the Z direction.
/// </summary>
VectorZ = 0x42,
/// <summary>
/// A vector in the X direction relative to the body of an object.
/// </summary>
VectorXBodyRelative = 0x43,
/// <summary>
/// A vector in the Y direction relative to the body of an object.
/// </summary>
VectorYBodyRelative = 0x44,
/// <summary>
/// A vector in the Z direction relative to the body of an object.
/// </summary>
VectorZBodyRelative = 0x45,
/// <summary>
/// A non oriented vector or value.
/// </summary>
VectorNonOriented = 0x46,
// 0x47 - 0x7F // Reserved
/// <summary>
/// An application-level collection that contains system-software-specific usages.
/// </summary>
SystemControl = 0x80,
/// <summary>
/// Asserted when the intended action is to initiate system-wide power down now from
/// Full Power or Sleep states.
/// </summary>
SystemPowerDown = 0x81,
/// <summary>
/// Asserted when the intended action is to initiate system-wide low power mode now.
/// </summary>
SystemSleep = 0x82,
/// <summary>
/// Asserted when the intended action is to initiate system-wide Full Power state now.
/// </summary>
SystemWakeUp = 0x83,
/// <summary>
/// Evokes a context-sensitive menu.
/// </summary>
SystemContextMenu = 0x84,
/// <summary>
/// Evokes the OS main-level selection menu.
/// </summary>
SystemMainMenu = 0x85,
/// <summary>
/// Displays an application-specific menu.
/// </summary>
SystemAppMenu = 0x86,
/// <summary>
/// Displays the help menu.
/// </summary>
SystemMenuHelp = 0x87,
/// <summary>
/// Exits a menu.
/// </summary>
SystemMenuExit = 0x88,
/// <summary>
/// Selects a menu item.
/// </summary>
SystemMenuSelect = 0x89,
/// <summary>
/// Menu select right.
/// </summary>
SystemMenuRight = 0x8A,
/// <summary>
/// Menu select left.
/// </summary>
SystemMenuLeft = 0x8B,
/// <summary>
/// Menu select up.
/// </summary>
SystemMenuUp = 0x8C,
/// <summary>
/// Menu select down.
/// </summary>
SystemMenuDown = 0x8D,
// 0x8E - 0x8F // Reserved
/// <summary>
/// Indicates that top of a Direction Pad is pressed.
/// </summary>
DPadUp = 0x90,
/// <summary>
/// Indicates that bottom of a Direction Pad is pressed
/// </summary>
DPadDown = 0x91,
/// <summary>
/// Indicates that right side of a Direction Pad is pressed
/// </summary>
DPadRight = 0x92,
/// <summary>
/// Indicates that left side of a Direction Pad is pressed
/// </summary>
DPadLeft = 0x93,
// 0x94 - 0xFFFF // Reserved
}
}
@@ -0,0 +1,57 @@
using System.Diagnostics;
namespace StgSharp.Graphic.Input
{
public static class HidHelper
{
/// <summary>
/// Translates a generic HID usage value to a specific joystick axis for the specified <see cref="HidPage"/>.
/// </summary>
/// <param name="page">The HID usage page.</param>
/// <param name="usage">The generic usage value.</param>
/// <returns>An <see cref="int"/> that maps the HID usage value to a joystick axis.</returns>
public static int TranslateJoystickAxis(HidPage page, int usage)
{
switch (page)
{
case HidPage.GenericDesktop:
switch ((HidGenericDesktopUsage)usage)
{
case HidGenericDesktopUsage.X:
return 0;
case HidGenericDesktopUsage.Y:
return 1;
case HidGenericDesktopUsage.Z:
return 2;
case HidGenericDesktopUsage.RotationZ:
return 3;
case HidGenericDesktopUsage.RotationX:
return 4;
case HidGenericDesktopUsage.RotationY:
return 5;
case HidGenericDesktopUsage.Slider:
return 6;
case HidGenericDesktopUsage.Dial:
return 7;
case HidGenericDesktopUsage.Wheel:
return 8;
}
break;
case HidPage.Simulation:
switch ((HidSimulationUsage)usage)
{
case HidSimulationUsage.Rudder:
return 9;
case HidSimulationUsage.Throttle:
return 10;
}
break;
}
Debug.Print($"[Input] Unknown axis with HID page/usage {page}/{usage}");
return 0;
}
}
}
+170
View File
@@ -0,0 +1,170 @@
namespace StgSharp.Graphic.Input
{
public enum HidPage : ushort
{
/// <summary>
/// This page describes an undefined usage.
/// </summary>
Undefined = 0x00,
/// <summary>
/// This page describes generic desktop controls.
/// </summary>
GenericDesktop = 0x01,
/// <summary>
/// This page provides detailed descriptions of the usages employed by simulation devices.
/// </summary>
Simulation = 0x02,
/// <summary>
/// Describes virtual reality controls. The usages depend on designators to identify the individual controls.
/// </summary>
VR = 0x03,
/// <summary>
/// This page describes sport controls.
/// </summary>
Sport = 0x04,
/// <summary>
/// This page describes game controls.
/// </summary>
Game = 0x05,
/// <summary>
/// This page provides usage definitions for controls that can be on any type of device.
/// </summary>
GenericDevice = 0x06,
/// <summary>
/// This page is for key codes to be used in implementing a USB keyboard.
/// </summary>
/// <remarks>
/// The usage type of all key codes is Selectors (Sel), except for the modifier keys 'Keyboard Left Control'
/// (0x224) to 'Keyboard Right GUI' (0x231) which are Dynamic Flags (DV).
/// </remarks>
KeyboardOrKeypad = 0x07,
/// <summary>
/// This page describes an LED or indicator that is implemented as an On/Off control (OOC)
/// using the "Single button toggle" mode,
/// where a value of 1 will turn on the indicator, and a value of 0 will turn it off.
/// </summary>
LEDs = 0x08,
/// <summary>
/// This page describes a set of buttons which can be defined as Sel, OOC, MC or OSC depending on
/// the context of their declaration.
/// </summary>
Button = 0x09,
/// <summary>
/// This page allows multiple instances of a control or sets of controls to be declared without
/// requiring indiviual enumeration in the native usage page.
/// </summary>
Ordinal = 0x0A,
/// <summary>
/// This page defines the keytop and control usages for telephony devices.
/// </summary>
/// <remarks>
/// Note that in many cases usage definitions are intentionally vague, since it is assumed that
/// the controls are interpreted by the telephone software application.
/// </remarks>
Telephony = 0x0B,
/// <summary>
/// This page describes application-specific controls.
/// They only affect a specific device, not the system as a whole.
/// </summary>
Consumer = 0x0C,
/// <summary>
/// This section provides detailed descriptions of the usages employed by Digitizer Devices.
/// </summary>
Digitizer = 0x0D,
// 0x0E // Reserved
/// <summary>
/// Describes force feedback and related devices.
/// </summary>
PID = 0x0F,
/// <summary>
/// The Unicode page directly maps to the two-octet form defined in the Unicode Standard.
/// </summary>
Unicode = 0x10,
// 0x11 - 0x13 // Reserved
/// <summary>
/// The Alphanumeric display page is intended for use by simple alphanumeric
/// displays that are used on consumer devices.
/// </summary>
AlphanumericDisplay = 0x14,
// 0x15 - 0x3F // Reserved
/// <summary>
/// This page provides usage definitions for medical instruments.
/// </summary>
MedicalInstruments = 0x40,
// 0x41 - 0x7F
// 0x80 - 0x83 // USB Device Class Definition for Monitor Devices
/// <summary>
/// Power device page.
/// </summary>
PowerDevice = 0x84,
/// <summary>
/// Battery system page.
/// </summary>
BatterySystem = 0x85,
// 0x86 - 0x87 // USB Device Class Definition for Power Devices (also includes 0x84 and 0x85)
// 0x88 - 0x8B // Reserved
/// <summary>
/// This page describes the USB Device Class definition for a bar code scanner ("Point of Sale" device).
/// </summary>
BarCodeScanner = 0x8C,
/// <summary>
/// This page describes the USB Device Class definition for a scale ("Point of Sale" device).
/// </summary>
Scale = 0x8D,
/// <summary>
/// This page describes the USB Device Class definition for a magnetic stripe reading device
/// ("Point of Sale" device).
/// </summary>
MagneticStripeReader = 0x8E,
// 0x8F // Reserved Point of Sale pages
/// <summary>
/// This page describes the USB Device Class definition for "Image Class Devices".
/// </summary>
CameraControl = 0x90,
/// <summary>
/// This page describes the OAAF definitions for arcade and coinop related devices.
/// </summary>
Arcade = 0x91,
// 0x92 - 0xFEFF // Reserved
/// <summary>
/// Marks the beginning of vendor-defined usage pages.
/// </summary>
VendorDefinedStart = 0xFF00,
// 0xFF00 - 0xFFFF // Vendor-defined
}
}
@@ -0,0 +1,288 @@
using StgSharp.Graphic;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphic.Input
{
public enum HidSimulationUsage : ushort
{
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses the
/// standard controls found on an airplane.
/// </summary>
FlightSimulationDevice = 0x01,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses the
/// standard controls found in an automobile or truck.
/// </summary>
AutomobileSimulationDevice = 0x02,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found in a tank or a treaded vehicle.
/// </summary>
TankSimulationDevice = 0x03,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found on a spaceship.
/// </summary>
SpaceshipSimulationDevice = 0x04,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard controls of a submarine.
/// </summary>
SubmarineSimulationDevice = 0x05,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard controls of a sailboat.
/// </summary>
SailingSimulationDevice = 0x06,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard controls of a motorcycle.
/// </summary>
MotorcycleSimulationDevice = 0x07,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found on a sports simulation device.
/// </summary>
SportsSimulationDevice = 0x08,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found on an airplane.
/// </summary>
AirplaneSimulationDevice = 0x09,
/// <summary>
/// This usage definition allows a device to be generally classified as one that uses
/// standard controls found on a helicopter.
/// </summary>
HelicopterSimulationDevice = 0x0A,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard control of a magic carpet.
/// </summary>
MagicCarpetSimulationDevice = 0x0B,
/// <summary>
/// Allows a device to be generally classified as one that uses the standard controls of a bicycle.
/// </summary>
BicycleSimulationDevice = 0x0C,
// 0x0D - 0x1F // Reserved
/// <summary>
/// A Flight Control Stick controls the Pitch and Roll of an airplane.
/// </summary>
FlightControlStick = 0x20,
/// <summary>
/// A Flight Stick defines a class of device commonly used for flight simulator games.
/// </summary>
FlightStick = 0x21,
/// <summary>
/// This control is specifically for a helicopter.<para/>
/// A cyclic control is a stick between the pilot’s legs that moves in two axes.
/// </summary>
CyclicControl = 0x22,
/// <summary>
/// This control is specifically for a helicopter.<para/>
/// Cyclic Trim allows fine adjustment of the cyclic position in two dimensions.
/// </summary>
CyclicTrim = 0x23,
/// <summary>
/// A flight yoke (also called a control wheel) controls the pitch and roll of an airplane.
/// </summary>
FlightYoke = 0x24,
/// <summary>
/// A device for controlling the direction and velocity of a vehicle that is driven by tracks.
/// </summary>
TrackControl = 0x25,
// 0x26 - 0xAF // Reserved
/// <summary>
/// An aileron is one of two movable flaps on the wings of an airplane that can be used
/// to control the plane’s rolling and banking movements.
/// </summary>
Aileron = 0xB0,
/// <summary>
/// Allows fine adjustment of the Aileron position.
/// </summary>
AileronTrim = 0xB1,
/// <summary>
/// This control mechanically behaves the same as rudder pedals.
/// </summary>
AntiTorqueControl = 0xB2,
/// <summary>
/// This control enables or disables an airplane’s autopilot.
/// </summary>
AutopilotEnable = 0xB3,
/// <summary>
/// Chaff is used to reflect electromagnetic energy as a radar countermeasure.
/// </summary>
ChaffRelease = 0xB4,
/// <summary>
/// This control is specifically for a helicopter.
/// It controls the vertical acceleration or lift of the helicopter.
/// </summary>
CollectiveControl = 0xB5,
/// <summary>
/// A flap that can be extended on an aircraft to increase drag and reduce the speed of descent.
/// </summary>
DiveBrake = 0xB6,
/// <summary>
/// A pushbutton that enables electronic countermeasures.
/// </summary>
ElectronicCountermeasures = 0xB7,
/// <summary>
/// A movable control surface, usually attached to the horizontal stabilizer of an aircraft,
/// that is used to produce motion up or down.
/// </summary>
Elevator = 0xB8,
/// <summary>
/// Elevator Trim allows fine adjustment of the Elevator position.
/// </summary>
ElevatorTrim = 0xB9,
/// <summary>
/// The zero position is centered, positive values turn right, and negative values turn left.
/// </summary>
Rudder = 0xBA,
/// <summary>
/// A valve that regulates the flow of a fluid, such as the valve in an internal-combustion engine
/// that controls the amount of vaporized fuel entering the cylinders.
/// </summary>
Throttle = 0xBB,
/// <summary>
/// Typically this is a two-position pushbutton where the first position enables communications with the
/// crew and the second position enables the transmitter for communication external to the plane.
/// </summary>
FlightCommunications = 0xBC,
/// <summary>
/// A flare is a device that produces a bright light for signaling, illumination, identification,
/// or heat for infrared missile countermeasures.
/// </summary>
FlareRelease = 0xBD,
/// <summary>
/// A control for raising or lowering an airplane’s landing gear.
/// </summary>
LandingGear = 0xBE,
/// <summary>
/// A device for slowing or stopping the motion of an airplane when it is on the ground.
/// </summary>
ToeBrake = 0xBF,
/// <summary>
/// A lever pressed by the finger to release or activate a mechanism, typically used to discharge a firearm.
/// </summary>
Trigger = 0xC0,
/// <summary>
/// This device is normally a covered toggle switch that must be selected to enable the weapons system.
/// </summary>
WeaponsArm = 0xC1,
/// <summary>
/// This device can either be a pushbutton that steps through the available weapons or
/// a radio button that selects them individually.
/// </summary>
WeaponsSelect = 0xC2,
/// <summary>
/// Wing flap controls are usually powered either hydraulically or by electric motors,
/// and are used for low-speed control of an airplane.
/// </summary>
WingFlaps = 0xC3,
/// <summary>
/// A device, especially the gas pedal of a motor vehicle, for increasing speed.
/// </summary>
Accelerator = 0xC4,
/// <summary>
/// A device for slowing or stopping motion, as of a vehicle, especially by contact friction.
/// </summary>
Brake = 0xC5,
/// <summary>
/// A device for disengaging the transmission of a vehicle to allow shifting of gears.
/// </summary>
Clutch = 0xC6,
/// <summary>
/// A device for shifting gears in a vehicle.
/// </summary>
Shifter = 0xC7,
/// <summary>
/// A steering wheel is a single degree-of-freedom device that rotates about an axis.
/// </summary>
Steering = 0xC8,
/// <summary>
/// This control determines the right-to-left positioning of the tank turret.
/// </summary>
TurretDirection = 0xC9,
/// <summary>
/// This control determines the elevation of the gun barrel in a turret.
/// </summary>
BarrelElevation = 0xCA,
/// <summary>
/// Dive planes control the vertical ascent or descent of the submarine under power.
/// </summary>
DivePlane = 0xCB,
/// <summary>
/// Ballast controls the vertical ascent or descent of the submarine.
/// </summary>
Ballast = 0xCC,
/// <summary>
/// A foot-operated assembly of pedals attached to a crank that is used for powering a bicycle.
/// </summary>
BicycleCrank = 0xCD,
/// <summary>
/// A steering control, held in both hands, for a motorcycle or bicycle.
/// </summary>
HandleBars = 0xCE,
/// <summary>
/// Engages the front brake of the motorcycle to slow the vehicle.
/// </summary>
FrontBrake = 0xCF,
/// <summary>
/// Engages the rear brake of the motorcycle to slow the vehicle.
/// </summary>
RearBrake = 0xD0,
// 0xD1 - 0xFFFF // Reserved
}
}
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphics
{
public struct GLclampd
{
private double value;
public void SetValue(double v)
{
if (v<0||v>1)
{
throw new ArgumentOutOfRangeException("Input is out of range");
}
else
{
value = v;
}
}
public double Value()
{
return this.value;
}
public static implicit operator double(GLclampd gLclampd)
{
return gLclampd.value;
}
}
}
@@ -0,0 +1,31 @@
using System;
namespace StgSharp.Graphics
{
public struct GLclampf
{
private float value;
public void Value(float v)
{
if (v<0||v>1)
{
throw new ArgumentOutOfRangeException("Input is out of range!");
}
else
{
value = v;
}
}
public float Value()
{
return value;
}
public static implicit operator float(GLclampf gLclampf)
{
return gLclampf.value;
}
}
}
@@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Graphic
namespace StgSharp.Graphics
{
internal class Class1
public enum GLenum:uint
{
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix2x2Int:IEquatable<matrix2x2>
{
[FieldOffset(0)]
public vec2dInt row1;
[FieldOffset(8)]
public vec2dInt row2;
public matrix2x2Int(vec2d c0, vec2d c1)
{
row1 = c0;
row2 = c1;
}
public matrix2x2Int(
int a11,
int a12,
int a21,
int a22
)
{
row1 = new vec2dInt(a11, a12);
row2 = new vec2dInt(a21, a22);
}
bool IEquatable<matrix2x2>.Equals(matrix2x2 other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return
this.row1 == other.row1
&& this.row2 == other.row2;
}
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix2x2))
{
return false;
}
else
{
return this.Equals((vec3d)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(row1,row2);
}
public override string ToString()
{
return $"{row1}\n{row2}";
}
public static matrix2x2Int operator +(matrix2x2Int matrix1 , matrix2x2Int matrix2)
{
return new matrix2x2Int(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2
);
}
public static matrix2x2Int operator -(matrix2x2Int matrix1, matrix2x2Int matrix2)
{
return new matrix2x2Int(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2
);
}
}
}
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix2x3Int:IEquatable<matrix2x3Int>
{
[FieldOffset(0)]
public vec3d row1;
[FieldOffset(12)]
public vec3d row2;
public matrix2x3Int(vec3d r1, vec3d r2)
{
row1 = r1;
row2 = r2;
}
public matrix2x3Int(
int r11, int r12, int r13,
int r21, int r22, int r23
)
{
row1 = new vec3d(r11, r12, r13);
row2 = new vec3d(r21, r22, r23);
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix2x3Int))
{
return false;
}
else
{
return this.Equals((vec3d)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(row1, row2);
}
public override string ToString()
{
return $"{row1}\n{row2}";
}
bool IEquatable<matrix2x3Int>.Equals(matrix2x3Int other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return
this.row1 == other.row1
&& this.row2 == other.row2;
}
}
public static matrix2x3Int operator +(matrix2x3Int matrix1, matrix2x3Int matrix2)
{
return new matrix2x3Int(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2
);
}
public static matrix2x3Int operator -(matrix2x3Int matrix1, matrix2x3Int matrix2)
{
return new matrix2x3Int(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2
);
}
public static matrix2x3Int operator *(matrix2x3Int array, int x)
{
return new matrix2x3Int(
array.row1 * x,
array.row2 * x
) ;
}
public static matrix2x3Int operator /(matrix2x3Int array, int x)
{
return new matrix2x3Int(
array.row1 / x,
array.row2 / x
);
}
}
}
@@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct matrix3x2Int:IEquatable<matrix3x2Int>
{
[FieldOffset(0)]
public vec2d row1;
[FieldOffset(8)]
public vec2d row2;
[FieldOffset(16)]
public vec2d row3;
public matrix3x2Int(vec2d r1,vec2d r2,vec2d r3)
{
row1= r1;
row2= r2;
row3= r3;
}
public matrix3x2Int(
int a11, int a12,
int a21, int a22,
int a31, int a32
)
{
row1 = new vec2d(a11, a12);
row2 = new vec2d(a21, a22);
row3 = new vec2d(a31, a32);
}
bool IEquatable<matrix3x2Int>.Equals(matrix3x2Int other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return
this.row1 == other.row1
&& this.row2 == other.row2
&& this.row3 == other.row3
;
}
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(matrix3x2Int))
{
return false;
}
else
{
return this.Equals((matrix3x2Int)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(row1, row2, row3);
}
public override string ToString()
{
return $"{row1}\n{row2}\n{row3}";
}
public static matrix3x2Int operator +(matrix3x2Int matrix1, matrix3x2Int matrix2)
{
return new matrix3x2Int(
matrix1.row1 + matrix2.row1,
matrix1.row2 + matrix2.row2,
matrix1.row3 + matrix2.row3
);
}
public static matrix3x2Int operator -(matrix3x2Int matrix1, matrix3x2Int matrix2)
{
return new matrix3x2Int(
matrix1.row1 - matrix2.row1,
matrix1.row2 - matrix2.row2,
matrix1.row3 - matrix2.row3
);
}
}
}
@@ -0,0 +1,44 @@
using Steamworks;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit,Size = 8)]
public unsafe struct vec2dInt
{
[FieldOffset(0)]
public int X;
[FieldOffset(4)]
public int Y;
public vec2dInt(int x, int y)
{
this.X = x;
this.Y = y;
}
public static implicit operator vec2d(vec2dInt vec)
{
return new vec2d(vec.X,vec.Y);
}
public static implicit operator vec2dInt(vec2d vec)
{
return new vec2dInt((int)vec.X, (int)vec.Y);
}
public static vec2dInt operator +(vec2dInt vec1, vec2dInt vec2)
{
return new vec2dInt(vec1.X + vec2.X, vec1.Y + vec2.Y);
}
public static vec2dInt operator -(vec2dInt vec1, vec2dInt vec2)
{
return new vec2dInt(vec1.X - vec2.X, vec1.Y - vec2.Y);
}
}
}
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit,Size =12)]
public struct vec3dInt
{
[FieldOffset(0)]
public int X;
[FieldOffset(4)]
public int Y;
[FieldOffset(8)]
public int Z;
}
}
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit,Size =16)]
public struct vec4dInt
{
[FieldOffset(0)]
public int X;
[FieldOffset(4)]
public int Y;
[FieldOffset(8)]
public int Z;
[FieldOffset(12)]
public int W;
}
}
@@ -7,6 +7,19 @@ namespace StgSharp.Math
{
public static unsafe partial class VectorCalc
{
private static float getMatrixMember(float* p1, float* p2)
{
float result = 0;
for (int i = 0; i < 4; i++)
{
result += *p1 * *p2;
p1 += 1;
p2 += 3;
}
return result;
}
/// <summary>
///
/// </summary>
@@ -439,18 +452,7 @@ namespace StgSharp.Math
getMatrixMember(p1+4, p2), getMatrixMember(p1+4, p2+1), getMatrixMember(p1+4, p2 + 2)
);
static float getMatrixMember(float* p1, float* p2)
{
float result = 0;
for (int i = 0; i < 4; i++)
{
result += *p1 * *p2;
p1 += 1;
p2 += 3;
}
return result;
}
}
/// <summary>

Some files were not shown because too many files have changed in this diff Show More