From 401eb04e4dfb179291befb19d74e2e3148c4e268 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 8 Nov 2013 11:09:17 +0100 Subject: libxtrans libxcb xcb-proto mesa git update 8 nov 2013 libxcb commit e8663a935890ff366f49e356211049dfd0d9756a libxcb/xcb-proto commit 29beba6bf02bda86a5b163ace63e1d0a4d3eee5b libxtrans commit 0153d1670e4a1883e1bb6dd971435d6268eac5ba mesa commit 035cce83f7b3d9a037c9e7cc17a212d6cf7e927f --- mesalib/src/mesa/drivers/dri/common/utils.c | 64 +++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'mesalib/src/mesa/drivers/dri/common/utils.c') diff --git a/mesalib/src/mesa/drivers/dri/common/utils.c b/mesalib/src/mesa/drivers/dri/common/utils.c index f3780d9b6..b30fca903 100644 --- a/mesalib/src/mesa/drivers/dri/common/utils.c +++ b/mesalib/src/mesa/drivers/dri/common/utils.c @@ -37,6 +37,7 @@ #include "main/cpuinfo.h" #include "main/extensions.h" #include "utils.h" +#include "dri_util.h" unsigned @@ -477,3 +478,66 @@ driIndexConfigAttrib(const __DRIconfig *config, int index, return GL_FALSE; } + +/** + * Implement queries for values that are common across all Mesa drivers + * + * Currently only the following queries are supported by this function: + * + * - \c __DRI2_RENDERER_VERSION + * - \c __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION + * - \c __DRI2_RENDERER_OPENGL_COMPATIBLITY_PROFILE_VERSION + * - \c __DRI2_RENDERER_ES_PROFILE_VERSION + * - \c __DRI2_RENDERER_ES2_PROFILE_VERSION + * + * \returns + * Zero if a recognized value of \c param is supplied, -1 otherwise. + */ +int +driQueryRendererIntegerCommon(__DRIscreen *psp, int param, int *value) +{ + switch (param) { + case __DRI2_RENDERER_VERSION: { + static const char *const ver = PACKAGE_VERSION; + char *endptr; + int v[3]; + + v[0] = strtol(ver, &endptr, 10); + assert(endptr[0] == '.'); + if (endptr[0] != '.') + return -1; + + v[1] = strtol(endptr + 1, &endptr, 10); + assert(endptr[0] == '.'); + if (endptr[0] != '.') + return -1; + + v[2] = strtol(endptr + 1, &endptr, 10); + + value[0] = v[0]; + value[1] = v[1]; + value[2] = v[2]; + return 0; + } + case __DRI2_RENDERER_OPENGL_CORE_PROFILE_VERSION: + value[0] = psp->max_gl_core_version / 10; + value[1] = psp->max_gl_core_version % 10; + return 0; + case __DRI2_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION: + value[0] = psp->max_gl_compat_version / 10; + value[1] = psp->max_gl_compat_version % 10; + return 0; + case __DRI2_RENDERER_OPENGL_ES_PROFILE_VERSION: + value[0] = psp->max_gl_es1_version / 10; + value[1] = psp->max_gl_es1_version % 10; + return 0; + case __DRI2_RENDERER_OPENGL_ES2_PROFILE_VERSION: + value[0] = psp->max_gl_es2_version / 10; + value[1] = psp->max_gl_es2_version % 10; + return 0; + default: + break; + } + + return -1; +} -- cgit v1.2.3