diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 1bddae5707f..f754dd956cf 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -1058,14 +1058,14 @@ _mesa_ClampColor(GLenum target, GLenum clamp) switch (target) { case GL_CLAMP_VERTEX_COLOR_ARB: - if (ctx->API == API_OPENGL_CORE) + if (_mesa_is_desktop_gl_core(ctx)) goto invalid_enum; FLUSH_VERTICES(ctx, _NEW_LIGHT_STATE, GL_LIGHTING_BIT | GL_ENABLE_BIT); ctx->Light.ClampVertexColor = clamp; _mesa_update_clamp_vertex_color(ctx, ctx->DrawBuffer); break; case GL_CLAMP_FRAGMENT_COLOR_ARB: - if (ctx->API == API_OPENGL_CORE) + if (_mesa_is_desktop_gl_core(ctx)) goto invalid_enum; if (ctx->Color.ClampFragmentColor != clamp) { FLUSH_VERTICES(ctx, 0, GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT); diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index bdc8c10f739..bdeee3bd85e 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1296,7 +1296,7 @@ handle_bind_buffer_gen(struct gl_context *ctx, { struct gl_buffer_object *buf = *buf_handle; - if (unlikely(!no_error && !buf && (ctx->API == API_OPENGL_CORE))) { + if (unlikely(!no_error && !buf && _mesa_is_desktop_gl_core(ctx))) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-gen name)", caller); return false; } diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index ad1d281d050..160cdfcd92f 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1777,7 +1777,7 @@ bind_renderbuffer(GLenum target, GLuint renderbuffer) newRb = NULL; isGenName = true; } - else if (!newRb && ctx->API == API_OPENGL_CORE) { + else if (!newRb && _mesa_is_desktop_gl_core(ctx)) { /* All RB IDs must be Gen'd */ _mesa_error(ctx, GL_INVALID_OPERATION, "glBindRenderbuffer(non-gen name)"); @@ -3262,7 +3262,7 @@ bind_framebuffer(GLenum target, GLuint framebuffer) newDrawFb = NULL; isGenName = true; } - else if (!newDrawFb && ctx->API == API_OPENGL_CORE) { + else if (!newDrawFb && _mesa_is_desktop_gl_core(ctx)) { /* All FBO IDs must be Gen'd */ _mesa_error(ctx, GL_INVALID_OPERATION, "glBindFramebuffer(non-gen name)"); diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 83c4f5cb74c..9096c2346db 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1460,7 +1460,7 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d break; case EXTRA_API_GL_CORE: api_check = GL_TRUE; - if (ctx->API == API_OPENGL_CORE) + if (_mesa_is_desktop_gl_core(ctx)) api_found = GL_TRUE; break; case EXTRA_API_GL_COMPAT: diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index f452f199031..8e12809273d 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -154,7 +154,7 @@ _mesa_GetString( GLenum name ) case GL_VERSION: return (const GLubyte *) ctx->VersionString; case GL_EXTENSIONS: - if (ctx->API == API_OPENGL_CORE) { + if (_mesa_is_desktop_gl_core(ctx)) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetString(GL_EXTENSIONS)"); return (const GLubyte *) 0; } diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c index 8f7166a75e0..d63d2677bdc 100644 --- a/src/mesa/main/hint.c +++ b/src/mesa/main/hint.c @@ -103,7 +103,7 @@ _mesa_Hint( GLenum target, GLenum mode ) /* GL_SGIS_generate_mipmap */ case GL_GENERATE_MIPMAP_HINT_SGIS: - if (ctx->API == API_OPENGL_CORE) + if (_mesa_is_desktop_gl_core(ctx)) goto invalid_target; if (ctx->Hint.GenerateMipmap == mode) return; diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index f1188742514..50085ef7e2f 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -767,7 +767,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, */ const bool has_xfb = (_mesa_is_desktop_gl_compat(ctx) && ctx->Extensions.EXT_transform_feedback) - || ctx->API == API_OPENGL_CORE + || _mesa_is_desktop_gl_core(ctx) || _mesa_is_gles3(ctx); /* True if geometry shaders (of the form that was adopted into GLSL 1.50 @@ -781,7 +781,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, const bool has_ubo = (_mesa_is_desktop_gl_compat(ctx) && ctx->Extensions.ARB_uniform_buffer_object) - || ctx->API == API_OPENGL_CORE + || _mesa_is_desktop_gl_core(ctx) || _mesa_is_gles3(ctx); if (!shProg) { diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 1acc110a0c9..06879a40677 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -941,7 +941,7 @@ _mesa_init_teximage_fields_ms(struct gl_context *ctx, img->Height = height; img->Depth = depth; - GLenum depth_mode = ctx->API == API_OPENGL_CORE ? GL_RED : GL_LUMINANCE; + GLenum depth_mode = _mesa_is_desktop_gl_core(ctx) ? GL_RED : GL_LUMINANCE; /* In ES 3.0, DEPTH_TEXTURE_MODE is expected to be GL_RED for textures * with depth component data specified with a sized internal format. @@ -3042,7 +3042,7 @@ lookup_texture_ext_dsa(struct gl_context *ctx, GLenum target, GLuint texture, bool isGenName; texObj = _mesa_lookup_texture(ctx, texture); isGenName = texObj != NULL; - if (!texObj && ctx->API == API_OPENGL_CORE) { + if (!texObj && _mesa_is_desktop_gl_core(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-gen name)", caller); return NULL; } @@ -3285,7 +3285,7 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims, _mesa_dirty_texobj(ctx, texObj); /* only apply depthMode swizzle if it was explicitly changed */ - GLenum depth_mode = ctx->API == API_OPENGL_CORE ? GL_RED : GL_LUMINANCE; + GLenum depth_mode = _mesa_is_desktop_gl_core(ctx) ? GL_RED : GL_LUMINANCE; if (texObj->Attrib.DepthMode != depth_mode) _mesa_update_teximage_format_swizzle(ctx, texObj->Image[0][texObj->Attrib.BaseLevel], texObj->Attrib.DepthMode); _mesa_update_texture_object_swizzle(ctx, texObj); diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 6b0824c5be3..ca76492a410 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -395,7 +395,7 @@ _mesa_initialize_texture_object( struct gl_context *ctx, obj->Sampler.Attrib.CompareFunc = GL_LEQUAL; /* ARB_shadow */ obj->Sampler.Attrib.state.compare_mode = PIPE_TEX_COMPARE_NONE; obj->Sampler.Attrib.state.compare_func = PIPE_FUNC_LEQUAL; - obj->Attrib.DepthMode = ctx->API == API_OPENGL_CORE ? GL_RED : GL_LUMINANCE; + obj->Attrib.DepthMode = _mesa_is_desktop_gl_core(ctx) ? GL_RED : GL_LUMINANCE; obj->StencilSampling = false; obj->Sampler.Attrib.CubeMapSeamless = GL_FALSE; obj->Sampler.Attrib.state.seamless_cube_map = false; @@ -1763,7 +1763,7 @@ _mesa_lookup_or_create_texture(struct gl_context *ctx, GLenum target, finish_texture_init(ctx, target, newTexObj, targetIndex); } } else { - if (!no_error && ctx->API == API_OPENGL_CORE) { + if (!no_error && _mesa_is_desktop_gl_core(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-gen name)", caller); return NULL; diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index af67d37d740..f54093f8695 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -1012,7 +1012,7 @@ validate_array(struct gl_context *ctx, const char *func, * * The check for VBOs is handled below. */ - if (ctx->API == API_OPENGL_CORE && (vao == ctx->Array.DefaultVAO)) { + if (_mesa_is_desktop_gl_core(ctx) && (vao == ctx->Array.DefaultVAO)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no array object bound)", func); return; @@ -3305,7 +3305,7 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset, * "An INVALID_OPERATION error is generated if no vertex array object * is bound." */ - if ((ctx->API == API_OPENGL_CORE || _mesa_is_gles31(ctx)) && + if ((_mesa_is_desktop_gl_core(ctx) || _mesa_is_gles31(ctx)) && ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindVertexBuffer(No array object bound)"); @@ -3527,7 +3527,7 @@ _mesa_BindVertexBuffers(GLuint first, GLsizei count, const GLuint *buffers, * "An INVALID_OPERATION error is generated if no * vertex array object is bound." */ - if (ctx->API == API_OPENGL_CORE && + if (_mesa_is_desktop_gl_core(ctx) && ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindVertexBuffers(No array object bound)"); @@ -3638,7 +3638,7 @@ vertex_attrib_format(GLuint attribIndex, GLint size, GLenum type, * is an oversight. In the OpenGL 4.3 (Core Profile) spec, it applies * to all three functions. */ - if ((ctx->API == API_OPENGL_CORE || _mesa_is_gles31(ctx)) && + if ((_mesa_is_desktop_gl_core(ctx) || _mesa_is_gles31(ctx)) && ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(No array object bound)", func); @@ -3886,7 +3886,7 @@ _mesa_VertexAttribBinding(GLuint attribIndex, GLuint bindingIndex) * "An INVALID_OPERATION error is generated if no vertex array object * is bound." */ - if ((ctx->API == API_OPENGL_CORE || _mesa_is_gles31(ctx)) && + if ((_mesa_is_desktop_gl_core(ctx) || _mesa_is_gles31(ctx)) && ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribBinding(No array object bound)"); @@ -3996,7 +3996,7 @@ _mesa_VertexBindingDivisor(GLuint bindingIndex, GLuint divisor) * "An INVALID_OPERATION error is generated if no vertex array object * is bound." */ - if ((ctx->API == API_OPENGL_CORE || _mesa_is_gles31(ctx)) && + if ((_mesa_is_desktop_gl_core(ctx) || _mesa_is_gles31(ctx)) && ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexBindingDivisor(No array object bound)"); diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 77607e0d19c..a9c0778d259 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -136,7 +136,7 @@ create_version_string(struct gl_context *ctx, const char *prefix) "%s%u.%u%s Mesa " PACKAGE_VERSION MESA_GIT_SHA1, prefix, ctx->Version / 10, ctx->Version % 10, - (ctx->API == API_OPENGL_CORE) ? " (Core Profile)" : + _mesa_is_desktop_gl_core(ctx) ? " (Core Profile)" : (_mesa_is_desktop_gl_compat(ctx) && ctx->Version >= 32) ? " (Compatibility Profile)" : "" );