You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Platforms: link GPU view support only when an app mounts a GPU view #2265
#1741 (for #1536) routes every backend's optional features (shaders, video, web views, canvas) through feature tables, so a minimal app no longer links code it never shows. GPU views were left out of that work: mountGPU (core/gpu.go:114) never calls an enabler, and every backend handles driver.ItemGPU directly:
Through those paths each backend's GPU pipeline compiler and its shading-language writer link into every app: internal/platform/apple/gpu.go:389 (msl.CompilePipeline), internal/platform/windows/gpu_d3d11_desc.go:939,962 (hlsl.CompilePipeline), internal/platform/linux/gpu_gl.go, internal/platform/android/gpu.go:39-54, and internal/platform/web/gpu_common.go / gpu_webgl2.go (GLSL).
Because of this, #1741 leaves msl, hlsl and glsl out of the minimal-app link check, and layers.md says so.
Why it matters
The MSL, HLSL and GLSL writers are a sizeable part of every binary and wasm bundle, including apps that never mount a GPU view. That is the case #1536 set out to remove.
Proposal
Add a GPUEnabler and call it from mountGPU, the same way the other features are enabled.
In each backend, move ItemGPU handling, GPU view creation and release into a gpus feature table that the enabler fills.
Add msl, hlsl and glsl to unlinked in internal/moduletest/linked_test.go. Shaders also use these writers, so they should stay linked when an app uses shaders; the minimal-app check should cover an app with neither.
Acceptance
TestMinimalAppLinks fails if msl, hlsl or glsl links into a minimal app on any backend.
A feature-app link test shows the writers link when an app mounts a GPU view.
Risk: medium — moves GPU view handling into the backends' feature tables; no release, CI or data changes.
Acceptance: TestMinimalAppLinks fails if msl, hlsl or glsl links into a minimal app on any backend; a feature-app link test shows the writers link when an app mounts a GPU view; GPU views still work on all six backends.
On where the writers are reached: the MSL, HLSL and GLSL writers are called from the GPU pipeline compile path, not only from ItemGPU handling. Android compiles in writeGPUResourceOp (its frame encoding), Windows in d3dCompilePipelineHLSL (its frame execution), Web in gpu_common.go and Linux in gpu_gl.go. So each backend's GPUEnabler has to cover the frame path as well as view creation and release, which is why msl, hlsl and glsl stay linked today.
A work-in-progress branch has the enabler in place; what remains, measured with -ldflags=-dumpdep on testdata/minimal:
Android: done — glsl and the frame path unlink once the submitter is connected on mountGPU instead of at engine attach.
macOS, Linux: the writers survive as types: apple.gpuPipeline holds []msl.BindingSlot, and linux.glGPUPipeline holds []glsl.UniformBlockSlot and []glsl.SamplerPair, both <UsedInIface>. Those pipeline types must name local binding/sampler types instead.
Windows: (*gfx).program stays reachable from the glass path (glass.go), which compiles a program without a GPU view.
Web: (*glShader).link stays reachable from the effect path (effect.go), likewise.
The feature app links every writer on all five targets already.
Progress on the branch: macOS, Linux and Android now pass TestMinimalAppLinks (local pipeline types replace the writers' types, and Linux's GPU GL callbacks register when a GPU view mounts instead of at start). Windows and the web still link their writer, and the cause is the same on both: the glass and backdrop effect paths draw through a GL/HLSL program without a GPU view. Closing that needs the effect draw to go through the shader enabler's table, with core enabling shaders when a style asks for a glass effect, so the writers link only for apps that use either.
Risk: medium — moves GPU and glass entry points behind feature tables, adds two enabler interfaces, and mirrors the writers' register and slot types; no release, CI or data changes.
Acceptance: TestMinimalAppLinks fails if msl, hlsl or glsl links into a minimal app on any target; TestFeatureAppLinks links them for an app that mounts a core.GPUView; all targets vet.
Activity
Laotree commentedon Nov 26, 2026
Task record
TestMinimalAppLinksfails ifmsl,hlslorglsllinks into a minimal app on any backend; a feature-app link test shows the writers link when an app mounts a GPU view; GPU views still work on all six backends.Laotree commentedon Nov 26, 2026
On where the writers are reached: the MSL, HLSL and GLSL writers are called from the GPU pipeline compile path, not only from
ItemGPUhandling. Android compiles inwriteGPUResourceOp(its frame encoding), Windows ind3dCompilePipelineHLSL(its frame execution), Web ingpu_common.goand Linux ingpu_gl.go. So each backend'sGPUEnablerhas to cover the frame path as well as view creation and release, which is whymsl,hlslandglslstay linked today.Laotree commentedon Nov 26, 2026
A work-in-progress branch has the enabler in place; what remains, measured with
-ldflags=-dumpdepontestdata/minimal:glsland the frame path unlink once the submitter is connected onmountGPUinstead of at engine attach.apple.gpuPipelineholds[]msl.BindingSlot, andlinux.glGPUPipelineholds[]glsl.UniformBlockSlotand[]glsl.SamplerPair, both<UsedInIface>. Those pipeline types must name local binding/sampler types instead.(*gfx).programstays reachable from the glass path (glass.go), which compiles a program without a GPU view.(*glShader).linkstays reachable from the effect path (effect.go), likewise.The feature app links every writer on all five targets already.
Laotree commentedon Nov 26, 2026
Progress on the branch: macOS, Linux and Android now pass
TestMinimalAppLinks(local pipeline types replace the writers' types, and Linux's GPU GL callbacks register when a GPU view mounts instead of at start). Windows and the web still link their writer, and the cause is the same on both: the glass and backdrop effect paths draw through a GL/HLSL program without a GPU view. Closing that needs the effect draw to go through the shader enabler's table, withcoreenabling shaders when a style asks for a glass effect, so the writers link only for apps that use either.Laotree commentedon Nov 26, 2026
Task record
TestMinimalAppLinksfails ifmsl,hlslorglsllinks into a minimal app on any target;TestFeatureAppLinkslinks them for an app that mounts acore.GPUView; all targets vet.