Changes while attempting to debug
This commit is contained in:
		| @@ -238,6 +238,7 @@ State :: struct { | ||||
| 	font_provider_data : FontProviderData, | ||||
|  | ||||
| 	font_firacode                : FontID, | ||||
| 	font_open_sans               : FontID, | ||||
| 	font_squidgy_slimes          : FontID, | ||||
| 	font_rec_mono_semicasual_reg : FontID, | ||||
| 	default_font                 : FontID, | ||||
|   | ||||
| @@ -68,7 +68,7 @@ render :: proc() | ||||
| 	} | ||||
|  | ||||
| 	// learnopengl.com/In-Practice/Text-Rendering | ||||
| 	when false | ||||
| 	when true | ||||
| 	{ | ||||
| 		profile("learngl_text_render_pass") | ||||
| 		using font_provider_data | ||||
|   | ||||
| @@ -281,9 +281,12 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem | ||||
| 		// path_squidgy_slimes := strings.concatenate( { Path_Assets, "Squidgy Slimes.ttf" } ) | ||||
| 		// font_squidgy_slimes = font_load( path_squidgy_slimes, 24.0, "Squidgy_Slime" ) | ||||
|  | ||||
| 		path_firacode := strings.concatenate( { Path_Assets, "FiraCode-Regular.ttf" } ) | ||||
| 		font_firacode  = font_load( path_firacode, 24.0, "FiraCode" ) | ||||
| 		default_font = font_firacode | ||||
| 		// path_firacode := strings.concatenate( { Path_Assets, "FiraCode-Regular.ttf" } ) | ||||
| 		// font_firacode  = font_load( path_firacode, 24.0, "FiraCode" ) | ||||
|  | ||||
| 		path_open_sans := strings.concatenate( { Path_Assets, "OpenSans-Regular.ttf" } ) | ||||
| 		font_open_sans  = font_load( path_open_sans, 24.0, "OpenSans" ) | ||||
| 		default_font = font_open_sans | ||||
| 		log( "Default font loaded" ) | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -3,6 +3,7 @@ package sectr | ||||
| import ve         "codebase:font/VEFontCache" | ||||
| import sokol_gfx  "thirdparty:sokol/gfx" | ||||
| import sokol_glue "thirdparty:sokol/glue" | ||||
| import "core:time" | ||||
|  | ||||
| PassActions :: struct { | ||||
| 	bg_clear_black : sokol_gfx.Pass_Action, | ||||
| @@ -38,6 +39,8 @@ render :: proc() | ||||
| 	do_nothing : bool | ||||
| 	do_nothing = false | ||||
|  | ||||
| 	time.sleep(10000) | ||||
|  | ||||
| 	// The below are most likely limited to a "depth layer" and so | ||||
| 	// different depth layers need different draw pass combos (of the 3 constructive passes) | ||||
| 	// Will need to profile how expensive it is for batching with the UI box rendering | ||||
| @@ -47,26 +50,65 @@ render :: proc() | ||||
| 	using font_provider | ||||
| 	// ve_ctx := & font_provider.ve_font_cache | ||||
|  | ||||
| 	// Triangle Demo | ||||
| 	if true | ||||
| 	{ | ||||
| 		using debug.gfx_tri_demo_state | ||||
| 		sokol_gfx.begin_pass(sokol_gfx.Pass { action = pass_action, swapchain = sokol_glue.swapchain() }) | ||||
| 		sokol_gfx.apply_pipeline( pipeline ) | ||||
| 		sokol_gfx.apply_bindings( bindings ) | ||||
|  | ||||
| 		sokol_gfx.draw( 0, 3, 1 ) | ||||
|  | ||||
| 		sokol_gfx.end_pass() | ||||
| 	} | ||||
|  | ||||
| 	// Clear Demo | ||||
| 	if false | ||||
| 	{ | ||||
| 	  green_value := debug.gfx_clear_demo_pass_action.colors[0].clear_value.g + 0.01 | ||||
| 	  debug.gfx_clear_demo_pass_action.colors[0].clear_value.g = green_value > 1.0 ? 0.0 : green_value | ||||
|  | ||||
| 	  sokol_gfx.begin_pass( sokol_gfx.Pass { | ||||
| 	  	action    = debug.gfx_clear_demo_pass_action, | ||||
| 	  	swapchain = sokol_glue.swapchain() | ||||
| 	  }) | ||||
| 	  sokol_gfx.end_pass() | ||||
| 	  sokol_gfx.commit() | ||||
| 	} | ||||
|  | ||||
| 	// "Draw text" using immediate mode api | ||||
| 	{ | ||||
| 		// text_test_str := str_fmt("frametime: %v", frametime_avg_ms) | ||||
| 		text_test_str := str_fmt("HELLO VE FONT CACHE!!!!!") | ||||
| 		// text_test_str := str_fmt("HELLO VE FONT CACHE!!!!!") | ||||
| 		text_test_str := str_fmt("A") | ||||
|  | ||||
| 		// font_provider := & state.font_provider_data | ||||
| 		fdef := hmap_chained_get( font_cache, default_font.key ) | ||||
|  | ||||
| 		ve.draw_text( & ve_font_cache, fdef.ve_id, text_test_str, {30, 30}, Vec2{1, 1} ) | ||||
| 		width  := app_window.extent.x * 2 | ||||
| 		height := app_window.extent.y * 2 | ||||
|  | ||||
| 		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.0, 0.0}, Vec2{1 / width, 1 / height} ) | ||||
| 	} | ||||
|  | ||||
| 	// Process the draw calls for drawing text | ||||
| 	if true | ||||
| 	{ | ||||
| 		draw_list := ve.get_draw_list( & ve_font_cache ) | ||||
|  | ||||
| 		sokol_gfx.update_buffer( draw_list_vbuf, Range{ draw_list.vertices.data, draw_list.vertices.num }) | ||||
| 		sokol_gfx.update_buffer( draw_list_ibuf, Range{ draw_list.indices.data,  draw_list.indices.num  }) | ||||
|  | ||||
| 		draw_list_vert_slice := array_to_slice(draw_list.vertices) | ||||
| 		draw_list_index_slice := array_to_slice(draw_list.indices) | ||||
| 		draw_list_call_slice := array_to_slice(draw_list.calls) | ||||
| 		for & draw_call in array_to_slice(draw_list.calls) | ||||
| 		{ | ||||
| 			profile("ve draw call") | ||||
| 			if (draw_call.end_index - draw_call.start_index) == 0 do continue | ||||
|  | ||||
| 			switch draw_call.pass | ||||
| @@ -74,6 +116,7 @@ render :: proc() | ||||
| 				// 1. Do the glyph rendering pass | ||||
| 				// Glyphs are first rendered to an intermediate 2k x 512px R8 texture | ||||
| 				case .Glyph: | ||||
| 					profile("ve draw call: glyph") | ||||
| 					width  := ve_font_cache.atlas.buffer_width | ||||
| 					height := ve_font_cache.atlas.buffer_height | ||||
|  | ||||
| @@ -102,9 +145,15 @@ render :: proc() | ||||
| 					} | ||||
| 					sokol_gfx.apply_bindings( bindings ) | ||||
|  | ||||
| 					// num_indices := draw_call.end_index - draw_call.start_index | ||||
| 					// sokol_gfx.draw( 0, num_indices, 1 ) | ||||
|  | ||||
| 					// sokol_gfx.end_pass() | ||||
|  | ||||
| 				// 2. Do the atlas rendering pass | ||||
| 				// A simple 16-tap box downsample shader is then used to blit from this intermediate texture to the final atlas location | ||||
| 				case .Atlas: | ||||
| 					profile("ve draw call: atlas") | ||||
| 					width  := ve_font_cache.atlas.width | ||||
| 					height := ve_font_cache.atlas.height | ||||
|  | ||||
| @@ -142,6 +191,7 @@ render :: proc() | ||||
| 				case .None: fallthrough | ||||
| 				case .Target: fallthrough | ||||
| 				case .Target_Uncached: | ||||
| 					profile("ve draw call: target") | ||||
| 					width  := u32(app_window.extent.x * 2) | ||||
| 					height := u32(app_window.extent.y * 2) | ||||
|  | ||||
| @@ -180,11 +230,12 @@ render :: proc() | ||||
| 			} | ||||
|  | ||||
| 			num_indices := draw_call.end_index - draw_call.start_index | ||||
| 			sokol_gfx.draw( 0, num_indices, 1 ) | ||||
| 			sokol_gfx.draw( draw_call.start_index, num_indices, 1 ) | ||||
|  | ||||
| 			sokol_gfx.end_pass() | ||||
| 		} | ||||
|  | ||||
| 		sokol_gfx.commit() | ||||
| 		ve.flush_draw_list( & ve_font_cache ) | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -204,6 +204,11 @@ font_provider_startup :: proc() | ||||
| 	log("font_provider initialized") | ||||
| } | ||||
|  | ||||
| font_provider_reload :: proc() | ||||
| { | ||||
| 	 | ||||
| } | ||||
|  | ||||
| font_provider_shutdown :: proc() | ||||
| { | ||||
| 	font_provider_data := & get_state().font_provider_data; using font_provider_data | ||||
|   | ||||
| @@ -75,6 +75,10 @@ font_provider_startup :: proc() | ||||
|  | ||||
| 	ve.configure_snap( & provider_data.ve_font_cache, u32(state.app_window.extent.x * 2.0), u32(state.app_window.extent.y * 2.0) ) | ||||
|  | ||||
| 	provider_data.ve_font_cache.debug_print = true | ||||
| 	provider_data.ve_font_cache.debug_print_verbose = true | ||||
|  | ||||
| 	 | ||||
| 	// TODO(Ed): Setup sokol hookup for VEFontCache | ||||
| 	{ | ||||
| 		AttachmentDesc          :: sokol_gfx.Attachment_Desc | ||||
| @@ -160,6 +164,8 @@ 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, | ||||
| @@ -430,7 +436,7 @@ font_provider_reload :: proc() | ||||
| 	state         := get_state() | ||||
| 	provider_data := & state.font_provider_data | ||||
|  | ||||
| 	ve.configure_snap( & provider_data.ve_font_cache, u32(state.app_window.extent.x * 2.0), u32(state.app_window.extent.y) ) | ||||
| 	ve.configure_snap( & provider_data.ve_font_cache, u32(state.app_window.extent.x * 2.0), u32(state.app_window.extent.y * 2.0) ) | ||||
| } | ||||
|  | ||||
| font_provider_shutdown :: proc() | ||||
| @@ -473,7 +479,7 @@ font_load :: proc(path_file : string, | ||||
| 	def.path_file = path_file | ||||
|  | ||||
| 	// TODO(Ed): Load even sizes from 8px to upper bound. | ||||
| 	def.ve_id = ve.load_font( & provider_data.ve_font_cache, desired_id, font_data, 36.0 ) | ||||
| 	def.ve_id = ve.load_font( & provider_data.ve_font_cache, desired_id, font_data, 72.0 ) | ||||
|  | ||||
| 	fid := FontID { key, desired_id } | ||||
| 	return fid | ||||
|   | ||||
| @@ -6,7 +6,7 @@ import sg "thirdparty:sokol/gfx" | ||||
|     Generated by sokol-shdc (https://github.com/floooh/sokol-tools) | ||||
|  | ||||
|     Cmdline: | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\simple_font_glyph.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\simple_font_glyph.odin --slang hlsl5 --format=sokol_odin | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\simple_font_glyph.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\simple_font_glyph.odin --slang glsl410:hlsl5 --format=sokol_odin | ||||
|  | ||||
|     Overview: | ||||
|     ========= | ||||
| @@ -52,6 +52,84 @@ Font_Glyph_Fs_Params :: struct #align(16) { | ||||
|         _: [4]u8, | ||||
|     }, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     uniform vec4 font_glyph_vs_params[4]; | ||||
|     layout(location = 0) in vec2 vertex; | ||||
|     layout(location = 0) out vec2 uv; | ||||
|     layout(location = 1) in vec2 texture_coord; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         gl_Position = mat4(font_glyph_vs_params[0], font_glyph_vs_params[1], font_glyph_vs_params[2], font_glyph_vs_params[3]) * vec4(vertex, 0.0, 1.0); | ||||
|         uv = texture_coord; | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| font_glyph_vs_source_glsl410 := [359]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, | ||||
|     0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x6f,0x6e,0x74,0x5f, | ||||
|     0x67,0x6c,0x79,0x70,0x68,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, | ||||
|     0x34,0x5d,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74, | ||||
|     0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32, | ||||
|     0x20,0x76,0x65,0x72,0x74,0x65,0x78,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28, | ||||
|     0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75, | ||||
|     0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75, | ||||
|     0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x31,0x29,0x20, | ||||
|     0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f, | ||||
|     0x63,0x6f,0x6f,0x72,0x64,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69, | ||||
|     0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73, | ||||
|     0x69,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x6d,0x61,0x74,0x34,0x28,0x66,0x6f,0x6e, | ||||
|     0x74,0x5f,0x67,0x6c,0x79,0x70,0x68,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d, | ||||
|     0x73,0x5b,0x30,0x5d,0x2c,0x20,0x66,0x6f,0x6e,0x74,0x5f,0x67,0x6c,0x79,0x70,0x68, | ||||
|     0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x31,0x5d,0x2c,0x20,0x66, | ||||
|     0x6f,0x6e,0x74,0x5f,0x67,0x6c,0x79,0x70,0x68,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72, | ||||
|     0x61,0x6d,0x73,0x5b,0x32,0x5d,0x2c,0x20,0x66,0x6f,0x6e,0x74,0x5f,0x67,0x6c,0x79, | ||||
|     0x70,0x68,0x5f,0x76,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b,0x33,0x5d,0x29, | ||||
|     0x20,0x2a,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x65,0x72,0x74,0x65,0x78,0x2c,0x20, | ||||
|     0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x75, | ||||
|     0x76,0x20,0x3d,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x63,0x6f,0x6f,0x72, | ||||
|     0x64,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     uniform vec4 font_glyph_fs_params[1]; | ||||
|     uniform sampler2D glyph_bitmap_glyph_bitmap_sampler; | ||||
|  | ||||
|     layout(location = 0) in vec2 uv; | ||||
|     layout(location = 0) out vec4 color; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         color = vec4(font_glyph_fs_params[0].xyz, texture(glyph_bitmap_glyph_bitmap_sampler, uv).x); | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| font_glyph_fs_source_glsl410 := [292]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, | ||||
|     0x69,0x66,0x6f,0x72,0x6d,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x6f,0x6e,0x74,0x5f, | ||||
|     0x67,0x6c,0x79,0x70,0x68,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x5b, | ||||
|     0x31,0x5d,0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70, | ||||
|     0x6c,0x65,0x72,0x32,0x44,0x20,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x69,0x74,0x6d, | ||||
|     0x61,0x70,0x5f,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x69,0x74,0x6d,0x61,0x70,0x5f, | ||||
|     0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74, | ||||
|     0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69, | ||||
|     0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75, | ||||
|     0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20, | ||||
|     0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a, | ||||
|     0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20, | ||||
|     0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28, | ||||
|     0x66,0x6f,0x6e,0x74,0x5f,0x67,0x6c,0x79,0x70,0x68,0x5f,0x66,0x73,0x5f,0x70,0x61, | ||||
|     0x72,0x61,0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x74,0x65,0x78, | ||||
|     0x74,0x75,0x72,0x65,0x28,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x69,0x74,0x6d,0x61, | ||||
|     0x70,0x5f,0x67,0x6c,0x79,0x70,0x68,0x5f,0x62,0x69,0x74,0x6d,0x61,0x70,0x5f,0x73, | ||||
|     0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x29,0x2e,0x78,0x29,0x3b,0x0a, | ||||
|     0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     cbuffer font_glyph_vs_params : register(b0) | ||||
|     { | ||||
| @@ -232,6 +310,33 @@ font_glyph_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc { | ||||
|     desc: sg.Shader_Desc | ||||
|     desc.label = "font_glyph_shader" | ||||
|     #partial switch backend { | ||||
|     case .GLCORE: | ||||
|         desc.attrs[0].name = "vertex" | ||||
|         desc.attrs[1].name = "texture_coord" | ||||
|         desc.vs.source = transmute(cstring)&font_glyph_vs_source_glsl410 | ||||
|         desc.vs.entry = "main" | ||||
|         desc.vs.uniform_blocks[0].size = 64 | ||||
|         desc.vs.uniform_blocks[0].layout = .STD140 | ||||
|         desc.vs.uniform_blocks[0].uniforms[0].name = "font_glyph_vs_params" | ||||
|         desc.vs.uniform_blocks[0].uniforms[0].type = .FLOAT4 | ||||
|         desc.vs.uniform_blocks[0].uniforms[0].array_count = 4 | ||||
|         desc.fs.source = transmute(cstring)&font_glyph_fs_source_glsl410 | ||||
|         desc.fs.entry = "main" | ||||
|         desc.fs.uniform_blocks[0].size = 16 | ||||
|         desc.fs.uniform_blocks[0].layout = .STD140 | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].name = "font_glyph_fs_params" | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].type = .FLOAT4 | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].array_count = 1 | ||||
|         desc.fs.images[0].used = true | ||||
|         desc.fs.images[0].multisampled = false | ||||
|         desc.fs.images[0].image_type = ._2D | ||||
|         desc.fs.images[0].sample_type = .FLOAT | ||||
|         desc.fs.samplers[0].used = true | ||||
|         desc.fs.samplers[0].sampler_type = .FILTERING | ||||
|         desc.fs.image_sampler_pairs[0].used = true | ||||
|         desc.fs.image_sampler_pairs[0].image_slot = 0 | ||||
|         desc.fs.image_sampler_pairs[0].sampler_slot = 0 | ||||
|         desc.fs.image_sampler_pairs[0].glsl_name = "glyph_bitmap_glyph_bitmap_sampler" | ||||
|     case .D3D11: | ||||
|         desc.attrs[0].sem_name = "TEXCOORD" | ||||
|         desc.attrs[0].sem_index = 0 | ||||
|   | ||||
| @@ -6,7 +6,7 @@ import sg "thirdparty:sokol/gfx" | ||||
|     Generated by sokol-shdc (https://github.com/floooh/sokol-tools) | ||||
|  | ||||
|     Cmdline: | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\ve_blit_atlas.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\ve_blit_atlas.odin --slang hlsl5 --format=sokol_odin --module =vefc_blit_atlas | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\ve_blit_atlas.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\ve_blit_atlas.odin --slang glsl410:hlsl5 --format=sokol_odin --module =vefc_blit_atlas | ||||
|  | ||||
|     Overview: | ||||
|     ========= | ||||
| @@ -43,6 +43,203 @@ Ve_Blit_Atlas_Fs_Params :: struct #align(16) { | ||||
|         _: [12]u8, | ||||
|     }, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     layout(location = 0) out vec2 uv; | ||||
|     layout(location = 1) in vec2 v_texture; | ||||
|     layout(location = 0) in vec2 v_position; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         uv = v_texture; | ||||
|         gl_Position = vec4(v_position, 0.0, 1.0); | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| ve_blit_atlas_vs_source_glsl410 := [214]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61, | ||||
|     0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, | ||||
|     0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a, | ||||
|     0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, | ||||
|     0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x76,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x75,0x72,0x65,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c, | ||||
|     0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20, | ||||
|     0x76,0x65,0x63,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b, | ||||
|     0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75, | ||||
|     0x72,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, | ||||
|     0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x5f,0x70,0x6f,0x73, | ||||
|     0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29, | ||||
|     0x3b,0x0a,0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     uniform ivec4 ve_blit_atlas_fs_params[1]; | ||||
|     uniform sampler2D ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler; | ||||
|  | ||||
|     layout(location = 0) in vec2 uv; | ||||
|     layout(location = 0) out vec4 frag_color; | ||||
|  | ||||
|     float down_sample(vec2 uv_1, vec2 texture_size) | ||||
|     { | ||||
|         return 0.25 * (((texture(ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler, uv_1).x + texture(ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler, fma(vec2(0.0, 1.0), texture_size, uv_1)).x) + texture(ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler, fma(vec2(1.0, 0.0), texture_size, uv_1)).x) + texture(ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler, uv_1 + texture_size).x); | ||||
|     } | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         uint _88 = uint(ve_blit_atlas_fs_params[0].x); | ||||
|         bool _89 = _88 == 0u; | ||||
|         bool _98; | ||||
|         if (!_89) | ||||
|         { | ||||
|             _98 = _88 == 1u; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             _98 = _89; | ||||
|         } | ||||
|         bool _107; | ||||
|         if (!_98) | ||||
|         { | ||||
|             _107 = _88 == 2u; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             _107 = _98; | ||||
|         } | ||||
|         if (_107) | ||||
|         { | ||||
|             vec2 param = uv + vec2(-0.00048828125, -0.0029296875); | ||||
|             vec2 param_1 = vec2(0.00048828125, 0.001953125); | ||||
|             vec2 param_2 = uv + vec2(0.000244140625, -0.0029296875); | ||||
|             vec2 param_3 = vec2(0.00048828125, 0.001953125); | ||||
|             vec2 param_4 = uv + vec2(-0.000732421875, 0.0009765625); | ||||
|             vec2 param_5 = vec2(0.00048828125, 0.001953125); | ||||
|             vec2 param_6 = uv + vec2(0.000244140625, 0.0009765625); | ||||
|             vec2 param_7 = vec2(0.00048828125, 0.001953125); | ||||
|             frag_color = vec4(1.0, 1.0, 1.0, 0.25 * (((down_sample(param, param_1) + down_sample(param_2, param_3)) + down_sample(param_4, param_5)) + down_sample(param_6, param_7))); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             frag_color = vec4(0.0, 0.0, 0.0, 1.0); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| ve_blit_atlas_fs_source_glsl410 := [1716]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x75,0x6e, | ||||
|     0x69,0x66,0x6f,0x72,0x6d,0x20,0x69,0x76,0x65,0x63,0x34,0x20,0x76,0x65,0x5f,0x62, | ||||
|     0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72, | ||||
|     0x61,0x6d,0x73,0x5b,0x31,0x5d,0x3b,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20, | ||||
|     0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x76,0x65,0x5f,0x62,0x6c,0x69, | ||||
|     0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74, | ||||
|     0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,0x61, | ||||
|     0x73,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x3b,0x0a,0x0a, | ||||
|     0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, | ||||
|     0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b, | ||||
|     0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e, | ||||
|     0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66, | ||||
|     0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x66,0x6c,0x6f,0x61, | ||||
|     0x74,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x28,0x76,0x65, | ||||
|     0x63,0x32,0x20,0x75,0x76,0x5f,0x31,0x2c,0x20,0x76,0x65,0x63,0x32,0x20,0x74,0x65, | ||||
|     0x78,0x74,0x75,0x72,0x65,0x5f,0x73,0x69,0x7a,0x65,0x29,0x0a,0x7b,0x0a,0x20,0x20, | ||||
|     0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x30,0x2e,0x32,0x35,0x20,0x2a,0x20, | ||||
|     0x28,0x28,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65,0x5f,0x62,0x6c, | ||||
|     0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78, | ||||
|     0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c, | ||||
|     0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20, | ||||
|     0x75,0x76,0x5f,0x31,0x29,0x2e,0x78,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72, | ||||
|     0x65,0x28,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f, | ||||
|     0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x62, | ||||
|     0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61, | ||||
|     0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x66,0x6d,0x61,0x28,0x76,0x65,0x63,0x32,0x28, | ||||
|     0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x2c,0x20,0x74,0x65,0x78,0x74,0x75, | ||||
|     0x72,0x65,0x5f,0x73,0x69,0x7a,0x65,0x2c,0x20,0x75,0x76,0x5f,0x31,0x29,0x29,0x2e, | ||||
|     0x78,0x29,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65,0x5f, | ||||
|     0x62,0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f,0x61, | ||||
|     0x74,0x6c,0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72, | ||||
|     0x2c,0x20,0x66,0x6d,0x61,0x28,0x76,0x65,0x63,0x32,0x28,0x31,0x2e,0x30,0x2c,0x20, | ||||
|     0x30,0x2e,0x30,0x29,0x2c,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x73,0x69, | ||||
|     0x7a,0x65,0x2c,0x20,0x75,0x76,0x5f,0x31,0x29,0x29,0x2e,0x78,0x29,0x20,0x2b,0x20, | ||||
|     0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f, | ||||
|     0x61,0x74,0x6c,0x61,0x73,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72, | ||||
|     0x65,0x5f,0x76,0x65,0x5f,0x62,0x6c,0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f, | ||||
|     0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,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,0x6d,0x61, | ||||
|     0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x75,0x69,0x6e,0x74,0x20, | ||||
|     0x5f,0x38,0x38,0x20,0x3d,0x20,0x75,0x69,0x6e,0x74,0x28,0x76,0x65,0x5f,0x62,0x6c, | ||||
|     0x69,0x74,0x5f,0x61,0x74,0x6c,0x61,0x73,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61, | ||||
|     0x6d,0x73,0x5b,0x30,0x5d,0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f, | ||||
|     0x6f,0x6c,0x20,0x5f,0x38,0x39,0x20,0x3d,0x20,0x5f,0x38,0x38,0x20,0x3d,0x3d,0x20, | ||||
|     0x30,0x75,0x3b,0x0a,0x20,0x20,0x20,0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x39,0x38, | ||||
|     0x3b,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x21,0x5f,0x38,0x39,0x29,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x39, | ||||
|     0x38,0x20,0x3d,0x20,0x5f,0x38,0x38,0x20,0x3d,0x3d,0x20,0x31,0x75,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,0x38,0x20, | ||||
|     0x3d,0x20,0x5f,0x38,0x39,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20, | ||||
|     0x20,0x62,0x6f,0x6f,0x6c,0x20,0x5f,0x31,0x30,0x37,0x3b,0x0a,0x20,0x20,0x20,0x20, | ||||
|     0x69,0x66,0x20,0x28,0x21,0x5f,0x39,0x38,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x5f,0x31,0x30,0x37,0x20,0x3d,0x20,0x5f, | ||||
|     0x38,0x38,0x20,0x3d,0x3d,0x20,0x32,0x75,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,0x37,0x20,0x3d,0x20,0x5f,0x39, | ||||
|     0x38,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20, | ||||
|     0x28,0x5f,0x31,0x30,0x37,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20, | ||||
|     0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x20, | ||||
|     0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,0x30, | ||||
|     0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x30, | ||||
|     0x30,0x32,0x39,0x32,0x39,0x36,0x38,0x37,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, | ||||
|     0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x31, | ||||
|     0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38, | ||||
|     0x32,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31, | ||||
|     0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63, | ||||
|     0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x32,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b, | ||||
|     0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34, | ||||
|     0x30,0x36,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x30,0x30,0x32,0x39,0x32,0x39,0x36, | ||||
|     0x38,0x37,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65, | ||||
|     0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x33,0x20,0x3d,0x20,0x76,0x65,0x63, | ||||
|     0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x2c, | ||||
|     0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x29,0x3b,0x0a,0x20, | ||||
|     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61, | ||||
|     0x6d,0x5f,0x34,0x20,0x3d,0x20,0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28, | ||||
|     0x2d,0x30,0x2e,0x30,0x30,0x30,0x37,0x33,0x32,0x34,0x32,0x31,0x38,0x37,0x35,0x2c, | ||||
|     0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72, | ||||
|     0x61,0x6d,0x5f,0x35,0x20,0x3d,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30, | ||||
|     0x30,0x34,0x38,0x38,0x32,0x38,0x31,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31, | ||||
|     0x39,0x35,0x33,0x31,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | ||||
|     0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x36,0x20,0x3d,0x20, | ||||
|     0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32, | ||||
|     0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39, | ||||
|     0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, | ||||
|     0x20,0x76,0x65,0x63,0x32,0x20,0x70,0x61,0x72,0x61,0x6d,0x5f,0x37,0x20,0x3d,0x20, | ||||
|     0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x34,0x38,0x38,0x32,0x38,0x31, | ||||
|     0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x31,0x39,0x35,0x33,0x31,0x32,0x35,0x29, | ||||
|     0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63, | ||||
|     0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x31,0x2e,0x30,0x2c, | ||||
|     0x20,0x31,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x32,0x35,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, | ||||
|     0x76,0x65,0x63,0x34,0x28,0x30,0x2e,0x30,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x30, | ||||
|     0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a, | ||||
|     0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     static float4 gl_Position; | ||||
|     static float2 uv; | ||||
| @@ -342,6 +539,28 @@ ve_blit_atlas_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc { | ||||
|     desc: sg.Shader_Desc | ||||
|     desc.label = "ve_blit_atlas_shader" | ||||
|     #partial switch backend { | ||||
|     case .GLCORE: | ||||
|         desc.attrs[0].name = "v_position" | ||||
|         desc.attrs[1].name = "v_texture" | ||||
|         desc.vs.source = transmute(cstring)&ve_blit_atlas_vs_source_glsl410 | ||||
|         desc.vs.entry = "main" | ||||
|         desc.fs.source = transmute(cstring)&ve_blit_atlas_fs_source_glsl410 | ||||
|         desc.fs.entry = "main" | ||||
|         desc.fs.uniform_blocks[0].size = 16 | ||||
|         desc.fs.uniform_blocks[0].layout = .STD140 | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].name = "ve_blit_atlas_fs_params" | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].type = .INT4 | ||||
|         desc.fs.uniform_blocks[0].uniforms[0].array_count = 1 | ||||
|         desc.fs.images[0].used = true | ||||
|         desc.fs.images[0].multisampled = false | ||||
|         desc.fs.images[0].image_type = ._2D | ||||
|         desc.fs.images[0].sample_type = .FLOAT | ||||
|         desc.fs.samplers[0].used = true | ||||
|         desc.fs.samplers[0].sampler_type = .FILTERING | ||||
|         desc.fs.image_sampler_pairs[0].used = true | ||||
|         desc.fs.image_sampler_pairs[0].image_slot = 0 | ||||
|         desc.fs.image_sampler_pairs[0].sampler_slot = 0 | ||||
|         desc.fs.image_sampler_pairs[0].glsl_name = "ve_blit_atlas_src_texture_ve_blit_atlas_src_sampler" | ||||
|     case .D3D11: | ||||
|         desc.attrs[0].sem_name = "TEXCOORD" | ||||
|         desc.attrs[0].sem_index = 0 | ||||
|   | ||||
							
								
								
									
										0
									
								
								code/sectr/shaders/ve_demo/ve_demo_glyph_vs.glsl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								code/sectr/shaders/ve_demo/ve_demo_glyph_vs.glsl
									
									
									
									
									
										Normal file
									
								
							| @@ -6,7 +6,7 @@ import sg "thirdparty:sokol/gfx" | ||||
|     Generated by sokol-shdc (https://github.com/floooh/sokol-tools) | ||||
|  | ||||
|     Cmdline: | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\ve_draw_text.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\ve_draw_text.odin --slang hlsl5 --format=sokol_odin --module =vefc_draw_text | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\ve_draw_text.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\ve_draw_text.odin --slang glsl410:hlsl5 --format=sokol_odin --module =vefc_draw_text | ||||
|  | ||||
|     Overview: | ||||
|     ========= | ||||
| @@ -44,6 +44,127 @@ Ve_Draw_Text_Fs_Params :: struct #align(16) { | ||||
|         colour: [4]f32, | ||||
|     }, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     layout(location = 0) out vec2 uv; | ||||
|     layout(location = 1) in vec2 v_texture; | ||||
|     layout(location = 0) in vec2 v_position; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         uv = v_texture; | ||||
|         gl_Position = vec4((v_position * 2.0) - vec2(1.0), 0.0, 1.0); | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| ve_draw_text_vs_source_glsl410 := [234]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61, | ||||
|     0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, | ||||
|     0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a, | ||||
|     0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, | ||||
|     0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x76,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x75,0x72,0x65,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c, | ||||
|     0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20, | ||||
|     0x76,0x65,0x63,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b, | ||||
|     0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75, | ||||
|     0x72,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, | ||||
|     0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x28,0x76,0x5f,0x70,0x6f, | ||||
|     0x73,0x69,0x74,0x69,0x6f,0x6e,0x20,0x2a,0x20,0x32,0x2e,0x30,0x29,0x20,0x2d,0x20, | ||||
|     0x76,0x65,0x63,0x32,0x28,0x31,0x2e,0x30,0x29,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20, | ||||
|     0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     struct ve_draw_text_fs_params | ||||
|     { | ||||
|         int down_sample; | ||||
|         vec4 colour; | ||||
|     }; | ||||
|  | ||||
|     uniform ve_draw_text_fs_params _31; | ||||
|  | ||||
|     uniform sampler2D ve_draw_text_src_texture_ve_draw_text_src_sampler; | ||||
|  | ||||
|     layout(location = 0) in vec2 uv; | ||||
|     layout(location = 0) out vec4 frag_color; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         float alpha = texture(ve_draw_text_src_texture_ve_draw_text_src_sampler, uv).x; | ||||
|         if (uint(_31.down_sample) == 1u) | ||||
|         { | ||||
|             alpha = 0.25 * (((texture(ve_draw_text_src_texture_ve_draw_text_src_sampler, uv + vec2(-0.000244140625, -0.0009765625)).x + texture(ve_draw_text_src_texture_ve_draw_text_src_sampler, uv + vec2(-0.000244140625, 0.0009765625)).x) + texture(ve_draw_text_src_texture_ve_draw_text_src_sampler, uv + vec2(0.000244140625, -0.0009765625)).x) + texture(ve_draw_text_src_texture_ve_draw_text_src_sampler, uv + vec2(0.000244140625, 0.0009765625)).x); | ||||
|         } | ||||
|         frag_color = vec4(_31.colour.xyz, _31.colour.w * alpha); | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| ve_draw_text_fs_source_glsl410 := [931]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x73,0x74, | ||||
|     0x72,0x75,0x63,0x74,0x20,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78, | ||||
|     0x74,0x5f,0x66,0x73,0x5f,0x70,0x61,0x72,0x61,0x6d,0x73,0x0a,0x7b,0x0a,0x20,0x20, | ||||
|     0x20,0x20,0x69,0x6e,0x74,0x20,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c, | ||||
|     0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x76,0x65,0x63,0x34,0x20,0x63,0x6f,0x6c,0x6f, | ||||
|     0x75,0x72,0x3b,0x0a,0x7d,0x3b,0x0a,0x0a,0x75,0x6e,0x69,0x66,0x6f,0x72,0x6d,0x20, | ||||
|     0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x66,0x73,0x5f, | ||||
|     0x70,0x61,0x72,0x61,0x6d,0x73,0x20,0x5f,0x33,0x31,0x3b,0x0a,0x0a,0x75,0x6e,0x69, | ||||
|     0x66,0x6f,0x72,0x6d,0x20,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x32,0x44,0x20,0x76, | ||||
|     0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f, | ||||
|     0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f, | ||||
|     0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72, | ||||
|     0x3b,0x0a,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69, | ||||
|     0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20, | ||||
|     0x75,0x76,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74, | ||||
|     0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63, | ||||
|     0x34,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x0a,0x76, | ||||
|     0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20, | ||||
|     0x20,0x66,0x6c,0x6f,0x61,0x74,0x20,0x61,0x6c,0x70,0x68,0x61,0x20,0x3d,0x20,0x74, | ||||
|     0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f, | ||||
|     0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63, | ||||
|     0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x29,0x2e,0x78,0x3b, | ||||
|     0x0a,0x20,0x20,0x20,0x20,0x69,0x66,0x20,0x28,0x75,0x69,0x6e,0x74,0x28,0x5f,0x33, | ||||
|     0x31,0x2e,0x64,0x6f,0x77,0x6e,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x29,0x20,0x3d, | ||||
|     0x3d,0x20,0x31,0x75,0x29,0x0a,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20, | ||||
|     0x20,0x20,0x20,0x20,0x61,0x6c,0x70,0x68,0x61,0x20,0x3d,0x20,0x30,0x2e,0x32,0x35, | ||||
|     0x20,0x2a,0x20,0x28,0x28,0x28,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65, | ||||
|     0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c, | ||||
|     0x20,0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30, | ||||
|     0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x2d,0x30,0x2e,0x30, | ||||
|     0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x2e,0x78,0x20,0x2b,0x20, | ||||
|     0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f, | ||||
|     0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65, | ||||
|     0x5f,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72, | ||||
|     0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x20,0x2b,0x20, | ||||
|     0x76,0x65,0x63,0x32,0x28,0x2d,0x30,0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34, | ||||
|     0x30,0x36,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36, | ||||
|     0x32,0x35,0x29,0x29,0x2e,0x78,0x29,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72, | ||||
|     0x65,0x28,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73, | ||||
|     0x72,0x63,0x5f,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x64,0x72, | ||||
|     0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70, | ||||
|     0x6c,0x65,0x72,0x2c,0x20,0x75,0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x30, | ||||
|     0x2e,0x30,0x30,0x30,0x32,0x34,0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x2d, | ||||
|     0x30,0x2e,0x30,0x30,0x30,0x39,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x2e,0x78, | ||||
|     0x29,0x20,0x2b,0x20,0x74,0x65,0x78,0x74,0x75,0x72,0x65,0x28,0x76,0x65,0x5f,0x64, | ||||
|     0x72,0x61,0x77,0x5f,0x74,0x65,0x78,0x74,0x5f,0x73,0x72,0x63,0x5f,0x74,0x65,0x78, | ||||
|     0x74,0x75,0x72,0x65,0x5f,0x76,0x65,0x5f,0x64,0x72,0x61,0x77,0x5f,0x74,0x65,0x78, | ||||
|     0x74,0x5f,0x73,0x72,0x63,0x5f,0x73,0x61,0x6d,0x70,0x6c,0x65,0x72,0x2c,0x20,0x75, | ||||
|     0x76,0x20,0x2b,0x20,0x76,0x65,0x63,0x32,0x28,0x30,0x2e,0x30,0x30,0x30,0x32,0x34, | ||||
|     0x34,0x31,0x34,0x30,0x36,0x32,0x35,0x2c,0x20,0x30,0x2e,0x30,0x30,0x30,0x39,0x37, | ||||
|     0x36,0x35,0x36,0x32,0x35,0x29,0x29,0x2e,0x78,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20, | ||||
|     0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72, | ||||
|     0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x5f,0x33,0x31,0x2e,0x63,0x6f,0x6c,0x6f, | ||||
|     0x75,0x72,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x5f,0x33,0x31,0x2e,0x63,0x6f,0x6c,0x6f, | ||||
|     0x75,0x72,0x2e,0x77,0x20,0x2a,0x20,0x61,0x6c,0x70,0x68,0x61,0x29,0x3b,0x0a,0x7d, | ||||
|     0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     static float4 gl_Position; | ||||
|     static float2 uv; | ||||
| @@ -257,6 +378,31 @@ ve_draw_text_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc { | ||||
|     desc: sg.Shader_Desc | ||||
|     desc.label = "ve_draw_text_shader" | ||||
|     #partial switch backend { | ||||
|     case .GLCORE: | ||||
|         desc.attrs[0].name = "v_position" | ||||
|         desc.attrs[1].name = "v_texture" | ||||
|         desc.vs.source = transmute(cstring)&ve_draw_text_vs_source_glsl410 | ||||
|         desc.vs.entry = "main" | ||||
|         desc.fs.source = transmute(cstring)&ve_draw_text_fs_source_glsl410 | ||||
|         desc.fs.entry = "main" | ||||
|         desc.fs.uniform_blocks[0].size = 32 | ||||
|         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] | ||||
|         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] | ||||
|         desc.fs.images[0].used = true | ||||
|         desc.fs.images[0].multisampled = false | ||||
|         desc.fs.images[0].image_type = ._2D | ||||
|         desc.fs.images[0].sample_type = .FLOAT | ||||
|         desc.fs.samplers[0].used = true | ||||
|         desc.fs.samplers[0].sampler_type = .FILTERING | ||||
|         desc.fs.image_sampler_pairs[0].used = true | ||||
|         desc.fs.image_sampler_pairs[0].image_slot = 0 | ||||
|         desc.fs.image_sampler_pairs[0].sampler_slot = 0 | ||||
|         desc.fs.image_sampler_pairs[0].glsl_name = "ve_draw_text_src_texture_ve_draw_text_src_sampler" | ||||
|     case .D3D11: | ||||
|         desc.attrs[0].sem_name = "TEXCOORD" | ||||
|         desc.attrs[0].sem_index = 0 | ||||
|   | ||||
| @@ -6,7 +6,7 @@ import sg "thirdparty:sokol/gfx" | ||||
|     Generated by sokol-shdc (https://github.com/floooh/sokol-tools) | ||||
|  | ||||
|     Cmdline: | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\ve_render_glyph.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\ve_render_glyph.odin --slang hlsl5 --format=sokol_odin --module =vefc_render_glyph | ||||
|         sokol-shdc --input C:\projects\SectrPrototype\code\sectr\shaders\ve_render_glyph.shdc.glsl --output C:\projects\SectrPrototype\code\sectr\shaders\ve_render_glyph.odin --slang glsl410:hlsl5 --format=sokol_odin --module =vefc_render_glyph | ||||
|  | ||||
|     Overview: | ||||
|     ========= | ||||
| @@ -20,6 +20,61 @@ import sg "thirdparty:sokol/gfx" | ||||
| */ | ||||
| ATTR_ve_render_glyph_vs_v_position :: 0 | ||||
| ATTR_ve_render_glyph_vs_v_texture :: 1 | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     layout(location = 0) out vec2 uv; | ||||
|     layout(location = 1) in vec2 v_texture; | ||||
|     layout(location = 0) in vec2 v_position; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         uv = v_texture; | ||||
|         gl_Position = vec4(v_position, 0.0, 1.0); | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| ve_render_glyph_vs_source_glsl410 := [214]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61, | ||||
|     0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, | ||||
|     0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a, | ||||
|     0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20, | ||||
|     0x3d,0x20,0x31,0x29,0x20,0x69,0x6e,0x20,0x76,0x65,0x63,0x32,0x20,0x76,0x5f,0x74, | ||||
|     0x65,0x78,0x74,0x75,0x72,0x65,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c, | ||||
|     0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20, | ||||
|     0x76,0x65,0x63,0x32,0x20,0x76,0x5f,0x70,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,0x3b, | ||||
|     0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d,0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a, | ||||
|     0x20,0x20,0x20,0x20,0x75,0x76,0x20,0x3d,0x20,0x76,0x5f,0x74,0x65,0x78,0x74,0x75, | ||||
|     0x72,0x65,0x3b,0x0a,0x20,0x20,0x20,0x20,0x67,0x6c,0x5f,0x50,0x6f,0x73,0x69,0x74, | ||||
|     0x69,0x6f,0x6e,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x76,0x5f,0x70,0x6f,0x73, | ||||
|     0x69,0x74,0x69,0x6f,0x6e,0x2c,0x20,0x30,0x2e,0x30,0x2c,0x20,0x31,0x2e,0x30,0x29, | ||||
|     0x3b,0x0a,0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     #version 410 | ||||
|  | ||||
|     layout(location = 0) out vec4 frag_color; | ||||
|     layout(location = 0) in vec2 uv; | ||||
|  | ||||
|     void main() | ||||
|     { | ||||
|         frag_color = vec4(1.0); | ||||
|     } | ||||
|  | ||||
| */ | ||||
| @(private) | ||||
| ve_render_glyph_fs_source_glsl410 := [136]u8 { | ||||
|     0x23,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x34,0x31,0x30,0x0a,0x0a,0x6c,0x61, | ||||
|     0x79,0x6f,0x75,0x74,0x28,0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20, | ||||
|     0x30,0x29,0x20,0x6f,0x75,0x74,0x20,0x76,0x65,0x63,0x34,0x20,0x66,0x72,0x61,0x67, | ||||
|     0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x3b,0x0a,0x6c,0x61,0x79,0x6f,0x75,0x74,0x28,0x6c, | ||||
|     0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e,0x20,0x3d,0x20,0x30,0x29,0x20,0x69,0x6e,0x20, | ||||
|     0x76,0x65,0x63,0x32,0x20,0x75,0x76,0x3b,0x0a,0x0a,0x76,0x6f,0x69,0x64,0x20,0x6d, | ||||
|     0x61,0x69,0x6e,0x28,0x29,0x0a,0x7b,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67, | ||||
|     0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x31,0x2e, | ||||
|     0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, | ||||
| } | ||||
| /* | ||||
|     static float4 gl_Position; | ||||
|     static float2 uv; | ||||
| @@ -163,6 +218,13 @@ ve_render_glyph_shader_desc :: proc (backend: sg.Backend) -> sg.Shader_Desc { | ||||
|     desc: sg.Shader_Desc | ||||
|     desc.label = "ve_render_glyph_shader" | ||||
|     #partial switch backend { | ||||
|     case .GLCORE: | ||||
|         desc.attrs[0].name = "v_position" | ||||
|         desc.attrs[1].name = "v_texture" | ||||
|         desc.vs.source = transmute(cstring)&ve_render_glyph_vs_source_glsl410 | ||||
|         desc.vs.entry = "main" | ||||
|         desc.fs.source = transmute(cstring)&ve_render_glyph_fs_source_glsl410 | ||||
|         desc.fs.entry = "main" | ||||
|     case .D3D11: | ||||
|         desc.attrs[0].sem_name = "TEXCOORD" | ||||
|         desc.attrs[0].sem_index = 0 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user