Skip to content

Commit dc1cdc1

Browse files
committed
Added repo link. Removed unused project.
1 parent 3004edf commit dc1cdc1

File tree

5 files changed

+38
-16
lines changed

5 files changed

+38
-16
lines changed

BlazorWASMWebGPUComputeDemo.sln

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ VisualStudioVersion = 17.14.36414.22
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorWASMWebGPUComputeDemo", "BlazorWASMWebGPUComputeDemo\BlazorWASMWebGPUComputeDemo.csproj", "{D757DC99-EB3F-41CD-A261-F6A3946D92A5}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpawnDev.Fractals", "..\..\SpawnDev.Fractals\SpawnDev.Fractals\SpawnDev.Fractals.csproj", "{5C8913B7-76A8-4909-AFA3-175FE131F756}"
9-
EndProject
108
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
119
ProjectSection(SolutionItems) = preProject
1210
README.md = README.md
@@ -22,10 +20,6 @@ Global
2220
{D757DC99-EB3F-41CD-A261-F6A3946D92A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
2321
{D757DC99-EB3F-41CD-A261-F6A3946D92A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
2422
{D757DC99-EB3F-41CD-A261-F6A3946D92A5}.Release|Any CPU.Build.0 = Release|Any CPU
25-
{5C8913B7-76A8-4909-AFA3-175FE131F756}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26-
{5C8913B7-76A8-4909-AFA3-175FE131F756}.Debug|Any CPU.Build.0 = Debug|Any CPU
27-
{5C8913B7-76A8-4909-AFA3-175FE131F756}.Release|Any CPU.ActiveCfg = Release|Any CPU
28-
{5C8913B7-76A8-4909-AFA3-175FE131F756}.Release|Any CPU.Build.0 = Release|Any CPU
2923
EndGlobalSection
3024
GlobalSection(SolutionProperties) = preSolution
3125
HideSolutionNode = FALSE

BlazorWASMWebGPUComputeDemo/Layout/MainLayout.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<main>
88
<div class="top-row px-4">
9-
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
9+
<a href="https://github.com/LostBeard/BlazorWASMWebGPUComputeDemo" target="_blank">GitHub Repo</a>
1010
</div>
1111

1212
<article class="content px-4">

BlazorWASMWebGPUComputeDemo/Layout/NavMenu.razor

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="top-row ps-3 navbar navbar-dark">
22
<div class="container-fluid">
3-
<a class="navbar-brand" href="">BlazorWASMWebGPUComputeDemo</a>
3+
<a class="navbar-brand" href="">WebGPU Demo</a>
44
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
55
<span class="navbar-toggler-icon"></span>
66
</button>
@@ -10,18 +10,18 @@
1010
<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
1111
<nav class="flex-column">
1212
<div class="nav-item px-3">
13-
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
14-
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Compute Boids
13+
<NavLink class="nav-link" href="BasicDemo" Match="NavLinkMatch.All">
14+
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Basic Demo
1515
</NavLink>
1616
</div>
1717
<div class="nav-item px-3">
18-
<NavLink class="nav-link" href="Tutorial01" Match="NavLinkMatch.All">
19-
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Compute 1
18+
<NavLink class="nav-link" href="ComputeBoids" Match="NavLinkMatch.All">
19+
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Compute Boids
2020
</NavLink>
2121
</div>
2222
<div class="nav-item px-3">
23-
<NavLink class="nav-link" href="BasicDemo" Match="NavLinkMatch.All">
24-
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Basic Demo
23+
<NavLink class="nav-link" href="Tutorial01" Match="NavLinkMatch.All">
24+
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Compute Tutorial 1
2525
</NavLink>
2626
</div>
2727
</nav>

BlazorWASMWebGPUComputeDemo/Pages/BasicDemo.razor

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
@page "/BasicDemo"
1+
@page "/"
2+
@page "/BasicDemo"
23
@using SpawnDev.BlazorJS.JSObjects
4+
@implements IDisposable
35

46
<canvas @ref=_canvasReference width="500px" height="500px" style="background:magenta"></canvas>
57

@@ -17,9 +19,30 @@
1719
private ElementReference _canvasReference;
1820
private HTMLCanvasElement? _canvasElement;
1921
private Window? _window;
22+
bool Disposed;
23+
24+
public void Dispose()
25+
{
26+
Disposed = true;
27+
}
28+
void CleanUp()
29+
{
30+
_gpuCanvasContext?.Dispose();
31+
_adapter?.Dispose();
32+
_adapterInfo?.Dispose();
33+
_device?.Dispose();
34+
_renderPipeline?.Dispose();
35+
_canvasElement?.Dispose();
36+
_window?.Dispose();
37+
}
2038

2139
private void Frame()
2240
{
41+
if (Disposed)
42+
{
43+
CleanUp();
44+
return;
45+
}
2346
var commandEncoder = _device?.CreateCommandEncoder();
2447

2548
var textureView = _gpuCanvasContext?.GetCurrentTexture().CreateView();
@@ -56,6 +79,11 @@
5679

5780
_device?.Queue?.Submit(new[] { commandBuffer });
5881

82+
if (Disposed)
83+
{
84+
CleanUp();
85+
return;
86+
}
5987
_window?.RequestAnimationFrame(Frame);
6088
}
6189

BlazorWASMWebGPUComputeDemo/Pages/ComputeBoidsSample/ComputeBoids.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@page "/"
1+
@page "/ComputeBoids"
22

33
<PageTitle>WebGPU Compute Boids</PageTitle>
44

0 commit comments

Comments
 (0)