Add support for WebGL2 TexImage2D

Adds initial support for one of the WebGL2 `TexImage2D` call.
This commit is contained in:
Istvan Miklos 2020-05-26 16:09:57 +02:00
parent ba5568a0a6
commit 6591fa54f9
8 changed files with 254 additions and 49 deletions

View file

@ -919,7 +919,7 @@ impl WebGLThread {
0,
gl::RGBA,
gl::UNSIGNED_BYTE,
None,
gl::TexImageSource::Pixels(None),
);
self.dom_outputs.insert(
pipeline_id,
@ -1595,7 +1595,31 @@ impl WebGLImpl {
0,
format.as_gl_constant(),
effective_data_type,
Some(&pixels),
gl::TexImageSource::Pixels(Some(&pixels)),
);
},
WebGLCommand::TexImage2DPBO {
target,
level,
internal_format,
size,
format,
effective_data_type,
unpacking_alignment,
offset,
} => {
gl.pixel_store_i(gl::UNPACK_ALIGNMENT, unpacking_alignment as i32);
gl.tex_image_2d(
target,
level as i32,
internal_format.as_gl_constant() as i32,
size.width as i32,
size.height as i32,
0,
format.as_gl_constant(),
effective_data_type,
gl::TexImageSource::BufferOffset(offset),
);
},
WebGLCommand::TexSubImage2D {