The ash runner is over-engineered: it supports multiple pipelines, each
one with a separate vertex/fragment shader pair, but it only ever uses
one pipeline. The other runners don't support multiple pipelines, so
this just seems like unnecessary complexity. This is bad because the
examples are currently some of the best rust-gpu documentation there is.
More specifically:
- `rebuild_pipelines` is now just `rebuild_pipeline`, and
`build_pipelines` is no longer needed.
- `compile_shaders` returns a pair instead of a `Vec`: one element for
the vertex shader data, and one for the fragment shader data.
- RenderBase no longer needs `Vec` and `HashMap` elements, it can just
store a single pipeline, a single vertex shader module, and a single
fragment shader module.
- The following types are no longer needed: `SpvFile`,
`VertextShaderEntryPoint`, `FragmentShaderEntryPoint`.
- Less iteration and `collect`ing in general.
- `filter_landing_pad` no longer has a return value.
- `build_session` no longer has the `sysroot` argument.
- `manual_is_multiple_of` clippy lint was enabled.
Better explain the shaders and runners, and explain how to invoke them,
and even document the `+`/`-` feature of the sky shader on ash, which
is currently invisible unless you read the code.
Currently you can use '+'/'-' on the numeric keypad to adjust the
intensity, but lots of keyboards lack a numeric keypad. This commit
changes it to use the up and down arrows instead.
It's supposed to produce a landscape with a small white sun, blue sky,
and yellow ground. Instead it produces a small white sun and everything
else is black. The problem is with the
`sun_intensity_extra_spec_const_factor` argument to `sky_shader::fs`.
- When running on the GPU, `sky_shader::fs` is called from `main_fs`,
which has a spec_constant with a default value of 100.
- When running on the CPU, `sky_shader::fs` is called directly from the
CPU shader's `main`, and it passes 1.
In other words, the CPU shader's sun intensity is 100x too small, which
explains why it's so dark. This commit changes the value to 100, which
makes the CPU shader produce the expected result.
(The shader later divides the intensity value by 100. There are comments
about integration testing for specialization constants that I don't
understand.)