fix texture atlas bounds check
This commit is contained in:
parent
fdd888cb32
commit
f3ae9674f1
@ -324,22 +324,22 @@ void GC_TickAsync(WaveLaneCtx *lane, AsyncFrameLaneCtx *base_async_lane_frame)
|
||||
SllStackPush(GC.first_atlas, atlas);
|
||||
++GC.atlases_count;
|
||||
}
|
||||
// Determine pos in atlas
|
||||
pos_in_atlas = atlas->cur_pos;
|
||||
atlas->cur_row_height = MaxI32(atlas->cur_row_height, image_dims.y);
|
||||
if (pos_in_atlas.x + image_dims.x > atlas->dims.x)
|
||||
if (atlas->cur_pos.x + image_dims.x > atlas->dims.x)
|
||||
{
|
||||
atlas->cur_pos.x = 0;
|
||||
atlas->cur_pos.y += atlas->cur_row_height;
|
||||
atlas->cur_row_height = image_dims.y;
|
||||
atlas->cur_row_height = 0;
|
||||
}
|
||||
atlas->cur_pos.x += image_dims.x;
|
||||
if (atlas->cur_pos.x < atlas->dims.x && atlas->cur_pos.y < atlas->dims.y)
|
||||
if (atlas->cur_pos.x + image_dims.x < atlas->dims.x && atlas->cur_pos.y + image_dims.y < atlas->dims.y)
|
||||
{
|
||||
pos_in_atlas = atlas->cur_pos;
|
||||
atlas->cur_row_height = MaxI32(atlas->cur_row_height, image_dims.y);
|
||||
atlas->cur_pos.x += image_dims.x;
|
||||
can_use_atlas = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// New atlas required
|
||||
atlas = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4960,17 +4960,9 @@ void V_TickForever(WaveLaneCtx *lane)
|
||||
//////////////////////////////
|
||||
//- End frame
|
||||
|
||||
i32 vsync = !!TweakBool("Vsync", 1);
|
||||
|
||||
// {
|
||||
// Arena *old_arena = sim_output->arena;
|
||||
// ZeroStruct(sim_output);
|
||||
// sim_output->arena = old_arena;
|
||||
// ResetArena(sim_output->arena);
|
||||
// }
|
||||
|
||||
G_CommitCommandList(frame->cl);
|
||||
|
||||
i32 vsync = !!TweakBool("Vsync", 1);
|
||||
UI_EndFrame(ui_frame, vsync);
|
||||
}
|
||||
|
||||
|
||||
@ -447,22 +447,22 @@ void SPR_TickAsync(WaveLaneCtx *lane, AsyncFrameLaneCtx *base_async_lane_frame)
|
||||
SllStackPush(SPR.first_atlas, atlas);
|
||||
++SPR.atlases_count;
|
||||
}
|
||||
// Determine pos in atlas
|
||||
atlas_pos = atlas->cur_pos;
|
||||
atlas->cur_row_height = MaxI32(atlas->cur_row_height, slice_dims.y);
|
||||
if (atlas_pos.x + slice_dims.x > atlas->dims.x)
|
||||
if (atlas->cur_pos.x + slice_dims.x > atlas->dims.x)
|
||||
{
|
||||
atlas->cur_pos.x = 0;
|
||||
atlas->cur_pos.y += atlas->cur_row_height;
|
||||
atlas->cur_row_height = slice_dims.y;
|
||||
atlas->cur_row_height = 0;
|
||||
}
|
||||
atlas->cur_pos.x += slice_dims.x;
|
||||
if (atlas->cur_pos.x < atlas->dims.x && atlas->cur_pos.y < atlas->dims.y)
|
||||
if (atlas->cur_pos.x + slice_dims.x < atlas->dims.x && atlas->cur_pos.y + slice_dims.y < atlas->dims.y)
|
||||
{
|
||||
atlas_pos = atlas->cur_pos;
|
||||
atlas->cur_row_height = MaxI32(atlas->cur_row_height, slice_dims.y);
|
||||
atlas->cur_pos.x += slice_dims.x;
|
||||
can_use_atlas = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// New atlas required
|
||||
atlas = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user