got rid fo the shape draw_list caching code
This commit is contained in:
		| @@ -617,19 +617,6 @@ draw_text_shape :: proc( ctx : ^Context, | ||||
| 	snap_width, snap_height : f32 | ||||
| ) -> (cursor_pos : Vec2) | ||||
| { | ||||
| 	// draw_hash   := shape_draw_hash( shaped, position, scale ) | ||||
| 	// dirty_shape := len(shaped.draw_list.calls) == 0 || draw_hash != shaped.draw_hash | ||||
| 	// if ! dirty_shape { | ||||
| 	// 	merge_draw_list( & ctx.draw_list, & shaped.draw_list ) | ||||
| 	// 	reset_batch_codepoint_state( ctx ) | ||||
| 	// 	cursor_pos = position + shaped.end_cursor_pos * scale | ||||
| 	// 	return | ||||
| 	// } | ||||
| 	// if dirty_shape { | ||||
| 	// 	clear_draw_list( & shaped.draw_list ) | ||||
| 	// } | ||||
|  | ||||
| 	// position := position //+ ctx.cursor_pos * scale | ||||
| 	// profile(#procedure) | ||||
| 	batch_start_idx : i32 = 0 | ||||
| 	for index : i32 = 0; index < cast(i32) len(shaped.glyphs); index += 1 | ||||
| @@ -645,10 +632,6 @@ draw_text_shape :: proc( ctx : ^Context, | ||||
| 		if check_glyph_in_atlas( ctx, font, entry, glyph_index, lru_code, atlas_index, region_kind, region, over_sample ) do continue | ||||
|  | ||||
| 		// We can no longer directly append the shape as it has missing glyphs in the atlas | ||||
| 		// if !dirty_shape { | ||||
| 		// 	clear_draw_list( & shaped.draw_list ) | ||||
| 		// } | ||||
| 		// dirty_shape = true | ||||
|  | ||||
| 		// First batch the other cached glyphs | ||||
| 		// flush_glyph_buffer_to_atlas(ctx) | ||||
| @@ -660,14 +643,8 @@ draw_text_shape :: proc( ctx : ^Context, | ||||
| 		batch_start_idx = index | ||||
| 	} | ||||
|  | ||||
| 	// if dirty_shape { | ||||
| 		flush_glyph_buffer_to_atlas(ctx) | ||||
| 		draw_text_batch( ctx, entry, shaped, batch_start_idx, cast(i32) len(shaped.glyphs), position, scale, snap_width , snap_height ) | ||||
| 		// shaped.draw_hash = draw_hash | ||||
| 	// } | ||||
|  | ||||
| 	// merge_draw_list( & ctx.draw_list, & shaped.draw_list ) | ||||
| 	// reset_batch_codepoint_state( ctx ) | ||||
| 	draw_text_batch( ctx, entry, shaped, batch_start_idx, cast(i32) len(shaped.glyphs), position, scale, snap_width , snap_height ) | ||||
| 	reset_batch_codepoint_state( ctx ) | ||||
|  | ||||
| 	cursor_pos = position + shaped.end_cursor_pos * scale | ||||
| 	return | ||||
| @@ -759,5 +736,5 @@ optimize_draw_list :: proc( draw_list : ^DrawList, call_offset : int ) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	resize( & draw_list.calls, write_index + 1 ) | ||||
| 	resize( & draw_list.calls, write_index + 1) | ||||
| } | ||||
|   | ||||
| @@ -1,13 +1,10 @@ | ||||
| package VEFontCache | ||||
|  | ||||
| ShapedText :: struct { | ||||
| 	// draw_list      : DrawList, | ||||
| 	glyphs         : [dynamic]Glyph, | ||||
| 	positions      : [dynamic]Vec2, | ||||
| 	end_cursor_pos : Vec2, | ||||
| 	size           : Vec2, | ||||
| 	// storage_hash   : u64, | ||||
| 	// draw_hash      : u64, | ||||
| } | ||||
|  | ||||
| ShapedTextCache :: struct { | ||||
| @@ -16,28 +13,6 @@ ShapedTextCache :: struct { | ||||
| 	next_cache_id : i32, | ||||
| } | ||||
|  | ||||
|  | ||||
| // shape_draw_hash :: #force_inline proc "contextless" ( shaped : ^ShapedText, pos, scale : Vec2 ) -> (draw_hash : u64) | ||||
| // { | ||||
| // 	pos   := pos | ||||
| // 	scale := scale | ||||
| // 	pos_bytes   := slice_ptr( transmute(^byte) & pos,   size_of(Vec2)) | ||||
| // 	scale_bytes := slice_ptr( transmute(^byte) & scale, size_of(Vec2)) | ||||
|  | ||||
| // 	draw_hash = shaped.storage_hash | ||||
| // 	shape_lru_hash( & shaped.draw_hash, pos_bytes ) | ||||
| // 	shape_lru_hash( & shaped.draw_hash, scale_bytes ) | ||||
| // 	return | ||||
| // } | ||||
|  | ||||
| // shape_lru_hash_og :: #force_inline proc "contextless" ( label : string ) -> u64 { | ||||
| // 	hash : u64 | ||||
| // 	for str_byte in transmute([]byte) label { | ||||
| // 		hash = ((hash << 8) + hash) + u64(str_byte) | ||||
| // 	} | ||||
| // 	return hash | ||||
| // } | ||||
|  | ||||
| shape_lru_hash :: #force_inline proc "contextless" ( hash : ^u64, bytes : []byte ) { | ||||
| 	for value in bytes { | ||||
| 		(hash^) = (( (hash^) << 8) + (hash^) ) + u64(value) | ||||
| @@ -55,18 +30,6 @@ shape_text_cached :: proc( ctx : ^Context, font : FontID, text_utf8 : string, en | ||||
| 	shape_lru_hash( & lru_code, font_bytes ) | ||||
| 	shape_lru_hash( & lru_code, text_bytes ) | ||||
|  | ||||
| 	// @static buffer : [64 * Kilobyte]byte | ||||
| 	// text_size       := len(text_utf8) | ||||
| 	// sice_end_offset := size_of(FontID) + len(text_utf8) | ||||
|  | ||||
| 	// buffer_slice := buffer[:] | ||||
| 	// copy( buffer_slice, font_bytes ) | ||||
|  | ||||
| 	// buffer_slice_post_font := buffer[ size_of(FontID) : sice_end_offset ] | ||||
| 	// copy( buffer_slice_post_font, text_bytes ) | ||||
|  | ||||
| 	// lru_code := shape_lru_hash_og( transmute(string) buffer[: sice_end_offset ] ) | ||||
|  | ||||
| 	shape_cache := & ctx.shape_cache | ||||
| 	state       := & ctx.shape_cache.state | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user