Skip to content

Commit

Permalink
Merge pull request #18 from EvergineTeam/fix-requiredFatures
Browse files Browse the repository at this point in the history
WGPUDeviceLostCallback  should be process like void*
  • Loading branch information
jcant0n authored Sep 27, 2024
2 parents 8133d77 + c11441d commit 7040ff4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion WebGPUGen/Evergine.Bindings.WebGPU/Generated/Structs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ public unsafe struct WGPUDeviceDescriptor
public WGPUFeatureName* requiredFeatures;
public WGPURequiredLimits* requiredLimits;
public WGPUQueueDescriptor defaultQueue;
public WGPUDeviceLostCallback deviceLostCallback;
public void* deviceLostCallback;
public void* deviceLostUserdata;
}

Expand Down
8 changes: 7 additions & 1 deletion WebGPUGen/HelloTriangle/HelloTriangle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,17 @@ private void InitWebGPU()

wgpuInstanceRequestAdapter(Instance, &options, OnAdapterRequestEnded, (void*)0);

var requiredFeatureCount = WebGPUNative.wgpuAdapterEnumerateFeatures(this.Adapter, null);
var requiredFeatures = stackalloc WGPUFeatureName[(int)requiredFeatureCount];

WebGPUNative.wgpuAdapterEnumerateFeatures(this.Adapter, requiredFeatures);

WGPUDeviceDescriptor deviceDescriptor = new WGPUDeviceDescriptor()
{
nextInChain = null,
label = null,
requiredFeatures = (WGPUFeatureName*)0,
requiredFeatures = requiredFeatures,
requiredFeatureCount = requiredFeatureCount,
requiredLimits = null,
};

Expand Down
8 changes: 1 addition & 7 deletions WebGPUGen/WebGPUGen/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ namespace WebGPUGen
{
public static class Helpers
{
//public static List<string> TypedefList;

private static readonly Dictionary<string, string> s_csNameMappings = new Dictionary<string, string>()
{
{ "uint8_t", "byte" },
Expand All @@ -28,6 +26,7 @@ public static class Helpers
{ "DWORD", "uint" },

{ "WGPUSubmissionIndex", "ulong" },
{ "WGPUDeviceLostCallback", "void*" },
};

public static string ConvertToCSharpType(CppType type, bool isPointer = false)
Expand Down Expand Up @@ -259,11 +258,6 @@ private static string GetCsCleanName(string name)
return name.Remove(name.Count() - 5);
}

//if (TypedefList.Contains(name))
//{
// return "IntPtr";
//}

return name;
}

Expand Down

0 comments on commit 7040ff4

Please sign in to comment.