aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglrenderbuffer.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2019-07-10 17:34:16 -0400
committerJosh Matthews <josh@joshmatthews.net>2019-07-12 13:36:44 -0400
commitdbaed5ed9276843ae3aa10f8671f65db839b7ffe (patch)
tree8493b7aa58d3e19cf558ebd5d346e5ea2ae897c4 /components/script/dom/webglrenderbuffer.rs
parent812bf8d816d29ecf132ff15a2da6a83c690e2e48 (diff)
downloadservo-dbaed5ed9276843ae3aa10f8671f65db839b7ffe.tar.gz
servo-dbaed5ed9276843ae3aa10f8671f65db839b7ffe.zip
Make GL/GLES decisions based on the API in use.
Diffstat (limited to 'components/script/dom/webglrenderbuffer.rs')
-rw-r--r--components/script/dom/webglrenderbuffer.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/components/script/dom/webglrenderbuffer.rs b/components/script/dom/webglrenderbuffer.rs
index d1387b277aa..459b76466e3 100644
--- a/components/script/dom/webglrenderbuffer.rs
+++ b/components/script/dom/webglrenderbuffer.rs
@@ -14,7 +14,7 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::{
- is_gles, webgl_channel, WebGLCommand, WebGLError, WebGLRenderbufferId, WebGLResult,
+ webgl_channel, GlType, WebGLCommand, WebGLError, WebGLRenderbufferId, WebGLResult,
};
use dom_struct::dom_struct;
use std::cell::Cell;
@@ -120,7 +120,15 @@ impl WebGLRenderbuffer {
self.ever_bound.get()
}
- pub fn storage(&self, internal_format: u32, width: i32, height: i32) -> WebGLResult<()> {
+ pub fn storage(
+ &self,
+ api_type: GlType,
+ internal_format: u32,
+ width: i32,
+ height: i32,
+ ) -> WebGLResult<()> {
+ let is_gles = api_type == GlType::Gles;
+
// Validate the internal_format, and save it for completeness
// validation.
let actual_format = match internal_format {
@@ -131,7 +139,7 @@ impl WebGLRenderbuffer {
constants::DEPTH_STENCIL => WebGL2RenderingContextConstants::DEPTH24_STENCIL8,
constants::RGB5_A1 => {
// 16-bit RGBA formats are not supported on desktop GL.
- if is_gles() {
+ if is_gles {
constants::RGB5_A1
} else {
WebGL2RenderingContextConstants::RGBA8
@@ -139,7 +147,7 @@ impl WebGLRenderbuffer {
},
constants::RGB565 => {
// RGB565 is not supported on desktop GL.
- if is_gles() {
+ if is_gles {
constants::RGB565
} else {
WebGL2RenderingContextConstants::RGB8