Bug 987828 - 3/4 - Use IsGLES instead of IsGLES2 - r=jgilbert

This commit is contained in:
Benoit Jacob 2014-03-31 05:10:49 -04:00
parent 0691e30a3d
commit 7fff2c454f
14 changed files with 53 additions and 53 deletions

View File

@ -60,7 +60,7 @@ WebGLContext::CreateQuery()
if (IsContextLost())
return nullptr;
if (mActiveOcclusionQuery && !gl->IsGLES2()) {
if (mActiveOcclusionQuery && !gl->IsGLES()) {
/* http://www.opengl.org/registry/specs/ARB/occlusion_query.txt
* Calling either GenQueriesARB or DeleteQueriesARB while any query of
* any target is active causes an INVALID_OPERATION error to be
@ -95,7 +95,7 @@ WebGLContext::DeleteQuery(WebGLQuery *query)
EndQuery(query->mType);
}
if (mActiveOcclusionQuery && !gl->IsGLES2()) {
if (mActiveOcclusionQuery && !gl->IsGLES()) {
/* http://www.opengl.org/registry/specs/ARB/occlusion_query.txt
* Calling either GenQueriesARB or DeleteQueriesARB while any query of
* any target is active causes an INVALID_OPERATION error to be

View File

@ -460,7 +460,7 @@ WebGLContext::WhatDoesVertexAttrib0Need()
}
#endif
if (MOZ_LIKELY(gl->IsGLES2() ||
if (MOZ_LIKELY(gl->IsGLES() ||
mBoundVertexArray->IsAttribArrayEnabled(0)))
{
return WebGLVertexAttrib0Status::Default;

View File

@ -2348,14 +2348,14 @@ WebGLContext::RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei
case LOCAL_GL_RGBA4:
case LOCAL_GL_RGB5_A1:
// 16-bit RGBA formats are not supported on desktop GL
if (!gl->IsGLES2()) internalformatForGL = LOCAL_GL_RGBA8;
if (!gl->IsGLES()) internalformatForGL = LOCAL_GL_RGBA8;
break;
case LOCAL_GL_RGB565:
// the RGB565 format is not supported on desktop GL
if (!gl->IsGLES2()) internalformatForGL = LOCAL_GL_RGB8;
if (!gl->IsGLES()) internalformatForGL = LOCAL_GL_RGB8;
break;
case LOCAL_GL_DEPTH_COMPONENT16:
if (!gl->IsGLES2() || gl->IsExtensionSupported(gl::GLContext::OES_depth24))
if (!gl->IsGLES() || gl->IsExtensionSupported(gl::GLContext::OES_depth24))
internalformatForGL = LOCAL_GL_DEPTH_COMPONENT24;
else if (gl->IsExtensionSupported(gl::GLContext::OES_packed_depth_stencil))
internalformatForGL = LOCAL_GL_DEPTH24_STENCIL8;
@ -2956,7 +2956,7 @@ WebGLContext::CompileShader(WebGLShader *shader)
MakeContextCurrent();
ShShaderOutput targetShaderSourceLanguage = gl->IsGLES2() ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT;
ShShaderOutput targetShaderSourceLanguage = gl->IsGLES() ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT;
bool useShaderSourceTranslation = true;
if (shader->NeedsTranslation() && mShaderValidation) {
@ -3526,7 +3526,7 @@ GLenum WebGLContext::CheckedTexImage2D(GLenum target,
// convert type for half float if not on GLES2
GLenum realType = type;
if (realType == LOCAL_GL_HALF_FLOAT_OES && !gl->IsGLES2()) {
if (realType == LOCAL_GL_HALF_FLOAT_OES && !gl->IsGLES()) {
realType = LOCAL_GL_HALF_FLOAT;
}
@ -3608,7 +3608,7 @@ WebGLContext::TexImage2D_base(GLenum target, GLint level, GLenum internalformat,
// Handle ES2 and GL differences in floating point internal formats. Note that
// format == internalformat, as checked above and as required by ES.
internalformat = InternalFormatForFormatAndType(format, type, gl->IsGLES2());
internalformat = InternalFormatForFormatAndType(format, type, gl->IsGLES());
// Handle ES2 and GL differences when supporting sRGB internal formats. GL ES
// requires that format == internalformat, but GL will fail in this case.
@ -3616,7 +3616,7 @@ WebGLContext::TexImage2D_base(GLenum target, GLint level, GLenum internalformat,
// format -> internalformat
// GL_RGB GL_SRGB_EXT
// GL_RGBA GL_SRGB_ALPHA_EXT
if (!gl->IsGLES2()) {
if (!gl->IsGLES()) {
switch (internalformat) {
case LOCAL_GL_SRGB_EXT:
format = LOCAL_GL_RGB;

View File

@ -1631,7 +1631,7 @@ WebGLContext::InitAndValidateGL()
MakeContextCurrent();
// on desktop OpenGL, we always keep vertex attrib 0 array enabled
if (!gl->IsGLES2()) {
if (!gl->IsGLES()) {
gl->fEnableVertexAttribArray(0);
}
@ -1729,7 +1729,7 @@ WebGLContext::InitAndValidateGL()
// Always 1 for GLES2
mMaxFramebufferColorAttachments = 1;
if (!gl->IsGLES2()) {
if (!gl->IsGLES()) {
// gl_PointSize is always available in ES2 GLSL, but has to be
// specifically enabled on desktop GLSL.
gl->fEnable(LOCAL_GL_VERTEX_PROGRAM_POINT_SIZE);

View File

@ -35,7 +35,7 @@ WebGLContext::VertexAttrib1f(GLuint index, GLfloat x0)
mVertexAttrib0Vector[1] = 0;
mVertexAttrib0Vector[2] = 0;
mVertexAttrib0Vector[3] = 1;
if (gl->IsGLES2())
if (gl->IsGLES())
gl->fVertexAttrib1f(index, x0);
}
}
@ -55,7 +55,7 @@ WebGLContext::VertexAttrib2f(GLuint index, GLfloat x0, GLfloat x1)
mVertexAttrib0Vector[1] = x1;
mVertexAttrib0Vector[2] = 0;
mVertexAttrib0Vector[3] = 1;
if (gl->IsGLES2())
if (gl->IsGLES())
gl->fVertexAttrib2f(index, x0, x1);
}
}
@ -75,7 +75,7 @@ WebGLContext::VertexAttrib3f(GLuint index, GLfloat x0, GLfloat x1, GLfloat x2)
mVertexAttrib0Vector[1] = x1;
mVertexAttrib0Vector[2] = x2;
mVertexAttrib0Vector[3] = 1;
if (gl->IsGLES2())
if (gl->IsGLES())
gl->fVertexAttrib3f(index, x0, x1, x2);
}
}
@ -96,7 +96,7 @@ WebGLContext::VertexAttrib4f(GLuint index, GLfloat x0, GLfloat x1,
mVertexAttrib0Vector[1] = x1;
mVertexAttrib0Vector[2] = x2;
mVertexAttrib0Vector[3] = x3;
if (gl->IsGLES2())
if (gl->IsGLES())
gl->fVertexAttrib4f(index, x0, x1, x2, x3);
}
}
@ -117,7 +117,7 @@ WebGLContext::VertexAttrib1fv_base(GLuint idx, uint32_t arrayLength,
mVertexAttrib0Vector[1] = GLfloat(0);
mVertexAttrib0Vector[2] = GLfloat(0);
mVertexAttrib0Vector[3] = GLfloat(1);
if (gl->IsGLES2())
if (gl->IsGLES())
gl->fVertexAttrib1fv(idx, ptr);
}
}
@ -137,7 +137,7 @@ WebGLContext::VertexAttrib2fv_base(GLuint idx, uint32_t arrayLength,
mVertexAttrib0Vector[1] = ptr[1];
mVertexAttrib0Vector[2] = GLfloat(0);
mVertexAttrib0Vector[3] = GLfloat(1);
if (gl->IsGLES2())
if (gl->IsGLES())
gl->fVertexAttrib2fv(idx, ptr);
}
}
@ -157,7 +157,7 @@ WebGLContext::VertexAttrib3fv_base(GLuint idx, uint32_t arrayLength,
mVertexAttrib0Vector[1] = ptr[1];
mVertexAttrib0Vector[2] = ptr[2];
mVertexAttrib0Vector[3] = GLfloat(1);
if (gl->IsGLES2())
if (gl->IsGLES())
gl->fVertexAttrib3fv(idx, ptr);
}
}
@ -177,7 +177,7 @@ WebGLContext::VertexAttrib4fv_base(GLuint idx, uint32_t arrayLength,
mVertexAttrib0Vector[1] = ptr[1];
mVertexAttrib0Vector[2] = ptr[2];
mVertexAttrib0Vector[3] = ptr[3];
if (gl->IsGLES2())
if (gl->IsGLES())
gl->fVertexAttrib4fv(idx, ptr);
}
}
@ -211,7 +211,7 @@ WebGLContext::DisableVertexAttribArray(GLuint index)
MakeContextCurrent();
InvalidateBufferFetching();
if (index || gl->IsGLES2())
if (index || gl->IsGLES())
gl->fDisableVertexAttribArray(index);
MOZ_ASSERT(mBoundVertexArray->HasAttrib(index)); // should have been validated earlier

View File

@ -890,7 +890,7 @@ FinalizeDrawAndReadBuffers(GLContext* aGL, bool aColorBufferDefined)
//
// Note that this test is not performed if OpenGL 4.2 or ARB_ES2_compatibility is
// available.
if (aGL->IsGLES2() ||
if (aGL->IsGLES() ||
aGL->IsSupported(GLFeature::ES2_compatibility) ||
aGL->IsAtLeast(ContextProfile::OpenGL, 420))
{

View File

@ -16,7 +16,7 @@ using namespace mozilla::gl;
static GLenum
DepthStencilDepthFormat(GLContext* gl) {
// We might not be able to get 24-bit, so let's pretend!
if (gl->IsGLES2() && !gl->IsExtensionSupported(gl::GLContext::OES_depth24))
if (gl->IsGLES() && !gl->IsExtensionSupported(gl::GLContext::OES_depth24))
return LOCAL_GL_DEPTH_COMPONENT16;
return LOCAL_GL_DEPTH_COMPONENT24;

View File

@ -125,7 +125,7 @@ WebGLTexture::Bind(GLenum aTarget) {
// thanks to the WebKit people for finding this out: GL_TEXTURE_WRAP_R is not
// present in GLES 2, but is present in GL and it seems as if for cube maps
// we need to set it to GL_CLAMP_TO_EDGE to get the expected GLES behavior.
if (mTarget == LOCAL_GL_TEXTURE_CUBE_MAP && !mContext->gl->IsGLES2())
if (mTarget == LOCAL_GL_TEXTURE_CUBE_MAP && !mContext->gl->IsGLES())
mContext->gl->fTexParameteri(mTarget, LOCAL_GL_TEXTURE_WRAP_R, LOCAL_GL_CLAMP_TO_EDGE);
}

View File

@ -484,7 +484,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
// Load OpenGL ES 2.0 symbols, or desktop if we aren't using ES 2.
if (mInitialized) {
if (IsGLES2()) {
if (IsGLES()) {
SymLoadStruct symbols_ES2[] = {
{ (PRFuncPtr*) &mSymbols.fGetShaderPrecisionFormat, { "GetShaderPrecisionFormat", nullptr } },
{ (PRFuncPtr*) &mSymbols.fClearDepthf, { "ClearDepthf", nullptr } },
@ -1338,7 +1338,7 @@ GLContext::ChooseGLFormats(const SurfaceCaps& caps) const
// If we're on ES2 hardware and we have an explicit request for 16 bits of color or less
// OR we don't support full 8-bit color, return a 4444 or 565 format.
bool bpp16 = caps.bpp16;
if (IsGLES2()) {
if (IsGLES()) {
if (!IsExtensionSupported(OES_rgb8_rgba8))
bpp16 = true;
} else {
@ -1348,7 +1348,7 @@ GLContext::ChooseGLFormats(const SurfaceCaps& caps) const
}
if (bpp16) {
MOZ_ASSERT(IsGLES2());
MOZ_ASSERT(IsGLES());
if (caps.alpha) {
formats.color_texInternalFormat = LOCAL_GL_RGBA;
formats.color_texFormat = LOCAL_GL_RGBA;
@ -1364,11 +1364,11 @@ GLContext::ChooseGLFormats(const SurfaceCaps& caps) const
formats.color_texType = LOCAL_GL_UNSIGNED_BYTE;
if (caps.alpha) {
formats.color_texInternalFormat = IsGLES2() ? LOCAL_GL_RGBA : LOCAL_GL_RGBA8;
formats.color_texInternalFormat = IsGLES() ? LOCAL_GL_RGBA : LOCAL_GL_RGBA8;
formats.color_texFormat = LOCAL_GL_RGBA;
formats.color_rbFormat = LOCAL_GL_RGBA8;
} else {
formats.color_texInternalFormat = IsGLES2() ? LOCAL_GL_RGB : LOCAL_GL_RGB8;
formats.color_texInternalFormat = IsGLES() ? LOCAL_GL_RGB : LOCAL_GL_RGB8;
formats.color_texFormat = LOCAL_GL_RGB;
formats.color_rbFormat = LOCAL_GL_RGB8;
}
@ -1387,12 +1387,12 @@ GLContext::ChooseGLFormats(const SurfaceCaps& caps) const
// Be clear that these are 0 if unavailable.
formats.depthStencil = 0;
if (!IsGLES2() || IsExtensionSupported(OES_packed_depth_stencil)) {
if (!IsGLES() || IsExtensionSupported(OES_packed_depth_stencil)) {
formats.depthStencil = LOCAL_GL_DEPTH24_STENCIL8;
}
formats.depth = 0;
if (IsGLES2()) {
if (IsGLES()) {
if (IsExtensionSupported(OES_depth24)) {
formats.depth = LOCAL_GL_DEPTH_COMPONENT24;
} else {

View File

@ -1780,7 +1780,7 @@ public:
private:
void raw_fGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
MOZ_ASSERT(IsGLES2());
MOZ_ASSERT(IsGLES());
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fGetShaderPrecisionFormat);
@ -1790,7 +1790,7 @@ private:
public:
void fGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) {
if (IsGLES2()) {
if (IsGLES()) {
raw_fGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
} else {
// Fall back to automatic values because almost all desktop hardware supports the OpenGL standard precisions.
@ -1878,7 +1878,7 @@ public:
private:
void raw_fDepthRange(GLclampf a, GLclampf b) {
MOZ_ASSERT(!IsGLES2());
MOZ_ASSERT(!IsGLES());
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fDepthRange);
@ -1887,7 +1887,7 @@ private:
}
void raw_fDepthRangef(GLclampf a, GLclampf b) {
MOZ_ASSERT(IsGLES2());
MOZ_ASSERT(IsGLES());
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fDepthRangef);
@ -1896,7 +1896,7 @@ private:
}
void raw_fClearDepth(GLclampf v) {
MOZ_ASSERT(!IsGLES2());
MOZ_ASSERT(!IsGLES());
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fClearDepth);
@ -1905,7 +1905,7 @@ private:
}
void raw_fClearDepthf(GLclampf v) {
MOZ_ASSERT(IsGLES2());
MOZ_ASSERT(IsGLES());
BEFORE_GL_CALL;
ASSERT_SYMBOL_PRESENT(fClearDepthf);
@ -1915,7 +1915,7 @@ private:
public:
void fDepthRange(GLclampf a, GLclampf b) {
if (IsGLES2()) {
if (IsGLES()) {
raw_fDepthRangef(a, b);
} else {
raw_fDepthRange(a, b);
@ -1923,7 +1923,7 @@ public:
}
void fClearDepth(GLclampf v) {
if (IsGLES2()) {
if (IsGLES()) {
raw_fClearDepthf(v);
} else {
raw_fClearDepth(v);

View File

@ -168,7 +168,7 @@ GetActualReadFormats(GLContext* gl,
}
bool fallback = true;
if (gl->IsGLES2()) {
if (gl->IsGLES()) {
GLenum auxFormat = 0;
GLenum auxType = 0;
@ -768,7 +768,7 @@ GLReadTexImageHelper::ReadTexImage(GLuint aTextureId,
mGL->fBindRenderbuffer(LOCAL_GL_RENDERBUFFER, rb);
GLenum rbInternalFormat =
mGL->IsGLES2()
mGL->IsGLES()
? (mGL->IsExtensionSupported(GLContext::OES_rgb8_rgba8) ? LOCAL_GL_RGBA8 : LOCAL_GL_RGBA4)
: LOCAL_GL_RGBA;
mGL->fRenderbufferStorage(LOCAL_GL_RENDERBUFFER, rbInternalFormat, aSize.width, aSize.height);

View File

@ -225,7 +225,7 @@ TexSubImage2DHelper(GLContext *gl,
GLint pixelsize, GLenum format,
GLenum type, const GLvoid* pixels)
{
if (gl->IsGLES2()) {
if (gl->IsGLES()) {
if (stride == width * pixelsize) {
gl->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT,
std::min(GetAddressAlignment((ptrdiff_t)pixels),
@ -278,7 +278,7 @@ TexImage2DHelper(GLContext *gl,
GLint pixelsize, GLint border, GLenum format,
GLenum type, const GLvoid *pixels)
{
if (gl->IsGLES2()) {
if (gl->IsGLES()) {
NS_ASSERTION(format == (GLenum)internalformat,
"format and internalformat not the same for glTexImage2D on GLES2");

View File

@ -322,7 +322,7 @@ const GLubyte* glGetString_mozilla(GrGLenum name)
// on the GL implementation and change them to match what GLContext actually exposes.
if (name == LOCAL_GL_VERSION) {
if (sGLContext.get()->IsGLES2()) {
if (sGLContext.get()->IsGLES()) {
return reinterpret_cast<const GLubyte*>("OpenGL ES 2.0");
} else {
return reinterpret_cast<const GLubyte*>("2.0");
@ -336,7 +336,7 @@ const GLubyte* glGetString_mozilla(GrGLenum name)
if (!extensionsStringBuilt) {
extensionsString[0] = '\0';
if (sGLContext.get()->IsGLES2()) {
if (sGLContext.get()->IsGLES()) {
// OES is only applicable to GLES2
if (sGLContext.get()->IsExtensionSupported(GLContext::OES_packed_depth_stencil)) {
strcat(extensionsString, "GL_OES_packed_depth_stencil ");
@ -384,7 +384,7 @@ const GLubyte* glGetString_mozilla(GrGLenum name)
return reinterpret_cast<const GLubyte*>(extensionsString);
} else if (name == LOCAL_GL_SHADING_LANGUAGE_VERSION) {
if (sGLContext.get()->IsGLES2()) {
if (sGLContext.get()->IsGLES()) {
return reinterpret_cast<const GLubyte*>("OpenGL ES GLSL ES 1.0");
} else {
return reinterpret_cast<const GLubyte*>("1.10");
@ -770,7 +770,7 @@ static GrGLInterface* CreateGrGLInterfaceFromGLContext(GLContext* context)
context->MakeCurrent();
// We support both desktop GL and GLES2
if (context->IsGLES2()) {
if (context->IsGLES()) {
i->fStandard = kGLES_GrGLStandard;
} else {
i->fStandard = kGL_GrGLStandard;

View File

@ -282,7 +282,7 @@ CompositorOGL::Initialize()
LOCAL_GL_NONE
};
if (!mGLContext->IsGLES2()) {
if (!mGLContext->IsGLES()) {
// No TEXTURE_RECTANGLE_ARB available on ES2
textureTargets[1] = LOCAL_GL_TEXTURE_RECTANGLE_ARB;
}
@ -734,7 +734,7 @@ CompositorOGL::CreateFBOWithTexture(const IntRect& aRect, bool aCopyFromSource,
GetFrameBufferInternalFormat(gl(), aSourceFrameBuffer, mWidget);
bool isFormatCompatibleWithRGBA
= gl()->IsGLES2() ? (format == LOCAL_GL_RGBA)
= gl()->IsGLES() ? (format == LOCAL_GL_RGBA)
: true;
if (isFormatCompatibleWithRGBA) {
@ -1193,19 +1193,19 @@ CompositorOGL::EndFrame()
// Unbind all textures
mGLContext->fActiveTexture(LOCAL_GL_TEXTURE0);
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, 0);
if (!mGLContext->IsGLES2()) {
if (!mGLContext->IsGLES()) {
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, 0);
}
mGLContext->fActiveTexture(LOCAL_GL_TEXTURE1);
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, 0);
if (!mGLContext->IsGLES2()) {
if (!mGLContext->IsGLES()) {
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, 0);
}
mGLContext->fActiveTexture(LOCAL_GL_TEXTURE2);
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, 0);
if (!mGLContext->IsGLES2()) {
if (!mGLContext->IsGLES()) {
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, 0);
}
}
@ -1320,7 +1320,7 @@ CompositorOGL::CopyToTarget(DrawTarget *aTarget, const gfx::Matrix& aTransform)
mGLContext->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, 0);
if (!mGLContext->IsGLES2()) {
if (!mGLContext->IsGLES()) {
// GLES2 promises that binding to any custom FBO will attach
// to GL_COLOR_ATTACHMENT0 attachment point.
mGLContext->fReadBuffer(LOCAL_GL_BACK);