Skip to content

Disable VALIDATION_INDIRECT_CALL by default in release builds for wgpu#23879

Merged
mockersf merged 2 commits intobevyengine:mainfrom
CrazyRoka:disable-indirect-validation-wgpu
Apr 19, 2026
Merged

Disable VALIDATION_INDIRECT_CALL by default in release builds for wgpu#23879
mockersf merged 2 commits intobevyengine:mainfrom
CrazyRoka:disable-indirect-validation-wgpu

Conversation

@CrazyRoka
Copy link
Copy Markdown
Contributor

Objective

Improves performance in release builds by disabling VALIDATION_INDIRECT_CALL wgpu instance default flag. Currently, even release builds have this validation enabled (link), causing unnecessary compute passes that add sometimes ~13% CPU overhead in stress tests.

Solution

Modified crates/bevy_render/src/settings.rs to explicitly remove VALIDATION_INDIRECT_CALL in release builds. Users can still apply environment variable overrides by using WGPU_VALIDATION_INDIRECT_CALL (link).

This ensures:

  • Debug builds: Unchanged, indirect validation is enabled.
  • Release builds: Indirect validation is disabled by default.
  • User override: Users can re-enable in release build by using WGPU_VALIDATION_INDIRECT_CALL=1 environment variable.

Testing

Tested on macOS with stress test scene:

  • Command: cargo run --profile profiling --example many_materials and cargo run --profile profiling --example many_shadow_lights -- -m 50 -l 50
  • Without fix (env var off): ~132 FPS on many_materials and ~13FPS on many_shadow_lights
  • With fix (default): ~148 FPS on many_materials and ~18FPS on many_shadow_lights
  • With WGPU_VALIDATION_INDIRECT_CALL=1: produces same result as "without fix" - 132FPS and 13FPS

The improvement is visible when comparing release build with vs without WGPU_VALIDATION_INDIRECT_CALL=1. The fix aligns the default with the expected behavior - validation enabled in debug, disabled in release.

Tested on:

SystemInfo { os: "macOS 15.3.1 Sequoia", kernel: "24.3.0", cpu: "Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz", core_count: "6", memory: "16.0 GiB" }
AdapterInfo { name: "AMD Radeon Pro 5300M", vendor: 0, device: 0, device_type: DiscreteGpu, device_pci_bus_id: "", driver: "", driver_info: "", backend: Metal, subgroup_min_size: 4, subgroup_max_size: 64, transient_saves_memory: false }

Profiling results before fix

It's clearly visible that inject_validation_pass takes ~13% CPU time.

image

@JMS55 JMS55 added A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times labels Apr 18, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Apr 18, 2026
@github-actions

This comment was marked as resolved.

@mockersf mockersf added this pull request to the merge queue Apr 19, 2026
Merged via the queue into bevyengine:main with commit 60a860d Apr 19, 2026
38 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in Rendering Apr 19, 2026
@CrazyRoka CrazyRoka deleted the disable-indirect-validation-wgpu branch April 19, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Performance A change motivated by improving speed, memory usage or compile times

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants