Pārlūkot izejas kodu

Some tweaks and dead code removal

Karl Zylinski 2 mēneši atpakaļ
vecāks
revīzija
b586ce4c38

+ 1 - 1
examples/build_web_example/build_web_example.odin

@@ -63,7 +63,7 @@ main :: proc() {
 			web_dir,
 			fmt.tprintf("-out:%v", wasm_out_path),
 			"-target:js_wasm32",
-			"-o:speed",
+			"-debug",
 			"-vet",
 			"-strict-style",
 		},

+ 0 - 18
render_backend_gl.odin

@@ -555,7 +555,6 @@ gl_load_shader :: proc(vs_source: []byte, fs_source: []byte, desc_allocator := f
 
 	gl.GenVertexArrays(1, &gl_shd.vao)
 	gl.BindVertexArray(gl_shd.vao)
-	gl.BindBuffer(gl.ARRAY_BUFFER, s.vertex_buffer_gpu)
 
 	offset: int
 	for idx in 0..<len(desc.inputs) {
@@ -567,23 +566,6 @@ gl_load_shader :: proc(vs_source: []byte, fs_source: []byte, desc_allocator := f
 		offset += format_size
 	}
 
-	/*{
-		num_uniforms: i32
-		uniform_name_buf: [256]u8
-		gl.GetProgramiv(program, gl.ACTIVE_UNIFORMS, &num_uniforms)
-		
-		for u_idx in 0..<num_uniforms {
-			name_len: i32
-			size: i32
-			type: u32
-			gl.GetActiveUniform(program, u32(u_idx), len(uniform_name_buf), &name_len, &size, &type, raw_data(&uniform_name_buf))
-
-			if type == gl.SAMPLER_2D {
-
-			}
-		}
-	}*/
-
 	constant_descs := make([dynamic]Shader_Constant_Desc, desc_allocator)
 	gl_constants := make([dynamic]GL_Shader_Constant, s.allocator)
 	texture_bindpoint_descs := make([dynamic]Shader_Texture_Bindpoint_Desc, desc_allocator)

+ 3 - 20
render_backend_webgl.odin

@@ -122,8 +122,9 @@ webgl_init :: proc(state: rawptr, window_handle: Window_Handle, swapchain_width,
 	gl.DepthFunc(gl.GREATER)
 
 	s.vertex_buffer_gpu = gl.CreateBuffer()
+
 	gl.BindBuffer(gl.ARRAY_BUFFER, s.vertex_buffer_gpu)
-	gl.BufferData(gl.ARRAY_BUFFER, VERTEX_BUFFER_MAX, nil, gl.DYNAMIC_DRAW)
+	gl.BufferData(gl.ARRAY_BUFFER, VERTEX_BUFFER_MAX, nil, gl.STREAM_DRAW)
 
 	gl.Enable(gl.BLEND)
 
@@ -251,7 +252,7 @@ webgl_draw :: proc(
 	}
 
 	gl.BindBuffer(gl.ARRAY_BUFFER, s.vertex_buffer_gpu)
-	gl.BufferDataSlice(gl.ARRAY_BUFFER, vertex_buffer, gl.DYNAMIC_DRAW)
+	gl.BufferDataSlice(gl.ARRAY_BUFFER, vertex_buffer, gl.STREAM_DRAW)
 
 	if len(bound_textures) == len(gl_shd.texture_bindings) {
 		for t, t_idx in bound_textures {
@@ -498,7 +499,6 @@ webgl_load_shader :: proc(vs_source: []byte, fs_source: []byte, desc_allocator :
 	}
 
 	gl.BindVertexArray(gl_shd.vao)
-	gl.BindBuffer(gl.ARRAY_BUFFER, s.vertex_buffer_gpu)
 
 	offset: int
 	for idx in 0..<len(desc.inputs) {
@@ -510,23 +510,6 @@ webgl_load_shader :: proc(vs_source: []byte, fs_source: []byte, desc_allocator :
 		offset += format_size
 	}
 
-	/*{
-		num_uniforms: i32
-		uniform_name_buf: [256]u8
-		gl.GetProgramiv(program, gl.ACTIVE_UNIFORMS, &num_uniforms)
-		
-		for u_idx in 0..<num_uniforms {
-			name_len: i32
-			size: i32
-			type: u32
-			gl.GetActiveUniform(program, u32(u_idx), len(uniform_name_buf), &name_len, &size, &type, raw_data(&uniform_name_buf))
-
-			if type == gl.SAMPLER_2D {
-
-			}
-		}
-	}*/
-
 	constant_descs := make([dynamic]Shader_Constant_Desc, desc_allocator)
 	gl_constants := make([dynamic]WebGL_Shader_Constant, s.allocator)
 	texture_bindpoint_descs := make([dynamic]Shader_Texture_Bindpoint_Desc, desc_allocator)