Skip to content

Conversation

@MarcosCobena
Copy link
Contributor

@MarcosCobena MarcosCobena commented Jun 30, 2025

As requested by @jcant0n, this PR deletes every runtime different from browser-wasm, focusing the attention in this last.

It includes the latest findings while testing the preview package at https://github.com/EvergineTeam/Engine/pull/274.

I have also updated README (it had headers which did not match their bodies, a broken link to the license, etc.)

@MarcosCobena MarcosCobena requested a review from davilovick June 30, 2025 09:11
@MarcosCobena MarcosCobena marked this pull request as ready for review June 30, 2025 09:11
@MarcosCobena MarcosCobena requested a review from Copilot June 30, 2025 09:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refocuses the repository on the browser‐wasm runtime by removing all other platform support, updating project references, and adding a Blazor WebAssembly “HelloTriangleWasm” sample with updated documentation.

  • Deletes non‐browser‐wasm runtimes and headers, retaining only Emscripten’s webgpu.h
  • Updates project files and solution to include the new HelloTriangleWasm sample and removes the old desktop example
  • Revises README for accurate headers, links, and installation instructions

Reviewed Changes

Copilot reviewed 27 out of 48 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
WebGPUGen/WebGPUGen/WebGPUGen.csproj Removed non‐browser header entries
WebGPUGen/WebGPUGen/Program.cs Updated headerFile path to webgpu.h
WebGPUGen/WebGPUGen/Helpers.cs Adjusted size_t mapping from ulong to uint
WebGPUGen/WebGPUGen/Headers/wgpu.h Deleted the C wrapper in favor of Emscripten’s header
WebGPUGen/WebGPUGen.sln Replaced HelloTriangle project with HelloTriangleWasm
WebGPUGen/HelloTriangleWasm/wwwroot/webgpu.js Added initWebGPU helper to preinitialize the device
WebGPUGen/HelloTriangleWasm/wwwroot/index.html Added <canvas> element and script reference
WebGPUGen/HelloTriangleWasm/Pages/Home.razor.cs Implemented the WebGPU triangle rendering sample
WebGPUGen/Evergine.Bindings.WebGPU/WebGPUNative.cs Added DllImport signatures for Emscripten WebGPU APIs
README.md Updated introduction, installation commands, and license
Comments suppressed due to low confidence (3)

WebGPUGen/HelloTriangleWasm/wwwroot/index.html:11

  • [nitpick] The <canvas> element has no explicit width/height, which can lead to inconsistent sizing across browsers. Consider adding width and height attributes or CSS rules to define its dimensions.
    <link rel="icon" type="image/png" href="favicon.png" />

WebGPUGen/Evergine.Bindings.WebGPU/WebGPUNative.cs:14

  • The native signature expects a WGPUMapModeFlags enum, but this uses WGPUMapMode. Update the parameter type to WGPUMapModeFlags to match the C API and avoid mismatches.
        public static extern void wgpuBufferMapAsyncWithoutCallback(WGPUBuffer buffer, WGPUMapMode mode, uint offset, uint size, void* userdata);

WebGPUGen/HelloTriangleWasm/Pages/Home.razor.cs:139

  • This nested initializer for alpha lacks a constructor and will not compile. Change to alpha = new WGPUBlendComponent { operation = ..., srcFactor = ..., dstFactor = ... }.
                alpha = {

{
public static char* ToPointer(this string text)
{
return (char*)System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(text);
Copy link

Copilot AI Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allocating unmanaged memory with StringToHGlobalAnsi without a corresponding free causes a leak. Consider providing a free method (e.g., Marshal.FreeHGlobal) or using a fixed buffer for temporary pointers.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcant0n @davilovick this is interesting. I have searched in Evergine and this pattern is used mostly in Vulkan and WebGPU. It may be interesting to apply what it proposes :-)

@davilovick davilovick merged commit 33cda95 into master Aug 25, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants