Skip to content

Commit

Permalink
Add support for WebGL2 TexStorage2D
Browse files Browse the repository at this point in the history
Adds initial support for the WebGL2 `TexStorage2D` call, adds
support for the related texture enums and enables some of the
texture tests.

See: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.6
  • Loading branch information
mmatyas authored and jdm committed Apr 30, 2020
1 parent 3bedd44 commit 8789a6a
Show file tree
Hide file tree
Showing 63 changed files with 1,882 additions and 360 deletions.
23 changes: 20 additions & 3 deletions components/canvas/webgl_thread.rs
Expand Up @@ -1555,7 +1555,7 @@ impl WebGLImpl {
WebGLCommand::TexImage2D {
target,
level,
effective_internal_format,
internal_format,
size,
format,
data_type,
Expand All @@ -1567,7 +1567,7 @@ impl WebGLImpl {
ref data,
} => {
let pixels = prepare_pixels(
format,
internal_format,
data_type,
size,
unpacking_alignment,
Expand All @@ -1581,7 +1581,7 @@ impl WebGLImpl {
gl.tex_image_2d(
target,
level as i32,
effective_internal_format as i32,
internal_format.as_gl_constant() as i32,
size.width as i32,
size.height as i32,
0,
Expand Down Expand Up @@ -1666,6 +1666,23 @@ impl WebGLImpl {
&*data,
);
},
WebGLCommand::TexStorage2D(target, levels, internal_format, width, height) => gl
.tex_storage_2d(
target,
levels as i32,
internal_format.as_gl_constant(),
width as i32,
height as i32,
),
WebGLCommand::TexStorage3D(target, levels, internal_format, width, height, depth) => gl
.tex_storage_3d(
target,
levels as i32,
internal_format.as_gl_constant(),
width as i32,
height as i32,
depth as i32,
),
WebGLCommand::DrawingBufferWidth(ref sender) => {
let size = device
.context_surface_info(&ctx)
Expand Down

0 comments on commit 8789a6a

Please sign in to comment.