mirror of
https://github.com/servo/servo.git
synced 2025-07-15 19:33:46 +01:00
WebGL2: support TexImage3D (#37718)
Add TexImage3D method to WebGL2RenderingContext Testing: conformance2 should pass. Also it should get http://webglsamples.org/WebGL2Samples/#texture_2d_array and http://webglsamples.org/WebGL2Samples/#texture_3d running. Fixes: #26511 Now Servo can run texture_2d_array and texture_3d samples!   And it can now run three.js too!  --------- Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
This commit is contained in:
parent
4499fdeb2b
commit
34c31ee418
43 changed files with 1341 additions and 980 deletions
|
@ -1582,6 +1582,48 @@ impl WebGLImpl {
|
|||
WebGLCommand::SetViewport(x, y, width, height) => unsafe {
|
||||
gl.viewport(x, y, width, height)
|
||||
},
|
||||
WebGLCommand::TexImage3D {
|
||||
target,
|
||||
level,
|
||||
internal_format,
|
||||
size,
|
||||
depth,
|
||||
format,
|
||||
data_type,
|
||||
effective_data_type,
|
||||
unpacking_alignment,
|
||||
alpha_treatment,
|
||||
y_axis_treatment,
|
||||
pixel_format,
|
||||
ref data,
|
||||
} => {
|
||||
let pixels = prepare_pixels(
|
||||
internal_format,
|
||||
data_type,
|
||||
size,
|
||||
unpacking_alignment,
|
||||
alpha_treatment,
|
||||
y_axis_treatment,
|
||||
pixel_format,
|
||||
Cow::Borrowed(data),
|
||||
);
|
||||
|
||||
unsafe {
|
||||
gl.pixel_store_i32(gl::UNPACK_ALIGNMENT, unpacking_alignment as i32);
|
||||
gl.tex_image_3d(
|
||||
target,
|
||||
level as i32,
|
||||
internal_format.as_gl_constant() as i32,
|
||||
size.width as i32,
|
||||
size.height as i32,
|
||||
depth as i32,
|
||||
0,
|
||||
format.as_gl_constant(),
|
||||
effective_data_type,
|
||||
PixelUnpackData::Slice(Some(&pixels)),
|
||||
);
|
||||
}
|
||||
},
|
||||
WebGLCommand::TexImage2D {
|
||||
target,
|
||||
level,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue