In the `shared` crate: Annotate functions/methods with `#[inline(always)]`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rust
- Domain
- compilers, computer-graphics
Research direction
Start by locating the shared crate and reviewing its small functions and methods that are used when compiling Rust shaders to GLSL. Compare generated shader output for representative functions such as shared_saturate, shared_smoothstep, and shared_mix_f32_f32_; done means the relevant functions are annotated and the resulting SPIR-V still passes validation.
Written by the indexing model from the issue text.
Description
When compiling Rust shaders to GLSL I noticed that a lot of functions are not inlined by default that should be.
I used the shared crate from this repo when porting some shadertoy shaders to Rust, e.g.
https://www.shadertoy.com/view/tsyBDm
You can see it has a lot of small functions that should be inlined (several of them from the shared crate), like:
float shared_saturate(float _3518)
{
return min(max(_3518, 0.0), 1.0);
}
float shared_smoothstep(float _3522, float _3523, float _3524)
{
float _3529 = shared_saturate((_3524 - _3522) / (_3523 - _3522));
return (_3529 * _3529) * (3.0 - (2.0 * _3529));
}
float shared_mix_f32_f32_(float _394, float _395, float _396)
{
return (_394 - (_394 * _396)) + (_395 * _396);
}
Inlining is especially important considering that the spirv backend doesn't really optimize much at the moment, and spirv-opt often produces invalid output (on which spirv validation fails).
- Dominant language
- Rust
- Stars
- 165
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Rust-GPU/rust-gpu-shadertoys
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in Rust-GPU/rust-gpu-shadertoys
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100