@@ -11,8 +11,8 @@ use std::rc::Rc;
11
11
use bitflags:: bitflags;
12
12
use canvas_traits:: webgl:: WebGLError :: * ;
13
13
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,
16
16
} ;
17
17
use dom_struct:: dom_struct;
18
18
use euclid:: default:: { Point2D , Rect , Size2D } ;
@@ -3118,6 +3118,8 @@ impl WebGL2RenderingContextMethods<crate::DomTypeHolder> for WebGL2RenderingCont
3118
3118
return Ok ( ( ) ) ;
3119
3119
} ;
3120
3120
3121
+ // TODO: If pixel store parameter constraints are not met, generates an INVALID_OPERATION error.
3122
+
3121
3123
// If srcData is null, a buffer of sufficient size initialized to 0 is passed.
3122
3124
let unpacking_alignment = self . base . texture_unpacking_alignment ( ) ;
3123
3125
let buff = match * src_data {
@@ -3144,6 +3146,17 @@ impl WebGL2RenderingContextMethods<crate::DomTypeHolder> for WebGL2RenderingCont
3144
3146
} ,
3145
3147
} ;
3146
3148
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
+ }
3147
3160
let tex_source = TexPixels :: from_array (
3148
3161
buff,
3149
3162
Size2D :: new ( width, height) ,
0 commit comments