Skip to content

Commit 19d23e5

Browse files
nnethercoteFirestar99
authored andcommitted
Fix the CPU sky-shader demo.
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.)
1 parent ca2ea7b commit 19d23e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/runners/cpu/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn main() {
140140
* vec2(WIDTH as f32, HEIGHT as f32);
141141

142142
// evaluate the fragment shader for the specific pixel
143-
let color = shader_module::fs(&push_constants, frag_coord, 1);
143+
let color = shader_module::fs(&push_constants, frag_coord, 100);
144144

145145
color_u32_from_vec4(color)
146146
})

0 commit comments

Comments
 (0)