Skip to content

Commit 3c10be8

Browse files
committed
Fix regression in flipbook
Fix a regression in the flipbook shader code where some variable previously emitted as `i32` by error instead of its actual `u32` type is now producing the correct literal value, resulting in an invalid shader operation between mismatching operand types. Cast the value to `i32` explicitly before emitting the shader code to ensure the value is emitted in the expected type.
1 parent ae41628 commit 3c10be8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,8 @@ impl EffectShaderSource {
960960
render_context.sprite_grid_size
961961
{
962962
layout_flags |= LayoutFlags::FLIPBOOK;
963-
let flipbook_row_count_code = grid_size.x.to_wgsl_string();
963+
// Note: row_count needs to be i32, not u32, because of sprite_index
964+
let flipbook_row_count_code = (grid_size.x as i32).to_wgsl_string();
964965
let flipbook_scale_code =
965966
Vec2::new(1.0 / grid_size.x as f32, 1.0 / grid_size.y as f32).to_wgsl_string();
966967
(flipbook_scale_code, flipbook_row_count_code)

0 commit comments

Comments
 (0)