Skip to content

Commit

Permalink
Check for GLES 3 in a few places. This is not comprehensive.
Browse files Browse the repository at this point in the history
Fixes #1482.
  • Loading branch information
DiamondLovesYou committed Jun 12, 2016
1 parent 11a6b7b commit 21d22eb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
23 changes: 16 additions & 7 deletions src/image_format.rs
Expand Up @@ -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 => {
Expand All @@ -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 => {
Expand Down Expand Up @@ -1234,19 +1238,24 @@ 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 => {
version >= &Version(Api::Gl, 3, 0) || extensions.gl_arb_depth_texture
},

&DepthFormat::F32 => {
version >= &Version(Api::Gl, 3, 0)
version >= &Version(Api::Gl, 3, 0) ||
version >= &Version(Api::GlEs, 3, 0)
},
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/program/raw.rs
Expand Up @@ -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)
},
Expand Down
1 change: 1 addition & 0 deletions src/sampler_object.rs
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/uniforms/bind.rs
Expand Up @@ -642,6 +642,7 @@ fn bind_texture_uniform<P, T>(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); }
Expand Down

0 comments on commit 21d22eb

Please sign in to comment.