__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base;
__DRIcontext *shared = NULL;
+ /* Check the renderType value */
+ if (!validate_renderType_against_config(config_base, renderType))
+ return NULL;
+
if (shareList) {
/* If the shareList context is not a DRI2 context, we cannot possibly
* create a DRI2 context that shares it.
&api, &reset, error))
goto error_exit;
+ /* Check the renderType value */
+ if (!validate_renderType_against_config(config_base, renderType))
+ goto error_exit;
+
if (shareList) {
pcp_shared = (struct dri2_context *) shareList;
shared = pcp_shared->driContext;
if (!psc->base.driScreen)
return NULL;
+ /* Check the renderType value */
+ if (!validate_renderType_against_config(config_base, renderType))
+ return NULL;
+
if (shareList) {
/* If the shareList context is not a DRI context, we cannot possibly
* create a DRI context that shares it.
if (!psc->base.driScreen)
return NULL;
+ /* Check the renderType value */
+ if (!validate_renderType_against_config(config_base, renderType))
+ return NULL;
+
if (shareList) {
/* If the shareList context is not a DRISW context, we cannot possibly
* create a DRISW context that shares it.
&api, &reset, error))
return NULL;
+ /* Check the renderType value */
+ if (!validate_renderType_against_config(config_base, renderType)) {
+ return NULL;
+ }
+
if (reset != __DRI_CTX_RESET_NO_NOTIFICATION)
return NULL;
applegl_create_display(struct glx_display *display);
#endif
+extern Bool validate_renderType_against_config(const struct glx_config *config,
+ int renderType);
+
extern struct glx_drawable *GetGLXDrawable(Display *dpy, GLXDrawable drawable);
extern int InitGLXDrawable(Display *dpy, struct glx_drawable *glxDraw,
return NULL;
}
+/**
+ * Verifies context's GLX_RENDER_TYPE value with config.
+ *
+ * \param config GLX FBConfig which will support the returned renderType.
+ * \param renderType The context render type to be verified.
+ * \return True if the value of context renderType was approved, or 0 if no
+ * valid value was found.
+ */
+Bool
+validate_renderType_against_config(const struct glx_config *config,
+ int renderType)
+{
+ switch (renderType) {
+ case GLX_RGBA_TYPE:
+ return (config->renderType & GLX_RGBA_BIT) != 0;
+ case GLX_COLOR_INDEX_TYPE:
+ return (config->renderType & GLX_COLOR_INDEX_BIT) != 0;
+ case GLX_RGBA_FLOAT_TYPE_ARB:
+ return (config->renderType & GLX_RGBA_FLOAT_BIT_ARB) != 0;
+ case GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT:
+ return (config->renderType & GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT) != 0;
+ default:
+ break;
+ }
+ return 0;
+}
+
_X_HIDDEN Bool
glx_context_init(struct glx_context *gc,
struct glx_screen *psc, struct glx_config *config)
* \todo Eliminate \c __glXInitVertexArrayState. Replace it with a new
* function called \c __glXAllocateClientState that allocates the memory and
* does all the initialization (including the pixel pack / unpack).
+ *
+ * \note
+ * This function is \b not the place to validate the context creation
+ * parameters. It is just the allocator for the \c glx_context.
*/
_X_HIDDEN struct glx_context *
indirect_create_context(struct glx_screen *psc,
XMesaVisual xmvis = (XMesaVisual) config;
if (!dpy || !config ||
- (renderType != GLX_RGBA_TYPE && renderType != GLX_COLOR_INDEX_TYPE))
+ (renderType != GLX_RGBA_TYPE &&
+ renderType != GLX_COLOR_INDEX_TYPE &&
+ renderType != GLX_RGBA_FLOAT_TYPE_ARB &&
+ renderType != GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT))
return 0;
glxCtx = CALLOC_STRUCT(fake_glx_context);