[Mesa-dev] [PATCH 1/2] mesa: add context version routines
Signed-off-by: Jordan Justen jordan.l.jus...@intel.com --- Based on the discussion July 26-27 in the thread [PATCH 1/4] mesa: Add a Version field to the context with VersionMajor*10+VersionMinor. src/mesa/main/version.h | 54 +++ 1 file changed, 54 insertions(+) diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 94a9855..6e13c6c 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -27,6 +27,11 @@ #ifndef VERSION_H #define VERSION_H +#include mtypes.h + +#ifdef __cplusplus +extern C { +#endif struct gl_context; @@ -48,4 +53,53 @@ _mesa_compute_version(struct gl_context *ctx); extern void _mesa_override_glsl_version(struct gl_context *ctx); +/** + * Merge major/minor into a comparable uint + */ +static inline GLuint +_mesa_uint_version(int major, int minor) +{ +return major * 10 + minor; +} + +/** + * Return the GL major version of the context + */ +static inline GLuint +_mesa_get_version_major(struct gl_context *ctx) +{ +return ctx-Version / 10; +} + +/** + * Return the GL minor version of the context + */ +static inline GLuint +_mesa_get_version_minor(struct gl_context *ctx) +{ +return ctx-Version % 10; +} + +/** + * Sets the context version to major.minor + */ +static inline void +_mesa_set_version(struct gl_context *ctx, int major, int minor) +{ +ctx-Version = _mesa_uint_version(major, minor); +} + +/** + * Checks if the context version is greater than or equal to major.minor + */ +static inline GLboolean +_mesa_have_version(const struct gl_context *ctx, int major, int minor) +{ +return ctx-Version = _mesa_uint_version(major, minor); +} + +#ifdef __cplusplus +} +#endif + #endif /* VERSION_H */ -- 1.7.9.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] mesa: add context version routines
On Fri, Aug 31, 2012 at 11:52 AM, Jordan Justen jordan.l.jus...@intel.com wrote: Signed-off-by: Jordan Justen jordan.l.jus...@intel.com --- Based on the discussion July 26-27 in the thread [PATCH 1/4] mesa: Add a Version field to the context with VersionMajor*10+VersionMinor. src/mesa/main/version.h | 54 +++ 1 file changed, 54 insertions(+) diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 94a9855..6e13c6c 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -27,6 +27,11 @@ #ifndef VERSION_H #define VERSION_H +#include mtypes.h + +#ifdef __cplusplus +extern C { +#endif struct gl_context; @@ -48,4 +53,53 @@ _mesa_compute_version(struct gl_context *ctx); extern void _mesa_override_glsl_version(struct gl_context *ctx); +/** + * Merge major/minor into a comparable uint + */ +static inline GLuint +_mesa_uint_version(int major, int minor) +{ +return major * 10 + minor; +} + +/** + * Return the GL major version of the context + */ +static inline GLuint +_mesa_get_version_major(struct gl_context *ctx) +{ +return ctx-Version / 10; +} + +/** + * Return the GL minor version of the context + */ +static inline GLuint +_mesa_get_version_minor(struct gl_context *ctx) +{ +return ctx-Version % 10; +} + +/** + * Sets the context version to major.minor + */ +static inline void +_mesa_set_version(struct gl_context *ctx, int major, int minor) +{ +ctx-Version = _mesa_uint_version(major, minor); +} + +/** + * Checks if the context version is greater than or equal to major.minor + */ +static inline GLboolean +_mesa_have_version(const struct gl_context *ctx, int major, int minor) +{ +return ctx-Version = _mesa_uint_version(major, minor); +} Brian, you sent _mesa_have_version to the list on July 27. Can I add your Signed-off-by to the patch? Thanks, -Jordan + +#ifdef __cplusplus +} +#endif + #endif /* VERSION_H */ -- 1.7.9.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] mesa: add context version routines
On 08/31/2012 12:52 PM, Jordan Justen wrote: Signed-off-by: Jordan Justenjordan.l.jus...@intel.com --- Based on the discussion July 26-27 in the thread [PATCH 1/4] mesa: Add a Version field to the context with VersionMajor*10+VersionMinor. src/mesa/main/version.h | 54 +++ 1 file changed, 54 insertions(+) diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 94a9855..6e13c6c 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -27,6 +27,11 @@ #ifndef VERSION_H #define VERSION_H +#include mtypes.h + +#ifdef __cplusplus +extern C { +#endif struct gl_context; @@ -48,4 +53,53 @@ _mesa_compute_version(struct gl_context *ctx); extern void _mesa_override_glsl_version(struct gl_context *ctx); +/** + * Merge major/minor into a comparable uint + */ +static inline GLuint +_mesa_uint_version(int major, int minor) +{ +return major * 10 + minor; +} + +/** + * Return the GL major version of the context + */ +static inline GLuint +_mesa_get_version_major(struct gl_context *ctx) +{ +return ctx-Version / 10; +} + +/** + * Return the GL minor version of the context + */ +static inline GLuint +_mesa_get_version_minor(struct gl_context *ctx) +{ +return ctx-Version % 10; +} + +/** + * Sets the context version to major.minor + */ +static inline void +_mesa_set_version(struct gl_context *ctx, int major, int minor) +{ +ctx-Version = _mesa_uint_version(major, minor); +} + +/** + * Checks if the context version is greater than or equal to major.minor + */ +static inline GLboolean +_mesa_have_version(const struct gl_context *ctx, int major, int minor) +{ +return ctx-Version= _mesa_uint_version(major, minor); +} + +#ifdef __cplusplus +} +#endif + #endif /* VERSION_H */ -- 1.7.9.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev Looks OK to me. Signed-off-by: Brian Paul bri...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] mesa: add context version routines
On 08/31/2012 11:52 AM, Jordan Justen wrote: Signed-off-by: Jordan Justen jordan.l.jus...@intel.com --- Based on the discussion July 26-27 in the thread [PATCH 1/4] mesa: Add a Version field to the context with VersionMajor*10+VersionMinor. src/mesa/main/version.h | 54 +++ 1 file changed, 54 insertions(+) diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 94a9855..6e13c6c 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -27,6 +27,11 @@ #ifndef VERSION_H #define VERSION_H +#include mtypes.h + +#ifdef __cplusplus +extern C { +#endif struct gl_context; @@ -48,4 +53,53 @@ _mesa_compute_version(struct gl_context *ctx); extern void _mesa_override_glsl_version(struct gl_context *ctx); +/** + * Merge major/minor into a comparable uint + */ +static inline GLuint +_mesa_uint_version(int major, int minor) +{ +return major * 10 + minor; +} + +/** + * Return the GL major version of the context + */ +static inline GLuint +_mesa_get_version_major(struct gl_context *ctx) +{ +return ctx-Version / 10; +} + +/** + * Return the GL minor version of the context + */ +static inline GLuint +_mesa_get_version_minor(struct gl_context *ctx) +{ +return ctx-Version % 10; +} + +/** + * Sets the context version to major.minor + */ +static inline void +_mesa_set_version(struct gl_context *ctx, int major, int minor) +{ +ctx-Version = _mesa_uint_version(major, minor); +} + +/** + * Checks if the context version is greater than or equal to major.minor + */ +static inline GLboolean +_mesa_have_version(const struct gl_context *ctx, int major, int minor) +{ +return ctx-Version = _mesa_uint_version(major, minor); +} + +#ifdef __cplusplus +} +#endif + #endif /* VERSION_H */ -- 1.7.9.5 Whitespace errors on all of these functions. Mesa is 3-space indent, not 4. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev