mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 19:20:08 +01:00
mesa: make use of the new _mesa_is_desktop_gl_core() helper
Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21343>
This commit is contained in:
parent
ae66411f26
commit
a5fa548a34
11 changed files with 22 additions and 22 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)");
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)");
|
||||
|
|
|
|||
|
|
@ -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)" : ""
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue