From 21d22eb806fe39c73a8fd7e0e3f8ac910065bbb0 Mon Sep 17 00:00:00 2001 From: Richard Diamond Date: Sun, 12 Jun 2016 15:13:22 -0500 Subject: [PATCH] Check for GLES 3 in a few places. This is not comprehensive. Fixes #1482. --- src/image_format.rs | 23 ++++++++++++++++------- src/program/raw.rs | 3 ++- src/sampler_object.rs | 1 + src/uniforms/bind.rs | 1 + 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/image_format.rs b/src/image_format.rs index 3eb97273c43..ad0a2ffd68b 100644 --- a/src/image_format.rs +++ b/src/image_format.rs @@ -905,8 +905,10 @@ impl UncompressedUintFormat { match self { &UncompressedUintFormat::U8 => { - version >= &Version(Api::Gl, 3, 0) || (extensions.gl_ext_texture_integer && - extensions.gl_arb_texture_rg) + version >= &Version(Api::Gl, 3, 0) || + version >= &Version(Api::GlEs, 3, 0) || + (extensions.gl_ext_texture_integer && + extensions.gl_arb_texture_rg) }, &UncompressedUintFormat::U16 => { @@ -915,8 +917,10 @@ impl UncompressedUintFormat { }, &UncompressedUintFormat::U32 => { - version >= &Version(Api::Gl, 3, 0) || (extensions.gl_ext_texture_integer && - extensions.gl_arb_texture_rg) + version >= &Version(Api::Gl, 3, 0) || + version >= &Version(Api::GlEs, 3, 0) || + (extensions.gl_ext_texture_integer && + extensions.gl_arb_texture_rg) }, &UncompressedUintFormat::U8U8 => { @@ -1234,11 +1238,15 @@ impl DepthFormat { match self { &DepthFormat::I16 => { - version >= &Version(Api::Gl, 3, 0) || extensions.gl_arb_depth_texture + version >= &Version(Api::Gl, 3, 0) || + version >= &Version(Api::GlEs, 3, 0) || + extensions.gl_arb_depth_texture }, &DepthFormat::I24 => { - version >= &Version(Api::Gl, 3, 0) || extensions.gl_arb_depth_texture + version >= &Version(Api::Gl, 3, 0) || + version >= &Version(Api::GlEs, 3, 0) || + extensions.gl_arb_depth_texture }, &DepthFormat::I32 => { @@ -1246,7 +1254,8 @@ impl DepthFormat { }, &DepthFormat::F32 => { - version >= &Version(Api::Gl, 3, 0) + version >= &Version(Api::Gl, 3, 0) || + version >= &Version(Api::GlEs, 3, 0) }, } } diff --git a/src/program/raw.rs b/src/program/raw.rs index c8443d297c9..07a1fb82f03 100644 --- a/src/program/raw.rs +++ b/src/program/raw.rs @@ -335,7 +335,8 @@ impl RawProgram { let value = unsafe { match self.id { Handle::Id(id) => { - assert!(ctxt.version >= &Version(Api::Gl, 2, 0)); + assert!(ctxt.version >= &Version(Api::Gl, 2, 0) || + ctxt.version >= &Version(Api::GlEs, 2, 0)); ctxt.gl.GetFragDataLocation(id, name_c.as_bytes_with_nul().as_ptr() as *const raw::c_char) }, diff --git a/src/sampler_object.rs b/src/sampler_object.rs index 8d2de92dc08..6f2df47aca5 100644 --- a/src/sampler_object.rs +++ b/src/sampler_object.rs @@ -20,6 +20,7 @@ impl SamplerObject { pub fn new(ctxt: &mut CommandContext, behavior: &SamplerBehavior) -> SamplerObject { // making sure that the backend supports samplers assert!(ctxt.version >= &Version(Api::Gl, 3, 2) || + ctxt.version >= &Version(Api::GlEs, 3, 0) || ctxt.extensions.gl_arb_sampler_objects); let sampler = unsafe { diff --git a/src/uniforms/bind.rs b/src/uniforms/bind.rs index 6bf5dc4ec14..3e3dadd46f9 100644 --- a/src/uniforms/bind.rs +++ b/src/uniforms/bind.rs @@ -642,6 +642,7 @@ fn bind_texture_uniform(mut ctxt: &mut context::CommandContext, if ctxt.state.texture_units[texture_unit as usize].sampler != sampler { assert!(ctxt.version >= &Version(Api::Gl, 3, 3) || + ctxt.version >= &Version(Api::GlEs, 3, 0) || ctxt.extensions.gl_arb_sampler_objects); unsafe { ctxt.gl.BindSampler(texture_unit as gl::types::GLenum, sampler); }