diff --git a/src/lib/components/OnboardingModal.svelte b/src/lib/components/OnboardingModal.svelte index ea80db9..a9a6f80 100644 --- a/src/lib/components/OnboardingModal.svelte +++ b/src/lib/components/OnboardingModal.svelte @@ -3,7 +3,7 @@ import WebGPUInstructions from './WebGPUInstructions.svelte'; import PaperViewer from './PaperViewer.svelte'; import MobileWarning from './MobileWarning.svelte'; - import { completeOnboarding, setConsent, getConsent } from '$lib/utils/consentStorage'; + import { completeOnboarding, setConsent, getConsent, updateWebGPUAvailability } from '$lib/utils/consentStorage'; import { useWebGPUStatus } from '$lib/composables/useWebGPUStatus.svelte'; interface Props { @@ -21,6 +21,16 @@ const webgpu = useWebGPUStatus(); + // Gate: non-dismissable when WebGPU is unavailable + const gated = $derived(!webgpu.isDetecting && !webgpu.available); + + // Update stored WebGPU availability when detection completes + $effect(() => { + if (!webgpu.isDetecting) { + updateWebGPUAvailability(webgpu.available); + } + }); + // Track completed steps let completedSteps = $state>(new Set()); @@ -48,6 +58,7 @@ } function handleFinish() { + if (gated) return; markStepCompleted(currentStep); if (dontShowAgain) { completeOnboarding(); @@ -61,13 +72,14 @@ } function handleBackdropClick(event: MouseEvent) { + if (gated) return; if (event.target === event.currentTarget) { handleFinish(); } } function handleKeydown(event: KeyboardEvent) { - if (event.key === 'Escape') { + if (event.key === 'Escape' && !gated) { handleFinish(); } else if (event.key === 'ArrowRight' || (event.key === 'Enter' && currentStep < TOTAL_STEPS)) { nextStep(); @@ -128,16 +140,18 @@ Step {currentStep} of {TOTAL_STEPS}

- + {#if !gated} + + {/if} @@ -227,9 +241,9 @@ {/if} - {#if !webgpu.available && !webgpu.isDetecting} -
- You can continue without WebGPU - the demo will use CPU-based processing (Futhark WASM). + {#if gated} +
+ WebGPU is required to use the Pixelwise demos. Please follow the instructions above to enable WebGPU in your browser, then click "Re-check".
{/if}
@@ -331,47 +345,61 @@ {:else if currentStep === 5}
-
-

- - - - Setup Complete -

-
-
- Backend: - {performanceTier} -
-
- WebGPU: - - {webgpu.available ? 'Available' : 'Using fallback'} - -
- {#if webgpu.adapter} + {#if gated} +
+

+ + + + WebGPU Required +

+

+ The Pixelwise demos require a WebGPU-capable browser. Please go back to Step 2 for browser-specific instructions on enabling WebGPU, then click "Re-check". +

+
+ {:else} +
+

+ + + + Setup Complete +

+
+
+ Backend: + {performanceTier} +
+
+ WebGPU: + + {webgpu.available ? 'Available' : 'Using fallback'} + +
+ {#if webgpu.adapter} +
+ GPU: + {webgpu.adapter} +
+ {/if}
- GPU: - {webgpu.adapter} + Screen Capture: + + {screenCaptureTestResult === 'granted' ? 'Granted' : 'Will prompt on start'} +
- {/if} -
- Screen Capture: - - {screenCaptureTestResult === 'granted' ? 'Granted' : 'Will prompt on start'} -
-
- + + {/if}
{/if}
@@ -418,6 +446,14 @@ + {:else if gated} + {:else}