8000 Address changes · servo/servo@7005212 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7005212

Browse files
wusyongYu Wei Wu
authored andcommitted
Address changes
Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
1 parent ac28fa0 commit 7005212

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

components/script/dom/webgl2renderingcontext.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use std::rc::Rc;
1111
use bitflags::bitflags;
1212
use canvas_traits::webgl::WebGLError::*;
1313
use canvas_traits::webgl::{
14-
GLContextAttributes, InternalFormatParameter, TexDataType, TexFormat, WebGLCommand,
15-
WebGLContextId, WebGLResult, WebGLVersion, webgl_channel,
14+
AlphaTreatment, GLContextAttributes, InternalFormatParameter, TexDataType, TexFormat,
15+
WebGLCommand, WebGLContextId, WebGLResult, WebGLVersion, YAxisTreatment, webgl_channel,
1616
};
1717
use dom_struct::dom_struct;
1818
use euclid::default::{Point2D, Rect, Size2D};
@@ -3118,6 +3118,8 @@ impl WebGL2RenderingContextMethods<crate::DomTypeHolder> for WebGL2RenderingCont
31183118
return Ok(());
31193119
};
31203120

3121+
// TODO: If pixel store parameter constraints are not met, generates an INVALID_OPERATION error.
3122+
31213123
// If srcData is null, a buffer of sufficient size initialized to 0 is passed.
31223124
let unpacking_alignment = self.base.texture_unpacking_alignment();
31233125
let buff = match *src_data {
@@ -3144,6 +3146,17 @@ impl WebGL2RenderingContextMethods<crate::DomTypeHolder> for WebGL2RenderingCont
31443146
},
31453147
};
31463148
let (alpha_treatment, y_axis_treatment) = self.base.get_current_unpack_state(false);
3149+
// If UNPACK_FLIP_Y_WEBGL or UNPACK_PREMULTIPLY_ALPHA_WEBGL is set to true, texImage3D and texSubImage3D
3150+
// generate an INVALID_OPERATION error if they upload data from a PIXEL_UNPACK_BUFFER or a non-null client
3151+
// side ArrayBufferView.
3152+
if let (Some(AlphaTreatment::Premultiply), YAxisTreatment::Flipped) =
3153+
(alpha_treatment, y_axis_treatment)
3154+
{
3155+
if src_data.is_some() {
3156+
self.base.webgl_error(InvalidOperation);
3157+
return Ok(());
3158+
}
3159+
}
31473160
let tex_source = TexPixels::from_array(
31483161
buff,
31493162
Size2D::new(width, height),

components/shared/canvas/webgl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ pub enum WebGLCommand {
372372
depth: u32,
373373
format: TexFormat,
374374
data_type: TexDataType,
375-
// FIXME(nox): This should be computed on the WebGL thread.
375+
// FIXME: This should be computed on the WebGL thread.
376376
effective_data_type: u32,
377377
unpacking_alignment: u32,
378378
alpha_treatment: Option<AlphaTreatment>,

0 commit comments

Comments
0 (0)
0