From b33b130fbb3f641729b8aad6a47b3f26a30d51e7 Mon Sep 17 00:00:00 2001 From: Brad Stricherz Date: Sat, 7 Nov 2026 20:26:10 -0600 Subject: [PATCH 01/13] docs: plan for issue 8 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf --- ...-11-07-issue-8-gpu-panel-render-backend.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md diff --git a/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md b/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md new file mode 100644 index 0000000..7f2caf0 --- /dev/null +++ b/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md @@ -0,0 +1,65 @@ +# Plan: GPU panel shows RENDER WebGPU while deck.gl is actually rendering with WebGL2 (issue #8) + +Risk tier: High. Not a forced-High area, but it raises two tiers from Low: the render backend comes from deck.gl's device initialization inside a MapLibre control, which jsdom cannot exercise (integration), and it alters existing behavior (RENDER no longer derives from the WebGPU adapter probe). Five or six files change. + +Domain skills: +- superpowers:test-driven-development: invoke. +- vercel-react-best-practices: invoke (state from an external callback, stable callbacks, no work in render). +- chrome-devtools-mcp:chrome-devtools: invoke for the live drive. If the chrome-devtools MCP fails (locked profile), use Playwright via `npx playwright` with the cached Chromium instead. +- chrome-devtools-mcp:a11y-debugging: not applicable because no control, focus order, or accessible name changes; only visible text of two values and one key changes. +- frontend-design: not applicable because the panel keeps its existing HUD styling. +- dataviz, django, fastapi, expo, payments, email: not applicable because none of that is touched. + +## Decision (user) + +Report the truth. Do not wire WebGPU rendering. RENDER reads the device type deck.gl actually created. WebGPU compute availability (the `useGPUCapabilities` tier) stays separate and only gates the compute readout. + +## Acceptance criteria + +1. RENDER shows the backend deck.gl actually uses: the luma.gl device type passed to deck's `onDeviceInitialized` callback. `webgl` (luma.gl's WebGL2 device; `webgl2` is accepted as an alias) shows `WebGL2`, `webgpu` shows `WebGPU`. Before deck has initialized its device, RENDER shows `Detecting...`. Any other non-empty type shows `Unknown`. +2. The WebGPU adapter tier (`webgpu`, `no-webgpu`, `unknown`) never decides the RENDER text. With tier `webgpu` and a `webgl` device, RENDER shows `WebGL2`. The strings `WebGL Fallback` and the tier-derived `WebGPU` RENDER label are gone. +3. RENDER value class: `ok` when the device type is `webgl`/`webgl2`/`webgpu`, `warn` while detecting or unknown. +4. The compute item's key reads `WEBGPU COMPUTE` (was `COMPUTE`), so WebGPU compute availability reads apart from RENDER. Its behavior from #11 is unchanged: `--` and no RUN button unless the tier is `webgpu` and the benchmark is supported; the RUN button's accessible name stays `Run compute benchmark`; the value stays a polite live region. +5. GPU label, in order: adapter `device`, then adapter `description`; if both are empty, adapter `vendor` and `architecture` joined with a space (either alone if only one is set); if the adapter offers none of those, the render device's `info.renderer` from deck's device (luma.gl `device.info.renderer`, the unmasked WebGL renderer string when exposed); otherwise `Unknown`. +6. Unit tests cover: RENDER for `webgl`, `webgl2`, and `webgpu` device types; the not-yet-initialized state (`Detecting...`); an unrecognized type; tier `webgpu` with device `webgl` still showing `WebGL2`; each GPU label fallback step. A MapView wiring test (with `react-map-gl/maplibre`, `@deck.gl/mapbox`, and the GPU hooks mocked) shows `Detecting...` first, then `WebGL2` after the overlay's `onDeviceInitialized` is called with `{ type: 'webgl' }`, proving the callback is passed to the `MapboxOverlay` constructor. +7. Prior work preserved: all other existing tests pass; tests that looked up the `COMPUTE` key text are updated only for the new key text. At 1024px wide or less the panel shows only RENDER, PTS, FRAME. At 375x812, 768x1024, and 1440x900 the panel stays inside the viewport and does not overlap the header, the layer panel, or an open popup at 768. No new `color:` rule unless it is added to `src/styles.test.js`'s `TEXT_PAIRS`. +8. README's GPU info panel bullet and Requirements text describe RENDER as the deck.gl backend (`WebGL2`, `WebGPU`, or `Detecting...`) and no longer say the panel shows `WebGL Fallback`; references to the COMPUTE key use `WEBGPU COMPUTE`. + +## Files that change + +- `src/components/gpuLabels.js` (new): pure helpers `renderBackendLabel(deviceType)` returning `{ text, ok }` (or two functions, implementer's choice), and `gpuDeviceLabel(adapterInfo, renderInfo)`. No React. +- `src/components/gpuLabels.test.js` (new): unit tests for both helpers (AC1, AC5). +- `src/components/GPUInfoPanel.jsx`: read `renderDevice` from `capabilities` (`{ type, renderer }` or null/undefined; must be optional so existing tests that omit it render `Detecting...`). RENDER text and class from `renderBackendLabel(renderDevice?.type)`. GPU text from `gpuDeviceLabel(adapterInfo, renderDevice)`. Compute key text `WEBGPU COMPUTE`. `isWebGPU` (tier) keeps gating only the RUN button. +- `src/components/GPUInfoPanel.test.jsx` and `src/components/GPUInfoPanel.benchmarkTier.test.jsx`: change `getByText('COMPUTE')` lookups and the `'COMPUTE'` entry in the secondary-key loop to `'WEBGPU COMPUTE'`; add panel tests for AC1 to AC3 (incl. tier `webgpu` + device `webgl`). +- `src/components/MapView.jsx`: `const [renderDevice, setRenderDevice] = useState(null)`. A stable `useCallback` `(device) => setRenderDevice({ type: device.type, renderer: device.info?.renderer })`. `DeckGLOverlay` takes `onDeviceInitialized` and passes it in the `MapboxOverlay` constructor props (the overlay creates its `Deck` in `onAdd` from those props, so it must be there at construction; `setProps({ layers })` keeps it). Add `renderDevice` to the `capabilities` memo and its deps. +- `src/components/MapView.test.jsx` (new): wiring test of AC6. Mock `react-map-gl/maplibre` (`Map` renders children; `useControl(factory)` calls the factory once and returns its result), mock `@deck.gl/mapbox` `MapboxOverlay` as a class that records its constructor props and has `setProps`, mock `maplibre-gl/dist/maplibre-gl.css` and `../config/maplibreWorker.js` if needed, mock `useGPUCapabilities` and `useGPUCompute`. Call the recorded `onDeviceInitialized` inside `act` and assert RENDER. +- `README.md`: AC8 only. + +## Order of work + +1. Red: `gpuLabels.test.js`, then the helpers. +2. Red: panel tests (new RENDER cases, renamed key), then `GPUInfoPanel.jsx`. +3. Red: `MapView.test.jsx`, then `MapView.jsx`. +4. README. +5. Gate, then live drive. + +## Risks + +- `onDeviceInitialized` must be in the constructor props; passing it only through `setProps` after `onAdd` would miss the event. The wiring test asserts constructor props. +- React StrictMode double-invokes effects; `useControl` may create the overlay twice in dev. The callback only sets state, so a repeated call is harmless. +- If deck's device creation fails, RENDER stays `Detecting...`. Loading and error states are issue #10; not handled here (noted in the PR). +- Longer key text `WEBGPU COMPUTE` widens the panel at widths over 1024px; re-measure at 1440. +- luma.gl's WebGL device type string is `webgl`, not `webgl2`; the label maps both. + +## Not done + +- WebGPU rendering (`deviceProps: { type: 'webgpu' }`): rejected by the user. +- Header "SYS NOMINAL" and loading/error states: issue #10. + +## Proof + +- AC1, AC3, AC5: `src/components/gpuLabels.test.js` and the new panel tests. +- AC2: panel test with tier `webgpu` and device `webgl`. +- AC4, AC7: existing panel and benchmark tier tests (key text updated), `src/styles.test.js`. +- AC6: `src/components/MapView.test.jsx`. +- Live drive: `npm run build && npm run preview`; in the browser RENDER shows `WebGL2`, and the console shows the deck canvas holds a `webgl2` context (for example `[...document.querySelectorAll('canvas')].map(c => !!c.getContext('webgl2'))` all true, and no `webgpu` context) matching the label. Note: headless Chromium has no WebGPU adapter and the user's Chrome returns null from `requestAdapter()`, so the tier is `no-webgpu` there; WEBGPU COMPUTE shows `--` with no RUN button. GPU label shows the WebGL renderer string when the adapter offers nothing. Re-measure layout at 375x812, 768x1024, 1440x900. From 15c8a4662ee4647da172f8877add265e6c6e8651 Mon Sep 17 00:00:00 2001 From: Brad Stricherz Date: Sat, 7 Nov 2026 20:27:47 -0600 Subject: [PATCH 02/13] test: add failing tests for RENDER reporting the deck.gl device backend (#8) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf --- .../GPUInfoPanel.benchmarkTier.test.jsx | 2 +- src/components/GPUInfoPanel.test.jsx | 65 +++++++++++++++--- src/components/MapView.test.jsx | 66 +++++++++++++++++++ src/components/gpuLabels.test.js | 62 +++++++++++++++++ 4 files changed, 186 insertions(+), 9 deletions(-) create mode 100644 src/components/MapView.test.jsx create mode 100644 src/components/gpuLabels.test.js diff --git a/src/components/GPUInfoPanel.benchmarkTier.test.jsx b/src/components/GPUInfoPanel.benchmarkTier.test.jsx index 0fb7111..2b99152 100644 --- a/src/components/GPUInfoPanel.benchmarkTier.test.jsx +++ b/src/components/GPUInfoPanel.benchmarkTier.test.jsx @@ -18,7 +18,7 @@ describe('GPUInfoPanel RUN control and the detected tier', () => { it.each(['no-webgpu', 'unknown'])('hides the RUN button when the tier is %s', (tier) => { render() expect(screen.queryByRole('button', { name: 'Run compute benchmark' })).not.toBeInTheDocument() - expect(screen.getByText('COMPUTE').closest('.gpu-info-item')).toHaveTextContent('--') + expect(screen.getByText('WEBGPU COMPUTE').closest('.gpu-info-item')).toHaveTextContent('--') }) it('shows the RUN button when the tier is webgpu', () => { diff --git a/src/components/GPUInfoPanel.test.jsx b/src/components/GPUInfoPanel.test.jsx index 0d69668..97a310f 100644 --- a/src/components/GPUInfoPanel.test.jsx +++ b/src/components/GPUInfoPanel.test.jsx @@ -18,9 +18,9 @@ describe('GPUInfoPanel', () => { expect(screen.getByText('Test GPU')).toBeInTheDocument() }) - it('renders COMPUTE key', () => { + it('renders WEBGPU COMPUTE key', () => { render() - expect(screen.getByText('COMPUTE')).toBeInTheDocument() + expect(screen.getByText('WEBGPU COMPUTE')).toBeInTheDocument() }) it('renders compute throughput value', () => { @@ -72,10 +72,10 @@ describe('GPUInfoPanel', () => { }) }) describe('GPUInfoPanel secondary stats', () => { - it('marks GPU, COMPUTE, and HEATMAP as secondary and keeps RENDER, PTS, FRAME primary', () => { + it('marks GPU, WEBGPU COMPUTE, and HEATMAP as secondary and keeps RENDER, PTS, FRAME primary', () => { render() const item = (key) => screen.getByText(key).closest('.gpu-info-item') - for (const key of ['GPU', 'COMPUTE', 'HEATMAP']) { + for (const key of ['GPU', 'WEBGPU COMPUTE', 'HEATMAP']) { expect(item(key)).toHaveClass('gpu-info-secondary') } for (const key of ['RENDER', 'PTS', 'FRAME']) { @@ -103,17 +103,17 @@ describe('GPUInfoPanel benchmark control', () => { it('has no RUN button when the benchmark is unsupported', () => { render() expect(screen.queryByRole('button', { name: 'Run compute benchmark' })).not.toBeInTheDocument() - expect(screen.getByText('COMPUTE').closest('.gpu-info-item')).toHaveTextContent('--') + expect(screen.getByText('WEBGPU COMPUTE').closest('.gpu-info-item')).toHaveTextContent('--') }) - it('renders a native RUN button inside the COMPUTE item when supported', () => { + it('renders a native RUN button inside the WEBGPU COMPUTE item when supported', () => { render() const button = screen.getByRole('button', { name: 'Run compute benchmark' }) expect(button.tagName).toBe('BUTTON') expect(button).toHaveAttribute('type', 'button') expect(button).toHaveTextContent('RUN') expect(button).toHaveClass('gpu-bench-btn') - expect(button.closest('.gpu-info-item')).toBe(screen.getByText('COMPUTE').closest('.gpu-info-item')) + expect(button.closest('.gpu-info-item')).toBe(screen.getByText('WEBGPU COMPUTE').closest('.gpu-info-item')) }) it('runs on click', async () => { @@ -154,10 +154,59 @@ describe('GPUInfoPanel benchmark control', () => { expect(screen.getByRole('button', { name: 'Run compute benchmark' })).not.toHaveAttribute('aria-disabled') }) - it('announces the COMPUTE value through a polite live region', () => { + it('announces the WEBGPU COMPUTE value through a polite live region', () => { render() const value = screen.getByText('~1.3 GB/s est.') expect(value).toHaveAttribute('aria-live', 'polite') expect(value).not.toContainElement(screen.getByRole('button', { name: 'Run compute benchmark' })) }) }) + +// Issue #8: RENDER reports the device deck.gl created, not the WebGPU adapter tier. +describe('GPUInfoPanel RENDER backend', () => { + const renderVal = () => screen.getByText('RENDER').closest('.gpu-info-item').querySelector('.gpu-info-val') + + it('shows Detecting... with a warn class before deck has initialized its device', () => { + render() + expect(renderVal()).toHaveTextContent('Detecting...') + expect(renderVal()).toHaveClass('warn') + expect(renderVal()).not.toHaveClass('ok') + }) + + it.each([ + ['webgl', 'WebGL2'], + ['webgl2', 'WebGL2'], + ['webgpu', 'WebGPU'], + ])('shows the deck device type %s as %s with an ok class', (type, text) => { + render() + expect(renderVal()).toHaveTextContent(text) + expect(renderVal()).toHaveClass('ok') + }) + + it('shows WebGL2 when the WebGPU tier is available but deck renders with WebGL', () => { + render() + expect(renderVal()).toHaveTextContent('WebGL2') + expect(screen.queryByText('WebGPU')).not.toBeInTheDocument() + }) + + it.each(['no-webgpu', 'unknown'])('never shows WebGL Fallback when the tier is %s', (tier) => { + render() + expect(renderVal()).toHaveTextContent('WebGL2') + expect(screen.queryByText('WebGL Fallback')).not.toBeInTheDocument() + }) + + it('shows Unknown with a warn class for an unrecognized device type', () => { + render() + expect(renderVal()).toHaveTextContent('Unknown') + expect(renderVal()).toHaveClass('warn') + }) + + it('falls back to the render device renderer for the GPU label when the adapter offers nothing', () => { + render( + + ) + expect(screen.getByText('GPU').closest('.gpu-info-item')).toHaveTextContent('ANGLE (Test)') + }) +}) diff --git a/src/components/MapView.test.jsx b/src/components/MapView.test.jsx new file mode 100644 index 0000000..87d15dd --- /dev/null +++ b/src/components/MapView.test.jsx @@ -0,0 +1,66 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest' +import { render, screen, act } from '@testing-library/react' + +// jsdom has no WebGL or WebGPU: stub the map, the deck overlay, and the GPU +// hooks. The overlay mock records its constructor props so the test can play +// deck.gl's part and report the device it created (issue #8). +const overlays = vi.hoisted(() => []) + +vi.mock('react-map-gl/maplibre', async () => { + const { useState } = await import('react') + return { + default: ({ children }) =>
{children}
, + useControl: (factory) => { + const [control] = useState(factory) + return control + }, + } +}) + +vi.mock('@deck.gl/mapbox', () => ({ + MapboxOverlay: class { + constructor(props) { + this.props = props + overlays.push(this) + } + setProps() {} + }, +})) + +vi.mock('maplibre-gl/dist/maplibre-gl.css', () => ({})) +vi.mock('../config/maplibreWorker.js', () => ({})) +vi.mock('../layers/index.js', () => ({ buildLayers: () => [] })) + +const GPU_BASE = { tier: 'webgpu', adapterInfo: {} } +vi.mock('../hooks/useGPUCapabilities.js', () => ({ useGPUCapabilities: () => GPU_BASE })) + +const COMPUTE = { throughput: '--', supported: false, running: false, run: () => {} } +vi.mock('../hooks/useGPUCompute.js', () => ({ useGPUCompute: () => COMPUTE })) + +import { MapView } from './MapView.jsx' + +const layerData = { airports: [], ports: [], stressPoints: [] } +const renderVal = () => screen.getByText('RENDER').closest('.gpu-info-item').querySelector('.gpu-info-val') + +describe('MapView render backend wiring', () => { + beforeEach(() => { + overlays.length = 0 + }) + + it('shows Detecting... until deck reports its device, then the device type', () => { + render() + expect(renderVal()).toHaveTextContent('Detecting...') + + expect(overlays.length).toBeGreaterThan(0) + const { onDeviceInitialized } = overlays[0].props + expect(typeof onDeviceInitialized).toBe('function') + + act(() => { + onDeviceInitialized({ type: 'webgl', info: { renderer: 'ANGLE (Test Renderer)' } }) + }) + + expect(renderVal()).toHaveTextContent('WebGL2') + expect(renderVal()).toHaveClass('ok') + expect(screen.getByText('GPU').closest('.gpu-info-item')).toHaveTextContent('ANGLE (Test Renderer)') + }) +}) diff --git a/src/components/gpuLabels.test.js b/src/components/gpuLabels.test.js new file mode 100644 index 0000000..c2b1f55 --- /dev/null +++ b/src/components/gpuLabels.test.js @@ -0,0 +1,62 @@ +import { describe, it, expect } from 'vitest' +import { renderBackendLabel, gpuDeviceLabel } from './gpuLabels.js' + +// Issue #8: RENDER must name the backend deck.gl actually created, read from +// the luma.gl device type, never from the WebGPU adapter probe. +describe('renderBackendLabel', () => { + it('maps the luma.gl WebGL device type to WebGL2', () => { + expect(renderBackendLabel('webgl')).toEqual({ text: 'WebGL2', ok: true }) + }) + + it('accepts webgl2 as an alias for WebGL2', () => { + expect(renderBackendLabel('webgl2')).toEqual({ text: 'WebGL2', ok: true }) + }) + + it('maps the webgpu device type to WebGPU', () => { + expect(renderBackendLabel('webgpu')).toEqual({ text: 'WebGPU', ok: true }) + }) + + it.each([undefined, null, ''])('shows Detecting... before deck has a device (%s)', (type) => { + expect(renderBackendLabel(type)).toEqual({ text: 'Detecting...', ok: false }) + }) + + it('shows Unknown for an unrecognized device type', () => { + expect(renderBackendLabel('null')).toEqual({ text: 'Unknown', ok: false }) + }) +}) + +describe('gpuDeviceLabel', () => { + const render = { type: 'webgl', renderer: 'ANGLE (Intel, Mesa Intel(R) UHD Graphics 620)' } + + it('prefers the adapter device', () => { + expect(gpuDeviceLabel({ device: 'RTX 4090', description: 'desc', vendor: 'nvidia' }, render)).toBe('RTX 4090') + }) + + it('falls back to the adapter description', () => { + expect(gpuDeviceLabel({ description: 'Apple M2', vendor: 'apple' }, render)).toBe('Apple M2') + }) + + it('joins vendor and architecture when device and description are empty', () => { + expect(gpuDeviceLabel({ device: '', description: '', vendor: 'intel', architecture: 'gen-12lp' }, render)).toBe( + 'intel gen-12lp' + ) + }) + + it('uses vendor alone when architecture is missing', () => { + expect(gpuDeviceLabel({ vendor: 'amd' }, render)).toBe('amd') + }) + + it('uses architecture alone when vendor is missing', () => { + expect(gpuDeviceLabel({ architecture: 'rdna-3' }, render)).toBe('rdna-3') + }) + + it('falls back to the render device renderer string when the adapter offers nothing', () => { + expect(gpuDeviceLabel({}, render)).toBe('ANGLE (Intel, Mesa Intel(R) UHD Graphics 620)') + }) + + it('shows Unknown when neither the adapter nor the render device names the GPU', () => { + expect(gpuDeviceLabel({}, { type: 'webgl', renderer: '' })).toBe('Unknown') + expect(gpuDeviceLabel({}, null)).toBe('Unknown') + expect(gpuDeviceLabel(undefined, undefined)).toBe('Unknown') + }) +}) From cf860b792b969c5f20bc8a54f12ea1110c1d3dd2 Mon Sep 17 00:00:00 2001 From: Brad Stricherz Date: Sat, 7 Nov 2026 20:28:26 -0600 Subject: [PATCH 03/13] fix: show the deck.gl render device backend in the GPU panel (#8) RENDER now reads the luma.gl device type passed to deck's onDeviceInitialized instead of the WebGPU adapter tier, and the compute readout key becomes WEBGPU COMPUTE. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf --- src/components/GPUInfoPanel.jsx | 16 +++++++++------- src/components/MapView.jsx | 19 ++++++++++++++----- src/components/gpuLabels.js | 23 +++++++++++++++++++++++ 3 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 src/components/gpuLabels.js diff --git a/src/components/GPUInfoPanel.jsx b/src/components/GPUInfoPanel.jsx index 733b33d..79bd1eb 100644 --- a/src/components/GPUInfoPanel.jsx +++ b/src/components/GPUInfoPanel.jsx @@ -1,3 +1,5 @@ +import { renderBackendLabel, gpuDeviceLabel } from './gpuLabels.js' + function Sparkline({ history }) { if (!history || history.length === 0) return null @@ -47,12 +49,12 @@ function BenchmarkButton({ running, onRun }) { } export function GPUInfoPanel({ capabilities, benchmark = NO_BENCHMARK }) { - const { tier, adapterInfo, activePointCount, frameTime, frameHistory, gpuThroughput, heatmapComputeMs } = capabilities + const { tier, adapterInfo, renderDevice, activePointCount, frameTime, frameHistory, gpuThroughput, heatmapComputeMs } = + capabilities - const deviceLabel = - adapterInfo.device || adapterInfo.description || adapterInfo.vendor || adapterInfo.architecture || 'Unknown' - const renderLabel = - tier === 'no-webgpu' ? 'WebGL Fallback' : tier === 'unknown' ? 'Detecting...' : 'WebGPU' + const deviceLabel = gpuDeviceLabel(adapterInfo, renderDevice) + // RENDER is the backend deck.gl created; the WebGPU tier only gates compute. + const render = renderBackendLabel(renderDevice?.type) const isWebGPU = tier === 'webgpu' const frameClass = frameTime <= 16 ? 'ok' : frameTime <= 33 ? 'warn' : 'err' @@ -65,7 +67,7 @@ export function GPUInfoPanel({ capabilities, benchmark = NO_BENCHMARK }) { | RENDER - {renderLabel} + {render.text} | @@ -82,7 +84,7 @@ export function GPUInfoPanel({ capabilities, benchmark = NO_BENCHMARK }) { | - COMPUTE + WEBGPU COMPUTE {gpuThroughput} {/* navigator.gpu can exist with no adapter, so also require the detected tier. */} {benchmark.supported && isWebGPU ? ( diff --git a/src/components/MapView.jsx b/src/components/MapView.jsx index 97c9581..3a54513 100644 --- a/src/components/MapView.jsx +++ b/src/components/MapView.jsx @@ -11,8 +11,12 @@ import { useGPUCapabilities } from '../hooks/useGPUCapabilities.js' import { useGPUCompute } from '../hooks/useGPUCompute.js' import { GPUInfoPanel } from './GPUInfoPanel.jsx' -function DeckGLOverlay({ layers }) { - const overlay = useControl(() => new MapboxOverlay({ interleaved: false, useDevicePixels: false })) +function DeckGLOverlay({ layers, onDeviceInitialized }) { + // MapboxOverlay builds its Deck in onAdd from the constructor props, so the + // device callback must be passed here, not later through setProps. + const overlay = useControl( + () => new MapboxOverlay({ interleaved: false, useDevicePixels: false, onDeviceInitialized }) + ) overlay.setProps({ layers }) return null } @@ -45,6 +49,11 @@ function useFrameTime() { export function MapView({ layerData, heatmapComputeMs }) { const { viewport, setViewport, layerVisibility, setSelectedFeature } = useMapStore() const gpuBase = useGPUCapabilities() + const [renderDevice, setRenderDevice] = useState(null) + const onDeviceInitialized = useCallback( + (device) => setRenderDevice({ type: device.type, renderer: device.info?.renderer }), + [] + ) const { frameTime, frameHistory } = useFrameTime() const { throughput: gpuThroughput, supported: benchSupported, running: benchRunning, run: runBenchmark } = useGPUCompute() @@ -55,8 +64,8 @@ export function MapView({ layerData, heatmapComputeMs }) { (layerData.stressPoints?.length ?? 0) const capabilities = useMemo( - () => ({ ...gpuBase, activePointCount, frameTime, frameHistory, gpuThroughput, heatmapComputeMs }), - [gpuBase, activePointCount, frameTime, frameHistory, gpuThroughput, heatmapComputeMs] + () => ({ ...gpuBase, renderDevice, activePointCount, frameTime, frameHistory, gpuThroughput, heatmapComputeMs }), + [gpuBase, renderDevice, activePointCount, frameTime, frameHistory, gpuThroughput, heatmapComputeMs] ) const benchmark = useMemo( @@ -82,7 +91,7 @@ export function MapView({ layerData, heatmapComputeMs }) { mapStyle={BASEMAP_STYLE} onMove={(evt) => setViewport(evt.viewState)} > - +
diff --git a/src/components/gpuLabels.js b/src/components/gpuLabels.js new file mode 100644 index 0000000..26ad065 --- /dev/null +++ b/src/components/gpuLabels.js @@ -0,0 +1,23 @@ +// Pure label helpers for the GPU info panel (issue #8). + +const BACKEND_LABELS = { + webgl: 'WebGL2', // luma.gl's WebGL2 device reports type 'webgl' + webgl2: 'WebGL2', + webgpu: 'WebGPU', +} + +// RENDER names the luma.gl device type deck.gl actually created. It never +// looks at the WebGPU adapter tier. +export function renderBackendLabel(deviceType) { + if (!deviceType) return { text: 'Detecting...', ok: false } + const text = BACKEND_LABELS[deviceType] + return text ? { text, ok: true } : { text: 'Unknown', ok: false } +} + +// GPU names the adapter when WebGPU describes it, otherwise the renderer +// string of deck's render device (the unmasked WebGL renderer when exposed). +export function gpuDeviceLabel(adapterInfo, renderDevice) { + const info = adapterInfo ?? {} + const vendorArch = [info.vendor, info.architecture].filter(Boolean).join(' ') + return info.device || info.description || vendorArch || renderDevice?.renderer || 'Unknown' +} From 94d3959f129ca5a811e4fc28616695f770a82281 Mon Sep 17 00:00:00 2001 From: Brad Stricherz Date: Sat, 7 Nov 2026 20:28:26 -0600 Subject: [PATCH 04/13] docs: describe RENDER as the deck.gl backend and rename WEBGPU COMPUTE (#8) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8e1e9ee..ce465fd 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,14 @@ Built with React 19, Vite, MapLibre GL (through `react-map-gl`), deck.gl (`@deck - **Sea ports layer:** the bundled ports GeoJSON, drawn as green points. Click a point to see its properties. - **Heatmap layer (WebGPU only):** a two-pass compute shader bins airport positions into a 1024 x 512 grid and colorizes it into a bitmap overlay. It runs once, after the airports load. The layer toggle appears only after that compute succeeds, so it is hidden while airports load, when WebGPU is unavailable, and when the airports fetch or the compute fails. - **Stress test:** a slider from 0 to 5,000,000 points in steps of 100,000. Points are generated on the main thread 150 ms after the slider stops moving, then drawn as a deck.gl binary attribute layer. -- **GPU info panel:** adapter name, render tier (`WebGPU`, `WebGL Fallback`, or `Detecting...`), active point count, frame time with a 60-frame sparkline, an on-demand compute benchmark (press `RUN` next to COMPUTE: 5 sequential dispatches over a 64 MB storage buffer, reported as the median in GB/s, labelled `est.` because it is CPU timed, or `Too fast` when the timer is too coarse to measure it; out-of-memory, validation errors, and device loss show `Failed`; the buffer and device are freed when the run ends, and the run stops if the tab is hidden), and heatmap compute time. At 1024px wide or less it shows only the render tier, active point count, and frame time. On small screens (see below) it is hidden while a feature popup is open. +- **GPU info panel:** GPU name (the WebGPU adapter, or the WebGL renderer string when the adapter offers none), RENDER: the backend deck.gl actually draws with (`WebGL2`, `WebGPU`, or `Detecting...` until deck has created its device), active point count, frame time with a 60-frame sparkline, an on-demand WebGPU compute benchmark (press `RUN` next to WEBGPU COMPUTE: 5 sequential dispatches over a 64 MB storage buffer, reported as the median in GB/s, labelled `est.` because it is CPU timed, or `Too fast` when the timer is too coarse to measure it; out-of-memory, validation errors, and device loss show `Failed`; the buffer and device are freed when the run ends, and the run stops if the tab is hidden), and heatmap compute time. At 1024px wide or less it shows only RENDER, active point count, and frame time. On small screens (see below) it is hidden while a feature popup is open. - **Small screens** (640px wide or less, or up to 1024px wide and 500px tall or less): the layer panel starts collapsed behind a "Sensor layers" button, the header drops the coordinates and status, and the feature popup opens as a bottom sheet. ## Requirements - **Node.js:** current LTS (CI uses `lts/*`). Vite 8 needs Node 20.19+ or 22.12+. - **Browser:** any browser with WebGL 2 for the map and point layers. deck.gl draws through WebGL; WebGPU is used only for compute. -- **WebGPU (optional):** needed for the heatmap and the COMPUTE readout. Use a browser and GPU where `navigator.gpu.requestAdapter()` returns an adapter, for example current Chrome or Edge on desktop. Without it the app still runs: the panel shows `WebGL Fallback`, the heatmap toggle never appears, and on screens wider than 1024px COMPUTE shows `--`. +- **WebGPU (optional):** needed for the heatmap and the WEBGPU COMPUTE readout. Use a browser and GPU where `navigator.gpu.requestAdapter()` returns an adapter, for example current Chrome or Edge on desktop. Without it the app still runs: RENDER still shows `WebGL2` (deck.gl renders with WebGL either way), the heatmap toggle never appears, and on screens wider than 1024px WEBGPU COMPUTE shows `--`. - **Network access:** the basemap style and tiles come from CARTO and the airports CSV comes from GitHub at runtime. The ports data is bundled. ## Setup from a clean clone @@ -75,5 +75,5 @@ public/data/ports.geojson bundled ports data - The basemap needs CARTO to be reachable; offline, only the overlays draw. - The heatmap runs once per page load from the first non-empty airports list and does not update afterwards. - Stress points are generated on the main thread. Large counts (millions of points) briefly block the UI once the slider settles. -- The COMPUTE benchmark is CPU timed (submit to `onSubmittedWorkDone`), so it includes driver and callback latency and reads lower than the real memory bandwidth. The `RUN` control is hidden at 1024px wide or less along with the rest of COMPUTE. +- The WEBGPU COMPUTE benchmark is CPU timed (submit to `onSubmittedWorkDone`), so it includes driver and callback latency and reads lower than the real memory bandwidth. The `RUN` control is hidden at 1024px wide or less along with the rest of WEBGPU COMPUTE. - Unit tests run in jsdom, which has no WebGL or WebGPU. GPU code paths are covered by mocks and pure helpers only; check rendering in a real browser. From 33fe11ebbc0919b5d1faa0955dac8db28957460d Mon Sep 17 00:00:00 2001 From: Brad Stricherz Date: Sat, 7 Nov 2026 20:39:58 -0600 Subject: [PATCH 05/13] test: add failing test for RENDER label on prototype member names (#8) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf --- src/components/gpuLabels.protoKeys.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/components/gpuLabels.protoKeys.test.js diff --git a/src/components/gpuLabels.protoKeys.test.js b/src/components/gpuLabels.protoKeys.test.js new file mode 100644 index 0000000..b4c019c --- /dev/null +++ b/src/components/gpuLabels.protoKeys.test.js @@ -0,0 +1,13 @@ +import { describe, it, expect } from 'vitest' +import { renderBackendLabel } from './gpuLabels.js' + +// A device type that names an Object.prototype member must not resolve to +// that member: AC1 says any other non-empty type shows Unknown, not ok. +describe('renderBackendLabel with prototype member names', () => { + it.each(['__proto__', 'toString', 'constructor', 'hasOwnProperty', 'valueOf'])( + 'shows Unknown for %s', + (type) => { + expect(renderBackendLabel(type)).toEqual({ text: 'Unknown', ok: false }) + } + ) +}) From 3838b74f28116ba3afdaa9ef172a5b8fdab5b937 Mon Sep 17 00:00:00 2001 From: Brad Stricherz Date: Sat, 7 Nov 2026 20:40:08 -0600 Subject: [PATCH 06/13] fix: look up RENDER backend labels in a Map so prototype names show Unknown (#8) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf --- .../2026-11-07-issue-8-gpu-panel-render-backend.md | 5 +++-- src/components/gpuLabels.js | 13 +++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md b/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md index 7f2caf0..2fbb0f2 100644 --- a/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md +++ b/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md @@ -16,7 +16,7 @@ Report the truth. Do not wire WebGPU rendering. RENDER reads the device type dec ## Acceptance criteria -1. RENDER shows the backend deck.gl actually uses: the luma.gl device type passed to deck's `onDeviceInitialized` callback. `webgl` (luma.gl's WebGL2 device; `webgl2` is accepted as an alias) shows `WebGL2`, `webgpu` shows `WebGPU`. Before deck has initialized its device, RENDER shows `Detecting...`. Any other non-empty type shows `Unknown`. +1. RENDER shows the backend deck.gl actually uses: the luma.gl device type passed to deck's `onDeviceInitialized` callback. `webgl` (luma.gl's WebGL2 device; `webgl2` is accepted as an alias) shows `WebGL2`, `webgpu` shows `WebGPU`. Before deck has initialized its device, RENDER shows `Detecting...`. Any other non-empty type shows `Unknown`, including names of `Object.prototype` members such as `__proto__`, `toString`, and `constructor` (the lookup is a `Map`, not a plain object). 2. The WebGPU adapter tier (`webgpu`, `no-webgpu`, `unknown`) never decides the RENDER text. With tier `webgpu` and a `webgl` device, RENDER shows `WebGL2`. The strings `WebGL Fallback` and the tier-derived `WebGPU` RENDER label are gone. 3. RENDER value class: `ok` when the device type is `webgl`/`webgl2`/`webgpu`, `warn` while detecting or unknown. 4. The compute item's key reads `WEBGPU COMPUTE` (was `COMPUTE`), so WebGPU compute availability reads apart from RENDER. Its behavior from #11 is unchanged: `--` and no RUN button unless the tier is `webgpu` and the benchmark is supported; the RUN button's accessible name stays `Run compute benchmark`; the value stays a polite live region. @@ -29,6 +29,7 @@ Report the truth. Do not wire WebGPU rendering. RENDER reads the device type dec - `src/components/gpuLabels.js` (new): pure helpers `renderBackendLabel(deviceType)` returning `{ text, ok }` (or two functions, implementer's choice), and `gpuDeviceLabel(adapterInfo, renderInfo)`. No React. - `src/components/gpuLabels.test.js` (new): unit tests for both helpers (AC1, AC5). +- `src/components/gpuLabels.protoKeys.test.js` (new, review fix B1): `renderBackendLabel` returns `Unknown`, not ok, for prototype member names (AC1). - `src/components/GPUInfoPanel.jsx`: read `renderDevice` from `capabilities` (`{ type, renderer }` or null/undefined; must be optional so existing tests that omit it render `Detecting...`). RENDER text and class from `renderBackendLabel(renderDevice?.type)`. GPU text from `gpuDeviceLabel(adapterInfo, renderDevice)`. Compute key text `WEBGPU COMPUTE`. `isWebGPU` (tier) keeps gating only the RUN button. - `src/components/GPUInfoPanel.test.jsx` and `src/components/GPUInfoPanel.benchmarkTier.test.jsx`: change `getByText('COMPUTE')` lookups and the `'COMPUTE'` entry in the secondary-key loop to `'WEBGPU COMPUTE'`; add panel tests for AC1 to AC3 (incl. tier `webgpu` + device `webgl`). - `src/components/MapView.jsx`: `const [renderDevice, setRenderDevice] = useState(null)`. A stable `useCallback` `(device) => setRenderDevice({ type: device.type, renderer: device.info?.renderer })`. `DeckGLOverlay` takes `onDeviceInitialized` and passes it in the `MapboxOverlay` constructor props (the overlay creates its `Deck` in `onAdd` from those props, so it must be there at construction; `setProps({ layers })` keeps it). Add `renderDevice` to the `capabilities` memo and its deps. @@ -58,7 +59,7 @@ Report the truth. Do not wire WebGPU rendering. RENDER reads the device type dec ## Proof -- AC1, AC3, AC5: `src/components/gpuLabels.test.js` and the new panel tests. +- AC1, AC3, AC5: `src/components/gpuLabels.test.js`, `src/components/gpuLabels.protoKeys.test.js`, and the new panel tests. - AC2: panel test with tier `webgpu` and device `webgl`. - AC4, AC7: existing panel and benchmark tier tests (key text updated), `src/styles.test.js`. - AC6: `src/components/MapView.test.jsx`. diff --git a/src/components/gpuLabels.js b/src/components/gpuLabels.js index 26ad065..42bacef 100644 --- a/src/components/gpuLabels.js +++ b/src/components/gpuLabels.js @@ -1,16 +1,17 @@ // Pure label helpers for the GPU info panel (issue #8). -const BACKEND_LABELS = { - webgl: 'WebGL2', // luma.gl's WebGL2 device reports type 'webgl' - webgl2: 'WebGL2', - webgpu: 'WebGPU', -} +// A Map, not a plain object, so names like '__proto__' or 'toString' miss. +const BACKEND_LABELS = new Map([ + ['webgl', 'WebGL2'], // luma.gl's WebGL2 device reports type 'webgl' + ['webgl2', 'WebGL2'], + ['webgpu', 'WebGPU'], +]) // RENDER names the luma.gl device type deck.gl actually created. It never // looks at the WebGPU adapter tier. export function renderBackendLabel(deviceType) { if (!deviceType) return { text: 'Detecting...', ok: false } - const text = BACKEND_LABELS[deviceType] + const text = BACKEND_LABELS.get(deviceType) return text ? { text, ok: true } : { text: 'Unknown', ok: false } } From a069c25f10463a6c790ba59e453440031754cfd5 Mon Sep 17 00:00:00 2001 From: Brad Stricherz Date: Sat, 7 Nov 2026 20:40:27 -0600 Subject: [PATCH 07/13] test: add failing tests for the GPU panel clearing the feature popup (#8) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf --- src/components/GPUInfoPanel.gpuName.test.jsx | 34 ++++++++++++++ src/styles.test.js | 48 ++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 src/components/GPUInfoPanel.gpuName.test.jsx diff --git a/src/components/GPUInfoPanel.gpuName.test.jsx b/src/components/GPUInfoPanel.gpuName.test.jsx new file mode 100644 index 0000000..b28ff07 --- /dev/null +++ b/src/components/GPUInfoPanel.gpuName.test.jsx @@ -0,0 +1,34 @@ +import { describe, it, expect } from 'vitest' +import { render, screen } from '@testing-library/react' +import { GPUInfoPanel } from './GPUInfoPanel.jsx' + +// The GPU name can be a ~90 character WebGL renderer string. It is truncated +// by CSS (gpu-info-name) so the panel clears the feature popup, and the full +// name stays readable in the title attribute. +const RENDERER = 'ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero) (0x0000C0DE)), SwiftShader driver)' +const base = { + tier: 'no-webgpu', + adapterInfo: {}, + renderDevice: { type: 'webgl', renderer: RENDERER }, + activePointCount: 0, + frameTime: 16, + frameHistory: [], + gpuThroughput: '--', +} + +describe('GPUInfoPanel GPU name', () => { + const gpuVal = () => screen.getByText('GPU').closest('.gpu-info-item').querySelector('.gpu-info-val') + + it('marks the GPU value for truncation and keeps the full name in title', () => { + render() + expect(gpuVal()).toHaveClass('gpu-info-name') + expect(gpuVal()).toHaveAttribute('title', RENDERER) + expect(gpuVal()).toHaveTextContent(RENDERER) + }) + + it('titles a short adapter name too', () => { + render() + expect(gpuVal()).toHaveClass('gpu-info-name') + expect(gpuVal()).toHaveAttribute('title', 'RTX 4090') + }) +}) diff --git a/src/styles.test.js b/src/styles.test.js index d33be0c..60d41df 100644 --- a/src/styles.test.js +++ b/src/styles.test.js @@ -295,3 +295,51 @@ describe('reduced motion (WCAG 2.3.3)', () => { expect(d.transition).toBe('none !important') }) }) + +// Rules outside every @media block: what applies above 1024px wide. +function topLevelCss() { + let out = '' + let i = 0 + while (i < css.length) { + const at = css.indexOf('@media', i) + if (at === -1) return out + css.slice(i) + out += css.slice(i, at) + let depth = 0 + let j = css.indexOf('{', at) + for (; j < css.length; j++) { + if (css[j] === '{') depth++ + else if (css[j] === '}' && --depth === 0) break + } + i = j + 1 + } + return out +} + +function topLevelRule(selector) { + const found = innermostRules(topLevelCss()).filter((r) => r.selector === selector) + if (found.length === 0) throw new Error(`top-level rule not found: ${selector}`) + return found.map((r) => declarations(r.body)).reduce((a, b) => ({ ...a, ...b }), {}) +} + +// Issue #8: a long GPU name (the WebGL renderer string) must not stretch the +// panel over the 288px feature popup at left: 20px. +describe('GPU panel clears the feature popup above 1024px', () => { + it('truncates the GPU name with an ellipsis', () => { + const d = topLevelRule('.gpu-info-name') + expect(d['white-space']).toBe('nowrap') + expect(d.overflow).toBe('hidden') + expect(d['text-overflow']).toBe('ellipsis') + expect(d['max-width']).toBe('32ch') + }) + + it('caps the panel width so it never reaches the popup right edge', () => { + expect(topLevelRule('.gpu-info-panel')['max-width']).toBe('calc(100vw - 340px)') + }) + + it('keeps the 1024px and 640px panel widths from issue #5', () => { + const tablet = innermostRules(mediaBlock('@media (max-width: 1024px)')).find((r) => r.selector === '.gpu-info-panel') + expect(declarations(tablet.body)['max-width']).toBe('calc(100vw - 340px)') + const narrow = innermostRules(mediaBlock('@media (max-width: 640px)')).find((r) => r.selector === '.gpu-info-panel') + expect(declarations(narrow.body)['max-width']).toBe('calc(100vw - 32px)') + }) +}) From c1f955168c4fe12959f9996f93bd86a9c46e5f0a Mon Sep 17 00:00:00 2001 From: Brad Stricherz Date: Sat, 7 Nov 2026 20:40:50 -0600 Subject: [PATCH 08/13] fix: truncate the GPU name and cap the panel width so it clears the popup (#8) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf --- .../2026-11-07-issue-8-gpu-panel-render-backend.md | 10 +++++++--- src/components/GPUInfoPanel.jsx | 4 +++- src/index.css | 12 +++++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md b/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md index 2fbb0f2..980b314 100644 --- a/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md +++ b/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md @@ -20,9 +20,9 @@ Report the truth. Do not wire WebGPU rendering. RENDER reads the device type dec 2. The WebGPU adapter tier (`webgpu`, `no-webgpu`, `unknown`) never decides the RENDER text. With tier `webgpu` and a `webgl` device, RENDER shows `WebGL2`. The strings `WebGL Fallback` and the tier-derived `WebGPU` RENDER label are gone. 3. RENDER value class: `ok` when the device type is `webgl`/`webgl2`/`webgpu`, `warn` while detecting or unknown. 4. The compute item's key reads `WEBGPU COMPUTE` (was `COMPUTE`), so WebGPU compute availability reads apart from RENDER. Its behavior from #11 is unchanged: `--` and no RUN button unless the tier is `webgpu` and the benchmark is supported; the RUN button's accessible name stays `Run compute benchmark`; the value stays a polite live region. -5. GPU label, in order: adapter `device`, then adapter `description`; if both are empty, adapter `vendor` and `architecture` joined with a space (either alone if only one is set); if the adapter offers none of those, the render device's `info.renderer` from deck's device (luma.gl `device.info.renderer`, the unmasked WebGL renderer string when exposed); otherwise `Unknown`. +5. GPU label, in order: adapter `device`, then adapter `description`; if both are empty, adapter `vendor` and `architecture` joined with a space (either alone if only one is set); if the adapter offers none of those, the render device's `info.renderer` from deck's device (luma.gl `device.info.renderer`, the unmasked WebGL renderer string when exposed); otherwise `Unknown`. The GPU value carries class `gpu-info-name`, which truncates it with an ellipsis at 32ch, and a `title` attribute with the full name, because the renderer string can be about 90 characters. 6. Unit tests cover: RENDER for `webgl`, `webgl2`, and `webgpu` device types; the not-yet-initialized state (`Detecting...`); an unrecognized type; tier `webgpu` with device `webgl` still showing `WebGL2`; each GPU label fallback step. A MapView wiring test (with `react-map-gl/maplibre`, `@deck.gl/mapbox`, and the GPU hooks mocked) shows `Detecting...` first, then `WebGL2` after the overlay's `onDeviceInitialized` is called with `{ type: 'webgl' }`, proving the callback is passed to the `MapboxOverlay` constructor. -7. Prior work preserved: all other existing tests pass; tests that looked up the `COMPUTE` key text are updated only for the new key text. At 1024px wide or less the panel shows only RENDER, PTS, FRAME. At 375x812, 768x1024, and 1440x900 the panel stays inside the viewport and does not overlap the header, the layer panel, or an open popup at 768. No new `color:` rule unless it is added to `src/styles.test.js`'s `TEXT_PAIRS`. +7. Prior work preserved: all other existing tests pass; tests that looked up the `COMPUTE` key text are updated only for the new key text. At 1024px wide or less the panel shows only RENDER, PTS, FRAME. At 375x812, 768x1024, and 1440x900 the panel stays inside the viewport and does not overlap the header, the layer panel, or an open popup at 768. At every width over 1024px the panel does not overlap an open feature popup whatever the GPU label length: the panel's top-level `max-width` is `calc(100vw - 340px)` (the 1024px rule already used it; the 640px narrow rule keeps `calc(100vw - 32px)`). No new `color:` rule unless it is added to `src/styles.test.js`'s `TEXT_PAIRS`. 8. README's GPU info panel bullet and Requirements text describe RENDER as the deck.gl backend (`WebGL2`, `WebGPU`, or `Detecting...`) and no longer say the panel shows `WebGL Fallback`; references to the COMPUTE key use `WEBGPU COMPUTE`. ## Files that change @@ -30,7 +30,10 @@ Report the truth. Do not wire WebGPU rendering. RENDER reads the device type dec - `src/components/gpuLabels.js` (new): pure helpers `renderBackendLabel(deviceType)` returning `{ text, ok }` (or two functions, implementer's choice), and `gpuDeviceLabel(adapterInfo, renderInfo)`. No React. - `src/components/gpuLabels.test.js` (new): unit tests for both helpers (AC1, AC5). - `src/components/gpuLabels.protoKeys.test.js` (new, review fix B1): `renderBackendLabel` returns `Unknown`, not ok, for prototype member names (AC1). -- `src/components/GPUInfoPanel.jsx`: read `renderDevice` from `capabilities` (`{ type, renderer }` or null/undefined; must be optional so existing tests that omit it render `Detecting...`). RENDER text and class from `renderBackendLabel(renderDevice?.type)`. GPU text from `gpuDeviceLabel(adapterInfo, renderDevice)`. Compute key text `WEBGPU COMPUTE`. `isWebGPU` (tier) keeps gating only the RUN button. +- `src/index.css` (review fix B2): new `.gpu-info-name` rule (nowrap, hidden overflow, ellipsis, `max-width: 32ch`, no `color:`), and the top-level `.gpu-info-panel` `max-width` becomes `calc(100vw - 340px)`. +- `src/styles.test.js` (review fix B2): asserts the `.gpu-info-name` declarations, the top-level panel `max-width`, and that the 1024px and 640px panel widths from #5 are unchanged. +- `src/components/GPUInfoPanel.gpuName.test.jsx` (new, review fix B2): the GPU value has class `gpu-info-name` and the full name in `title`. +- `src/components/GPUInfoPanel.jsx`: read `renderDevice` from `capabilities` (`{ type, renderer }` or null/undefined; must be optional so existing tests that omit it render `Detecting...`). RENDER text and class from `renderBackendLabel(renderDevice?.type)`. GPU text from `gpuDeviceLabel(adapterInfo, renderDevice)`, in a value span with class `gpu-info-name` and `title` set to the full name. Compute key text `WEBGPU COMPUTE`. `isWebGPU` (tier) keeps gating only the RUN button. - `src/components/GPUInfoPanel.test.jsx` and `src/components/GPUInfoPanel.benchmarkTier.test.jsx`: change `getByText('COMPUTE')` lookups and the `'COMPUTE'` entry in the secondary-key loop to `'WEBGPU COMPUTE'`; add panel tests for AC1 to AC3 (incl. tier `webgpu` + device `webgl`). - `src/components/MapView.jsx`: `const [renderDevice, setRenderDevice] = useState(null)`. A stable `useCallback` `(device) => setRenderDevice({ type: device.type, renderer: device.info?.renderer })`. `DeckGLOverlay` takes `onDeviceInitialized` and passes it in the `MapboxOverlay` constructor props (the overlay creates its `Deck` in `onAdd` from those props, so it must be there at construction; `setProps({ layers })` keeps it). Add `renderDevice` to the `capabilities` memo and its deps. - `src/components/MapView.test.jsx` (new): wiring test of AC6. Mock `react-map-gl/maplibre` (`Map` renders children; `useControl(factory)` calls the factory once and returns its result), mock `@deck.gl/mapbox` `MapboxOverlay` as a class that records its constructor props and has `setProps`, mock `maplibre-gl/dist/maplibre-gl.css` and `../config/maplibreWorker.js` if needed, mock `useGPUCapabilities` and `useGPUCompute`. Call the recorded `onDeviceInitialized` inside `act` and assert RENDER. @@ -62,5 +65,6 @@ Report the truth. Do not wire WebGPU rendering. RENDER reads the device type dec - AC1, AC3, AC5: `src/components/gpuLabels.test.js`, `src/components/gpuLabels.protoKeys.test.js`, and the new panel tests. - AC2: panel test with tier `webgpu` and device `webgl`. - AC4, AC7: existing panel and benchmark tier tests (key text updated), `src/styles.test.js`. +- AC5 truncation and AC7 popup clearance: `src/components/GPUInfoPanel.gpuName.test.jsx` and `src/styles.test.js`; live drive at 1440x900 and 1025x800 with a feature popup open measures the panel and popup rects. - AC6: `src/components/MapView.test.jsx`. - Live drive: `npm run build && npm run preview`; in the browser RENDER shows `WebGL2`, and the console shows the deck canvas holds a `webgl2` context (for example `[...document.querySelectorAll('canvas')].map(c => !!c.getContext('webgl2'))` all true, and no `webgpu` context) matching the label. Note: headless Chromium has no WebGPU adapter and the user's Chrome returns null from `requestAdapter()`, so the tier is `no-webgpu` there; WEBGPU COMPUTE shows `--` with no RUN button. GPU label shows the WebGL renderer string when the adapter offers nothing. Re-measure layout at 375x812, 768x1024, 1440x900. diff --git a/src/components/GPUInfoPanel.jsx b/src/components/GPUInfoPanel.jsx index 79bd1eb..26c605f 100644 --- a/src/components/GPUInfoPanel.jsx +++ b/src/components/GPUInfoPanel.jsx @@ -62,7 +62,9 @@ export function GPUInfoPanel({ capabilities, benchmark = NO_BENCHMARK }) {
GPU - {deviceLabel} + + {deviceLabel} + | diff --git a/src/index.css b/src/index.css index b3801ea..140e9e9 100644 --- a/src/index.css +++ b/src/index.css @@ -595,7 +595,9 @@ body::before { font-size: 10px; letter-spacing: 0.11em; pointer-events: none; - max-width: calc(100vw - 32px); + /* Keep clear of the 288px popup at left: 20px at every width; the + narrow-screen block below widens it again, where the popup is a sheet. */ + max-width: calc(100vw - 340px); flex-wrap: wrap; row-gap: 4px; } @@ -637,6 +639,14 @@ body::before { color: var(--red); } +/* The GPU name can be a long WebGL renderer string; the full text is in title. */ +.gpu-info-name { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 32ch; +} + .gpu-info-sep { color: var(--text-dim); } From 264840acba5dfc37b4882753325c1037fb7d4fa9 Mon Sep 17 00:00:00 2001 From: Brad Stricherz Date: Sat, 7 Nov 2026 20:44:56 -0600 Subject: [PATCH 09/13] test: add failing test for the GPU name tooltip taking the pointer (#8) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf --- src/styles.gpuPanel.test.js | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/styles.gpuPanel.test.js diff --git a/src/styles.gpuPanel.test.js b/src/styles.gpuPanel.test.js new file mode 100644 index 0000000..28b24fd --- /dev/null +++ b/src/styles.gpuPanel.test.js @@ -0,0 +1,53 @@ +import { describe, it, expect } from 'vitest' +import { readFileSync } from 'node:fs' +import { fileURLToPath } from 'node:url' +import { dirname, resolve } from 'node:path' + +// GPU info panel rules that apply above 1024px (outside every @media block). +const here = dirname(fileURLToPath(import.meta.url)) +const css = readFileSync(resolve(here, 'index.css'), 'utf8').replace(/\/\*[\s\S]*?\*\//g, '') + +function topLevelCss() { + let out = '' + let i = 0 + while (i < css.length) { + const at = css.indexOf('@media', i) + if (at === -1) return out + css.slice(i) + out += css.slice(i, at) + let depth = 0 + let j = css.indexOf('{', at) + for (; j < css.length; j++) { + if (css[j] === '{') depth++ + else if (css[j] === '}' && --depth === 0) break + } + i = j + 1 + } + return out +} + +function topLevelRule(selector) { + const decls = {} + const re = /([^{}]+)\{([^{}]*)\}/g + let m + let found = false + while ((m = re.exec(topLevelCss())) !== null) { + if (m[1].trim().replace(/\s+/g, ' ') !== selector) continue + found = true + for (const part of m[2].split(';')) { + const idx = part.indexOf(':') + if (idx !== -1) decls[part.slice(0, idx).trim()] = part.slice(idx + 1).trim() + } + } + if (!found) throw new Error(`top-level rule not found: ${selector}`) + return decls +} + +describe('GPU name tooltip', () => { + it('keeps the panel transparent to the pointer', () => { + expect(topLevelRule('.gpu-info-panel')['pointer-events']).toBe('none') + }) + + it('lets the truncated GPU name take the pointer so its title shows on hover', () => { + expect(topLevelRule('.gpu-info-name')['pointer-events']).toBe('auto') + }) +}) From 212cde31c6de4f7be7f8cd4730876327e9f2f419 Mon Sep 17 00:00:00 2001 From: Brad Stricherz Date: Sat, 7 Nov 2026 20:44:59 -0600 Subject: [PATCH 10/13] fix: let the truncated GPU name take the pointer so its title shows (#8) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf --- docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md | 5 +++-- src/index.css | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md b/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md index 980b314..5bee7b7 100644 --- a/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md +++ b/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md @@ -20,7 +20,7 @@ Report the truth. Do not wire WebGPU rendering. RENDER reads the device type dec 2. The WebGPU adapter tier (`webgpu`, `no-webgpu`, `unknown`) never decides the RENDER text. With tier `webgpu` and a `webgl` device, RENDER shows `WebGL2`. The strings `WebGL Fallback` and the tier-derived `WebGPU` RENDER label are gone. 3. RENDER value class: `ok` when the device type is `webgl`/`webgl2`/`webgpu`, `warn` while detecting or unknown. 4. The compute item's key reads `WEBGPU COMPUTE` (was `COMPUTE`), so WebGPU compute availability reads apart from RENDER. Its behavior from #11 is unchanged: `--` and no RUN button unless the tier is `webgpu` and the benchmark is supported; the RUN button's accessible name stays `Run compute benchmark`; the value stays a polite live region. -5. GPU label, in order: adapter `device`, then adapter `description`; if both are empty, adapter `vendor` and `architecture` joined with a space (either alone if only one is set); if the adapter offers none of those, the render device's `info.renderer` from deck's device (luma.gl `device.info.renderer`, the unmasked WebGL renderer string when exposed); otherwise `Unknown`. The GPU value carries class `gpu-info-name`, which truncates it with an ellipsis at 32ch, and a `title` attribute with the full name, because the renderer string can be about 90 characters. +5. GPU label, in order: adapter `device`, then adapter `description`; if both are empty, adapter `vendor` and `architecture` joined with a space (either alone if only one is set); if the adapter offers none of those, the render device's `info.renderer` from deck's device (luma.gl `device.info.renderer`, the unmasked WebGL renderer string when exposed); otherwise `Unknown`. The GPU value carries class `gpu-info-name`, which truncates it with an ellipsis at 32ch, and a `title` attribute with the full name, because the renderer string can be about 90 characters. The panel keeps `pointer-events: none`; `.gpu-info-name` sets `pointer-events: auto` so the title tooltip shows on hover. 6. Unit tests cover: RENDER for `webgl`, `webgl2`, and `webgpu` device types; the not-yet-initialized state (`Detecting...`); an unrecognized type; tier `webgpu` with device `webgl` still showing `WebGL2`; each GPU label fallback step. A MapView wiring test (with `react-map-gl/maplibre`, `@deck.gl/mapbox`, and the GPU hooks mocked) shows `Detecting...` first, then `WebGL2` after the overlay's `onDeviceInitialized` is called with `{ type: 'webgl' }`, proving the callback is passed to the `MapboxOverlay` constructor. 7. Prior work preserved: all other existing tests pass; tests that looked up the `COMPUTE` key text are updated only for the new key text. At 1024px wide or less the panel shows only RENDER, PTS, FRAME. At 375x812, 768x1024, and 1440x900 the panel stays inside the viewport and does not overlap the header, the layer panel, or an open popup at 768. At every width over 1024px the panel does not overlap an open feature popup whatever the GPU label length: the panel's top-level `max-width` is `calc(100vw - 340px)` (the 1024px rule already used it; the 640px narrow rule keeps `calc(100vw - 32px)`). No new `color:` rule unless it is added to `src/styles.test.js`'s `TEXT_PAIRS`. 8. README's GPU info panel bullet and Requirements text describe RENDER as the deck.gl backend (`WebGL2`, `WebGPU`, or `Detecting...`) and no longer say the panel shows `WebGL Fallback`; references to the COMPUTE key use `WEBGPU COMPUTE`. @@ -31,6 +31,7 @@ Report the truth. Do not wire WebGPU rendering. RENDER reads the device type dec - `src/components/gpuLabels.test.js` (new): unit tests for both helpers (AC1, AC5). - `src/components/gpuLabels.protoKeys.test.js` (new, review fix B1): `renderBackendLabel` returns `Unknown`, not ok, for prototype member names (AC1). - `src/index.css` (review fix B2): new `.gpu-info-name` rule (nowrap, hidden overflow, ellipsis, `max-width: 32ch`, no `color:`), and the top-level `.gpu-info-panel` `max-width` becomes `calc(100vw - 340px)`. +- `src/styles.gpuPanel.test.js` (new, review fix F1): the panel keeps `pointer-events: none` and `.gpu-info-name` has `pointer-events: auto`. - `src/styles.test.js` (review fix B2): asserts the `.gpu-info-name` declarations, the top-level panel `max-width`, and that the 1024px and 640px panel widths from #5 are unchanged. - `src/components/GPUInfoPanel.gpuName.test.jsx` (new, review fix B2): the GPU value has class `gpu-info-name` and the full name in `title`. - `src/components/GPUInfoPanel.jsx`: read `renderDevice` from `capabilities` (`{ type, renderer }` or null/undefined; must be optional so existing tests that omit it render `Detecting...`). RENDER text and class from `renderBackendLabel(renderDevice?.type)`. GPU text from `gpuDeviceLabel(adapterInfo, renderDevice)`, in a value span with class `gpu-info-name` and `title` set to the full name. Compute key text `WEBGPU COMPUTE`. `isWebGPU` (tier) keeps gating only the RUN button. @@ -65,6 +66,6 @@ Report the truth. Do not wire WebGPU rendering. RENDER reads the device type dec - AC1, AC3, AC5: `src/components/gpuLabels.test.js`, `src/components/gpuLabels.protoKeys.test.js`, and the new panel tests. - AC2: panel test with tier `webgpu` and device `webgl`. - AC4, AC7: existing panel and benchmark tier tests (key text updated), `src/styles.test.js`. -- AC5 truncation and AC7 popup clearance: `src/components/GPUInfoPanel.gpuName.test.jsx` and `src/styles.test.js`; live drive at 1440x900 and 1025x800 with a feature popup open measures the panel and popup rects. +- AC5 truncation, tooltip, and AC7 popup clearance: `src/components/GPUInfoPanel.gpuName.test.jsx`, `src/styles.test.js`, and `src/styles.gpuPanel.test.js`; live drive at 1440x900 and 1025x800 with a feature popup open measures the panel and popup rects. - AC6: `src/components/MapView.test.jsx`. - Live drive: `npm run build && npm run preview`; in the browser RENDER shows `WebGL2`, and the console shows the deck canvas holds a `webgl2` context (for example `[...document.querySelectorAll('canvas')].map(c => !!c.getContext('webgl2'))` all true, and no `webgpu` context) matching the label. Note: headless Chromium has no WebGPU adapter and the user's Chrome returns null from `requestAdapter()`, so the tier is `no-webgpu` there; WEBGPU COMPUTE shows `--` with no RUN button. GPU label shows the WebGL renderer string when the adapter offers nothing. Re-measure layout at 375x812, 768x1024, 1440x900. diff --git a/src/index.css b/src/index.css index 140e9e9..25d0abf 100644 --- a/src/index.css +++ b/src/index.css @@ -639,8 +639,10 @@ body::before { color: var(--red); } -/* The GPU name can be a long WebGL renderer string; the full text is in title. */ +/* The GPU name can be a long WebGL renderer string; the full text is in title. + It opts back into pointer input (the panel ignores it) so the title shows on hover. */ .gpu-info-name { + pointer-events: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; From 8e04e05f13deff3a2608a92d3d52e06c7b283854 Mon Sep 17 00:00:00 2001 From: Brad Stricherz Date: Sat, 7 Nov 2026 20:45:23 -0600 Subject: [PATCH 11/13] test: add failing test for GPU panel separators above 1024px (#8) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf --- src/styles.gpuSeparators.test.js | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/styles.gpuSeparators.test.js diff --git a/src/styles.gpuSeparators.test.js b/src/styles.gpuSeparators.test.js new file mode 100644 index 0000000..883713e --- /dev/null +++ b/src/styles.gpuSeparators.test.js @@ -0,0 +1,56 @@ +import { describe, it, expect } from 'vitest' +import { readFileSync } from 'node:fs' +import { fileURLToPath } from 'node:url' +import { dirname, resolve } from 'node:path' + +// GPU info panel rules that apply above 1024px (outside every @media block). +// With the 340px width cap the panel can wrap above 1024px too, so a wrapped +// row must never start or end with a | separator (the approach #5 used at +// 1024px and below). +const here = dirname(fileURLToPath(import.meta.url)) +const css = readFileSync(resolve(here, 'index.css'), 'utf8').replace(/\/\*[\s\S]*?\*\//g, '') + +function topLevelCss() { + let out = '' + let i = 0 + while (i < css.length) { + const at = css.indexOf('@media', i) + if (at === -1) return out + css.slice(i) + out += css.slice(i, at) + let depth = 0 + let j = css.indexOf('{', at) + for (; j < css.length; j++) { + if (css[j] === '{') depth++ + else if (css[j] === '}' && --depth === 0) break + } + i = j + 1 + } + return out +} + +function topLevelRule(selector) { + const decls = {} + const re = /([^{}]+)\{([^{}]*)\}/g + let m + let found = false + while ((m = re.exec(topLevelCss())) !== null) { + if (m[1].trim().replace(/\s+/g, ' ') !== selector) continue + found = true + for (const part of m[2].split(';')) { + const idx = part.indexOf(':') + if (idx !== -1) decls[part.slice(0, idx).trim()] = part.slice(idx + 1).trim() + } + } + if (!found) throw new Error(`top-level rule not found: ${selector}`) + return decls +} + +describe('GPU panel separators at every width', () => { + it('hides the | separators', () => { + expect(topLevelRule('.gpu-info-sep').display).toBe('none') + }) + + it('spaces items with a 14px column gap instead', () => { + expect(topLevelRule('.gpu-info-panel')['column-gap']).toBe('14px') + }) +}) From 886f4cfff316ae7c1a9245388096406ff302a332 Mon Sep 17 00:00:00 2001 From: Brad Stricherz Date: Sat, 7 Nov 2026 20:45:25 -0600 Subject: [PATCH 12/13] fix: hide GPU panel separators at every width so wrapped rows stay clean (#8) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf --- docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md | 6 ++++-- src/index.css | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md b/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md index 5bee7b7..0fadbea 100644 --- a/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md +++ b/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md @@ -22,7 +22,7 @@ Report the truth. Do not wire WebGPU rendering. RENDER reads the device type dec 4. The compute item's key reads `WEBGPU COMPUTE` (was `COMPUTE`), so WebGPU compute availability reads apart from RENDER. Its behavior from #11 is unchanged: `--` and no RUN button unless the tier is `webgpu` and the benchmark is supported; the RUN button's accessible name stays `Run compute benchmark`; the value stays a polite live region. 5. GPU label, in order: adapter `device`, then adapter `description`; if both are empty, adapter `vendor` and `architecture` joined with a space (either alone if only one is set); if the adapter offers none of those, the render device's `info.renderer` from deck's device (luma.gl `device.info.renderer`, the unmasked WebGL renderer string when exposed); otherwise `Unknown`. The GPU value carries class `gpu-info-name`, which truncates it with an ellipsis at 32ch, and a `title` attribute with the full name, because the renderer string can be about 90 characters. The panel keeps `pointer-events: none`; `.gpu-info-name` sets `pointer-events: auto` so the title tooltip shows on hover. 6. Unit tests cover: RENDER for `webgl`, `webgl2`, and `webgpu` device types; the not-yet-initialized state (`Detecting...`); an unrecognized type; tier `webgpu` with device `webgl` still showing `WebGL2`; each GPU label fallback step. A MapView wiring test (with `react-map-gl/maplibre`, `@deck.gl/mapbox`, and the GPU hooks mocked) shows `Detecting...` first, then `WebGL2` after the overlay's `onDeviceInitialized` is called with `{ type: 'webgl' }`, proving the callback is passed to the `MapboxOverlay` constructor. -7. Prior work preserved: all other existing tests pass; tests that looked up the `COMPUTE` key text are updated only for the new key text. At 1024px wide or less the panel shows only RENDER, PTS, FRAME. At 375x812, 768x1024, and 1440x900 the panel stays inside the viewport and does not overlap the header, the layer panel, or an open popup at 768. At every width over 1024px the panel does not overlap an open feature popup whatever the GPU label length: the panel's top-level `max-width` is `calc(100vw - 340px)` (the 1024px rule already used it; the 640px narrow rule keeps `calc(100vw - 32px)`). No new `color:` rule unless it is added to `src/styles.test.js`'s `TEXT_PAIRS`. +7. Prior work preserved: all other existing tests pass; tests that looked up the `COMPUTE` key text are updated only for the new key text. At 1024px wide or less the panel shows only RENDER, PTS, FRAME. At 375x812, 768x1024, and 1440x900 the panel stays inside the viewport and does not overlap the header, the layer panel, or an open popup at 768. At every width over 1024px the panel does not overlap an open feature popup whatever the GPU label length: the panel's top-level `max-width` is `calc(100vw - 340px)` (the 1024px rule already used it; the 640px narrow rule keeps `calc(100vw - 32px)`). Because that cap can wrap the panel above 1024px, the `|` separators are hidden at every width (kept in the DOM) and items are spaced by `column-gap: 14px`, as #5 already did at 1024px and below, so a wrapped row never starts or ends with a separator. No new `color:` rule unless it is added to `src/styles.test.js`'s `TEXT_PAIRS`. 8. README's GPU info panel bullet and Requirements text describe RENDER as the deck.gl backend (`WebGL2`, `WebGPU`, or `Detecting...`) and no longer say the panel shows `WebGL Fallback`; references to the COMPUTE key use `WEBGPU COMPUTE`. ## Files that change @@ -31,6 +31,8 @@ Report the truth. Do not wire WebGPU rendering. RENDER reads the device type dec - `src/components/gpuLabels.test.js` (new): unit tests for both helpers (AC1, AC5). - `src/components/gpuLabels.protoKeys.test.js` (new, review fix B1): `renderBackendLabel` returns `Unknown`, not ok, for prototype member names (AC1). - `src/index.css` (review fix B2): new `.gpu-info-name` rule (nowrap, hidden overflow, ellipsis, `max-width: 32ch`, no `color:`), and the top-level `.gpu-info-panel` `max-width` becomes `calc(100vw - 340px)`. +- `src/index.css` (review fix F2): top-level `.gpu-info-sep` gets `display: none` and `.gpu-info-panel` gets `column-gap: 14px`. +- `src/styles.gpuSeparators.test.js` (new, review fix F2): asserts both top-level declarations. - `src/styles.gpuPanel.test.js` (new, review fix F1): the panel keeps `pointer-events: none` and `.gpu-info-name` has `pointer-events: auto`. - `src/styles.test.js` (review fix B2): asserts the `.gpu-info-name` declarations, the top-level panel `max-width`, and that the 1024px and 640px panel widths from #5 are unchanged. - `src/components/GPUInfoPanel.gpuName.test.jsx` (new, review fix B2): the GPU value has class `gpu-info-name` and the full name in `title`. @@ -66,6 +68,6 @@ Report the truth. Do not wire WebGPU rendering. RENDER reads the device type dec - AC1, AC3, AC5: `src/components/gpuLabels.test.js`, `src/components/gpuLabels.protoKeys.test.js`, and the new panel tests. - AC2: panel test with tier `webgpu` and device `webgl`. - AC4, AC7: existing panel and benchmark tier tests (key text updated), `src/styles.test.js`. -- AC5 truncation, tooltip, and AC7 popup clearance: `src/components/GPUInfoPanel.gpuName.test.jsx`, `src/styles.test.js`, and `src/styles.gpuPanel.test.js`; live drive at 1440x900 and 1025x800 with a feature popup open measures the panel and popup rects. +- AC5 truncation, tooltip, and AC7 popup clearance: `src/components/GPUInfoPanel.gpuName.test.jsx`, `src/styles.test.js`, `src/styles.gpuPanel.test.js`, and `src/styles.gpuSeparators.test.js`; live drive at 1440x900, 1280x800, and 1025x800 checks no separator is visible; live drive at 1440x900 and 1025x800 with a feature popup open measures the panel and popup rects. - AC6: `src/components/MapView.test.jsx`. - Live drive: `npm run build && npm run preview`; in the browser RENDER shows `WebGL2`, and the console shows the deck canvas holds a `webgl2` context (for example `[...document.querySelectorAll('canvas')].map(c => !!c.getContext('webgl2'))` all true, and no `webgpu` context) matching the label. Note: headless Chromium has no WebGPU adapter and the user's Chrome returns null from `requestAdapter()`, so the tier is `no-webgpu` there; WEBGPU COMPUTE shows `--` with no RUN button. GPU label shows the WebGL renderer string when the adapter offers nothing. Re-measure layout at 375x812, 768x1024, 1440x900. diff --git a/src/index.css b/src/index.css index 25d0abf..42d1b03 100644 --- a/src/index.css +++ b/src/index.css @@ -588,6 +588,9 @@ body::before { display: flex; align-items: center; gap: 10px; + /* The width cap can wrap the panel at any width, so separators are hidden + everywhere and a column gap spaces the items; a wrapped row never ends in one. */ + column-gap: 14px; padding: 6px 14px; background: var(--bg-panel); border: 1px solid var(--border); @@ -650,6 +653,7 @@ body::before { } .gpu-info-sep { + display: none; color: var(--text-dim); } From ff04f8e67b7d36c2610ecf42b4a819c7747a3f15 Mon Sep 17 00:00:00 2001 From: Brad Stricherz Date: Sat, 7 Nov 2026 20:54:40 -0600 Subject: [PATCH 13/13] docs: note GPU name truncation and RENDER limits in README (#8) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AELE7jB1i3uqqrHu3SjJjf --- README.md | 3 ++- docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ce465fd..323c0bf 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Built with React 19, Vite, MapLibre GL (through `react-map-gl`), deck.gl (`@deck - **Sea ports layer:** the bundled ports GeoJSON, drawn as green points. Click a point to see its properties. - **Heatmap layer (WebGPU only):** a two-pass compute shader bins airport positions into a 1024 x 512 grid and colorizes it into a bitmap overlay. It runs once, after the airports load. The layer toggle appears only after that compute succeeds, so it is hidden while airports load, when WebGPU is unavailable, and when the airports fetch or the compute fails. - **Stress test:** a slider from 0 to 5,000,000 points in steps of 100,000. Points are generated on the main thread 150 ms after the slider stops moving, then drawn as a deck.gl binary attribute layer. -- **GPU info panel:** GPU name (the WebGPU adapter, or the WebGL renderer string when the adapter offers none), RENDER: the backend deck.gl actually draws with (`WebGL2`, `WebGPU`, or `Detecting...` until deck has created its device), active point count, frame time with a 60-frame sparkline, an on-demand WebGPU compute benchmark (press `RUN` next to WEBGPU COMPUTE: 5 sequential dispatches over a 64 MB storage buffer, reported as the median in GB/s, labelled `est.` because it is CPU timed, or `Too fast` when the timer is too coarse to measure it; out-of-memory, validation errors, and device loss show `Failed`; the buffer and device are freed when the run ends, and the run stops if the tab is hidden), and heatmap compute time. At 1024px wide or less it shows only RENDER, active point count, and frame time. On small screens (see below) it is hidden while a feature popup is open. +- **GPU info panel:** GPU name (the WebGPU adapter, or the WebGL renderer string when the adapter offers none; a long name is cut off with an ellipsis and shown in full on hover), RENDER: the backend deck.gl actually draws with (`WebGL2`, `WebGPU`, or `Detecting...` until deck has created its device), active point count, frame time with a 60-frame sparkline, an on-demand WebGPU compute benchmark (press `RUN` next to WEBGPU COMPUTE: 5 sequential dispatches over a 64 MB storage buffer, reported as the median in GB/s, labelled `est.` because it is CPU timed, or `Too fast` when the timer is too coarse to measure it; out-of-memory, validation errors, and device loss show `Failed`; the buffer and device are freed when the run ends, and the run stops if the tab is hidden), and heatmap compute time. At 1024px wide or less it shows only RENDER, active point count, and frame time. On small screens (see below) it is hidden while a feature popup is open. - **Small screens** (640px wide or less, or up to 1024px wide and 500px tall or less): the layer panel starts collapsed behind a "Sensor layers" button, the header drops the coordinates and status, and the feature popup opens as a bottom sheet. ## Requirements @@ -76,4 +76,5 @@ public/data/ports.geojson bundled ports data - The heatmap runs once per page load from the first non-empty airports list and does not update afterwards. - Stress points are generated on the main thread. Large counts (millions of points) briefly block the UI once the slider settles. - The WEBGPU COMPUTE benchmark is CPU timed (submit to `onSubmittedWorkDone`), so it includes driver and callback latency and reads lower than the real memory bandwidth. The `RUN` control is hidden at 1024px wide or less along with the rest of WEBGPU COMPUTE. +- RENDER is set when deck.gl reports the device it created and is not updated afterwards. If deck fails to create a device, RENDER stays `Detecting...`, and a lost WebGL context is not reflected. - Unit tests run in jsdom, which has no WebGL or WebGPU. GPU code paths are covered by mocks and pure helpers only; check rendering in a real browser. diff --git a/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md b/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md index 0fadbea..26565f9 100644 --- a/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md +++ b/docs/plans/2026-11-07-issue-8-gpu-panel-render-backend.md @@ -40,7 +40,7 @@ Report the truth. Do not wire WebGPU rendering. RENDER reads the device type dec - `src/components/GPUInfoPanel.test.jsx` and `src/components/GPUInfoPanel.benchmarkTier.test.jsx`: change `getByText('COMPUTE')` lookups and the `'COMPUTE'` entry in the secondary-key loop to `'WEBGPU COMPUTE'`; add panel tests for AC1 to AC3 (incl. tier `webgpu` + device `webgl`). - `src/components/MapView.jsx`: `const [renderDevice, setRenderDevice] = useState(null)`. A stable `useCallback` `(device) => setRenderDevice({ type: device.type, renderer: device.info?.renderer })`. `DeckGLOverlay` takes `onDeviceInitialized` and passes it in the `MapboxOverlay` constructor props (the overlay creates its `Deck` in `onAdd` from those props, so it must be there at construction; `setProps({ layers })` keeps it). Add `renderDevice` to the `capabilities` memo and its deps. - `src/components/MapView.test.jsx` (new): wiring test of AC6. Mock `react-map-gl/maplibre` (`Map` renders children; `useControl(factory)` calls the factory once and returns its result), mock `@deck.gl/mapbox` `MapboxOverlay` as a class that records its constructor props and has `setProps`, mock `maplibre-gl/dist/maplibre-gl.css` and `../config/maplibreWorker.js` if needed, mock `useGPUCapabilities` and `useGPUCompute`. Call the recorded `onDeviceInitialized` inside `act` and assert RENDER. -- `README.md`: AC8 only. +- `README.md`: AC8, plus the GPU name truncation and hover in the panel bullet and a Known limitations line that RENDER is not updated after deck reports its device (device creation failure stays `Detecting...`, context loss is not reflected). ## Order of work