More progress toward VEFontCache rendering
Based off of render doc, most likely down to UV issues for where on the glyph buffer the shape is located
This commit is contained in:
		| @@ -92,7 +92,7 @@ render :: proc() | ||||
| 		ve.set_colour( & ve_font_cache,  { 1.0, 1.0, 1.0, 1.0 } ) | ||||
| 		ve.configure_snap( & ve_font_cache, u32(state.app_window.extent.x * 2.0), u32(state.app_window.extent.y * 2.0) ) | ||||
|  | ||||
| 		ve.draw_text( & ve_font_cache, fdef.ve_id, text_test_str, {0.4, 0.1}, Vec2{1 / width, 1 / height} ) | ||||
| 		ve.draw_text( & ve_font_cache, fdef.ve_id, text_test_str, {0.5, 0.0}, Vec2{1 / width, 1 / height} ) | ||||
| 	} | ||||
|  | ||||
| 	// Process the draw calls for drawing text | ||||
| @@ -109,6 +109,7 @@ render :: proc() | ||||
| 		draw_list_call_slice := array_to_slice(draw_list.calls) | ||||
| 		for & draw_call in array_to_slice(draw_list.calls) | ||||
| 		{ | ||||
| 			watch := draw_call | ||||
| 			profile("ve draw call") | ||||
| 			if (draw_call.end_index - draw_call.start_index) == 0 do continue | ||||
|  | ||||
| @@ -128,8 +129,8 @@ render :: proc() | ||||
| 					} | ||||
| 					sokol_gfx.begin_pass( pass ) | ||||
|  | ||||
| 					sokol_gfx.apply_viewport( 0,0, width, height, origin_top_left = true ) | ||||
| 					sokol_gfx.apply_scissor_rect( 0,0, width, height, origin_top_left = true ) | ||||
| 					// sokol_gfx.apply_viewport( 0,0, width, height, origin_top_left = true ) | ||||
| 					// sokol_gfx.apply_scissor_rect( 0,0, width, height, origin_top_left = true ) | ||||
|  | ||||
| 					sokol_gfx.apply_pipeline( glyph_pipeline ) | ||||
|  | ||||
| @@ -141,7 +142,7 @@ render :: proc() | ||||
| 							0 = 0, | ||||
| 						}, | ||||
| 						index_buffer        = draw_list_ibuf, | ||||
| 						index_buffer_offset = i32(draw_call.start_index), | ||||
| 						index_buffer_offset = 0,//i32(draw_call.start_index), | ||||
| 						fs = {}, | ||||
| 					} | ||||
| 					sokol_gfx.apply_bindings( bindings ) | ||||
| @@ -160,13 +161,13 @@ render :: proc() | ||||
|  | ||||
| 					pass := atlas_pass | ||||
| 					if draw_call.clear_before_draw { | ||||
| 						pass.action.colors[0].load_action = .CLEAR | ||||
| 						// pass.action.colors[0].clear_value.a = 0.0 | ||||
| 						pass.action.colors[0].load_action   = .CLEAR | ||||
| 						pass.action.colors[0].clear_value.a = 1.0 | ||||
| 					} | ||||
| 					sokol_gfx.begin_pass( pass ) | ||||
|  | ||||
| 					sokol_gfx.apply_viewport( 0, 0, width, height, origin_top_left = true ) | ||||
| 					sokol_gfx.apply_scissor_rect( 0, 0, width, height, origin_top_left = true ) | ||||
| 					// sokol_gfx.apply_viewport( 0, 0, width, height, origin_top_left = true ) | ||||
| 					// sokol_gfx.apply_scissor_rect( 0, 0, width, height, origin_top_left = true ) | ||||
|  | ||||
| 					sokol_gfx.apply_pipeline( atlas_pipeline ) | ||||
|  | ||||
| @@ -181,7 +182,7 @@ render :: proc() | ||||
| 							0 = 0, | ||||
| 						}, | ||||
| 						index_buffer        = draw_list_ibuf, | ||||
| 						index_buffer_offset = i32(draw_call.start_index), | ||||
| 						index_buffer_offset = 0,//i32(draw_call.start_index), | ||||
| 						fs = { | ||||
| 							images   = { SLOT_ve_blit_atlas_src_texture = glyph_rt_color, }, | ||||
| 							samplers = { SLOT_ve_blit_atlas_src_sampler = gfx_sampler,   }, | ||||
| @@ -198,14 +199,14 @@ render :: proc() | ||||
|  | ||||
| 					pass := screen_pass | ||||
| 					if ! draw_call.clear_before_draw { | ||||
| 						pass.action.colors[0].load_action = .LOAD | ||||
| 						// pass.action.colors[0].clear_value.a = 0.0 | ||||
| 						pass.action.colors[0].load_action   = .LOAD | ||||
| 						pass.action.colors[0].clear_value.a = 0.0 | ||||
| 					} | ||||
| 					pass.swapchain = sokol_glue.swapchain() | ||||
| 					sokol_gfx.begin_pass( pass ) | ||||
|  | ||||
| 					sokol_gfx.apply_viewport( 0, 0, width, height, origin_top_left = true ) | ||||
| 					sokol_gfx.apply_scissor_rect( 0, 0, width, height, origin_top_left = true ) | ||||
| 					// sokol_gfx.apply_viewport( 0, 0, width, height, origin_top_left = true ) | ||||
| 					// sokol_gfx.apply_scissor_rect( 0, 0, width, height, origin_top_left = true ) | ||||
|  | ||||
| 					sokol_gfx.apply_pipeline( screen_pipeline ) | ||||
|  | ||||
| @@ -222,7 +223,7 @@ render :: proc() | ||||
| 							0 = 0, | ||||
| 						}, | ||||
| 						index_buffer        = draw_list_ibuf, | ||||
| 						index_buffer_offset = i32(draw_call.start_index), | ||||
| 						index_buffer_offset = 0,//i32(draw_call.start_index), | ||||
| 						fs = { | ||||
| 							images   = { SLOT_ve_draw_text_src_texture = src_rt, }, | ||||
| 							samplers = { SLOT_ve_draw_text_src_sampler = gfx_sampler,   }, | ||||
|   | ||||
| @@ -164,8 +164,6 @@ font_provider_startup :: proc() | ||||
| 					enabled = true, | ||||
| 					src_factor_rgb   = .ONE_MINUS_DST_COLOR, | ||||
| 					dst_factor_rgb   = .ONE_MINUS_SRC_COLOR, | ||||
| 					// src_factor_rgb   = .SRC_ALPHA, | ||||
| 					// dst_factor_rgb   = .ONE_MINUS_SRC_ALPHA, | ||||
| 					op_rgb           = BlendOp.ADD, | ||||
| 					src_factor_alpha = BlendFactor.ONE, | ||||
| 					dst_factor_alpha = BlendFactor.ZERO, | ||||
| @@ -183,6 +181,7 @@ font_provider_startup :: proc() | ||||
| 				color_count  = 1, | ||||
| 				depth = { | ||||
| 					pixel_format = .DEPTH, | ||||
| 					// compare = .ALWAYS, | ||||
| 				}, | ||||
| 				// sample_count = 1, | ||||
| 				// label = | ||||
| @@ -237,9 +236,10 @@ font_provider_startup :: proc() | ||||
| 			glyph_action := PassAction { | ||||
| 				colors = { | ||||
| 					0 = { | ||||
| 						load_action  = .DONTCARE, | ||||
| 						load_action  = .CLEAR, | ||||
| 						store_action = .STORE, | ||||
| 						clear_value  = {0,0,0,1}, | ||||
| 						clear_value  = {0.01,0.01,0.01,1}, | ||||
| 						// clear_value  = {0.00, 0.00, 0.00, 0.00}, | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| @@ -296,6 +296,7 @@ font_provider_startup :: proc() | ||||
| 				color_count  = 1, | ||||
| 				depth = { | ||||
| 					pixel_format = .DEPTH, | ||||
| 					compare = .ALWAYS, | ||||
| 				}, | ||||
| 				// sample_count = 1, | ||||
| 			}) | ||||
| @@ -351,7 +352,7 @@ font_provider_startup :: proc() | ||||
| 					0 = { | ||||
| 						load_action  = .LOAD, | ||||
| 						store_action = .STORE, | ||||
| 						clear_value  = {0,0,0,1}, | ||||
| 						clear_value  = {0,0,0,1.0}, | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| @@ -418,7 +419,7 @@ font_provider_startup :: proc() | ||||
| 					0 = { | ||||
| 						load_action  = .CLEAR, | ||||
| 						store_action = .STORE, | ||||
| 						clear_value  = {0,0,0,0}, | ||||
| 						clear_value  = {1.0,0.0,0.0,1.0}, | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
|   | ||||
| @@ -389,10 +389,10 @@ ve_draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc { | ||||
|         desc.fs.uniform_blocks[0].layout = .STD140 | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].name = "_31.down_sample" | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].type = .INT | ||||
|         // array_count = desc.fs.uniform_blocks[0].uniforms[0] | ||||
|         // .array_count = desc.fs.uniform_blocks[0].uniforms[0] | ||||
|         desc.fs.uniform_blocks[0].uniforms[1].name = "_31.colour" | ||||
|         desc.fs.uniform_blocks[0].uniforms[1].type = .FLOAT4 | ||||
|         // array_count = desc.fs.uniform_blocks[0].uniforms[1] | ||||
|         // .array_count = desc.fs.uniform_blocks[0].uniforms[1] | ||||
|         desc.fs.images[0].used = true | ||||
|         desc.fs.images[0].multisampled = false | ||||
|         desc.fs.images[0].image_type = ._2D | ||||
|   | ||||
		Reference in New Issue
	
	Block a user