On 07/27/2012 12:43 AM, Jordan Justen wrote:
These macros make it easier to check for multiple API types.

Signed-off-by: Jordan Justen<jordan.l.jus...@intel.com>
---
  src/mesa/main/mtypes.h |    4 ++++
  1 file changed, 4 insertions(+)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7d77956..7a715b3 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3340,6 +3340,10 @@ typedef enum
     API_OPENGL_CORE,
  } gl_api;

+#define IS_CTX_IN2(ctx, api1, api2) ((ctx->API == api1) || (ctx->API == api2))
+#define IS_CTX_DESKTOP_GL(ctx) IS_CTX_IN2(ctx, API_OPENGL, API_OPENGL_CORE)
+#define IS_CTX_GLES(ctx) IS_CTX_IN2(ctx, API_OPENGLES, API_OPENGLES2)
+
  /**
   * Driver-specific state flags.
   *

I'd prefer inline functions such as:

static inline GLboolean
_mesa_is_desktop_gl(const struct gl_context *ctx)
{
   return ctx->API == API_OPENGL || ctx->API == API_OPENGL_CORE;
}

static inline GLboolean
_mesa_is_gles(const struct gl_context *ctx)
{
   return ctx->API == API_OPENGLES || ctx->API == API_OPENGLES2;
}

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to