summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/swrast/swrast.c
diff options
context:
space:
mode:
authorNeil Roberts <[email protected]>2014-10-01 20:00:46 +0100
committerAdam Jackson <[email protected]>2017-11-06 16:09:02 -0500
commit6d87500fe12e77ad13db057430964b864cacb055 (patch)
treeace32137fad6b6ed17de33d7c1566b31263598d2 /src/mesa/drivers/dri/swrast/swrast.c
parent8c0729fd99c8548ceaf40e273b809ce0a69d8a44 (diff)
dri: Change __DriverApiRec::CreateContext to take a struct for attribs
Previously the CreateContext method of __DriverApiRec took a set of arguments to describe the attribute values from the window system API's CreateContextAttribs function. As more attributes get added this could quickly get unworkable and every new attribute needs a modification for every driver. To fix that, pass the attribute values in a struct instead. The struct has a bitmask to specify which members are used. The first three members (two for the GL version and one for the flags) are always set. If the bit is not set in the attribute mask then it can be assumed the attribute has the default value. Drivers will error if unknown bits in the mask are set. Reviewed-by: Adam Jackson <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Neil Roberts <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/swrast/swrast.c')
-rw-r--r--src/mesa/drivers/dri/swrast/swrast.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 6b71d806f09..f9bd1b9d560 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -752,11 +752,7 @@ static GLboolean
dri_create_context(gl_api api,
const struct gl_config * visual,
__DRIcontext * cPriv,
- unsigned major_version,
- unsigned minor_version,
- uint32_t flags,
- bool notify_reset,
- unsigned priority,
+ const struct __DriverContextConfig *ctx_config,
unsigned *error,
void *sharedContextPrivate)
{
@@ -770,7 +766,13 @@ dri_create_context(gl_api api,
/* Flag filtering is handled in dri2CreateContextAttribs.
*/
- (void) flags;
+ (void) ctx_config->flags;
+
+ /* The swrast driver doesn't understand any of the attributes */
+ if (ctx_config->attribute_mask != 0) {
+ *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+ return false;
+ }
ctx = CALLOC_STRUCT(dri_context);
if (ctx == NULL) {
@@ -797,7 +799,7 @@ dri_create_context(gl_api api,
goto context_fail;
}
- driContextSetFlags(mesaCtx, flags);
+ driContextSetFlags(mesaCtx, ctx_config->flags);
/* create module contexts */
_swrast_CreateContext( mesaCtx );