Repository navigation
Bring support for wasm and mac - #17
Closed
cwfitzgerald wants to merge 18 commits into
Closed
cwfitzgerald wants to merge 18 commits into
cwfitzgerald wants to merge 18 commits into
Conversation
Add FormatProfile {Core, Tier2, Native} with from_device detection and an
override on FsrContextInfo. Expose FsrFormats via FsrContext::formats(); validate
caller-provided textures against the active profile. Only Native is wired up;
Core/Tier2 assert pending their shader variants.
Seven storage images are only ever imageStore'd; declare them writeonly in GLSL and bind them WriteOnly. Required for the widened core-profile formats (which only validate as write-only) and a correctness improvement on native. Regenerated SPIR-V and shader table.
Frame info is a single read-modify-write vec4 of per-frame metadata. Storing it in a 1x1 Rgba32Float texture needs read-write storage-texture access, which is heavily restricted in baseline WebGPU. Back it with a storage buffer instead — unrestricted read-write at every format profile, and simpler. Profile-independent.
cwfitzgerald
force-pushed
the
support-for-wasm-mac
branch
from
June 9, 2026 18:48
0b74975 to
f794931
Compare
Add the FFX_WGPU_FORMAT_PROFILE shader permutation and FSR3_FMT_* macros that remap storage-image formats per profile: on Core, single-channel sampled textures widen to RGBA and point-sampled/read-write ones pack into 32-bit formats. Thread FormatProfile through choose_shaders, resource format selection, texture creation, and bind-group layouts (unfilterable sample types for the packed core formats). The xtask names the profile enum Core/Tier2/Native. SPD mips still use the native format; Core/Tier2 remain asserted-off until the SPD restructure lands. Native is unchanged.
Pull the passthrough-vs-SpirV shader-module creation out of FsrPass::new into a shared create_shader_module, so the upcoming Core SPD pyramid passes can reuse it. No behavior change.
…eader Move the per-pixel shading-change difference metric (the sample sets, sorting network, ComputeDiff, and SpdLoadSourceImage) out of ffx_fsr3upscaler_shading_change_pyramid.h into a new ffx_fsr3upscaler_shading_change_diff.h, included by the pyramid header. This lets the upcoming Core write-only mip0 pass share the exact same metric. Preprocessed output is unchanged, so the compiled SPIR-V is identical.
Tier2 keeps FFX's single-pass SPD but widens the mips to rgba16float. Core has no multi-channel read-write storage, so the luma and shading-change pyramids become a chain of write-only single-level dispatches (mip0 reduction, downsample chain, auto-exposure), behind an SpdPyramid wrapper that keeps the dispatch call sites profile-agnostic. Lifts the Native-only assert and adds Core/Tier2 smoke tests plus a Core-vs-Native scene-average comparison. The packed 32-bit Core formats (R32Float / Rg32Float) are not filterable on a baseline device without float32-filterable, so the exposure, dilated depth, dilated motion-vector, and new-locks SRVs are bound unfilterable on Core, and the debug view point-loads the dilated depth and motion vectors instead of linearly sampling them. They are only ever point-loaded in production passes.
Verify wgpu-ffx builds for wasm32-unknown-unknown with the WebGPU backend (clippy + doc), so the WebGPU-compatible Core profile keeps compiling for the web even though we do not run it there.
cwfitzgerald
force-pushed
the
support-for-wasm-mac
branch
from
June 9, 2026 19:40
f794931 to
d96d4b8
Compare
cwfitzgerald
force-pushed
the
support-for-wasm-mac
branch
from
June 9, 2026 21:17
d34afb3 to
a29d26c
Compare
…passthrough path PASSTHROUGH_SHADERS being present does not mean the active backend consumes SPIR-V passthrough; only Vulkan does. Pick the shader delivery from the adapter backend so Metal/DX12 take the naga ShaderSource::SpirV path instead of failing create_shader_module_passthrough. The single-pass SPD decorates a read-write storage image `coherent`, which naga rejects (memory decorations are only valid in the storage address space), so it is only usable on the passthrough path. Naga backends now use the write-only Core SPD mip chain at every profile, sidestepping the coherent image.
…t every profile InputExposure (Rg32Float) and OutputDilatedDepth (R32Float) are 32-bit float at every profile and only ever point-loaded (texelFetch, no sampler), but their SRV layout entries were only marked unfilterable on Core. On Tier2/Native a filterable binding rejects the 32-bit view format at create_bind_group on any device lacking float32-filterable (e.g. Metal under AUTO_EXPOSURE). Mark both unfilterable at every profile. Add fsr_dispatch_smoke_auto_exposure, which drops FLOAT32_FILTERABLE and runs a dispatch with HIGH_DYNAMIC_RANGE | AUTO_EXPOSURE (exposure: None) to bind the internal default-exposure texture and exercise the fallback.
Owner
Author
|
So the thing is that this runs but has visual artifacts, so I'm going to close it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
cargo clippyreports no issuescargo docreports no issuescargo denyissues have been fixed or added todeny.tomlAdded new functionality. @githubnameDescription
Related Issues