Add local TerraFX fork and polyfills for D2D1Interop project

このコミットが含まれているのは:
Sergio Pedri committed 2022-04-24 21:03:14 +02:00
1 親 2717a569d5
コミット 365066cb23
19ファイル変更
+629 -8

検索条件に一致するファイルはありません

+10 -1
ファイルの表示
@@ -77,6 +77,10 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "TerraFX.Interop.Windows.Dyn
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1Interop", "src\ComputeSharp.D2D1Interop\ComputeSharp.D2D1Interop.csproj", "{4D7D9BA8-A821-4B1C-9EE2-CBCF5849906E}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "TerraFX.Interop.Windows.D2D1Interop", "src\TerraFX.Interop.Windows.D2D1Interop\TerraFX.Interop.Windows.D2D1Interop.shproj", "{9DA1DA9F-F8B2-4B25-BE80-C21F773029E3}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.D2D1Interop.NetStandard", "src\ComputeSharp.D2D1Interop.NetStandard\ComputeSharp.D2D1Interop.NetStandard.shproj", "{2608EB41-F98B-4BE5-9F4D-68FED6115088}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
samples\ComputeSharp.SwapChain.Core.Shared\ComputeSharp.SwapChain.Core.Shared.projitems*{0071701e-b9c5-4098-be5f-ef556c4553c6}*SharedItemsImports = 5
@@ -84,13 +88,17 @@ Global
samples\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems*{0800bd51-499d-44c2-9417-fd1f7fdfe9c4}*SharedItemsImports = 13
src\ComputeSharp.UI\ComputeSharp.UI.projitems*{0c82ede1-5b8a-4df3-87da-700b29d5e265}*SharedItemsImports = 13
src\TerraFX.Interop.Windows.Dynamic\TerraFX.Interop.Windows.Dynamic.projitems*{158f984d-cd96-4062-bd02-2268946031a0}*SharedItemsImports = 13
src\ComputeSharp.D2D1Interop.NetStandard\ComputeSharp.D2D1Interop.NetStandard.projitems*{2608eb41-f98b-4be5-9f4d-68fed6115088}*SharedItemsImports = 13
src\ComputeSharp.NetStandard\ComputeSharp.NetStandard.projitems*{314eb353-e7e3-4146-8111-685cc83ec1de}*SharedItemsImports = 5
src\TerraFX.Interop.Windows\TerraFX.Interop.Windows.projitems*{314eb353-e7e3-4146-8111-685cc83ec1de}*SharedItemsImports = 5
src\ComputeSharp.D2D1Interop.NetStandard\ComputeSharp.D2D1Interop.NetStandard.projitems*{4d7d9ba8-a821-4b1c-9ee2-cbcf5849906e}*SharedItemsImports = 5
src\TerraFX.Interop.Windows.D2D1Interop\TerraFX.Interop.Windows.D2D1Interop.projitems*{4d7d9ba8-a821-4b1c-9ee2-cbcf5849906e}*SharedItemsImports = 5
src\TerraFX.Interop.Windows\TerraFX.Interop.Windows.projitems*{514ff00e-bbf0-4d55-a47c-eeeb6208adce}*SharedItemsImports = 13
samples\ComputeSharp.Sample.Shared\ComputeSharp.Sample.Shared.projitems*{7048deea-0a6f-46a0-b951-b682a8f1cb75}*SharedItemsImports = 5
samples\ComputeSharp.SwapChain.Core.Shared\ComputeSharp.SwapChain.Core.Shared.projitems*{751bb05b-563d-4b3a-94c6-15e2d79d35ea}*SharedItemsImports = 13
src\TerraFX.Interop.Windows.Dynamic\TerraFX.Interop.Windows.Dynamic.projitems*{76c66257-fdaa-47ab-85e7-ef757eab10c0}*SharedItemsImports = 5
samples\ComputeSharp.Sample.Shared\ComputeSharp.Sample.Shared.projitems*{8cefc324-ca6c-4845-9ad9-70b92bd87057}*SharedItemsImports = 13
src\TerraFX.Interop.Windows.D2D1Interop\TerraFX.Interop.Windows.D2D1Interop.projitems*{9da1da9f-f8b2-4b25-be80-c21f773029e3}*SharedItemsImports = 13
src\ComputeSharp.NetStandard\ComputeSharp.NetStandard.projitems*{a5997814-d8d2-4541-87ac-c3e53caa67c0}*SharedItemsImports = 13
src\ComputeSharp.UI\ComputeSharp.UI.projitems*{afaafdc9-be42-45d4-8c79-0ee8c8edbf52}*SharedItemsImports = 5
samples\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems*{e7c9247d-016b-4819-af9f-0e9b3591e04b}*SharedItemsImports = 5
@@ -375,7 +383,8 @@ Global
{751BB05B-563D-4B3A-94C6-15E2D79D35EA} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
{4A8FCE22-851C-442A-8BC9-3EC3FD00B637} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
{158F984D-CD96-4062-BD02-2268946031A0} = {8DCE343F-BA78-4FE1-B562-B57C603A8BAA}
{6892B4F9-163D-4F08-9910-114C2A3B986F} = {8DCE343F-BA78-4FE1-B562-B57C603A8BAA}
{9DA1DA9F-F8B2-4B25-BE80-C21F773029E3} = {8DCE343F-BA78-4FE1-B562-B57C603A8BAA}
{2608EB41-F98B-4BE5-9F4D-68FED6115088} = {8DCE343F-BA78-4FE1-B562-B57C603A8BAA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4664C5E3-0340-4E22-BCFD-98AAEDF5F2DC}
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>2608eb41-f98b-4be5-9f4d-68fed6115088</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>ComputeSharp.D2D1Interop.NetStandard</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)\System.Runtime.CompilerServices\RuntimeHelpers.cs" />
</ItemGroup>
</Project>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>2608eb41-f98b-4be5-9f4d-68fed6115088</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="ComputeSharp.D2D1Interop.NetStandard.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
@@ -0,0 +1,18 @@
using System;
using System.Runtime.InteropServices;
namespace ComputeSharp.D2D1Interop.NetStandard.System.Runtime.CompilerServices;
/// <summary>
/// A polyfill type that mirrors some methods from <see cref="RuntimeHelpers"/> on .NET 5.
/// </summary>
internal static class RuntimeHelpers
{
/// <summary>
/// Allocates some memory tied to the lifetime of a specific type.
/// </summary>
/// <param name="type">The type to associate the memory to.</param>
/// <param name="size">The size in byte of the memory to allocate.</param>
/// <returns>A pointer to the allocated memory.</returns>
public static IntPtr AllocateTypeAssociatedMemory(Type type, int size) => Marshal.AllocHGlobal(size);
}
+6 -4
ファイルの表示
@@ -8,10 +8,12 @@
<!-- Enable trimming support on .NET 6 -->
<PropertyGroup>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<IsTrimmable>true</IsTrimmable>
<!-- Workaround for .NET 6.0.x regression (see https://github.com/dotnet/linker/issues/2642), enable again when fixed in SDK -->
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="TerraFX.Interop.Windows" Version="10.0.20348" />
</ItemGroup>
<Import Project="..\TerraFX.Interop.Windows.D2D1Interop\TerraFX.Interop.Windows.D2D1Interop.projitems" Label="Shared" />
<Import Project="..\ComputeSharp.D2D1Interop.NetStandard\ComputeSharp.D2D1Interop.NetStandard.projitems" Label="Shared" />
</Project>
+2 -2
ファイルの表示
@@ -18,7 +18,7 @@ internal static class ComPtrExtensions
/// <remarks>This method is only valid when the current <see cref="ComPtr{T}"/> instance is on the stack or pinned.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void** GetVoidAddressOf<T>(this in ComPtr<T> ptr)
where T : unmanaged, IUnknown.Interface
where T : unmanaged
{
return (void**)Unsafe.AsPointer(ref Unsafe.AsRef(in ptr));
}
@@ -31,7 +31,7 @@ internal static class ComPtrExtensions
/// <returns>The moved <see cref="ComPtr{T}"/> instance.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe ComPtr<T> Move<T>(this in ComPtr<T> ptr)
where T : unmanaged, IUnknown.Interface
where T : unmanaged
{
ComPtr<T> copy = default;
@@ -0,0 +1,29 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0
// Original source is Copyright © Microsoft. All rights reserved.
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using TerraFX.Interop.Windows;
#pragma warning disable CS0649
namespace TerraFX.Interop.DirectX
{
[Guid("693CE632-7F2F-45DE-93FE-18D88B37AA21")]
[NativeTypeName("struct ID2D1DrawInfo : ID2D1RenderInfo")]
[NativeInheritance("ID2D1RenderInfo")]
internal unsafe partial struct ID2D1DrawInfo
{
public void** lpVtbl;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(7)]
public HRESULT SetPixelShaderConstantBuffer([NativeTypeName("const BYTE *")] byte* buffer, [NativeTypeName("UINT32")] uint bufferCount)
{
return ((delegate* unmanaged<ID2D1DrawInfo*, byte*, uint, int>)(lpVtbl[7]))((ID2D1DrawInfo*)Unsafe.AsPointer(ref this), buffer, bufferCount);
}
}
}
@@ -0,0 +1,87 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/d3d11shader.h in the Windows SDK for Windows 10.0.22000.0
// Original source is Copyright © Microsoft. All rights reserved.
namespace TerraFX.Interop.DirectX
{
internal unsafe partial struct D3D11_SHADER_DESC
{
public uint Version;
[NativeTypeName("LPCSTR")]
public sbyte* Creator;
public uint Flags;
public uint ConstantBuffers;
public uint BoundResources;
public uint InputParameters;
public uint OutputParameters;
public uint InstructionCount;
public uint TempRegisterCount;
public uint TempArrayCount;
public uint DefCount;
public uint DclCount;
public uint TextureNormalInstructions;
public uint TextureLoadInstructions;
public uint TextureCompInstructions;
public uint TextureBiasInstructions;
public uint TextureGradientInstructions;
public uint FloatInstructionCount;
public uint IntInstructionCount;
public uint UintInstructionCount;
public uint StaticFlowControlCount;
public uint DynamicFlowControlCount;
public uint MacroInstructionCount;
public uint ArrayInstructionCount;
public uint CutInstructionCount;
public uint EmitInstructionCount;
public D3D_PRIMITIVE_TOPOLOGY GSOutputTopology;
public uint GSMaxOutputVertexCount;
public D3D_PRIMITIVE InputPrimitive;
public uint PatchConstantParameters;
public uint cGSInstanceCount;
public uint cControlPoints;
public D3D_TESSELLATOR_OUTPUT_PRIMITIVE HSOutputPrimitive;
public D3D_TESSELLATOR_PARTITIONING HSPartitioning;
public D3D_TESSELLATOR_DOMAIN TessellatorDomain;
public uint cBarrierInstructions;
public uint cInterlockedInstructions;
public uint cTextureStoreInstructions;
}
}
@@ -0,0 +1,112 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/d3d11shader.h in the Windows SDK for Windows 10.0.22000.0
// Original source is Copyright © Microsoft. All rights reserved.
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using TerraFX.Interop.Windows;
#pragma warning disable CS0649
namespace TerraFX.Interop.DirectX
{
[Guid("8D536CA1-0CCA-4956-A837-786963755584")]
[NativeTypeName("struct ID3D11ShaderReflection : IUnknown")]
[NativeInheritance("IUnknown")]
internal unsafe partial struct ID3D11ShaderReflection
{
public void** lpVtbl;
/// <inheritdoc cref="IUnknown.QueryInterface" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(0)]
public HRESULT QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject)
{
return ((delegate* unmanaged<ID3D11ShaderReflection*, Guid*, void**, int>)(lpVtbl[0]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this), riid, ppvObject);
}
/// <inheritdoc cref="IUnknown.AddRef" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(1)]
[return: NativeTypeName("ULONG")]
public uint AddRef()
{
return ((delegate* unmanaged<ID3D11ShaderReflection*, uint>)(lpVtbl[1]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
/// <inheritdoc cref="IUnknown.Release" />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(2)]
[return: NativeTypeName("ULONG")]
public uint Release()
{
return ((delegate* unmanaged<ID3D11ShaderReflection*, uint>)(lpVtbl[2]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(3)]
public HRESULT GetDesc(D3D11_SHADER_DESC* pDesc)
{
return ((delegate* unmanaged<ID3D11ShaderReflection*, D3D11_SHADER_DESC*, int>)(lpVtbl[3]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this), pDesc);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(12)]
public uint GetMovInstructionCount()
{
return ((delegate* unmanaged<ID3D11ShaderReflection*, uint>)(lpVtbl[12]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(13)]
public uint GetMovcInstructionCount()
{
return ((delegate* unmanaged<ID3D11ShaderReflection*, uint>)(lpVtbl[13]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(14)]
public uint GetConversionInstructionCount()
{
return ((delegate* unmanaged<ID3D11ShaderReflection*, uint>)(lpVtbl[14]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(15)]
public uint GetBitwiseInstructionCount()
{
return ((delegate* unmanaged<ID3D11ShaderReflection*, uint>)(lpVtbl[15]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(16)]
public D3D_PRIMITIVE GetGSInputPrimitive()
{
return ((delegate* unmanaged<ID3D11ShaderReflection*, D3D_PRIMITIVE>)(lpVtbl[16]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(18)]
public uint GetNumInterfaceSlots()
{
return ((delegate* unmanaged<ID3D11ShaderReflection*, uint>)(lpVtbl[18]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(20)]
public uint GetThreadGroupSize(uint* pSizeX, uint* pSizeY, uint* pSizeZ)
{
return ((delegate* unmanaged<ID3D11ShaderReflection*, uint*, uint*, uint*, uint>)(lpVtbl[20]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this), pSizeX, pSizeY, pSizeZ);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(21)]
[return: NativeTypeName("UINT64")]
public ulong GetRequiresFlags()
{
return ((delegate* unmanaged<ID3D11ShaderReflection*, ulong>)(lpVtbl[21]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
}
}
+16
ファイルの表示
@@ -0,0 +1,16 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from d3dcommon.h in Microsoft.Direct3D.D3D12 v1.600.10
// Original source is Copyright © Microsoft. Licensed under the MIT license
namespace TerraFX.Interop.DirectX
{
internal unsafe partial struct D3D_SHADER_MACRO
{
[NativeTypeName("LPCSTR")]
public sbyte* Name;
[NativeTypeName("LPCSTR")]
public sbyte* Definition;
}
}
+112
ファイルの表示
@@ -0,0 +1,112 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/d3dcompiler.h in the Windows SDK for Windows 10.0.22000.0
// Original source is Copyright © Microsoft. All rights reserved.
namespace TerraFX.Interop.DirectX
{
internal static partial class D3DCOMPILE
{
[NativeTypeName("#define D3DCOMPILE_DEBUG (1 << 0)")]
public const int D3DCOMPILE_DEBUG = (1 << 0);
[NativeTypeName("#define D3DCOMPILE_SKIP_VALIDATION (1 << 1)")]
public const int D3DCOMPILE_SKIP_VALIDATION = (1 << 1);
[NativeTypeName("#define D3DCOMPILE_SKIP_OPTIMIZATION (1 << 2)")]
public const int D3DCOMPILE_SKIP_OPTIMIZATION = (1 << 2);
[NativeTypeName("#define D3DCOMPILE_PACK_MATRIX_ROW_MAJOR (1 << 3)")]
public const int D3DCOMPILE_PACK_MATRIX_ROW_MAJOR = (1 << 3);
[NativeTypeName("#define D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR (1 << 4)")]
public const int D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR = (1 << 4);
[NativeTypeName("#define D3DCOMPILE_PARTIAL_PRECISION (1 << 5)")]
public const int D3DCOMPILE_PARTIAL_PRECISION = (1 << 5);
[NativeTypeName("#define D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT (1 << 6)")]
public const int D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT = (1 << 6);
[NativeTypeName("#define D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT (1 << 7)")]
public const int D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT = (1 << 7);
[NativeTypeName("#define D3DCOMPILE_NO_PRESHADER (1 << 8)")]
public const int D3DCOMPILE_NO_PRESHADER = (1 << 8);
[NativeTypeName("#define D3DCOMPILE_AVOID_FLOW_CONTROL (1 << 9)")]
public const int D3DCOMPILE_AVOID_FLOW_CONTROL = (1 << 9);
[NativeTypeName("#define D3DCOMPILE_PREFER_FLOW_CONTROL (1 << 10)")]
public const int D3DCOMPILE_PREFER_FLOW_CONTROL = (1 << 10);
[NativeTypeName("#define D3DCOMPILE_ENABLE_STRICTNESS (1 << 11)")]
public const int D3DCOMPILE_ENABLE_STRICTNESS = (1 << 11);
[NativeTypeName("#define D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12)")]
public const int D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY = (1 << 12);
[NativeTypeName("#define D3DCOMPILE_IEEE_STRICTNESS (1 << 13)")]
public const int D3DCOMPILE_IEEE_STRICTNESS = (1 << 13);
[NativeTypeName("#define D3DCOMPILE_OPTIMIZATION_LEVEL0 (1 << 14)")]
public const int D3DCOMPILE_OPTIMIZATION_LEVEL0 = (1 << 14);
[NativeTypeName("#define D3DCOMPILE_OPTIMIZATION_LEVEL1 0")]
public const int D3DCOMPILE_OPTIMIZATION_LEVEL1 = 0;
[NativeTypeName("#define D3DCOMPILE_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15))")]
public const int D3DCOMPILE_OPTIMIZATION_LEVEL2 = ((1 << 14) | (1 << 15));
[NativeTypeName("#define D3DCOMPILE_OPTIMIZATION_LEVEL3 (1 << 15)")]
public const int D3DCOMPILE_OPTIMIZATION_LEVEL3 = (1 << 15);
[NativeTypeName("#define D3DCOMPILE_RESERVED16 (1 << 16)")]
public const int D3DCOMPILE_RESERVED16 = (1 << 16);
[NativeTypeName("#define D3DCOMPILE_RESERVED17 (1 << 17)")]
public const int D3DCOMPILE_RESERVED17 = (1 << 17);
[NativeTypeName("#define D3DCOMPILE_WARNINGS_ARE_ERRORS (1 << 18)")]
public const int D3DCOMPILE_WARNINGS_ARE_ERRORS = (1 << 18);
[NativeTypeName("#define D3DCOMPILE_RESOURCES_MAY_ALIAS (1 << 19)")]
public const int D3DCOMPILE_RESOURCES_MAY_ALIAS = (1 << 19);
[NativeTypeName("#define D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES (1 << 20)")]
public const int D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES = (1 << 20);
[NativeTypeName("#define D3DCOMPILE_ALL_RESOURCES_BOUND (1 << 21)")]
public const int D3DCOMPILE_ALL_RESOURCES_BOUND = (1 << 21);
[NativeTypeName("#define D3DCOMPILE_DEBUG_NAME_FOR_SOURCE (1 << 22)")]
public const int D3DCOMPILE_DEBUG_NAME_FOR_SOURCE = (1 << 22);
[NativeTypeName("#define D3DCOMPILE_DEBUG_NAME_FOR_BINARY (1 << 23)")]
public const int D3DCOMPILE_DEBUG_NAME_FOR_BINARY = (1 << 23);
[NativeTypeName("#define D3DCOMPILE_EFFECT_CHILD_EFFECT (1 << 0)")]
public const int D3DCOMPILE_EFFECT_CHILD_EFFECT = (1 << 0);
[NativeTypeName("#define D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS (1 << 1)")]
public const int D3DCOMPILE_EFFECT_ALLOW_SLOW_OPS = (1 << 1);
[NativeTypeName("#define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST 0")]
public const int D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST = 0;
[NativeTypeName("#define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_0 (1 << 4)")]
public const int D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_0 = (1 << 4);
[NativeTypeName("#define D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_1 (1 << 5)")]
public const int D3DCOMPILE_FLAGS2_FORCE_ROOT_SIGNATURE_1_1 = (1 << 5);
[NativeTypeName("#define D3DCOMPILE_SECDATA_MERGE_UAV_SLOTS 0x00000001")]
public const int D3DCOMPILE_SECDATA_MERGE_UAV_SLOTS = 0x00000001;
[NativeTypeName("#define D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS 0x00000002")]
public const int D3DCOMPILE_SECDATA_PRESERVE_TEMPLATE_SLOTS = 0x00000002;
[NativeTypeName("#define D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH 0x00000004")]
public const int D3DCOMPILE_SECDATA_REQUIRE_TEMPLATE_MATCH = 0x00000004;
}
}
+44
ファイルの表示
@@ -0,0 +1,44 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/d3dcompiler.h in the Windows SDK for Windows 10.0.22000.0
// Original source is Copyright © Microsoft. All rights reserved.
namespace TerraFX.Interop.DirectX
{
internal enum D3D_BLOB_PART
{
D3D_BLOB_INPUT_SIGNATURE_BLOB,
D3D_BLOB_OUTPUT_SIGNATURE_BLOB,
D3D_BLOB_INPUT_AND_OUTPUT_SIGNATURE_BLOB,
D3D_BLOB_PATCH_CONSTANT_SIGNATURE_BLOB,
D3D_BLOB_ALL_SIGNATURE_BLOB,
D3D_BLOB_DEBUG_INFO,
D3D_BLOB_LEGACY_SHADER,
D3D_BLOB_XNA_PREPASS_SHADER,
D3D_BLOB_XNA_SHADER,
D3D_BLOB_PDB,
D3D_BLOB_PRIVATE_DATA,
D3D_BLOB_ROOT_SIGNATURE,
D3D_BLOB_DEBUG_NAME,
D3D_BLOB_TEST_ALTERNATE_SHADER = 0x8000,
D3D_BLOB_TEST_COMPILE_DETAILS,
D3D_BLOB_TEST_COMPILE_PERF,
D3D_BLOB_TEST_COMPILE_REPORT,
}
}
+23
ファイルの表示
@@ -0,0 +1,23 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/d3dcompiler.h in the Windows SDK for Windows 10.0.22000.0
// Original source is Copyright © Microsoft. All rights reserved.
using System;
using System.Runtime.InteropServices;
using TerraFX.Interop.Windows;
namespace TerraFX.Interop.DirectX
{
internal static unsafe partial class DirectX
{
[DllImport("d3dcompiler_47", ExactSpelling = true)]
public static extern HRESULT D3DCompile([NativeTypeName("LPCVOID")] void* pSrcData, [NativeTypeName("SIZE_T")] nuint SrcDataSize, [NativeTypeName("LPCSTR")] sbyte* pSourceName, [NativeTypeName("const D3D_SHADER_MACRO *")] D3D_SHADER_MACRO* pDefines, [NativeTypeName("const ID3DInclude *")] void* pInclude, [NativeTypeName("LPCSTR")] sbyte* pEntrypoint, [NativeTypeName("LPCSTR")] sbyte* pTarget, uint Flags1, uint Flags2, ID3DBlob** ppCode, ID3DBlob** ppErrorMsgs);
[DllImport("d3dcompiler_47", ExactSpelling = true)]
public static extern HRESULT D3DReflect([NativeTypeName("LPCVOID")] void* pSrcData, [NativeTypeName("SIZE_T")] nuint SrcDataSize, [NativeTypeName("const IID &")] Guid* pInterface, void** ppReflector);
[DllImport("d3dcompiler_47", ExactSpelling = true)]
public static extern HRESULT D3DSetBlobPart([NativeTypeName("LPCVOID")] void* pSrcData, [NativeTypeName("SIZE_T")] nuint SrcDataSize, D3D_BLOB_PART Part, uint Flags, [NativeTypeName("LPCVOID")] void* pPart, [NativeTypeName("SIZE_T")] nuint PartSize, ID3DBlob** ppNewShader);
}
}
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>9da1da9f-f8b2-4b25-be80-c21f773029e3</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>TerraFX.Interop.Windows.D2D1Interop</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\DirectX\um\d3d11shader\D3D.cs" Link="DirectX\um\d3d11shader\D3D.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d3dcommon\D3D_SHADER_MACRO.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d3d11shadeer\D3D11_SHADER_DESC.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d3dcompiler\D3DCOMPILE.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d3dcompiler\D3D_BLOB_PART.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d3dcompiler\DirectX.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\DirectX\um\d3dcommon\D3D_PRIMITIVE_TOPOLOGY.cs" Link="DirectX\um\d3dcommon\D3D_PRIMITIVE_TOPOLOGY.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\DirectX\um\d3dcommon\D3D_PRIMITIVE.cs" Link="DirectX\um\d3dcommon\D3D_PRIMITIVE.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\DirectX\um\d3dcommon\D3D_TESSELLATOR_OUTPUT_PRIMITIVE.cs" Link="DirectX\um\d3dcommon\D3D_TESSELLATOR_OUTPUT_PRIMITIVE.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\DirectX\um\d3dcommon\D3D_TESSELLATOR_PARTITIONING.cs" Link="DirectX\um\d3dcommon\D3D_TESSELLATOR_PARTITIONING.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\DirectX\um\d3dcommon\D3D_TESSELLATOR_DOMAIN.cs" Link="DirectX\um\d3dcommon\D3D_TESSELLATOR_DOMAIN.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d3d11shadeer\ID3D11ShaderReflection.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Windows\shared\uuids\Windows.Manual.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\ComPtr`1.cs" Link="ComPtr`1.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\ID2D1DrawInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\Windows\other\helper-types\HRESULT.cs" Link="Windows\other\helper-types\HRESULT.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\DirectX\um\d3dcommon\ID3DBlob.cs" Link="DirectX\um\d3dcommon\ID3DBlob.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\Windows\um\Unknwnbase\IUnknown.cs" Link="Windows\um\Unknwnbase\IUnknown.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\Windows\other\helper-types\NativeInheritanceAttribute.cs" Link="Windows\other\helper-types\NativeInheritanceAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\Windows\other\helper-types\NativeTypeNameAttribute.cs" Link="Windows\other\helper-types\NativeTypeNameAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\Windows\shared\winerror\S.cs" Link="Windows\shared\winerror\S.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\Windows\other\helper-types\VtblIndexAttribute.cs" Link="Windows\other\helper-types\VtblIndexAttribute.cs" />
</ItemGroup>
</Project>
+13
ファイルの表示
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>9da1da9f-f8b2-4b25-be80-c21f773029e3</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="TerraFX.Interop.Windows.D2D1Interop.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
+90
ファイルの表示
@@ -0,0 +1,90 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from shared/uuids.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
#if NET6_0_OR_GREATER
using RuntimeHelpers = System.Runtime.CompilerServices.RuntimeHelpers;
#else
using RuntimeHelpers = ComputeSharp.D2D1Interop.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
#endif
namespace TerraFX.Interop.Windows
{
internal static partial class Windows
{
/// <summary>Retrieves the GUID of of a specified type.</summary>
/// <param name="value">A value of type <typeparamref name="T"/>.</param>
/// <typeparam name="T">The type to retrieve the GUID for.</typeparam>
/// <returns>A <see cref="UuidOfType"/> value wrapping a pointer to the GUID data for the input type. This value can be either converted to a <see cref="Guid"/> pointer, or implicitly assigned to a <see cref="Guid"/> value.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe UuidOfType __uuidof<T>(T value) // for type inference similar to C++'s __uuidof
where T : unmanaged
{
return new UuidOfType(UUID<T>.RIID);
}
/// <summary>Retrieves the GUID of of a specified type.</summary>
/// <param name="value">A pointer to a value of type <typeparamref name="T"/>.</param>
/// <typeparam name="T">The type to retrieve the GUID for.</typeparam>
/// <returns>A <see cref="UuidOfType"/> value wrapping a pointer to the GUID data for the input type. This value can be either converted to a <see cref="Guid"/> pointer, or implicitly assigned to a <see cref="Guid"/> value.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe UuidOfType __uuidof<T>(T* value) // for type inference similar to C++'s __uuidof
where T : unmanaged
{
return new UuidOfType(UUID<T>.RIID);
}
/// <summary>Retrieves the GUID of of a specified type.</summary>
/// <typeparam name="T">The type to retrieve the GUID for.</typeparam>
/// <returns>A <see cref="UuidOfType"/> value wrapping a pointer to the GUID data for the input type. This value can be either converted to a <see cref="Guid"/> pointer, or implicitly assigned to a <see cref="Guid"/> value.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe UuidOfType __uuidof<T>()
where T : unmanaged
{
return new UuidOfType(UUID<T>.RIID);
}
/// <summary>A proxy type that wraps a pointer to GUID data. Values of this type can be implicitly converted to and assigned to <see cref="Guid"/>* or <see cref="Guid"/> parameters.</summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public readonly unsafe ref struct UuidOfType
{
private readonly Guid* riid;
internal UuidOfType(Guid* riid)
{
this.riid = riid;
}
/// <summary>Reads a <see cref="Guid"/> value from the GUID buffer for a given <see cref="UuidOfType"/> instance.</summary>
/// <param name="guid">The input <see cref="UuidOfType"/> instance to read data for.</param>
public static implicit operator Guid(UuidOfType guid) => *guid.riid;
/// <summary>Returns the <see cref="Guid"/>* pointer to the GUID buffer for a given <see cref="UuidOfType"/> instance.</summary>
/// <param name="guid">The input <see cref="UuidOfType"/> instance to read data for.</param>
public static implicit operator Guid*(UuidOfType guid) => guid.riid;
}
/// <summary>A helper type to provide static GUID buffers for specific types.</summary>
/// <typeparam name="T">The type to allocate a GUID buffer for.</typeparam>
private static unsafe class UUID<T>
where T : unmanaged
{
/// <summary>The pointer to the <see cref="Guid"/> value for the current type.</summary>
/// <remarks>The target memory area should never be written to.</remarks>
public static readonly Guid* RIID = CreateRIID();
/// <summary>Allocates memory for a <see cref="Guid"/> value and initializes it.</summary>
/// <returns>A pointer to memory holding the <see cref="Guid"/> value for the current type.</returns>
private static Guid* CreateRIID()
{
var p = (Guid*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(T), sizeof(Guid));
*p = typeof(T).GUID;
return p;
}
}
}
}
+1 -1
ファイルの表示
@@ -5,7 +5,7 @@
namespace TerraFX.Interop.DirectX
{
public static partial class D3D
internal static partial class D3D
{
[NativeTypeName("#define D3D_SHADER_REQUIRES_DOUBLES 0x00000001")]
public const int D3D_SHADER_REQUIRES_DOUBLES = 0x00000001;
+2
ファイルの表示
@@ -8,6 +8,8 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using TerraFX.Interop.Windows;
#pragma warning disable CS0649
namespace TerraFX.Interop.DirectX
{
[Guid("8BA5FB08-5195-40E2-AC58-0D989C3A0102")]
+2
ファイルの表示
@@ -7,6 +7,8 @@ using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
#pragma warning disable CS0649
namespace TerraFX.Interop.Windows
{
[Guid("00000000-0000-0000-C000-000000000046")]