Skip to content

Commit 6c849a5

Browse files
BeyleyPerksey
andauthored
Add DirectWrite bindings (#1349)
* Add the ability to supply multiple library paths in SearchPathContainer (#1351) * Add the ability to supply multiple library paths in SearchPathContainer * OpenAL: Change `soft` parameter from exclusive to preference This means that now if loading OpenAL soft fails, ittl try to fall back to native, and if loading OpenAL native fails, ittl fall back to OpenAL soft * SingletonSeparatedList -> SeparatedList * Loader: Allow fallible loading of native contexts and libraries * SilkTouch: Use fallible codepath for multiple libname fallback * Update patch notes for 2.17 release (#1360) * Make examples dispose windows (#1355) * Load Assimp from source, rather than nuget in GL tut 4.1 * Make all OpenGL examples dispose their IWindow objects properly * Make all Direct3D11 examples dispose their IWindow objects properly * Apply overload exclusions to Vtbl functions * Add DirectWrite bindings * Add no-obsolete-enum control descriptor to Direct2D bindings Any bindings after 2.16 should be using this control descriptor, as they arent released yet, and dont need to keep backwards compat * Direct2D: Dont Generate IDXGISurface * Add DirectWrite to solution * Make d3d9 use the D3DColorValue from DXGI While this is a breaking change, it effects approximately 0 people --------- Co-authored-by: Dylan Perks <[email protected]>
1 parent 26a88d9 commit 6c849a5

File tree

689 files changed

+233850
-28068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

689 files changed

+233850
-28068
lines changed

Silk.NET.sln

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.DirectComposition"
562562
EndProject
563563
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.WebGPU.Native.WGPU", "src\Native\Silk.NET.WebGPU.Native.WGPU\Silk.NET.WebGPU.Native.WGPU.csproj", "{4031A5EB-820B-478D-A656-85C93210054E}"
564564
EndProject
565+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Silk.NET.DirectWrite", "src\Microsoft\Silk.NET.DirectWrite\Silk.NET.DirectWrite.csproj", "{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}"
566+
EndProject
565567
Global
566568
GlobalSection(SolutionConfigurationPlatforms) = preSolution
567569
Debug|Any CPU = Debug|Any CPU
@@ -3403,6 +3405,18 @@ Global
34033405
{4031A5EB-820B-478D-A656-85C93210054E}.Release|x64.Build.0 = Release|Any CPU
34043406
{4031A5EB-820B-478D-A656-85C93210054E}.Release|x86.ActiveCfg = Release|Any CPU
34053407
{4031A5EB-820B-478D-A656-85C93210054E}.Release|x86.Build.0 = Release|Any CPU
3408+
{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3409+
{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
3410+
{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Debug|x64.ActiveCfg = Debug|Any CPU
3411+
{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Debug|x64.Build.0 = Debug|Any CPU
3412+
{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Debug|x86.ActiveCfg = Debug|Any CPU
3413+
{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Debug|x86.Build.0 = Debug|Any CPU
3414+
{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
3415+
{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Release|Any CPU.Build.0 = Release|Any CPU
3416+
{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Release|x64.ActiveCfg = Release|Any CPU
3417+
{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Release|x64.Build.0 = Release|Any CPU
3418+
{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Release|x86.ActiveCfg = Release|Any CPU
3419+
{EDEFAF88-EDD7-4D9C-B364-28B769672FB3}.Release|x86.Build.0 = Release|Any CPU
34063420
EndGlobalSection
34073421
GlobalSection(SolutionProperties) = preSolution
34083422
HideSolutionNode = FALSE
@@ -3676,6 +3690,7 @@ Global
36763690
{82626916-C5F3-46E7-B0EC-1D38191450C7} = {58FECE86-7530-4E6F-BA61-512BE44DEA83}
36773691
{8773396C-5EDF-498C-97D7-1D2728CB969B} = {F2CF5D32-4B41-425E-B229-8FFC48F88063}
36783692
{4031A5EB-820B-478D-A656-85C93210054E} = {72E7FA64-5B1E-477D-BD30-63B7F206B3C4}
3693+
{EDEFAF88-EDD7-4D9C-B364-28B769672FB3} = {F2CF5D32-4B41-425E-B229-8FFC48F88063}
36793694
EndGlobalSection
36803695
GlobalSection(ExtensibilityGlobals) = postSolution
36813696
SolutionGuid = {F5273D7F-3334-48DF-94E3-41AE6816CD4D}

build/cache/d2d.json.gz

0 Bytes
Binary file not shown.

build/cache/d3d9.json.gz

0 Bytes
Binary file not shown.

build/cache/dwrite.json.gz

381 KB
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#include <windows.h>
2+
#include <dcommon.h>
3+
#include <dxgi.h>

generator.json

Lines changed: 145 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,8 @@
12671267
"cacheKey": "d2d",
12681268
"controlDescriptors": [
12691269
"convert-windows-only",
1270-
"typemap-native"
1270+
"typemap-native",
1271+
"no-obsolete-enum"
12711272
],
12721273
"converter": {},
12731274
"prefix": "D2D1_",
@@ -1333,7 +1334,8 @@
13331334
"D2D1_RECT_L",
13341335
"D2D1_SIZE_F",
13351336
"D2D1_SIZE_U",
1336-
"D2D1GetGradientMeshInteriorPointsFromCoonsPatch"
1337+
"D2D1GetGradientMeshInteriorPointsFromCoonsPatch",
1338+
"IDXGISurface"
13371339
],
13381340
"rename": {
13391341
},
@@ -1368,6 +1370,145 @@
13681370
"className": "D2DLibraryNameContainer"
13691371
},
13701372
"typeMaps": [
1373+
{
1374+
"IDXGISurface": "Silk.NET.DXGI.IDXGISurface"
1375+
},
1376+
{
1377+
"$include.dxTypemap": "build/dx_typemap.json",
1378+
"$include.commonTypeMap": "build/csharp_typemap.json"
1379+
}
1380+
]
1381+
},
1382+
{
1383+
"profileName": "DirectWrite",
1384+
"sources": [
1385+
"build/include/silk.net.directwrite.dcommon.h",
1386+
"$windowsSdkDir/Include/$windowsSdkVersion/um/dwrite.h",
1387+
"$windowsSdkDir/Include/$windowsSdkVersion/um/dwrite_1.h",
1388+
"$windowsSdkDir/Include/$windowsSdkVersion/um/dwrite_2.h",
1389+
"$windowsSdkDir/Include/$windowsSdkVersion/um/dwrite_3.h"
1390+
],
1391+
"mode": "Clang",
1392+
"cacheDir": "build/cache",
1393+
"cacheKey": "dwrite",
1394+
"controlDescriptors": [
1395+
"convert-windows-only",
1396+
"typemap-native",
1397+
"no-obsolete-enum"
1398+
],
1399+
"converter": {},
1400+
"prefix": "DWRITE_",
1401+
"clang": {
1402+
"args": [
1403+
"--language=c++",
1404+
"--std=c++17",
1405+
"-m32",
1406+
"-Wno-expansion-to-defined",
1407+
"-Wno-ignored-attributes",
1408+
"-Wno-ignored-pragma-intrinsic",
1409+
"-Wno-nonportable-include-path",
1410+
"-Wno-pragma-pack",
1411+
"-I$windowsSdkIncludes",
1412+
"-Ibuild/include"
1413+
],
1414+
"traverse": [
1415+
"$windowsSdkDir/Include/$windowsSdkVersion/um/dcommon.h",
1416+
"$windowsSdkDir/Include/$windowsSdkVersion/um/dwrite.h",
1417+
"$windowsSdkDir/Include/$windowsSdkVersion/um/dwrite_1.h",
1418+
"$windowsSdkDir/Include/$windowsSdkVersion/um/dwrite_2.h",
1419+
"$windowsSdkDir/Include/$windowsSdkVersion/um/dwrite_3.h"
1420+
],
1421+
"classes": {
1422+
"silk.net.directwrite.dcommon.h": "[Core]DWrite",
1423+
"dwrite.h": "[Core]DWrite",
1424+
"dwrite_1.h": "[Core]DWrite",
1425+
"dwrite_2.h": "[Core]DWrite",
1426+
"dwrite_3.h": "[Core]DWrite"
1427+
}
1428+
},
1429+
"exclude": [
1430+
"D2D_VECTOR_2F",
1431+
"D2D_VECTOR_3F",
1432+
"D2D_VECTOR_4F",
1433+
"D2D_POINT_2U",
1434+
"D2D_POINT_2F",
1435+
"D2D_POINT_2L",
1436+
"D2D_RECT_F",
1437+
"D2D_RECT_U",
1438+
"D2D_RECT_L",
1439+
"D2D_SIZE_F",
1440+
"D2D_SIZE_U",
1441+
"D2D_MATRIX_3X2_F",
1442+
"D2D_MATRIX_4X3_F",
1443+
"D2D_MATRIX_4X4_F",
1444+
"D2D_MATRIX_5X4_F",
1445+
"D2D1_POINT_2U",
1446+
"D2D1_POINT_2F",
1447+
"D2D1_POINT_2L",
1448+
"D2D1_RECT_F",
1449+
"D2D1_RECT_U",
1450+
"D2D1_RECT_L",
1451+
"D2D1_SIZE_F",
1452+
"D2D1_SIZE_U",
1453+
"D2D1GetGradientMeshInteriorPointsFromCoonsPatch",
1454+
"IDXGISurface",
1455+
"D2D1_ALPHA_MODE",
1456+
"D2D1_PIXEL_FORMAT",
1457+
"ID2D1SimplifiedGeometrySink",
1458+
"_D3DCOLORVALUE"
1459+
],
1460+
"rename": {
1461+
},
1462+
"bakery": {
1463+
"profileNames": [
1464+
"silk.net.directwrite.dcommon",
1465+
"dwrite",
1466+
"dwrite_1",
1467+
"dwrite_2",
1468+
"dwrite_3"
1469+
]
1470+
},
1471+
"output": {
1472+
"mode": "Default",
1473+
"path": "src/Microsoft",
1474+
"licenseFile": "build/LICENSE_HEADER.txt",
1475+
"props": "build/props/bindings.props"
1476+
},
1477+
"namespace": "Silk.NET.DirectWrite",
1478+
"extensionsNamespace": "Silk.NET.DirectWrite.Extensions",
1479+
"overloadExclusions": {
1480+
"RefOverloader": [
1481+
"GetGlyphs",
1482+
"GetJustifiedGlyphs",
1483+
"GetGlyphPlacements",
1484+
"GetGdiCompatibleGlyphPlacements",
1485+
"ApplyCharacterSpacing",
1486+
"GetTextComplexity",
1487+
"GetJustificationOpportunities",
1488+
"JustifyGlyphAdvances",
1489+
"CheckTypographicFeature"
1490+
]
1491+
},
1492+
"nameContainer": {
1493+
"linux-x64": "libdwrite.so",
1494+
"win-x64": "DWrite.dll",
1495+
"win-x86": "DWrite.dll",
1496+
"osx-x64": "libdwrite.dylib",
1497+
"android": "libdwrite.so",
1498+
"iOS": "__Internal",
1499+
"className": "DWriteLibraryNameContainer"
1500+
},
1501+
"typeMaps": [
1502+
{
1503+
"IDXGISurface": "Silk.NET.DXGI.IDXGISurface",
1504+
"D2D1_ALPHA_MODE": "Silk.NET.Direct2D.AlphaMode",
1505+
"D2D1PixelFormat": "Silk.NET.Direct2D.PixelFormat",
1506+
"ID2D1SimplifiedGeometrySink": "Silk.NET.Direct2D.ID2D1SimplifiedGeometrySink",
1507+
"_FILETIME": "Silk.NET.Core.Win32Extras.Filetime",
1508+
"tagLOGFONTW": "void",
1509+
"tagLOGFONTA": "void",
1510+
"tagFONTSIGNATURE": "void"
1511+
},
13711512
{
13721513
"$include.dxTypemap": "build/dx_typemap.json",
13731514
"$include.commonTypeMap": "build/csharp_typemap.json"
@@ -1612,7 +1753,8 @@
16121753
"exclude": [
16131754
"__AnonymousRecord_d3d9types_L93_C9",
16141755
"__AnonymousRecord_d3d9types_L92_C5",
1615-
"_D3DMATRIX"
1756+
"_D3DMATRIX",
1757+
"_D3DCOLORVALUE"
16161758
],
16171759
"rename": {
16181760
"_D3D_OMAC": "D3DOMac"
@@ -1973,7 +2115,6 @@
19732115
"D2D_MATRIX_3X2_F": "Silk.NET.Maths.Matrix3X2<float>",
19742116
"D2D_RECT_F": "Silk.NET.Maths.Rectangle<float>",
19752117
"D3DMATRIX": "Silk.NET.Maths.Matrix4X4<float>",
1976-
"_D3DCOLORVALUE": "Silk.NET.DXGI.D3Dcolorvalue",
19772118
"DXGI_RATIONAL": "Silk.NET.DXGI.Rational",
19782119
"DXGI_ALPHA_MODE": "Silk.NET.DXGI.AlphaMode",
19792120
"DXGI_HDR_METADATA_TYPE": "Silk.NET.DXGI.HdrMetadataType",
@@ -2124,92 +2265,6 @@
21242265
}
21252266
]
21262267
},
2127-
{
2128-
"profileName": "D2D1",
2129-
"sources": [
2130-
"src/Microsoft/Silk.NET.Direct2D1/D2D1.h"
2131-
],
2132-
"mode": "Clang",
2133-
"cacheDir": "build/cache",
2134-
"cacheKey": "d2d1",
2135-
"controlDescriptors": [
2136-
"convert-windows-only",
2137-
"Currently disabled due to bakery bugs.",
2138-
"no-convert",
2139-
"no-bind",
2140-
"typemap-native"
2141-
],
2142-
"converter": {},
2143-
"prefix": "D2D1",
2144-
"clang": {
2145-
"args": [
2146-
"--language=c++",
2147-
"--std=c++17",
2148-
"-m32",
2149-
"-Wno-expansion-to-defined",
2150-
"-Wno-ignored-attributes",
2151-
"-Wno-ignored-pragma-intrinsic",
2152-
"-Wno-nonportable-include-path",
2153-
"-Wno-pragma-pack",
2154-
"-I$windowsSdkIncludes",
2155-
"-Ibuild/include"
2156-
],
2157-
"traverse": [
2158-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1.h",
2159-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1effectauthor.h",
2160-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1effectauthor_1.h",
2161-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1effecthelpers.h",
2162-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1effects.h",
2163-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1effects_1.h",
2164-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1effects_2.h",
2165-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1helper.h",
2166-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1svg.h",
2167-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1_1.h",
2168-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1_1helper.h",
2169-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1_2.h",
2170-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1_2helper.h",
2171-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1_3.h",
2172-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2d1_3helper.h",
2173-
"$windowsSdkDir/Include/$windowsSdkVersion/um/d2dbasetypes.h",
2174-
"$windowsSdkDir/Include/$windowsSdkVersion/um/D2DErr.h"
2175-
],
2176-
"classes": {
2177-
"D2D1.h": "[Core]D2D1"
2178-
}
2179-
},
2180-
"exclude": [
2181-
],
2182-
"rename": {
2183-
},
2184-
"bakery": {
2185-
"profileNames": [
2186-
"D2D1"
2187-
]
2188-
},
2189-
"output": {
2190-
"mode": "Default",
2191-
"path": "src/Microsoft",
2192-
"licenseFile": "build/LICENSE_HEADER.txt",
2193-
"props": "build/props/bindings.props"
2194-
},
2195-
"namespace": "Silk.NET.Direct2D1",
2196-
"extensionsNamespace": "Silk.NET.Direct2D1.Extensions",
2197-
"nameContainer": {
2198-
"linux-x64": "libd2d1.so",
2199-
"win-x64": "d2d1.dll",
2200-
"win-x86": "d2d1.dll",
2201-
"osx-x64": "libd2d1.dylib",
2202-
"android": "libd2d1.so",
2203-
"iOS": "__Internal",
2204-
"className": "D2D1LibraryNameContainer"
2205-
},
2206-
"typeMaps": [
2207-
{
2208-
"$include.dxTypemap": "build/dx_typemap.json",
2209-
"$include.commonTypeMap": "build/csharp_typemap.json"
2210-
}
2211-
]
2212-
},
22132268
{
22142269
"profileName": "webgpu",
22152270
"sources": [

src/Core/Silk.NET.BuildTools/Bind/StructWriter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ public static void WriteStruct
458458
}
459459

460460
foreach (var function in @struct.Functions.Concat
461-
(ComVtblProcessor.GetHelperFunctions(@struct, profile)))
461+
(ComVtblProcessor.GetHelperFunctions(task, @struct, profile)))
462462
{
463463
if (function.Signature.Kind == SignatureKind.PotentiallyConflictingOverload)
464464
{
@@ -603,7 +603,7 @@ unsafe BaseInStructure* IChainable.PNext
603603
vt.WriteLine();
604604
vt.WriteLine($"public unsafe static class {className}");
605605
vt.WriteLine("{");
606-
foreach (var helper in ComVtblProcessor.GetHelperFunctions(@struct, profile, true))
606+
foreach (var helper in ComVtblProcessor.GetHelperFunctions(task, @struct, profile, true))
607607
{
608608
using (var sr = new StringReader(helper.Signature.Doc))
609609
{

src/Core/Silk.NET.BuildTools/Common/Functions/Function.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ private static string GetDeclarationString(Parameter parameter, bool appendAttri
269269
switch (parameter.Flow)
270270
{
271271
case FlowDirection.In:
272-
attributes.Add("Flow(FlowDirection.In)");
272+
attributes.Add("Flow(Silk.NET.Core.Native.FlowDirection.In)");
273273
break;
274274
case FlowDirection.Out:
275-
attributes.Add("Flow(FlowDirection.Out)");
275+
attributes.Add("Flow(Silk.NET.Core.Native.FlowDirection.Out)");
276276
break;
277277
}
278278

0 commit comments

Comments
 (0)