<div dir="ltr"><br><div><div><div><div class="gmail_extra"><div class="gmail_quote">2013/7/15 walter harms <span dir="ltr"><<a href="mailto:wharms@bfs.de" target="_blank">wharms@bfs.de</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
Am 15.07.2013 17:06, schrieb Tomasz Lis:<br>
<div><div class="h5">> From: Tomasz Lis <<a href="mailto:tomasz.lis@intel.com">tomasz.lis@intel.com</a>><br>
><br>
> Support of GLX_RGBA*_FLOAT_BIT*, and correct setting of the<br>
> flags. Also commented each renderType use with information<br>
> which (fbconfig or context) RENDER_TYPE it is.<br>
><br>
> Signed-off-by: Tomasz Lis <<a href="mailto:listom@gmail.com">listom@gmail.com</a>><br>
> ---<br>
> glx/createcontext.c | 2 ++<br>
> glx/glxext.h | 15 ++++++++++++++<br>
> hw/dmx/dmx_glxvisuals.c | 7 +++++--<br>
> hw/dmx/glxProxy/glxcmds.c | 42 +++++++++++++++++++++++++++++++++-------<br>
> hw/xquartz/GL/glcontextmodes.c | 10 ++++++++--<br>
> 5 files changed, 65 insertions(+), 11 deletions(-)<br>
><br>
> diff --git a/glx/createcontext.c b/glx/createcontext.c<br>
> index 13d21cc..41ecd11 100644<br>
> --- a/glx/createcontext.c<br>
> +++ b/glx/createcontext.c<br>
> @@ -68,6 +68,8 @@ validate_render_type(uint32_t render_type)<br>
> switch (render_type) {<br>
> case GLX_RGBA_TYPE:<br>
> case GLX_COLOR_INDEX_TYPE:<br>
> + case GLX_RGBA_FLOAT_TYPE_ARB:<br>
> + case GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT:<br>
> return True;<br>
> default:<br>
> return False;<br>
> diff --git a/glx/glxext.h b/glx/glxext.h<br>
> index 9b0978b..2d67af3 100644<br>
> --- a/glx/glxext.h<br>
> +++ b/glx/glxext.h<br>
> @@ -35,6 +35,21 @@<br>
> * Silicon Graphics, Inc.<br>
> */<br>
><br>
> +// doing #include <GL/glx.h> & #include <GL/glxext.h> could cause problems with<br>
> +// overlapping definitions, so let's use the easy way<br>
<br>
<br>
</div></div>I am not an expert but this should be fixed in openGL with priority.<br>
So i would move them in a glxfixes.h so it can be removed if fixed in openGL.<br>
<div><div><br>
</div></div></blockquote><div> <br>Thank you, Walter.<br></div><div>The comment isn't clear, sorry for that. It's not a problem with GL/glx.h & GL/glxext.h having bad definitions, but with XServer code containing some defines which won't compile with these headers included.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="h5">
> +#ifndef GLX_RGBA_FLOAT_BIT_ARB<br>
> +#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004<br>
> +#endif<br>
> +#ifndef GLX_RGBA_FLOAT_TYPE_ARB<br>
> +#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9<br>
> +#endif<br>
> +#ifndef GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT<br>
> +#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008<br>
> +#endif<br>
> +#ifndef GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT<br>
> +#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1<br>
> +#endif<br>
> +<br>
> extern GLboolean __glXFreeContext(__GLXcontext * glxc);<br>
> extern void __glXFlushContextCache(void);<br>
><br>
> diff --git a/hw/dmx/dmx_glxvisuals.c b/hw/dmx/dmx_glxvisuals.c<br>
> index f903b74..ba051a4 100644<br>
> --- a/hw/dmx/dmx_glxvisuals.c<br>
> +++ b/hw/dmx/dmx_glxvisuals.c<br>
> @@ -439,8 +439,11 @@ GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs)<br>
> /* Fill in derived values */<br>
> config->screen = screen;<br>
><br>
> - config->rgbMode = config->renderType & GLX_RGBA_BIT;<br>
> - config->colorIndexMode = !config->rgbMode;<br>
> + /* The rgbMode should be true for any mode which has distinguishible R, G and B components */<br>
> + config->rgbMode = (config->renderType & (GLX_RGBA_BIT |<br>
> + GLX_RGBA_FLOAT_BIT_ARB | GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) != 0;<br>
> + /* The colorIndexMode isn't really needed, as all non-RGB modes are CI modes */<br>
> + config->colorIndexMode = (config->renderType & GLX_COLOR_INDEX_BIT) != 0;<br>
><br>
> config->haveAccumBuffer =<br>
> config->accumRedBits > 0 ||<br>
> diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c<br>
> index 4538274..b325f4d 100644<br>
> --- a/hw/dmx/glxProxy/glxcmds.c<br>
> +++ b/hw/dmx/glxProxy/glxcmds.c<br>
> @@ -308,12 +308,12 @@ CreateContext(__GLXclientState * cl,<br>
> /* send the create context request to the back-end server */<br>
> dpy = GetBackEndDisplay(cl, screen);<br>
> if (glxc->pFBConfig) {<br>
> - /*Since for a certain visual both RGB and COLOR INDEX<br>
> - *can be on then the only parmeter to choose the renderType<br>
> - * should be the class of the colormap since all 4 first<br>
> - * classes does not support RGB mode only COLOR INDEX ,<br>
> - * and so TrueColor and DirectColor does not support COLOR INDEX*/<br>
> - int renderType = glxc->pFBConfig->renderType;<br>
> + /* For a specific visual, multiple render types (ie. both RGB and COLOR INDEX)<br>
> + * can be accessible. The only parameter to choose the renderType<br>
> + * should be the class of the colormap, since all 4 first classes<br>
> + * does not support RGB mode only COLOR INDEX,<br>
> + * and so TrueColor and DirectColor does not support COLOR INDEX. */<br>
> + int renderType = GLX_RGBA_TYPE;<br>
><br>
> if (pVisual) {<br>
> switch (pVisual->class) {<br>
> @@ -329,7 +329,21 @@ CreateContext(__GLXclientState * cl,<br>
> renderType = GLX_RGBA_TYPE;<br>
> break;<br>
> }<br>
> + } else {<br>
> + /* Convert the render type bits from fbconfig into context render type. */<br>
> + if (glxc->pFBConfig->renderType & GLX_RGBA_BIT)<br>
> + renderType = GLX_RGBA_TYPE;<br>
> + else if (glxc->pFBConfig->renderType & GLX_COLOR_INDEX_BIT)<br>
> + renderType = GLX_COLOR_INDEX_TYPE;<br>
> + else if (glxc->pFBConfig->renderType & GLX_RGBA_FLOAT_BIT_ARB)<br>
> + renderType = GLX_RGBA_FLOAT_TYPE_ARB;<br>
> + else if (glxc->pFBConfig->renderType & GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)<br>
> + renderType = GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT;<br>
> + else { /* There's no recognized renderType in the config */<br>
> + renderType = GLX_RGBA_TYPE;<br>
> + }<br>
> }<br>
> +<br>
> if (__GLX_IS_VERSION_SUPPORTED(1, 3)) {<br>
> LockDisplay(dpy);<br>
> GetReq(GLXCreateNewContext, be_new_req);<br>
> @@ -3193,6 +3207,7 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc)<br>
> __GLXcontext *ctx;<br>
> xGLXQueryContextReq *req;<br>
> xGLXQueryContextReply reply;<br>
> + int renderType;<br>
> int nProps;<br>
> int *sendBuf, *pSendBuf;<br>
> int nReplyBytes;<br>
> @@ -3205,6 +3220,19 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc)<br>
> return __glXBadContext;<br>
> }<br>
><br>
> + /* Convert the render type bits from fbconfig into context render type. */<br>
> + if (ctx->pFBConfig->renderType & GLX_RGBA_BIT)<br>
> + renderType = GLX_RGBA_TYPE;<br>
> + else if (ctx->pFBConfig->renderType & GLX_COLOR_INDEX_BIT)<br>
> + renderType = GLX_COLOR_INDEX_TYPE;<br>
> + else if (ctx->pFBConfig->renderType & GLX_RGBA_FLOAT_BIT_ARB)<br>
> + renderType = GLX_RGBA_FLOAT_TYPE_ARB;<br>
> + else if (ctx->pFBConfig->renderType & GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)<br>
> + renderType = GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT;<br>
> + else { /* There's no recognized renderType in the config */<br>
> + renderType = GLX_RGBA_TYPE;<br>
> + }<br>
> +<br>
> nProps = 3;<br>
><br>
> reply = (xGLXQueryContextReply) {<br>
> @@ -3220,7 +3248,7 @@ __glXQueryContext(__GLXclientState * cl, GLbyte * pc)<br>
> *pSendBuf++ = GLX_FBCONFIG_ID;<br>
> *pSendBuf++ = (int) (ctx->pFBConfig->id);<br>
> *pSendBuf++ = GLX_RENDER_TYPE;<br>
> - *pSendBuf++ = (int) (ctx->pFBConfig->renderType);<br>
> + *pSendBuf++ = (int)(renderType); /* context render type (one of GLX_*_TYPE values) */<br>
> *pSendBuf++ = GLX_SCREEN;<br>
> *pSendBuf++ = (int) (ctx->pScreen->myNum);<br>
><br>
> diff --git a/hw/xquartz/GL/glcontextmodes.c b/hw/xquartz/GL/glcontextmodes.c<br>
> index dc97f89..1fffaa8 100644<br>
> --- a/hw/xquartz/GL/glcontextmodes.c<br>
> +++ b/hw/xquartz/GL/glcontextmodes.c<br>
> @@ -141,9 +141,15 @@ _gl_copy_visual_to_context_mode(__GLcontextModes * mode,<br>
> mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;<br>
><br>
> mode->rgbMode = (config->rgba != 0);<br>
> - mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT;<br>
> -<br>
> mode->colorIndexMode = !(mode->rgbMode);<br>
> + /* It's impossible to create float config from visual. */<br>
> + mode->floatMode = GL_FALSE;<br>
> + /* The fact that we can't have float mode makes the code below unequivocal.<br>
> + * The rgbMode is true for both float or integer modes, but this time we're sure it's integer.<br>
> + * We could even skip checking colorIndexMode as all non-RGB modes are CI. */<br>
> + mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : 0 |<br>
> + (mode->colorIndexMode) ? GLX_COLOR_INDEX_BIT : 0;<br>
> +<br>
> mode->doubleBufferMode = (config->doubleBuffer != 0);<br>
> mode->stereoMode = (config->stereo != 0);<br>
><br>
</div></div>_______________________________________________<br>
<a href="mailto:xorg-devel@lists.x.org">xorg-devel@lists.x.org</a>: X.Org development<br>
Archives: <a href="http://lists.x.org/archives/xorg-devel" target="_blank">http://lists.x.org/archives/xorg-devel</a><br>
Info: <a href="http://lists.x.org/mailman/listinfo/xorg-devel" target="_blank">http://lists.x.org/mailman/listinfo/xorg-devel</a><br>
</blockquote></div><br><br>Thank you for your feedback and awaiting more comments!<br><br><br></div></div></div></div></div>