Make GL/GLES decisions based on the API in use.

This commit is contained in:
Josh Matthews 2019-07-10 17:34:16 -04:00
parent 812bf8d816
commit dbaed5ed92
13 changed files with 83 additions and 52 deletions

View file

@ -14,7 +14,7 @@ use crate::dom::webgl_extensions::ext::oesstandardderivatives::OESStandardDeriva
use crate::dom::webgl_extensions::WebGLExtensions;
use crate::dom::webglobject::WebGLObject;
use crate::dom::webglrenderingcontext::WebGLRenderingContext;
use canvas_traits::webgl::{webgl_channel, WebGLVersion};
use canvas_traits::webgl::{webgl_channel, GlType, WebGLVersion};
use canvas_traits::webgl::{GLLimits, WebGLCommand, WebGLError};
use canvas_traits::webgl::{WebGLResult, WebGLSLVersion, WebGLShaderId};
use dom_struct::dom_struct;
@ -93,6 +93,7 @@ impl WebGLShader {
/// glCompileShader
pub fn compile(
&self,
api_type: GlType,
webgl_version: WebGLVersion,
glsl_version: WebGLSLVersion,
limits: &GLLimits,
@ -122,7 +123,7 @@ impl WebGLShader {
};
let validator = match webgl_version {
WebGLVersion::WebGL1 => {
let output_format = if cfg!(any(target_os = "android", target_os = "ios")) {
let output_format = if api_type == GlType::Gles {
Output::Essl
} else {
Output::Glsl
@ -130,7 +131,7 @@ impl WebGLShader {
ShaderValidator::for_webgl(self.gl_type, output_format, &params).unwrap()
},
WebGLVersion::WebGL2 => {
let output_format = if cfg!(any(target_os = "android", target_os = "ios")) {
let output_format = if api_type == GlType::Gles {
Output::Essl
} else {
match (glsl_version.major, glsl_version.minor) {