v2 (idr): Open-code the check for GLX_RENDER_TYPE.
dri2_convert_glx_attribs can't be called from here because that function
only exists in direct-rendering builds. Also add a stub version of
indirect_create_context_attribs to tests/fake_glx_screen.cpp to prevent
'make check' regressions.
Signed-off-by: Tomasz Lis <tomasz.lis@intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
#ifdef GLX_USE_APPLEGL
gc = applegl_create_context(psc, cfg, share, 0);
#else
- gc = indirect_create_context(psc, cfg, share, 0);
+ gc = indirect_create_context_attribs(psc, cfg, share, num_attribs,
+ (const uint32_t *) attrib_list,
+ &dummy_err);
#endif
}
indirect_create_context(struct glx_screen *psc,
struct glx_config *mode,
struct glx_context *shareList, int renderType);
+extern struct glx_context *
+indirect_create_context_attribs(struct glx_screen *base,
+ struct glx_config *config_base,
+ struct glx_context *shareList,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ unsigned *error);
#endif /* !__GLX_client_h__ */
gc->share_xid = shareList ? shareList->xid : None;
gc->imported = GL_FALSE;
- gc->renderType = renderType;
return (GLXContext) gc;
}
gc->isDirect = GL_FALSE;
gc->vtable = &indirect_context_vtable;
state = calloc(1, sizeof(struct __GLXattributeRec));
+ gc->renderType = renderType;
+
if (state == NULL) {
/* Out of memory */
free(gc);
return gc;
}
-static struct glx_context *
+_X_HIDDEN struct glx_context *
indirect_create_context_attribs(struct glx_screen *base,
struct glx_config *config_base,
struct glx_context *shareList,
const uint32_t *attribs,
unsigned *error)
{
- /* All of the attribute validation for indirect contexts is handled on the
- * server, so there's not much to do here.
- */
- (void) num_attribs;
- (void) attribs;
+ int renderType = GLX_RGBA_TYPE;
+ unsigned i;
/* The error parameter is only used on the server so that correct GLX
* protocol errors can be generated. On the client, it can be ignored.
*/
(void) error;
- return indirect_create_context(base, config_base, shareList, 0);
+ /* All of the attribute validation for indirect contexts is handled on the
+ * server, so there's not much to do here. Still, we need to parse the
+ * attributes to correctly set renderType.
+ */
+ for (i = 0; i < num_attribs; i++) {
+ if (attribs[i * 2] == GLX_RENDER_TYPE)
+ renderType = attribs[i * 2 + 1];
+ }
+
+ return indirect_create_context(base, config_base, shareList, renderType);
}
struct glx_screen_vtable indirect_screen_vtable = {
struct glx_screen_vtable fake_glx_screen::vt = {
indirect_create_context,
- fake_glx_context::create_attribs
+ indirect_create_context_attribs
};
struct glx_screen_vtable fake_glx_screen_direct::vt = {
return new fake_glx_context(psc, mode);
}
+
+extern "C" struct glx_context *
+indirect_create_context_attribs(struct glx_screen *base,
+ struct glx_config *config_base,
+ struct glx_context *shareList,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ unsigned *error)
+{
+ (void) num_attribs;
+ (void) attribs;
+ (void) error;
+
+ return indirect_create_context(base, config_base, shareList, 0);
+}
contexts_allocated--;
}
- static glx_context *create_attribs(struct glx_screen *psc,
- struct glx_config *mode,
- struct glx_context *shareList,
- unsigned num_attribs,
- const uint32_t *attribs,
- unsigned *error)
- {
- (void) shareList;
- (void) num_attribs;
- (void) attribs;
-
- *error = 0;
- return new fake_glx_context(psc, mode);
- }
-
/** Number of context that are allocated (and not freed). */
static int contexts_allocated;