glx: Handle float config types in glxConvertConfigs
Replaces old use of floatMode attribute with new, extended range of values in __DRI_ATTRIB_RENDER_TYPE. Also adds new conditions, where the float modes support requires it. Enables support for not only float configs, but packed float configs as well. v2 (idr): Whitespace and formatting fixes. Refactor render type vs. pbuffer checking to a separate function that includes a quote from the spec. Re-write commit message. Fix compiler warnings: glxdricommon.c: In function 'glxConvertConfigs': glxdricommon.c:212:35: warning: pointer targets in passing argument 3 of 'core->getConfigAttrib' differ in signedness [-Wpointer-sign] glxdricommon.c:212:35: note: expected 'unsigned int *' but argument is of type 'int *' glxdricommon.c:230:35: warning: pointer targets in passing argument 3 of 'core->getConfigAttrib' differ in signedness [-Wpointer-sign] glxdricommon.c:230:35: note: expected 'unsigned int *' but argument is of type 'int *' Signed-off-by: Daniel Czarnowski <daniel.czarnowski@intel.com> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
parent
4e5eb15b4c
commit
ccc8bb1153
|
@ -809,7 +809,7 @@ LIBAPPLEWM="applewm >= 1.4"
|
|||
LIBDMX="dmx >= 1.0.99.1"
|
||||
LIBDRI="dri >= 7.8.0"
|
||||
LIBDRM="libdrm >= 2.3.0"
|
||||
LIBGL="gl >= 7.1.0"
|
||||
LIBGL="gl >= 9.2.0"
|
||||
LIBXEXT="xext >= 1.0.99.4"
|
||||
LIBXFONT="xfont >= 1.4.2"
|
||||
LIBXI="xi >= 1.2.99.1"
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <GL/internal/dri_interface.h>
|
||||
#include <os.h>
|
||||
#include "glxserver.h"
|
||||
#include "glxext.h"
|
||||
#include "glxcontext.h"
|
||||
#include "glxscreens.h"
|
||||
#include "glxdricommon.h"
|
||||
|
@ -127,6 +128,7 @@ createModeFromConfig(const __DRIcoreExtension * core,
|
|||
unsigned int visualType, unsigned int drawableType)
|
||||
{
|
||||
__GLXDRIconfig *config;
|
||||
GLint renderType = 0;
|
||||
unsigned int attrib, value;
|
||||
int i;
|
||||
|
||||
|
@ -138,11 +140,14 @@ createModeFromConfig(const __DRIcoreExtension * core,
|
|||
while (core->indexConfigAttrib(driConfig, i++, &attrib, &value)) {
|
||||
switch (attrib) {
|
||||
case __DRI_ATTRIB_RENDER_TYPE:
|
||||
config->config.renderType = 0;
|
||||
if (value & __DRI_ATTRIB_RGBA_BIT)
|
||||
config->config.renderType |= GLX_RGBA_BIT;
|
||||
renderType |= GLX_RGBA_BIT;
|
||||
if (value & __DRI_ATTRIB_COLOR_INDEX_BIT)
|
||||
config->config.renderType |= GLX_COLOR_INDEX_BIT;
|
||||
renderType |= GLX_COLOR_INDEX_BIT;
|
||||
if (value & __DRI_ATTRIB_FLOAT_BIT)
|
||||
renderType |= GLX_RGBA_FLOAT_BIT_ARB;
|
||||
if (value & __DRI_ATTRIB_UNSIGNED_FLOAT_BIT)
|
||||
renderType |= GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT;
|
||||
break;
|
||||
case __DRI_ATTRIB_CONFIG_CAVEAT:
|
||||
if (value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
|
||||
|
@ -171,11 +176,26 @@ createModeFromConfig(const __DRIcoreExtension * core,
|
|||
config->config.next = NULL;
|
||||
config->config.xRenderable = GL_TRUE;
|
||||
config->config.visualType = visualType;
|
||||
config->config.renderType = renderType;
|
||||
config->config.drawableType = drawableType;
|
||||
|
||||
return &config->config;
|
||||
}
|
||||
|
||||
static Bool
|
||||
render_type_is_pbuffer_only(unsigned renderType)
|
||||
{
|
||||
/* The GL_ARB_color_buffer_float spec says:
|
||||
*
|
||||
* "Note that floating point rendering is only supported for
|
||||
* GLXPbuffer drawables. The GLX_DRAWABLE_TYPE attribute of the
|
||||
* GLXFBConfig must have the GLX_PBUFFER_BIT bit set and the
|
||||
* GLX_RENDER_TYPE attribute must have the GLX_RGBA_FLOAT_BIT set."
|
||||
*/
|
||||
return !!(renderType & (__DRI_ATTRIB_UNSIGNED_FLOAT_BIT
|
||||
| __DRI_ATTRIB_FLOAT_BIT));
|
||||
}
|
||||
|
||||
__GLXconfig *
|
||||
glxConvertConfigs(const __DRIcoreExtension * core,
|
||||
const __DRIconfig ** configs, unsigned int drawableType)
|
||||
|
@ -187,6 +207,14 @@ glxConvertConfigs(const __DRIcoreExtension * core,
|
|||
head.next = NULL;
|
||||
|
||||
for (i = 0; configs[i]; i++) {
|
||||
unsigned renderType = 0;
|
||||
if (core->getConfigAttrib(configs[i], __DRI_ATTRIB_RENDER_TYPE,
|
||||
&renderType)) {
|
||||
if (render_type_is_pbuffer_only(renderType) &&
|
||||
!(drawableType & GLX_PBUFFER_BIT))
|
||||
continue;
|
||||
}
|
||||
/* Add all the others */
|
||||
tail->next = createModeFromConfig(core,
|
||||
configs[i], GLX_TRUE_COLOR,
|
||||
drawableType);
|
||||
|
@ -197,6 +225,14 @@ glxConvertConfigs(const __DRIcoreExtension * core,
|
|||
}
|
||||
|
||||
for (i = 0; configs[i]; i++) {
|
||||
int renderType = 0;
|
||||
if (core->getConfigAttrib(configs[i], __DRI_ATTRIB_RENDER_TYPE,
|
||||
&renderType)) {
|
||||
if (render_type_is_pbuffer_only(renderType) &&
|
||||
!(drawableType & GLX_PBUFFER_BIT))
|
||||
continue;
|
||||
}
|
||||
/* Add all the others */
|
||||
tail->next = createModeFromConfig(core,
|
||||
configs[i], GLX_DIRECT_COLOR,
|
||||
drawableType);
|
||||
|
|
|
@ -386,7 +386,9 @@ fbConfigsDump(unsigned int n, __GLXconfig * c)
|
|||
c->accumAlphaBits, c->sampleBuffers, c->samples,
|
||||
(c->drawableType & GLX_WINDOW_BIT) ? "y" : ".",
|
||||
(c->drawableType & GLX_PIXMAP_BIT) ? "y" : ".",
|
||||
(c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".", ".",
|
||||
(c->drawableType & GLX_PBUFFER_BIT) ? "y" : ".",
|
||||
(c->renderType & (GLX_RGBA_FLOAT_BIT_ARB |
|
||||
GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) ? "y" : ".",
|
||||
(c->transparentPixel != GLX_NONE_EXT) ? "y" : ".",
|
||||
c->visualSelectGroup,
|
||||
(c->visualRating == GLX_SLOW_VISUAL_EXT) ? "*" : " ");
|
||||
|
|
Loading…
Reference in New Issue