Skip to content

Fix pathological complexity explosion for certain shaders.#1594

Merged
HansKristian-Work merged 1 commit intomasterfrom
fix-1591
Jan 15, 2021
Merged

Fix pathological complexity explosion for certain shaders.#1594
HansKristian-Work merged 1 commit intomasterfrom
fix-1591

Conversation

@HansKristian-Work
Copy link
Copy Markdown
Contributor

Certain shaders where functions have a ton of merging control flow
will end up with exponential time complexity to figure out parameter
preservation semantics.

The trivial fix to make it O(1) again is to terminate recursive traversal early if we've seen
the path before. Simple oversight :(

Fix #1591.

Certain shaders where functions have a *ton* of merging control flow
will end up with exponential time complexity to figure out parameter
preservation semantics.

The trivial fix to make it O(1) again is to terminate recursive traversal early if we've seen
the path before. Simple oversight :(
@HansKristian-Work HansKristian-Work merged commit 9acb9ec into master Jan 15, 2021
@HansKristian-Work HansKristian-Work deleted the fix-1591 branch January 15, 2021 09:46
bors bot added a commit to gfx-rs/wgpu that referenced this pull request Jan 23, 2021
1163: Bump gfx to latest master r=kvark a=mkeeter

**Connections**
- This bumps `gfx` to [#3610](gfx-rs/gfx#3610), and also includes [#3608](gfx-rs/gfx#3608) and [#3609](gfx-rs/gfx#3608)
- [Here](gfx-rs/wgpu-native#66) is a draft PR to `wgpu-native`
- `wgpu-rs` requires a one-line fix to the `texture_view_drop` call (which now takes a boolean); I can PR this next.

**Description**
This fixes [pathological shader complexity in SPIRV-Cross](KhronosGroup/SPIRV-Cross#1594), as well as a few other `gfx` PRs.

**Testing**
I updated `wgpu-native` to use this branch, then updated my [toy raytracer](https://github.com/mkeeter/rayray) to use the resulting `dylibs` and confirmed that it no longer takes forever to compile the pathological shader.

In addition, I updated `wgpu-rs` and went through the examples; nothing seems out of place.

Co-authored-by: Matt Keeter <matt.j.keeter@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crashes in DuckStation emulator

1 participant