Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update submodules + Regenerate bindings #1534

Merged
merged 21 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/wgpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ jobs:
name: ${{ matrix.env.name }} Build
runs-on: ${{ matrix.env.os }}
steps:
- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/rust-toolchain@stable
if: runner.os == 'Windows'
with:
toolchain: nightly-x86_64-pc-windows-msvc
toolchain: stable-x86_64-pc-windows-msvc

- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/rust-toolchain@stable
if: runner.os == 'Linux'
with:
toolchain: nightly-x86_64-unknown-linux-gnu
toolchain: stable-x86_64-unknown-linux-gnu

- uses: dtolnay/rust-toolchain@nightly
- uses: dtolnay/rust-toolchain@stable
if: runner.os == 'macOS'
with:
toolchain: nightly-x86_64-apple-darwin
toolchain: stable-x86_64-apple-darwin

- name: Add targets
if: runner.os == 'Windows'
Expand Down
Binary file modified build/cache/assimp.json.gz
Binary file not shown.
Binary file modified build/cache/gl.json.gz
Binary file not shown.
Binary file modified build/cache/glcore.json.gz
Binary file not shown.
Binary file modified build/cache/gles2.json.gz
Binary file not shown.
Binary file modified build/cache/sdl.json.gz
Binary file not shown.
Binary file modified build/cache/spirv.json.gz
Binary file not shown.
Binary file modified build/cache/vulkan.json.gz
Binary file not shown.
Binary file modified build/cache/vulkan_video.json.gz
Binary file not shown.
Binary file modified build/cache/webgpu.json.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion build/nuke/Native/Assimp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ partial class Build {
() =>
{
var @out = AssimpPath / "build";
var prepare = "cmake -S. -B build -D BUILD_SHARED_LIBS=ON";
var prepare = "cmake -S. -B build -D BUILD_SHARED_LIBS=ON -DASSIMP_WARNINGS_AS_ERRORS=OFF";
var build = $"cmake --build build --config Release{JobsArg}";
EnsureCleanDirectory(@out);
var runtimes = RootDirectory / "src" / "Native" / "Silk.NET.Assimp.Native" / "runtimes";
Expand Down
2 changes: 1 addition & 1 deletion build/submodules/Assimp
Submodule Assimp updated 299 files
2 changes: 1 addition & 1 deletion build/submodules/GLFW
Submodule GLFW updated 56 files
+0 −0 .github/CODEOWNERS
+4 −4 .github/workflows/build.yml
+1 −2 CMakeLists.txt
+24 −0 CONTRIBUTORS.md
+68 −8 README.md
+6 −14 deps/glad/vk_platform.h
+2,381 −353 deps/glad/vulkan.h
+348 −208 deps/glad_vulkan.c
+803 −127 deps/stb_image_write.h
+2 −2 docs/CONTRIBUTING.md
+1 −1 docs/build.dox
+1 −5 docs/compat.dox
+4 −2 docs/compile.dox
+16 −4 docs/input.dox
+13 −0 docs/news.dox
+10 −3 docs/vulkan.dox
+28 −25 include/GLFW/glfw3.h
+69 −35 include/GLFW/glfw3native.h
+15 −5 src/cocoa_init.m
+8 −7 src/cocoa_joystick.m
+0 −4 src/cocoa_monitor.m
+13 −2 src/cocoa_platform.h
+114 −28 src/cocoa_window.m
+3 −1 src/context.c
+19 −0 src/egl_context.c
+2 −0 src/egl_context.h
+0 −2 src/glfw_config.h.in
+8 −6 src/glx_context.c
+94 −0 src/init.c
+29 −16 src/input.c
+8 −2 src/internal.h
+4 −4 src/linux_joystick.c
+2 −2 src/monitor.c
+4 −2 src/nsgl_context.h
+3 −0 src/null_window.c
+2 −0 src/osmesa_context.c
+2 −0 src/vulkan.c
+19 −4 src/win32_init.c
+7 −7 src/win32_joystick.c
+1 −1 src/win32_monitor.c
+7 −1 src/win32_platform.h
+131 −30 src/win32_window.c
+21 −24 src/window.c
+60 −792 src/wl_init.c
+62 −22 src/wl_monitor.c
+55 −37 src/wl_platform.h
+1,567 −676 src/wl_window.c
+65 −2 src/x11_init.c
+3 −0 src/x11_platform.h
+157 −177 src/x11_window.c
+2 −2 src/xkb_unicode.c
+3 −1 src/xkb_unicode.h
+6 −0 tests/gamma.c
+101 −78 tests/glfwinfo.c
+3 −3 tests/iconify.c
+15 −9 tests/triangle-vulkan.c
2 changes: 1 addition & 1 deletion build/submodules/SDL
Submodule SDL updated 931 files
2 changes: 1 addition & 1 deletion build/submodules/Vulkan-Loader
Submodule Vulkan-Loader updated 97 files
+283 −15 .github/workflows/build.yml
+7 −2 BUILD.gn
+105 −184 BUILD.md
+25 −19 CMakeLists.txt
+6 −25 README.md
+1 −1 docs/LoaderLayerInterface.md
+65 −50 loader/CMakeLists.txt
+5 −1 loader/asm_offset.c
+192 −27 loader/cJSON.c
+29 −8 loader/cJSON.h
+23 −22 loader/debug_utils.c
+1 −1 loader/debug_utils.h
+257 −250 loader/dev_ext_trampoline.c
+2 −2 loader/dirent_on_windows.c
+2 −2 loader/dirent_on_windows.h
+2 −2 loader/extension_manual.c
+2 −2 loader/extension_manual.h
+0 −1,484 loader/generated/vk_dispatch_table_helper.h
+70 −48 loader/generated/vk_layer_dispatch_table.h
+445 −213 loader/generated/vk_loader_extensions.c
+34 −26 loader/generated/vk_loader_extensions.h
+ loader/loader.aps
+1,194 −1,413 loader/loader.c
+47 −25 loader/loader.h
+2 −2 loader/loader.rc
+61 −52 loader/loader_common.h
+143 −151 loader/loader_environment.c
+6 −7 loader/loader_environment.h
+6 −6 loader/loader_linux.c
+2 −2 loader/loader_linux.h
+121 −18 loader/loader_windows.c
+7 −1 loader/loader_windows.h
+62 −63 loader/log.c
+25 −5 loader/log.h
+507 −500 loader/phys_dev_ext.c
+803 −0 loader/settings.c
+115 −0 loader/settings.h
+3 −1 loader/stack_allocation.h
+2 −0 loader/terminator.c
+54 −33 loader/trampoline.c
+20 −12 loader/unknown_ext_chain_gas_aarch64.S
+19 −5 loader/unknown_ext_chain_gas_x86.S
+9 −11 loader/unknown_function_handling.c
+66 −51 loader/vk_loader_platform.h
+41 −41 loader/wsi.c
+23 −23 loader/wsi.h
+64 −35 scripts/CMakeLists.txt
+2 −26 scripts/dispatch_table_helper_generator.py
+2 −3 scripts/generate_source.py
+1 −1 scripts/known_good.json
+22 −22 scripts/loader_extension_generator.py
+62 −42 scripts/update_deps.py
+3 −2 tests/CMakeLists.txt
+3 −3 tests/framework/CMakeLists.txt
+1 −2 tests/framework/framework_config.h.in
+4 −6 tests/framework/icd/CMakeLists.txt
+8 −2 tests/framework/icd/physical_device.h
+154 −151 tests/framework/icd/test_icd.cpp
+8 −1 tests/framework/icd/test_icd.h
+117 −0 tests/framework/json_writer.h
+4 −2 tests/framework/layer/CMakeLists.txt
+2 −2 tests/framework/layer/export_definitions/test_layer_0.def
+8 −0 tests/framework/layer/export_definitions/test_layer_0_named_gpa.def
+3 −5 tests/framework/layer/export_definitions/test_layer_1.def
+3 −5 tests/framework/layer/export_definitions/test_layer_2.def
+0 −9 tests/framework/layer/layer_util.h
+96 −40 tests/framework/layer/test_layer.cpp
+15 −0 tests/framework/layer/test_layer.h
+777 −0 tests/framework/layer/vk_dispatch_table_helper.h
+50 −56 tests/framework/layer/wrap_objects.cpp
+4 −2 tests/framework/shim/CMakeLists.txt
+34 −19 tests/framework/shim/shim.h
+51 −16 tests/framework/shim/shim_common.cpp
+52 −20 tests/framework/shim/unix_shim.cpp
+27 −25 tests/framework/shim/windows_shim.cpp
+296 −117 tests/framework/test_environment.cpp
+128 −49 tests/framework/test_environment.h
+127 −88 tests/framework/test_util.cpp
+67 −41 tests/framework/test_util.h
+2 −2 tests/live_verification/CMakeLists.txt
+9 −9 tests/live_verification/dynamic_loader_behavior/CMakeLists.txt
+4 −4 tests/live_verification/dynamic_loader_behavior/dynamic_library.h
+12 −2 tests/live_verification/dynamic_rendering_get_proc_addr.cpp
+220 −86 tests/loader_alloc_callback_tests.cpp
+47 −40 tests/loader_debug_ext_tests.cpp
+13 −19 tests/loader_envvar_tests.cpp
+45 −37 tests/loader_get_proc_addr_tests.cpp
+236 −584 tests/loader_handle_validation_tests.cpp
+962 −1,514 tests/loader_layer_tests.cpp
+502 −572 tests/loader_phys_dev_inst_ext_tests.cpp
+390 −442 tests/loader_regression_tests.cpp
+1,694 −0 tests/loader_settings_tests.cpp
+9 −16 tests/loader_testing_main.cpp
+19 −35 tests/loader_threading_tests.cpp
+103 −173 tests/loader_unknown_ext_tests.cpp
+228 −259 tests/loader_version_tests.cpp
+9 −22 tests/loader_wsi_tests.cpp
2 changes: 1 addition & 1 deletion build/submodules/dawn
Submodule dawn updated 21750 files
2 changes: 1 addition & 1 deletion build/submodules/dxvk
Submodule dxvk updated 46 files
+1 −1 RELEASE
+4 −0 include/native/windows/unknwn.h
+48 −5 include/native/windows/windows_base.h
+1 −1 meson.build
+5 −1 src/d3d11/d3d11_device.h
+1 −4 src/d3d11/d3d11_gdi.cpp
+3 −9 src/d3d11/d3d11_interop.cpp
+2 −8 src/d3d11/d3d11_on_12.cpp
+1 −4 src/d3d11/d3d11_swapchain.cpp
+22 −5 src/d3d9/d3d9_common_texture.cpp
+2 −0 src/d3d9/d3d9_common_texture.h
+86 −37 src/d3d9/d3d9_device.cpp
+50 −2 src/d3d9/d3d9_device.h
+16 −6 src/d3d9/d3d9_fixed_function.cpp
+12 −12 src/d3d9/d3d9_format.cpp
+0 −1 src/d3d9/d3d9_format.h
+4 −36 src/d3d9/d3d9_include.h
+1 −1 src/d3d9/d3d9_options.cpp
+3 −10 src/d3d9/d3d9_options.h
+8 −2 src/d3d9/d3d9_query.cpp
+3 −1 src/d3d9/d3d9_surface.cpp
+133 −28 src/d3d9/d3d9_swapchain.cpp
+28 −2 src/d3d9/d3d9_swapchain.h
+16 −5 src/d3d9/d3d9_window.cpp
+31 −4 src/dxgi/dxgi_adapter.cpp
+51 −7 src/dxgi/dxgi_factory.cpp
+5 −0 src/dxgi/dxgi_factory.h
+0 −17 src/dxgi/dxgi_include.h
+8 −9 src/dxgi/dxgi_output.cpp
+11 −1 src/dxgi/dxgi_swapchain.cpp
+32 −2 src/dxvk/dxvk_adapter.h
+69 −4 src/dxvk/dxvk_context.cpp
+8 −0 src/dxvk/dxvk_context.h
+8 −1 src/dxvk/dxvk_format.cpp
+1 −1 src/dxvk/dxvk_format.h
+5 −1 src/dxvk/dxvk_graphics.cpp
+1 −0 src/dxvk/dxvk_graphics.h
+14 −3 src/dxvk/dxvk_instance.cpp
+5 −0 src/spirv/spirv_code_buffer.h
+26 −23 src/util/config/config.cpp
+74 −2 src/util/thread.cpp
+55 −84 src/util/thread.h
+5 −1 src/wsi/glfw/wsi_monitor_glfw.cpp
+5 −1 src/wsi/sdl2/wsi_monitor_sdl2.cpp
+91 −4 src/wsi/win32/wsi_monitor_win32.cpp
+10 −0 src/wsi/wsi_monitor.h
2 changes: 1 addition & 1 deletion build/submodules/webgpu-headers
Submodule webgpu-headers updated 1 files
+693 −509 webgpu.h
6 changes: 4 additions & 2 deletions generator.json
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@
"char": "byte",
"Window": "nint",
"VkAabbPositionsKHR": "Silk.NET.Maths.Box3D<float>",
"VkAabbPositionsNV": "Silk.NET.Maths.Box3D<float>"
"VkAabbPositionsNV": "Silk.NET.Maths.Box3D<float>",
"_screen_buffer": "void"
},
{
"StdVideoDecodeH264PictureInfo": "Video.StdVideoDecodeH264PictureInfo",
Expand Down Expand Up @@ -2385,7 +2386,8 @@
"WGPUBufferUsageFlags": "Silk.NET.WebGPU.BufferUsage",
"WGPUMapModeFlags": "Silk.NET.WebGPU.MapMode",
"WGPUShaderStageFlags": "Silk.NET.WebGPU.ShaderStage",
"WGPUTextureUsageFlags": "Silk.NET.WebGPU.TextureUsage"
"WGPUTextureUsageFlags": "Silk.NET.WebGPU.TextureUsage",
"WGPUInstanceBackendFlags": "Silk.NET.WebGPU.Extensions.WGPU.InstanceBackend"
},
{
"$include.commonTypeMap": "build/csharp_typemap.json",
Expand Down
5 changes: 0 additions & 5 deletions src/Assimp/Silk.NET.Assimp/Enums/MorphingMethod.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ namespace Silk.NET.Assimp
[NativeName("Name", "aiMorphingMethod")]
public enum MorphingMethod : int
{
[Obsolete("Deprecated in favour of \"Unknown\"")]
[NativeName("Name", "aiMorphingMethod_UNKNOWN")]
MorphingMethodUnknown = 0x0,
[Obsolete("Deprecated in favour of \"VertexBlend\"")]
[NativeName("Name", "aiMorphingMethod_VERTEX_BLEND")]
MorphingMethodVertexBlend = 0x1,
Expand All @@ -24,8 +21,6 @@ public enum MorphingMethod : int
[Obsolete("Deprecated in favour of \"MorphRelative\"")]
[NativeName("Name", "aiMorphingMethod_MORPH_RELATIVE")]
MorphingMethodMorphRelative = 0x3,
[NativeName("Name", "aiMorphingMethod_UNKNOWN")]
Unknown = 0x0,
[NativeName("Name", "aiMorphingMethod_VERTEX_BLEND")]
VertexBlend = 0x1,
[NativeName("Name", "aiMorphingMethod_MORPH_NORMALIZED")]
Expand Down
8 changes: 4 additions & 4 deletions src/Assimp/Silk.NET.Assimp/Structs/Mesh.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Mesh
AssimpString? mName = null,
uint? mNumAnimMeshes = null,
AnimMesh** mAnimMeshes = null,
MorphingMethod? mMethod = null,
uint? mMethod = null,
Silk.NET.Maths.Box3D<float>? mAABB = null,
AssimpString** mTextureCoordsNames = null
) : this()
Expand Down Expand Up @@ -267,10 +267,10 @@ public ref System.Numerics.Vector3* this[int index]
[NativeName("Name", "mAnimMeshes")]
public AnimMesh** MAnimMeshes;

[NativeName("Type", "enum aiMorphingMethod")]
[NativeName("Type.Name", "enum aiMorphingMethod")]
[NativeName("Type", "unsigned int")]
[NativeName("Type.Name", "unsigned int")]
[NativeName("Name", "mMethod")]
public MorphingMethod MMethod;
public uint MMethod;

[NativeName("Type", "aiAABB")]
[NativeName("Type.Name", "aiAABB")]
Expand Down
56 changes: 30 additions & 26 deletions src/Lab/Experiments/WebGPUTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,29 @@ public static unsafe class Program
public static Instance* instance;
public static Adapter* adapter;
public static Device* device;

public static void Main(string[] args)
{
uint[] numbers = { 1, 2, 3, 4 };
var numbersSize = (uint) numbers.Length * sizeof(uint);
var numbersLength = (uint) numbers.Length;

var wgpu = WebGPU.GetApi();
var webGpu = WebGPU.GetApi();

wgpu.TryGetDeviceExtension(null, out Wgpu wgpuSpecific);
if (!webGpu.TryGetDeviceExtension(null, out Wgpu wgpuSpecific))
{
throw new Exception("This code only runs on wgpu-native! Please PR in support for Dawn if you know how to get it working there!");
}

InstanceDescriptor instanceDescriptor = new InstanceDescriptor();
instance = wgpu.CreateInstance(&instanceDescriptor);
instance = webGpu.CreateInstance(&instanceDescriptor);

var requestAdapterOptions = new RequestAdapterOptions();
wgpu.InstanceRequestAdapter(instance, &requestAdapterOptions, new PfnRequestAdapterCallback(RequestAdapterCallback), null);
webGpu.InstanceRequestAdapter(instance, &requestAdapterOptions, new PfnRequestAdapterCallback(RequestAdapterCallback), null);

wgpu.AdapterRequestDevice(adapter, null, new PfnRequestDeviceCallback(RequestDeviceCallback), null);
webGpu.AdapterRequestDevice(adapter, null, new PfnRequestDeviceCallback(RequestDeviceCallback), null);

SetErrorCallback(wgpu);
SetErrorCallback(webGpu);

// ReSharper disable once InconsistentNaming
var shaderModuleWGSLDescriptor = new ShaderModuleWGSLDescriptor();
Expand Down Expand Up @@ -85,7 +89,7 @@ fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
Label = (byte*) SilkMarshal.StringToPtr("Test Compute Shader") //TODO: free this
};

var shader = wgpu.DeviceCreateShaderModule(device, shaderModuleDescriptor);
var shader = webGpu.DeviceCreateShaderModule(device, shaderModuleDescriptor);

var stagingBufferDescription = new BufferDescriptor
{
Expand All @@ -94,7 +98,7 @@ fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
Size = numbersSize,
MappedAtCreation = false
};
var stagingBuffer = wgpu.DeviceCreateBuffer(device, stagingBufferDescription);
var stagingBuffer = webGpu.DeviceCreateBuffer(device, stagingBufferDescription);

var storageBufferDescription = new BufferDescriptor
{
Expand All @@ -103,7 +107,7 @@ fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
Size = numbersSize,
MappedAtCreation = false
};
var storageBuffer = wgpu.DeviceCreateBuffer(device, storageBufferDescription);
var storageBuffer = webGpu.DeviceCreateBuffer(device, storageBufferDescription);

var computePipelineDescriptor = new ComputePipelineDescriptor
{
Expand All @@ -115,9 +119,9 @@ fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
EntryPoint = (byte*) SilkMarshal.StringToPtr("main") //TODO: free this
}
};
var computePipeline = wgpu.DeviceCreateComputePipeline(device, computePipelineDescriptor);
var computePipeline = webGpu.DeviceCreateComputePipeline(device, computePipelineDescriptor);

var bindGroupLayout = wgpu.ComputePipelineGetBindGroupLayout(computePipeline, 0);
var bindGroupLayout = webGpu.ComputePipelineGetBindGroupLayout(computePipeline, 0);

var bindGroupDescriptor = new BindGroupDescriptor
{
Expand All @@ -134,57 +138,57 @@ fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
bindGroupDescriptor.Entries = entries;
bindGroupDescriptor.EntryCount = 1;

var bindGroup = wgpu.DeviceCreateBindGroup(device, bindGroupDescriptor);
var bindGroup = webGpu.DeviceCreateBindGroup(device, bindGroupDescriptor);

var commandEncoderDescriptor = new CommandEncoderDescriptor
{
Label = (byte*) SilkMarshal.StringToPtr("Command Encoder") //TODO: free this
};
var encoder = wgpu.DeviceCreateCommandEncoder(device, commandEncoderDescriptor);
var encoder = webGpu.DeviceCreateCommandEncoder(device, commandEncoderDescriptor);

var computePassDescriptor = new ComputePassDescriptor
{
Label = (byte*) SilkMarshal.StringToPtr("Compute Pass") //TODO: free this
};
var computePass = wgpu.CommandEncoderBeginComputePass(encoder, computePassDescriptor);
var computePass = webGpu.CommandEncoderBeginComputePass(encoder, computePassDescriptor);

wgpu.ComputePassEncoderSetPipeline(computePass, computePipeline);
wgpu.ComputePassEncoderSetBindGroup(computePass, 0, bindGroup, 0, null);
wgpu.ComputePassEncoderDispatchWorkgroups(computePass, numbersLength, 1, 1);
wgpu.ComputePassEncoderEnd(computePass);
wgpu.CommandEncoderCopyBufferToBuffer
webGpu.ComputePassEncoderSetPipeline(computePass, computePipeline);
webGpu.ComputePassEncoderSetBindGroup(computePass, 0, bindGroup, 0, null);
webGpu.ComputePassEncoderDispatchWorkgroups(computePass, numbersLength, 1, 1);
webGpu.ComputePassEncoderEnd(computePass);
webGpu.CommandEncoderCopyBufferToBuffer
(
encoder, storageBuffer, 0, stagingBuffer,
0, numbersSize
);

var queue = wgpu.DeviceGetQueue(device);
var queue = webGpu.DeviceGetQueue(device);
var commandBufferDescriptor = new CommandBufferDescriptor
{
Label = (byte*) SilkMarshal.StringToPtr("Command Buffer") //TODO: free this
};
var cmdBuffer = wgpu.CommandEncoderFinish(encoder, commandBufferDescriptor);
var cmdBuffer = webGpu.CommandEncoderFinish(encoder, commandBufferDescriptor);

fixed (uint* numberPtr = numbers)
wgpu.QueueWriteBuffer(queue, storageBuffer, 0, numberPtr, numbersSize);
webGpu.QueueWriteBuffer(queue, storageBuffer, 0, numberPtr, numbersSize);

wgpu.QueueSubmit(queue, 1, &cmdBuffer);
webGpu.QueueSubmit(queue, 1, &cmdBuffer);

wgpu.BufferMapAsync(stagingBuffer, MapMode.Read, 0, numbersSize, new PfnBufferMapCallback(
webGpu.BufferMapAsync(stagingBuffer, MapMode.Read, 0, numbersSize, new PfnBufferMapCallback(
(arg0, data) =>
{
if(arg0 != BufferMapAsyncStatus.Success)
{
throw new Exception($"Unable to map buffer! status: {arg0}");
}

var times = (uint*) wgpu.BufferGetMappedRange(stagingBuffer, 0, numbersSize); ;
var times = (uint*) webGpu.BufferGetMappedRange(stagingBuffer, 0, numbersSize); ;

Console.WriteLine($"Times: [{times[0]}, {times[1]}, {times[2]}, {times[3]}]");
}), null);

wgpuSpecific.DevicePoll(device, true, null);
wgpu.BufferUnmap(stagingBuffer);
webGpu.BufferUnmap(stagingBuffer);
}

private static void ReadBufferMap(BufferMapAsyncStatus arg0, void* arg1)
Expand Down
39 changes: 22 additions & 17 deletions src/Lab/Experiments/WebGPUTexturedQuad/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Silk.NET.Core.Native;
using Silk.NET.Maths;
using Silk.NET.WebGPU;
Expand Down Expand Up @@ -28,9 +30,8 @@ public Vertex(Vector2 position, Vector2 texCoord)
}

// ReSharper disable once InconsistentNaming
private static WebGPU wgpu = null!;
private static WebGPUDisposal _WebGpuDisposal = null!;
private static IWindow? _Window;
private static WebGPU wgpu = null!;
private static IWindow? _Window;

private static Instance* _Instance;
private static Surface* _Surface;
Expand Down Expand Up @@ -86,8 +87,6 @@ private static void WindowOnLoad()
{
wgpu = WebGPU.GetApi();

_WebGpuDisposal = new WebGPUDisposal(wgpu);

InstanceDescriptor instanceDescriptor = new InstanceDescriptor();
_Instance = wgpu.CreateInstance(instanceDescriptor);

Expand Down Expand Up @@ -118,10 +117,15 @@ private static void WindowOnLoad()
PrintAdapterFeatures();

{ //Get device
var deviceDescriptor = new DeviceDescriptor
{
DeviceLostCallback = new PfnDeviceLostCallback(DeviceLost),
};

wgpu.AdapterRequestDevice
(
_Adapter,
null,
in deviceDescriptor,
new PfnRequestDeviceCallback((_, device1, _, _) => _Device = device1),
null
);
Expand All @@ -130,7 +134,6 @@ private static void WindowOnLoad()
} //Get device

wgpu.DeviceSetUncapturedErrorCallback(_Device, new PfnErrorCallback(UncapturedError), null);
wgpu.DeviceSetDeviceLostCallback(_Device, new PfnDeviceLostCallback(DeviceLost), null);

{ //Load shader
var wgslDescriptor = new ShaderModuleWGSLDescriptor
Expand Down Expand Up @@ -260,10 +263,11 @@ private static void WindowOnLoad()
{ //Create sampler
var descriptor = new SamplerDescriptor
{
Compare = CompareFunction.Undefined,
MipmapFilter = MipmapFilterMode.Linear,
MagFilter = FilterMode.Linear,
MinFilter = FilterMode.Linear
Compare = CompareFunction.Undefined,
MipmapFilter = MipmapFilterMode.Linear,
MagFilter = FilterMode.Linear,
MinFilter = FilterMode.Linear,
MaxAnisotropy = 1
};

_Sampler = wgpu.DeviceCreateSampler(_Device, descriptor);
Expand Down Expand Up @@ -564,7 +568,7 @@ private static void WindowOnRender(double delta)
wgpu.RenderPassEncoderDraw(renderPass, 6, 1, 0, 0);

wgpu.RenderPassEncoderEnd(renderPass);
_WebGpuDisposal.Dispose(nextTexture);
wgpu.TextureViewRelease(nextTexture);

var queue = wgpu.DeviceGetQueue(_Device);

Expand All @@ -577,11 +581,12 @@ private static void WindowOnRender(double delta)

private static void WindowClosing()
{
_WebGpuDisposal.Dispose(_Shader);
_WebGpuDisposal.Dispose(_Pipeline);
_WebGpuDisposal.Dispose(_Device);
_WebGpuDisposal.Dispose(_Adapter);
_WebGpuDisposal.Dispose(_Surface);
wgpu.ShaderModuleRelease(_Shader);
wgpu.RenderPipelineRelease(_Pipeline);
wgpu.DeviceRelease(_Device);
wgpu.AdapterRelease(_Adapter);
wgpu.SurfaceRelease(_Surface);
wgpu.InstanceRelease(_Instance);

wgpu.Dispose();
}
Expand Down
6 changes: 1 addition & 5 deletions src/Lab/Experiments/WebGPUTexturedQuad/shader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ struct VertexOutputs {
@location(0) tex_coord: vec2<f32>
}

struct FragmentInputs {
@location(0) tex_coord: vec2<f32>
}

@group(1) @binding(0) var<uniform> projection_matrix: mat4x4<f32>;

@vertex
Expand All @@ -30,6 +26,6 @@ fn vs_main(
@group(0) @binding(1) var s: sampler;

@fragment
fn fs_main(input: FragmentInputs) -> @location(0) vec4<f32> {
fn fs_main(input: VertexOutputs) -> @location(0) vec4<f32> {
return textureSample(t, s, input.tex_coord);
}
Loading
Loading