Mesa (master): mesa: replace some API_OPENGL_CORE checks with _mesa_is_desktop_gl

Marek Olšák mareko at kemper.freedesktop.org
Fri Feb 23 19:50:35 UTC 2018


Module: Mesa
Branch: master
Commit: 1881f41b6c3fe6e68b76c561f33942657b135bc8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1881f41b6c3fe6e68b76c561f33942657b135bc8

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Wed Feb 14 21:19:33 2018 +0100

mesa: replace some API_OPENGL_CORE checks with _mesa_is_desktop_gl

This is more accurate with respect to the compatibility profile.

Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/main/get.c           | 2 +-
 src/mesa/main/varray.c        | 6 +++---
 src/mesa/vbo/vbo_attrib_tmp.h | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 13d5e857ab..7c3b9dd22c 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -2555,7 +2555,7 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v)
    case GL_SAMPLER_BINDING: {
       struct gl_sampler_object *samp;
 
-      if (ctx->API != API_OPENGL_CORE)
+      if (!_mesa_is_desktop_gl(ctx) || ctx->Version < 33)
          goto invalid_enum;
       if (index >= _mesa_max_tex_unit(ctx))
          goto invalid_value;
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index bcd78373f5..c6cacf426c 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -522,7 +522,7 @@ validate_array(struct gl_context *ctx, const char *func,
       return;
    }
 
-   if (ctx->API == API_OPENGL_CORE && ctx->Version >= 44 &&
+   if (_mesa_is_desktop_gl(ctx) && ctx->Version >= 44 &&
        stride > ctx->Const.MaxVertexAttribStride) {
       _mesa_error(ctx, GL_INVALID_VALUE, "%s(stride=%d > "
                   "GL_MAX_VERTEX_ATTRIB_STRIDE)", func, stride);
@@ -2166,7 +2166,7 @@ vertex_array_vertex_buffer_err(struct gl_context *ctx,
       return;
    }
 
-   if (((ctx->API == API_OPENGL_CORE && ctx->Version >= 44) || _mesa_is_gles31(ctx)) &&
+   if (((_mesa_is_desktop_gl(ctx) && ctx->Version >= 44) || _mesa_is_gles31(ctx)) &&
        stride > ctx->Const.MaxVertexAttribStride) {
       _mesa_error(ctx, GL_INVALID_VALUE, "%s(stride=%d > "
                   "GL_MAX_VERTEX_ATTRIB_STRIDE)", func, stride);
@@ -2320,7 +2320,7 @@ vertex_array_vertex_buffers(struct gl_context *ctx,
             continue;
          }
 
-         if (ctx->API == API_OPENGL_CORE && ctx->Version >= 44 &&
+         if (_mesa_is_desktop_gl(ctx) && ctx->Version >= 44 &&
              strides[i] > ctx->Const.MaxVertexAttribStride) {
             _mesa_error(ctx, GL_INVALID_VALUE,
                         "%s(strides[%u]=%d > "
diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
index fd24e571c7..796b388363 100644
--- a/src/mesa/vbo/vbo_attrib_tmp.h
+++ b/src/mesa/vbo/vbo_attrib_tmp.h
@@ -150,7 +150,7 @@ static inline float conv_i10_to_norm_float(const struct gl_context *ctx, int i10
     * is used in every case.  They remove equation 2.2 completely.
     */
    if (_mesa_is_gles3(ctx) ||
-       (ctx->API == API_OPENGL_CORE && ctx->Version >= 42)) {
+       (_mesa_is_desktop_gl(ctx) && ctx->Version >= 42)) {
       /* Equation 2.3 above. */
       float f = ((float) val.x) / 511.0F;
       return MAX2(f, -1.0f);
@@ -166,7 +166,7 @@ static inline float conv_i2_to_norm_float(const struct gl_context *ctx, int i2)
    val.x = i2;
 
    if (_mesa_is_gles3(ctx) ||
-       (ctx->API == API_OPENGL_CORE && ctx->Version >= 42)) {
+       (_mesa_is_desktop_gl(ctx) && ctx->Version >= 42)) {
       /* Equation 2.3 above. */
       float f = (float) val.x;
       return MAX2(f, -1.0f);




More information about the mesa-commit mailing list