Crate webgl2

Crate webgl2 

Source
Expand description

WebGL2 Shader Compiler and Emulator

A complete toolchain for compiling GLSL shaders to WebAssembly with DWARF debugging, including a software rasterizer for shader emulation and TypeScript harness generation.

§Modules

Re-exports§

pub use glsl_introspection::ResourceManifest;
pub use js_codegen::generate_harness;
pub use naga_wasm_backend::BackendError;
pub use naga_wasm_backend::WasmBackend;
pub use naga_wasm_backend::WasmBackendConfig;
pub use naga_wasm_backend::WasmModule;
pub use wasm_gl_emu::RuntimeError;

Modules§

glsl_introspection
GLSL Annotation Parser and Resource Manifest Generator
js_codegen
TypeScript/JavaScript Harness Code Generator
naga_wasm_backend
Naga IR to WebAssembly Backend with DWARF Debug Information
wasm_gl_emu
WebGL2 Software Rasterizer and WASM Shader Runtime
webgl2_context

Functions§

js_execute_shader
js_log
js_print
wasm_alloc
Allocate memory from WASM linear memory. Returns pointer (0 on failure; sets last_error).
wasm_create_context
Create a new WebGL2 context. Returns context handle (0 on failure; sets last_error).
wasm_ctx_active_texture
Set the active texture unit.
wasm_ctx_attach_shader
Attach a shader to a program.
wasm_ctx_bind_attrib_location
Bind attribute location.
wasm_ctx_bind_buffer
Bind a buffer.
wasm_ctx_bind_framebuffer
Bind a framebuffer. Returns errno.
wasm_ctx_bind_renderbuffer
wasm_ctx_bind_texture
Bind a texture. Returns errno.
wasm_ctx_bind_vertex_array
wasm_ctx_buffer_data
Upload data to the bound buffer.
wasm_ctx_buffer_sub_data
Update a subset of the bound buffer’s data.
wasm_ctx_clear
Clear buffers.
wasm_ctx_clear_color
Set the clear color.
wasm_ctx_compile_shader
Compile a shader.
wasm_ctx_create_buffer
Create a buffer.
wasm_ctx_create_framebuffer
Create a framebuffer in the given context. Returns framebuffer handle (0 on failure).
wasm_ctx_create_program
Create a program.
wasm_ctx_create_renderbuffer
wasm_ctx_create_shader
Create a shader.
wasm_ctx_create_texture
Create a texture in the given context. Returns texture handle (0 on failure).
wasm_ctx_create_vertex_array
wasm_ctx_delete_buffer
Delete a buffer.
wasm_ctx_delete_framebuffer
Delete a framebuffer. Returns errno.
wasm_ctx_delete_program
Delete a program.
wasm_ctx_delete_renderbuffer
wasm_ctx_delete_shader
Delete a shader.
wasm_ctx_delete_texture
Delete a texture. Returns errno.
wasm_ctx_delete_vertex_array
wasm_ctx_depth_func
Set the depth function.
wasm_ctx_disable
Disable a capability.
wasm_ctx_disable_vertex_attrib_array
Disable vertex attribute array.
wasm_ctx_draw_arrays
Draw arrays.
wasm_ctx_draw_arrays_instanced
Draw arrays instanced.
wasm_ctx_draw_elements
Draw elements.
wasm_ctx_draw_elements_instanced
Draw elements instanced.
wasm_ctx_enable
Enable a capability.
wasm_ctx_enable_vertex_attrib_array
Enable vertex attribute array.
wasm_ctx_framebuffer_renderbuffer
wasm_ctx_framebuffer_texture2d
Attach a texture to the bound framebuffer. Returns errno.
wasm_ctx_get_attrib_location
Get attribute location.
wasm_ctx_get_buffer_parameter
Get buffer parameter.
wasm_ctx_get_error
Get the last GL error.
wasm_ctx_get_parameter_v
Get a parameter (vector version).
wasm_ctx_get_program_info_log
Get program info log.
wasm_ctx_get_program_parameter
Get program parameter.
wasm_ctx_get_program_wasm
Get the generated WASM for a program’s shader.
wasm_ctx_get_program_wasm_len
Get the length of the generated WASM for a program’s shader.
wasm_ctx_get_shader_info_log
Get shader info log.
wasm_ctx_get_shader_parameter
Get shader parameter.
wasm_ctx_get_uniform_location
Get uniform location.
wasm_ctx_is_vertex_array
wasm_ctx_link_program
Link a program.
wasm_ctx_read_pixels
Read pixels from the bound framebuffer into dest_ptr. dest_ptr/dest_len point to RGBA u8 buffer in WASM linear memory. Returns errno.
wasm_ctx_renderbuffer_storage
wasm_ctx_scissor
Set the scissor box.
wasm_ctx_set_verbosity
Set verbosity level.
wasm_ctx_shader_source
Set shader source.
wasm_ctx_tex_image_2d
Upload pixel data to a texture. ptr/len point to RGBA u8 pixel data in WASM linear memory. Returns errno.
wasm_ctx_tex_parameter_i
Set texture parameters. Returns errno.
wasm_ctx_uniform1f
Set uniform 1f.
wasm_ctx_uniform1i
Set uniform 1i.
wasm_ctx_uniform2f
Set uniform 2f.
wasm_ctx_uniform3f
Set uniform 3f.
wasm_ctx_uniform4f
Set uniform 4f.
wasm_ctx_uniform_matrix_4fv
Set uniform matrix 4fv.
wasm_ctx_use_program
Use a program.
wasm_ctx_vertex_attrib1f
Set vertex attribute default value (1f).
wasm_ctx_vertex_attrib2f
Set vertex attribute default value (2f).
wasm_ctx_vertex_attrib3f
Set vertex attribute default value (3f).
wasm_ctx_vertex_attrib4f
Set vertex attribute default value (4f).
wasm_ctx_vertex_attrib_divisor
Vertex attribute divisor.
wasm_ctx_vertex_attrib_pointer
Vertex attribute pointer.
wasm_ctx_viewport
Set the viewport.
wasm_destroy_context
Destroy a WebGL2 context by handle. Returns errno (0 on success).
wasm_free
Free memory allocated by wasm_alloc. Returns errno (0 on success).
wasm_last_error_len
Get length of last error message in bytes.
wasm_last_error_ptr
Get pointer to last error message (UTF-8).