Text rendering is now around parity (if not better) than what was done before with raylib
Performance still sucks since the rendering implementation is subpar
This commit is contained in:
		| @@ -18,7 +18,7 @@ DebugData :: struct { | ||||
|  | ||||
| 	// UI Vis | ||||
| 	draw_ui_box_bounds_points : bool, | ||||
| 	draw_UI_padding_bounds    : bool, | ||||
| 	draw_ui_padding_bounds    : bool, | ||||
| 	draw_ui_content_bounds    : bool, | ||||
|  | ||||
| 	// Test First | ||||
|   | ||||
| @@ -289,7 +289,7 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem | ||||
| 		ui_floating_startup( & screen_ui.floating, 1 * Kilobyte, 1 * Kilobyte, persistent_slab_allocator(), "screen ui floating manager" ) | ||||
|  | ||||
| 		using screen_ui | ||||
| 		menu_bar.pos  = { -60, 0 } | ||||
| 		menu_bar.pos  = { -260, -200 } | ||||
| 		// menu_bar.pos  = Vec2(app_window.extent) * { -1, 1 } | ||||
| 		menu_bar.size = {140, 40} | ||||
|  | ||||
| @@ -498,14 +498,14 @@ tick_work_frame :: #force_inline proc( host_delta_time_ms : f64 ) -> b32 | ||||
| 	// rl.PollInputEvents() | ||||
|  | ||||
| 	debug.draw_ui_box_bounds_points = false | ||||
| 	debug.draw_UI_padding_bounds = false | ||||
| 	debug.draw_ui_padding_bounds = false | ||||
| 	debug.draw_ui_content_bounds = false | ||||
|  | ||||
| 	// config.engine_refresh_hz = 165 | ||||
|  | ||||
| 	// config.color_theme = App_Thm_Light | ||||
| 	config.color_theme = App_Thm_Dusk | ||||
| 	// config.color_theme = App_Thm_Dark | ||||
| 	// config.color_theme = App_Thm_Dusk | ||||
| 	config.color_theme = App_Thm_Dark | ||||
|  | ||||
| 	sokol_width  := sokol_app.widthf() | ||||
| 	sokol_height := sokol_app.heightf() | ||||
|   | ||||
| @@ -173,10 +173,10 @@ render_mode_screenspace :: proc() | ||||
| 		} | ||||
|  | ||||
| 		profile("debug_text_vis") | ||||
| 		fps_size : f32 = 14.0 | ||||
| 		fps_size : f32 = 16.0 | ||||
| 		fps_msg       := str_fmt( "FPS: %0.2f", fps_avg) | ||||
| 		fps_msg_size  := measure_text_size( fps_msg, default_font, fps_size, 0.0 ) | ||||
| 		fps_msg_pos   := screen_get_corners().top_right - { fps_msg_size.x * 2, fps_msg_size.y } | ||||
| 		fps_msg_pos   := screen_get_corners().top_right - { fps_msg_size.x, fps_msg_size.y } | ||||
| 		debug_draw_text( fps_msg, fps_msg_pos, fps_size, color = Color_Red ) | ||||
|  | ||||
| 		debug_text( "Screen Width : %v", screen_size.x ) | ||||
| @@ -466,6 +466,10 @@ render_ui_via_box_tree :: proc( root : ^UI_Box, cam : ^Camera = nil ) | ||||
| 	debug        := get_state().debug | ||||
| 	default_font := get_state().default_font | ||||
|  | ||||
| 	cam_zoom_ratio := cam != nil ? 1.0 / cam.zoom : 1.0 | ||||
|  | ||||
| 	circle_radius := cam != nil ? cam_zoom_ratio * 3 : 3 | ||||
|  | ||||
| 	for box := root.first; box != nil; box = ui_box_tranverse_next_depth_based( box ) | ||||
| 	{ | ||||
| 		text_enqueued  : b32 = false | ||||
| @@ -496,13 +500,25 @@ render_ui_via_box_tree :: proc( root : ^UI_Box, cam : ^Camera = nil ) | ||||
| 				shape_enqueued = true | ||||
| 			} | ||||
|  | ||||
| 			line_thickness := 1 * cam_zoom_ratio | ||||
|  | ||||
| 			if debug.draw_ui_padding_bounds && equal_range2( computed.content, computed.padding ) | ||||
| 			{ | ||||
| 				render_set_color( RGBA8_Debug_UI_Padding_Bounds ) | ||||
| 				draw_rect_border( computed.padding, line_thickness ) | ||||
| 			} | ||||
| 			else if debug.draw_ui_content_bounds { | ||||
| 				render_set_color( RGBA8_Debug_UI_Content_Bounds ) | ||||
| 				draw_rect_border( computed.content, line_thickness ) | ||||
| 			} | ||||
|  | ||||
| 			if debug.draw_ui_box_bounds_points | ||||
| 			{ | ||||
| 				render_set_color(Color_Red) | ||||
| 				draw_filled_circle(bounds.min.x, bounds.min.y, 3, 24) | ||||
| 				draw_filled_circle(bounds.min.x, bounds.min.y, circle_radius, 24) | ||||
|  | ||||
| 				render_set_color(Color_Blue) | ||||
| 				draw_filled_circle(bounds.max.x, bounds.max.y, 3, 24) | ||||
| 				draw_filled_circle(bounds.max.x, bounds.max.y, circle_radius, 24) | ||||
| 				shape_enqueued = true | ||||
| 			} | ||||
| 		} | ||||
| @@ -644,8 +660,8 @@ draw_text_string_pos_norm :: proc( content : string, id : FontID, size : f32, po | ||||
| 	width  := app_window.extent.x * 2 | ||||
| 	height := app_window.extent.y * 2 | ||||
|  | ||||
| 	ve_id      := font_provider_resolve_draw_id( id, size ) | ||||
| 	color_norm := normalize_rgba8(color) | ||||
| 	ve_id, resolved_size := font_provider_resolve_draw_id( id, size ) | ||||
| 	color_norm           := normalize_rgba8(color) | ||||
|  | ||||
| 	ve.set_colour( & font_provider_data.ve_font_cache, color_norm ) | ||||
| 	ve.draw_text( & font_provider_data.ve_font_cache, ve_id, content, pos, Vec2{1 / width, 1 / height} * scale ) | ||||
| @@ -665,21 +681,47 @@ draw_text_string_pos_extent :: proc( content : string, id : FontID, size : f32, | ||||
|  | ||||
| draw_text_string_pos_extent_zoomed :: proc( content : string, id : FontID, size : f32, pos : Vec2, cam : Camera, color := Color_White ) | ||||
| { | ||||
| 	state := get_state(); using state | ||||
|  | ||||
| 	// profile(#procedure) | ||||
| 	cam_offset := Vec2 { | ||||
| 		cam.position.x, | ||||
| 		cam.position.y, | ||||
| 	} | ||||
|  | ||||
| 	pos_offset := pos + cam_offset * cam.zoom | ||||
|  | ||||
| 	pos_offset     := (pos + cam_offset) | ||||
| 	cam_zoom_ratio := 1 / cam.zoom | ||||
|  | ||||
| 	state          := get_state(); using state | ||||
| 	screen_size    := app_window.extent * 2 | ||||
| 	render_pos     := screen_to_render_pos(pos_offset) | ||||
| 	normalized_pos := render_pos * (1.0 / screen_size) | ||||
| 	draw_text_string_pos_norm( content, id, size * cam.zoom, normalized_pos, color, cam.zoom ) | ||||
| 	screen_scale   := (1.0 / screen_size) | ||||
| 	render_pos     := ws_view_to_render_pos(pos) | ||||
| 	normalized_pos := render_pos * screen_scale | ||||
|  | ||||
| 	// Oversample font-size for any render under a camera | ||||
| 	over_sample : f32 = 2.0 | ||||
|  | ||||
| 	zoom_adjust_size := size * cam.zoom | ||||
| 	zoom_adjust_size *= over_sample | ||||
|  | ||||
| 	ve_id, resolved_size := font_provider_resolve_draw_id( id, zoom_adjust_size	) | ||||
|  | ||||
| 	text_scale : Vec2 = screen_scale | ||||
| 	// if config.cam_zoom_mode == .Smooth | ||||
| 	{ | ||||
| 		f32_resolved_size := f32(resolved_size) | ||||
| 		diff_scalar       := 1 + (zoom_adjust_size - f32_resolved_size) / f32_resolved_size | ||||
| 		text_scale         =  diff_scalar * screen_scale | ||||
| 		text_scale.x       = clamp( text_scale.x, 0, screen_size.x ) | ||||
| 		text_scale.y       = clamp( text_scale.y, 0, screen_size.y ) | ||||
| 	} | ||||
|  | ||||
| 	// Downsample back | ||||
| 	text_scale  /= over_sample | ||||
|  | ||||
| 	color_norm := normalize_rgba8(color) | ||||
| 	// logf("zoom_adjust_size: %v", zoom_adjust_size) | ||||
| 	ve.set_colour( & font_provider_data.ve_font_cache, color_norm ) | ||||
| 	ve.draw_text( & font_provider_data.ve_font_cache, ve_id, content, normalized_pos, text_scale ) | ||||
| } | ||||
|  | ||||
| // TODO(Ed): Eventually the workspace will need a viewport for drawing text | ||||
|   | ||||
| @@ -164,10 +164,10 @@ update :: proc( delta_time : f64 ) -> b32 | ||||
| 			workspace.zoom_target = cam.zoom | ||||
| 		} | ||||
|  | ||||
| 		config.cam_max_zoom = 30 | ||||
| 		config.cam_zoom_sensitivity_digital = 0.04 | ||||
| 		// config.cam_min_zoom = 0.04 | ||||
| 		config.cam_zoom_sensitivity_smooth = 0.02 | ||||
| 		config.cam_max_zoom = 10 | ||||
| 		config.cam_min_zoom = 0.10 | ||||
| 		config.cam_zoom_sensitivity_digital = 0.05 | ||||
| 		config.cam_zoom_sensitivity_smooth  = 2.0 | ||||
| 		config.cam_zoom_mode = .Smooth | ||||
| 		switch config.cam_zoom_mode | ||||
| 		{ | ||||
| @@ -181,7 +181,7 @@ update :: proc( delta_time : f64 ) -> b32 | ||||
| 				cam.zoom    += (workspace.zoom_target - cam.zoom) * lerp_factor * f32(delta_time) | ||||
| 				cam.zoom     = clamp(cam.zoom, config.cam_min_zoom, config.cam_max_zoom) // Ensure cam.zoom stays within bounds | ||||
| 			case .Digital: | ||||
| 				zoom_delta            := input.mouse.scroll.y * config.cam_zoom_sensitivity_digital | ||||
| 				zoom_delta            := clamp(input.mouse.scroll.y, -1, 1) * config.cam_zoom_sensitivity_digital | ||||
| 				workspace.zoom_target  = clamp(workspace.zoom_target + zoom_delta, config.cam_min_zoom, config.cam_max_zoom) | ||||
| 				cam.zoom = workspace.zoom_target | ||||
| 		} | ||||
| @@ -225,7 +225,7 @@ update :: proc( delta_time : f64 ) -> b32 | ||||
| 			flags          = frame_style_flags, | ||||
| 			anchor         = {}, | ||||
| 			// alignment      = { 0.5, 0.5 }, | ||||
| 			font_size      = 30, | ||||
| 			font_size      = 12, | ||||
| 			text_alignment = { 0.0, 0.0 }, | ||||
| 			// corner_radii   = { 0.2, 0.2, 0.2, 0.2 }, | ||||
| 			pos            = { 0, 0 }, | ||||
| @@ -249,7 +249,7 @@ update :: proc( delta_time : f64 ) -> b32 | ||||
| 		// test_draggable() | ||||
| 		// test_text_box() | ||||
| 		// test_parenting( & default_layout, & frame_style_default ) | ||||
| 		// test_whitespace_ast( & default_layout, & frame_style_default ) | ||||
| 		test_whitespace_ast( & default_layout, & frame_style_default ) | ||||
| 	} | ||||
| 	//endregion Workspace Imgui Tick | ||||
|  | ||||
|   | ||||
| @@ -8,11 +8,11 @@ import sokol_glue "thirdparty:sokol/glue" | ||||
|  | ||||
|  | ||||
| Font_Provider_Use_Freetype :: false | ||||
| Font_Largest_Px_Size       :: 132 | ||||
| Font_Largest_Px_Size       :: 110 | ||||
| Font_Size_Interval         :: 2 | ||||
|  | ||||
| Font_Default            :: FontID { 0, "" } | ||||
| Font_Default_Point_Size :: 16.0 | ||||
| Font_Default_Point_Size :: 12.0 | ||||
|  | ||||
| Font_Load_Use_Default_Size :: -1 | ||||
| Font_Load_Gen_ID           :: "" | ||||
| @@ -119,19 +119,21 @@ font_provider_startup :: proc() | ||||
| 		screen_shader = sokol_gfx.make_shader(ve_draw_text_shader_desc(backend) ) | ||||
|  | ||||
| 		draw_list_vbuf = sokol_gfx.make_buffer( BufferDesciption { | ||||
| 			size  = size_of([4]f32) * Kilo * 128, | ||||
| 			size  = size_of([4]f32) * Kilo * 512, | ||||
| 			usage = BufferUsage.STREAM, | ||||
| 			type  = BufferType.VERTEXBUFFER, | ||||
| 		}) | ||||
| 		verify( sokol_gfx.query_buffer_state( draw_list_vbuf) < ResourceState.FAILED, "Failed to make draw_list_vbuf" ) | ||||
|  | ||||
| 		draw_list_ibuf = sokol_gfx.make_buffer( BufferDesciption { | ||||
| 			size  = size_of(u32) * Kilo * 32, | ||||
| 			size  = size_of(u32) * Kilo * 256, | ||||
| 			usage = BufferUsage.STREAM, | ||||
| 			type  = BufferType.INDEXBUFFER, | ||||
| 		}) | ||||
| 		verify( sokol_gfx.query_buffer_state( draw_list_ibuf) < ResourceState.FAILED, "Failed to make draw_list_iubuf" ) | ||||
|  | ||||
| 		Image_Filter := Filter.LINEAR | ||||
|  | ||||
| 		// glyph_pipeline | ||||
| 		{ | ||||
| 			vs_layout : VertexLayoutState | ||||
| @@ -217,15 +219,16 @@ font_provider_startup :: proc() | ||||
| 			}) | ||||
|  | ||||
| 			glyph_rt_sampler = sokol_gfx.make_sampler( SamplerDescription { | ||||
| 				min_filter    = Filter.LINEAR, | ||||
| 				mag_filter    = Filter.LINEAR, | ||||
| 				mipmap_filter = Filter.NONE, | ||||
| 				wrap_u        = .CLAMP_TO_EDGE, | ||||
| 				wrap_v        = .CLAMP_TO_EDGE, | ||||
| 				min_lod       = -1000.0, | ||||
| 				max_lod       =  1000.0, | ||||
| 				border_color  = BorderColor.OPAQUE_BLACK, | ||||
| 				compare       = .NEVER | ||||
| 				min_filter     = Image_Filter, | ||||
| 				mag_filter     = Image_Filter, | ||||
| 				mipmap_filter  = Filter.NONE, | ||||
| 				wrap_u         = .CLAMP_TO_EDGE, | ||||
| 				wrap_v         = .CLAMP_TO_EDGE, | ||||
| 				min_lod        = -1000.0, | ||||
| 				max_lod        =  1000.0, | ||||
| 				border_color   = BorderColor.OPAQUE_BLACK, | ||||
| 				compare        = .NEVER, | ||||
| 				max_anisotropy = 1, | ||||
| 			}) | ||||
| 			verify( sokol_gfx.query_sampler_state( glyph_rt_sampler) < ResourceState.FAILED, "Failed to make atlas_rt_sampler" ) | ||||
|  | ||||
| @@ -354,15 +357,16 @@ font_provider_startup :: proc() | ||||
| 			verify( sokol_gfx.query_image_state(atlas_rt_depth) < ResourceState.FAILED, "Failed to make atlas_rt_depth") | ||||
|  | ||||
| 			atlas_rt_sampler = sokol_gfx.make_sampler( SamplerDescription { | ||||
| 				min_filter    = Filter.LINEAR, | ||||
| 				mag_filter    = Filter.LINEAR, | ||||
| 				mipmap_filter = Filter.NONE, | ||||
| 				wrap_u        = .CLAMP_TO_EDGE, | ||||
| 				wrap_v        = .CLAMP_TO_EDGE, | ||||
| 				min_lod       = -1000.0, | ||||
| 				max_lod       =  1000.0, | ||||
| 				border_color  = BorderColor.OPAQUE_BLACK, | ||||
| 				compare       = .NEVER | ||||
| 				min_filter     = Image_Filter, | ||||
| 				mag_filter     = Image_Filter, | ||||
| 				mipmap_filter  = Filter.NONE, | ||||
| 				wrap_u         = .CLAMP_TO_EDGE, | ||||
| 				wrap_v         = .CLAMP_TO_EDGE, | ||||
| 				min_lod        = -1000.0, | ||||
| 				max_lod        =  1000.0, | ||||
| 				border_color   = BorderColor.OPAQUE_BLACK, | ||||
| 				compare        = .NEVER, | ||||
| 				max_anisotropy = 1, | ||||
| 			}) | ||||
| 			verify( sokol_gfx.query_sampler_state( atlas_rt_sampler) < ResourceState.FAILED, "Failed to make atlas_rt_sampler" ) | ||||
|  | ||||
| @@ -574,22 +578,18 @@ font_load :: proc(path_file : string, | ||||
|  | ||||
| Font_Use_Default_Size :: f32(0.0) | ||||
|  | ||||
| font_provider_resolve_draw_id :: proc( id : FontID, size := Font_Use_Default_Size ) -> ve.FontID | ||||
| font_provider_resolve_draw_id :: proc( id : FontID, size := Font_Use_Default_Size ) -> (ve_id :ve.FontID, resolved_size : i32) | ||||
| { | ||||
| 	state := get_state(); using state | ||||
|  | ||||
| 	def           := hmap_chained_get( font_provider_data.font_cache, id.key ) | ||||
| 	size          := size == 0.0 ? f32(def.default_size) : size | ||||
| 	// size          :f32 = 14.0 | ||||
| 	even_size     := math.round(size * (1.0 / f32(Font_Size_Interval))) * f32(Font_Size_Interval) | ||||
| 	resolved_size := clamp( i32( even_size), 14, Font_Largest_Px_Size ) | ||||
| 	resolved_size  = clamp( i32( even_size), 14, Font_Largest_Px_Size ) | ||||
|  | ||||
| 	id    := (resolved_size / Font_Size_Interval) + (resolved_size % Font_Size_Interval) | ||||
| 	ve_id := def.size_table[ id - 1 ] | ||||
|  | ||||
| 	width  := app_window.extent.x * 2 | ||||
| 	height := app_window.extent.y * 2 | ||||
| 	return ve_id | ||||
| 	ve_id  = def.size_table[ id - 1 ] | ||||
| 	return | ||||
| } | ||||
|  | ||||
| measure_text_size :: proc( text : string, font : FontID, font_size := Font_Use_Default_Size, spacing : f32 ) -> Vec2 | ||||
| @@ -597,8 +597,7 @@ measure_text_size :: proc( text : string, font : FontID, font_size := Font_Use_D | ||||
| 	state := get_state(); using state | ||||
|  | ||||
| 	// profile(#procedure) | ||||
| 	px_size := math.round( font_size ) | ||||
| 	ve_id   := font_provider_resolve_draw_id( font, font_size ) | ||||
| 	ve_id, size := font_provider_resolve_draw_id( font, font_size ) | ||||
|  | ||||
| 	measured := ve.measure_text_size( & font_provider_data.ve_font_cache, ve_id, text ) | ||||
| 	return measured | ||||
|   | ||||
| @@ -168,8 +168,8 @@ view_get_bounds :: #force_inline proc "contextless"() -> Range2 { | ||||
| 	cam            := & project.workspace.cam | ||||
| 	screen_extent  := state.app_window.extent | ||||
| 	cam_zoom_ratio := 1.0 / cam.zoom | ||||
| 	bottom_left  := Vec2 { cam.position.x, -cam.position.y } + Vec2 { -screen_extent.x, -screen_extent.y} * cam_zoom_ratio | ||||
| 	top_right    := Vec2 { cam.position.x, -cam.position.y } + Vec2 {  screen_extent.x,  screen_extent.y} * cam_zoom_ratio | ||||
| 	bottom_left  := Vec2 { cam.position.x, cam.position.y } + Vec2 {  screen_extent.x, screen_extent.y} * cam_zoom_ratio | ||||
| 	top_right    := Vec2 { cam.position.x, cam.position.y } + Vec2 {  screen_extent.x, screen_extent.y} * cam_zoom_ratio | ||||
| 	return range2( bottom_left, top_right ) | ||||
| } | ||||
|  | ||||
| @@ -202,7 +202,7 @@ render_to_ws_view_pos :: #force_inline proc "contextless" (pos : Vec2) -> Vec2 { | ||||
| screen_to_ws_view_pos :: #force_inline proc "contextless" (pos: Vec2) -> Vec2 { | ||||
| 	state := get_state(); using state | ||||
| 	cam   := & project.workspace.cam | ||||
| 	result := Vec2 { cam.position.x, -cam.position.y} + Vec2 { pos.x, pos.y } * (1 / cam.zoom) | ||||
| 	result := (Vec2 { cam.position.x, -cam.position.y} + Vec2 { pos.x, pos.y }) * (1 / cam.zoom) | ||||
| 	return result | ||||
| } | ||||
|  | ||||
| @@ -229,7 +229,15 @@ ws_view_to_screen_pos :: #force_inline proc "contextless"(position: Vec2) -> Vec | ||||
| } | ||||
|  | ||||
| ws_view_to_render_pos :: #force_inline proc "contextless"(position: Vec2) -> Vec2 { | ||||
| 	return { position.x, position.y * -1 } | ||||
| 	state := get_state(); using state | ||||
| 	cam := state.project.workspace.cam | ||||
|  | ||||
| 	screen_extent := transmute(Vec2) get_state().app_window.extent | ||||
| 	extent_offset : Vec2 = { screen_extent.x, screen_extent.y } * { 1, 1 } | ||||
|  | ||||
| 	position   := Vec2 { position.x, position.y } | ||||
| 	cam_offset := Vec2 { cam.position.x, cam.position.y } | ||||
| 	return extent_offset + (position + cam_offset) * cam.zoom | ||||
| } | ||||
|  | ||||
| // Workspace view to screen space position (zoom agnostic) | ||||
|   | ||||
| @@ -129,7 +129,7 @@ ve_blit_atlas_vs_source_hlsl4 := [705]u8 { | ||||
| /* | ||||
|     cbuffer ve_blit_atlas_fs_params : register(b0) | ||||
|     { | ||||
|         int _83_region : packoffset(c0); | ||||
|         int _88_region : packoffset(c0); | ||||
|     }; | ||||
|  | ||||
|     Texture2D<float4> ve_blit_atlas_src_texture : register(t0); | ||||
| @@ -155,26 +155,26 @@ ve_blit_atlas_vs_source_hlsl4 := [705]u8 { | ||||
|  | ||||
|     void frag_main() | ||||
|     { | ||||
|         bool _88 = _83_region == 0; | ||||
|         bool _96; | ||||
|         if (!_88) | ||||
|         bool _93 = _88_region == 0; | ||||
|         bool _101; | ||||
|         if (!_93) | ||||
|         { | ||||
|             _96 = _83_region == 1; | ||||
|             _101 = _88_region == 1; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             _96 = _88; | ||||
|             _101 = _93; | ||||
|         } | ||||
|         bool _104; | ||||
|         if (!_96) | ||||
|         bool _109; | ||||
|         if (!_101) | ||||
|         { | ||||
|             _104 = _83_region == 2; | ||||
|             _109 = _88_region == 2; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             _104 = _96; | ||||
|             _109 = _101; | ||||
|         } | ||||
|         if (_104) | ||||
|         if (_109) | ||||
|         { | ||||
|             float2 param = uv + float2(-0.00048828125f, -0.0029296875f); | ||||
|             float2 param_1 = float2(0.00048828125f, 0.001953125f); | ||||
| @@ -202,11 +202,11 @@ ve_blit_atlas_vs_source_hlsl4 := [705]u8 { | ||||
|     } | ||||
| */ | ||||
| @(private) | ||||
| ve_blit_atlas_fs_source_hlsl4 := [2135]u8 { | ||||
| ve_blit_atlas_fs_source_hlsl4 := [2140]u8 { | ||||
|     0x63,0x62,0x75,0x66,0x66,0x65,0x72,0x20,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f, | ||||
|     0x61,0x74,0x6c,0x61,0x73,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x20, | ||||
|     0x3a,0x20,0x72,0x65,0x67,0x69,0x73,0x74,0x65,0x72,0x28,0x62,0x30,0x29,0x0a,0x7b, | ||||
|     0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x5f,0x38,0x33,0x5f,0x72,0x65,0x67, | ||||
|     0x0a,0x20,0x20,0x20,0x20,0x69,0x6e,0x74,0x20,0x5f,0x38,0x38,0x5f,0x72,0x65,0x67, | ||||
|     0x69,0x6f,0x6e,0x20,0x3a,0x20,0x70,0x61,0x63,0x6b,0x6f,0x66,0x66,0x73,0x65,0x74, | ||||
|     0x28,0x63,0x30,0x29,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x54,0x65,0x78,0x74,0x75,0x72, | ||||
|     0x65,0x32,0x44,0x3c,0x66,0x6c,0x6f,0x61,0x74,0x34,0x3e,0x20,0x76,0x65,0x5f,0x62, | ||||
| @@ -256,87 +256,87 @@ ve_blit_atlas_fs_source_hlsl4 := [2135]u8 { | ||||
|     0x72,0x2c,0x20,0x75,0x76,0x5f,0x31,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72, | ||||
|     0x65,0x5f,0x73,0x69,0x7a,0x65,0x29,0x2e,0x78,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x76, | ||||
|     0x6f,0x69,0x64,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a, | ||||
|     0x7b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x38,0x38,0x20,0x3d, | ||||
|     0x20,0x5f,0x38,0x33,0x5f,0x72,0x65,0x67,0x69,0x6f,0x6e,0x20,0x3d,0x3d,0x20,0x30, | ||||
|     0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x39,0x36,0x3b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x38,0x38,0x29,0x0a,0x20,0x20, | ||||
|     0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x39,0x36,0x20, | ||||
|     0x3d,0x20,0x5f,0x38,0x33,0x5f,0x72,0x65,0x67,0x69,0x6f,0x6e,0x20,0x3d,0x3d,0x20, | ||||
|     0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73, | ||||
|     0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | ||||
|     0x5f,0x39,0x36,0x20,0x3d,0x20,0x5f,0x38,0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d, | ||||
|     0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x30,0x34,0x3b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x39,0x36,0x29,0x0a,0x20,0x20, | ||||
|     0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30,0x34, | ||||
|     0x20,0x3d,0x20,0x5f,0x38,0x33,0x5f,0x72,0x65,0x67,0x69,0x6f,0x6e,0x20,0x3d,0x3d, | ||||
|     0x20,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65,0x6c, | ||||
|     0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | ||||
|     0x20,0x5f,0x31,0x30,0x34,0x20,0x3d,0x20,0x5f,0x39,0x36,0x3b,0x0a,0x20,0x20,0x20, | ||||
|     0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x5f,0x31,0x30,0x34,0x29, | ||||
|     0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66, | ||||
|     0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20,0x3d,0x20,0x75,0x76, | ||||
|     0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30, | ||||
|     0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30, | ||||
|     0x32,0x39,0x32,0x39,0x36,0x38,0x37,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, | ||||
|     0x7b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x39,0x33,0x20,0x3d, | ||||
|     0x20,0x5f,0x38,0x38,0x5f,0x72,0x65,0x67,0x69,0x6f,0x6e,0x20,0x3d,0x3d,0x20,0x30, | ||||
|     0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x30,0x31,0x3b, | ||||
|     0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x39,0x33,0x29,0x0a,0x20, | ||||
|     0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30, | ||||
|     0x31,0x20,0x3d,0x20,0x5f,0x38,0x38,0x5f,0x72,0x65,0x67,0x69,0x6f,0x6e,0x20,0x3d, | ||||
|     0x3d,0x20,0x31,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x65, | ||||
|     0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20, | ||||
|     0x20,0x20,0x5f,0x31,0x30,0x31,0x20,0x3d,0x20,0x5f,0x39,0x33,0x3b,0x0a,0x20,0x20, | ||||
|     0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x30, | ||||
|     0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x31,0x30,0x31, | ||||
|     0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | ||||
|     0x5f,0x31,0x30,0x39,0x20,0x3d,0x20,0x5f,0x38,0x38,0x5f,0x72,0x65,0x67,0x69,0x6f, | ||||
|     0x6e,0x20,0x3d,0x3d,0x20,0x32,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20, | ||||
|     0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20, | ||||
|     0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30,0x39,0x20,0x3d,0x20,0x5f,0x31,0x30,0x31, | ||||
|     0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28, | ||||
|     0x5f,0x31,0x30,0x39,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20, | ||||
|     0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d, | ||||
|     0x5f,0x31,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30, | ||||
|     0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30, | ||||
|     0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20, | ||||
|     0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, | ||||
|     0x32,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28, | ||||
|     0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,0x2c, | ||||
|     0x20,0x2d,0x30,0x2e,0x30,0x30,0x32,0x39,0x32,0x39,0x36,0x38,0x37,0x35,0x66,0x29, | ||||
|     0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, | ||||
|     0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74, | ||||
|     0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66, | ||||
|     0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b, | ||||
|     0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d, | ||||
|     0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20, | ||||
|     0x2d,0x30,0x2e,0x30,0x30,0x32,0x39,0x32,0x39,0x36,0x38,0x37,0x35,0x66,0x29,0x3b, | ||||
|     0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20, | ||||
|     0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66, | ||||
|     0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,0x37,0x33,0x32,0x34, | ||||
|     0x32,0x31,0x38,0x37,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36, | ||||
|     0x35,0x36,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | ||||
|     0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35,0x20,0x3d, | ||||
|     0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38, | ||||
|     0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33, | ||||
|     0x31,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66, | ||||
|     0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x20,0x3d,0x20, | ||||
|     0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30, | ||||
|     0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30, | ||||
|     0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, | ||||
|     0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c, | ||||
|     0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70, | ||||
|     0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c, | ||||
|     0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30, | ||||
|     0x36,0x32,0x35,0x66,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x32,0x39,0x32,0x39,0x36, | ||||
|     0x38,0x37,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66, | ||||
|     0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20, | ||||
|     0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32, | ||||
|     0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31, | ||||
|     0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c, | ||||
|     0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x20,0x3d,0x20,0x75, | ||||
|     0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30, | ||||
|     0x30,0x37,0x33,0x32,0x34,0x32,0x31,0x38,0x37,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30, | ||||
|     0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20, | ||||
|     0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61, | ||||
|     0x6d,0x5f,0x37,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30, | ||||
|     0x6d,0x5f,0x35,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x28,0x30,0x2e,0x30, | ||||
|     0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66,0x2c,0x20,0x30,0x2e,0x30, | ||||
|     0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, | ||||
|     0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, | ||||
|     0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e, | ||||
|     0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x32,0x35,0x66,0x20, | ||||
|     0x2a,0x20,0x28,0x28,0x28,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65, | ||||
|     0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31,0x29, | ||||
|     0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x70, | ||||
|     0x61,0x72,0x61,0x6d,0x5f,0x32,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x29, | ||||
|     0x29,0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28, | ||||
|     0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x35, | ||||
|     0x29,0x29,0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65, | ||||
|     0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x2c,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f, | ||||
|     0x37,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20, | ||||
|     0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20, | ||||
|     0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20, | ||||
|     0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x30,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x30, | ||||
|     0x66,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x29,0x3b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x7d,0x0a,0x7d,0x0a,0x0a,0x53,0x50,0x49,0x52,0x56,0x5f,0x43, | ||||
|     0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x6d,0x61,0x69,0x6e, | ||||
|     0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x49,0x6e,0x70, | ||||
|     0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x29,0x0a, | ||||
|     0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x73,0x74,0x61,0x67,0x65, | ||||
|     0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x75,0x76,0x3b,0x0a,0x20,0x20,0x20,0x20,0x66, | ||||
|     0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, | ||||
|     0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70, | ||||
|     0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b, | ||||
|     0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70,0x75, | ||||
|     0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66, | ||||
|     0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72, | ||||
|     0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75,0x74,0x70, | ||||
|     0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, | ||||
|     0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32,0x20,0x70,0x61,0x72,0x61,0x6d, | ||||
|     0x5f,0x36,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, | ||||
|     0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x66, | ||||
|     0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x66,0x29, | ||||
|     0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x6c,0x6f,0x61,0x74,0x32, | ||||
|     0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74, | ||||
|     0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x66, | ||||
|     0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x66,0x29,0x3b, | ||||
|     0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f, | ||||
|     0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x31,0x2e,0x30, | ||||
|     0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e,0x30,0x66,0x2c,0x20,0x30, | ||||
|     0x2e,0x32,0x35,0x66,0x20,0x2a,0x20,0x28,0x28,0x28,0x64,0x6f,0x77,0x6e,0x5f,0x73, | ||||
|     0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x2c,0x20,0x70,0x61,0x72, | ||||
|     0x61,0x6d,0x5f,0x31,0x29,0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d, | ||||
|     0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x2c,0x20,0x70,0x61,0x72, | ||||
|     0x61,0x6d,0x5f,0x33,0x29,0x29,0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61, | ||||
|     0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x34,0x2c,0x20,0x70,0x61, | ||||
|     0x72,0x61,0x6d,0x5f,0x35,0x29,0x29,0x20,0x2b,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73, | ||||
|     0x61,0x6d,0x70,0x6c,0x65,0x28,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x2c,0x20,0x70, | ||||
|     0x61,0x72,0x61,0x6d,0x5f,0x37,0x29,0x29,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d, | ||||
|     0x0a,0x20,0x20,0x20,0x20,0x65,0x6c,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c, | ||||
|     0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x30,0x2e,0x30,0x66, | ||||
|     0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x30,0x2e,0x30,0x66,0x2c,0x20,0x31,0x2e, | ||||
|     0x30,0x66,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x7d,0x0a,0x0a,0x53,0x50, | ||||
|     0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73,0x5f,0x4f,0x75,0x74,0x70,0x75,0x74, | ||||
|     0x20,0x6d,0x61,0x69,0x6e,0x28,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73, | ||||
|     0x73,0x5f,0x49,0x6e,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e, | ||||
|     0x70,0x75,0x74,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20, | ||||
|     0x73,0x74,0x61,0x67,0x65,0x5f,0x69,0x6e,0x70,0x75,0x74,0x2e,0x75,0x76,0x3b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x6d,0x61,0x69,0x6e,0x28,0x29,0x3b, | ||||
|     0x0a,0x20,0x20,0x20,0x20,0x53,0x50,0x49,0x52,0x56,0x5f,0x43,0x72,0x6f,0x73,0x73, | ||||
|     0x5f,0x4f,0x75,0x74,0x70,0x75,0x74,0x20,0x73,0x74,0x61,0x67,0x65,0x5f,0x6f,0x75, | ||||
|     0x74,0x70,0x75,0x74,0x3b,0x0a,0x20,0x20,0x20,0x20,0x73,0x74,0x61,0x67,0x65,0x5f, | ||||
|     0x6f,0x75,0x74,0x70,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f, | ||||
|     0x72,0x20,0x3d,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x73,0x74,0x61,0x67,0x65, | ||||
|     0x5f,0x6f,0x75,0x74,0x70,0x75,0x74,0x3b,0x0a,0x7d,0x0a,0x00, | ||||
| } | ||||
| ve_blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc { | ||||
|     desc: sg.Shader_Desc | ||||
|   | ||||
| @@ -20,11 +20,13 @@ uniform ve_blit_atlas_fs_params { | ||||
|  | ||||
| float down_sample( vec2 uv, vec2 texture_size ) | ||||
| { | ||||
| 	float down_sample_scale = 1.0f / 4.0f; | ||||
|  | ||||
| 	float value = | ||||
| 		texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 0.0f, 0.0f ) * texture_size ).x * 0.25f | ||||
| 	+	texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 0.0f, 1.0f ) * texture_size ).x * 0.25f | ||||
| 	+	texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 1.0f, 0.0f ) * texture_size ).x * 0.25f | ||||
| 	+	texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 1.0f, 1.0f ) * texture_size ).x * 0.25f; | ||||
| 		texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 0.0f, 0.0f ) * texture_size ).x * down_sample_scale | ||||
| 	+	texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 0.0f, 1.0f ) * texture_size ).x * down_sample_scale | ||||
| 	+	texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 1.0f, 0.0f ) * texture_size ).x * down_sample_scale | ||||
| 	+	texture(sampler2D( ve_blit_atlas_src_texture, ve_blit_atlas_src_sampler ), uv + vec2( 1.0f, 1.0f ) * texture_size ).x * down_sample_scale; | ||||
| 	return value; | ||||
| } | ||||
|  | ||||
| @@ -34,11 +36,13 @@ void main() | ||||
| 	const vec2 texture_size = 1.0f / vec2( 2048.0f, 512.0f ); // VEFontCache.Context.buffer_width/buffer_height | ||||
| 	if ( region == 0 || region == 1 || region == 2 ) | ||||
| 	{ | ||||
| 		float down_sample_scale = 1.0f / 4.0f; | ||||
|  | ||||
| 		float alpha = | ||||
| 			down_sample( uv + vec2( -1.0f, -1.5f ) * texture_size, texture_size ) * 0.25f | ||||
| 		+	down_sample( uv + vec2(  0.5f, -1.5f ) * texture_size, texture_size ) * 0.25f | ||||
| 		+	down_sample( uv + vec2( -1.5f,  0.5f ) * texture_size, texture_size ) * 0.25f | ||||
| 		+	down_sample( uv + vec2(  0.5f,  0.5f ) * texture_size, texture_size ) * 0.25f; | ||||
| 			down_sample( uv + vec2( -1.0f, -1.5f ) * texture_size, texture_size ) * down_sample_scale | ||||
| 		+	down_sample( uv + vec2(  0.5f, -1.5f ) * texture_size, texture_size ) * down_sample_scale | ||||
| 		+	down_sample( uv + vec2( -1.5f,  0.5f ) * texture_size, texture_size ) * down_sample_scale | ||||
| 		+	down_sample( uv + vec2(  0.5f,  0.5f ) * texture_size, texture_size ) * down_sample_scale; | ||||
| 		frag_color = vec4( 1.0f, 1.0f, 1.0f, alpha ); | ||||
| 	} | ||||
| 	else | ||||
|   | ||||
| @@ -71,11 +71,14 @@ ui_box_compute_layout :: proc( box : ^UI_Box, | ||||
| 	adjusted_size.y = max( adjusted_max_size_y, layout.size.min.y) | ||||
|  | ||||
| 	text_size : Vec2 | ||||
| 	if layout.font_size == computed.text_size.y { | ||||
| 		text_size = computed.text_size | ||||
| 	} | ||||
| 	else { | ||||
| 		text_size = cast(Vec2) measure_text_size( box.text.str, style.font, layout.font_size, 0 ) | ||||
| 	if len(box.text.str) > 0 | ||||
| 	{ | ||||
| 		if layout.font_size == computed.text_size.y { | ||||
| 			text_size = computed.text_size | ||||
| 		} | ||||
| 		else { | ||||
| 			text_size = cast(Vec2) measure_text_size( box.text.str, style.font, layout.font_size, 0 ) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	if size_to_text { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user