Conversation
issam3105
marked this pull request as ready for review
September 18, 2026 15:05
Contributor
Author
|
Should i compact the binding indices to fill the gaps left by the removed sampler ? |
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.
Objective
Partially addresses #24711 — reduces the number of sampler bindings in
@group(0)of the mesh view bind group.WebGPU impose tight limits on the number of samplers per shader stage (often 16). Before this PR, every feature that needed texture sampling allocated its own dedicated
Samplerobject and binding slot, leaving little headroom for features such as additional glTF extensions (e.g.KHR_materials_transmission,KHR_materials_specular,KHR_materials_anisotropy...) that would each require their own sampler.Solution
Audit every sampler in
@group(0)and merge those that share the same descriptor:LinearSamplerresource (always bound at slot 25) that replaces all per-featureLinearsamplers.Comparisonshadow samplers (point + directional were identical) into oneshadow_comparison_sampler.Samplerfields fromShadowSamplers,AtmosphereSampler, andViewTransmissionTexture.Testing
pbr_transmission_texturestriggered:pbr_specular_textures+pbr_transmission_texturescan be enabled simultaneously.Showcase
Mapping from old to shared samplers
point_shadow_textures_comparison_samplershadow_textures_comparison_samplerpoint_shadow_textures_linear_sampler(pcss)linear_samplerdirectional_shadow_textures_comparison_samplershadow_textures_comparison_samplerdirectional_shadow_textures_linear_sampler(pcss)linear_samplerdt_lut_sampler(tonemap)dt_lut_sampler(tonemap, unchanged)view_transmission_sampler(conditional)linear_sampleratmosphere_transmittance_sampler(conditional)linear_samplerarea_light_luts_sampler(conditional)linear_samplerdfg_lut_sampler(conditional)linear_sampler9 → 3 sampler bindings (with all features active).
GPU
Samplerobjects created at startuppoint_light_comparison_samplershadow_comparison_samplerdirectional_light_comparison_samplershadow_comparison_samplerpoint_light_linear_sampler(pcss)LinearSamplerdirectional_light_linear_sampler(pcss)LinearSamplerAtmosphereSamplerLinearSamplerViewTransmissionTexture::samplerLinearSampler6 → 2 GPU sampler objects.