st_context_attribs is moved into st_context.h.
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20027>
memset(&attribs, 0, sizeof(attribs));
switch (api) {
case API_OPENGLES:
- attribs.profile = ST_PROFILE_OPENGL_ES1;
+ attribs.profile = API_OPENGLES;
break;
case API_OPENGLES2:
- attribs.profile = ST_PROFILE_OPENGL_ES2;
+ attribs.profile = API_OPENGLES2;
break;
case API_OPENGL_COMPAT:
case API_OPENGL_CORE:
if (driQueryOptionb(optionCache, "force_compat_profile")) {
- attribs.profile = ST_PROFILE_DEFAULT;
+ attribs.profile = API_OPENGL_COMPAT;
} else {
- attribs.profile = api == API_OPENGL_COMPAT ? ST_PROFILE_DEFAULT
- : ST_PROFILE_OPENGL_CORE;
+ attribs.profile = api == API_OPENGL_COMPAT ? API_OPENGL_COMPAT
+ : API_OPENGL_CORE;
}
attribs.major = ctx_config->major_version;
* of the context is determined solely by the requested version."
*/
if (major > 3 || (major == 3 && minor >= 2)) {
- attribs.profile = ST_PROFILE_OPENGL_CORE;
+ attribs.profile = API_OPENGL_CORE;
break;
}
FALLTHROUGH;
* honour a 3.1 context is through core profile.
*/
if (major == 3 && minor == 1) {
- attribs.profile = ST_PROFILE_OPENGL_CORE;
+ attribs.profile = API_OPENGL_CORE;
} else {
- attribs.profile = ST_PROFILE_DEFAULT;
+ attribs.profile = API_OPENGL_COMPAT;
}
break;
case GLX_CONTEXT_ES_PROFILE_BIT_EXT:
if (major >= 2) {
- attribs.profile = ST_PROFILE_OPENGL_ES2;
+ attribs.profile = API_OPENGLES2;
} else {
- attribs.profile = ST_PROFILE_OPENGL_ES1;
+ attribs.profile = API_OPENGLES;
}
break;
default:
*/
memset(&attribs, 0, sizeof(attribs));
attribs.profile = (profile == OSMESA_CORE_PROFILE)
- ? ST_PROFILE_OPENGL_CORE : ST_PROFILE_DEFAULT;
+ ? API_OPENGL_CORE : API_OPENGL_COMPAT;
attribs.major = version_major;
attribs.minor = version_minor;
attribs.flags = 0; /* ST_CONTEXT_FLAG_x */
* of the context is determined solely by the requested version."
*/
if (majorVersion > 3 || (majorVersion == 3 && minorVersion >= 2)) {
- attribs.profile = ST_PROFILE_OPENGL_CORE;
+ attribs.profile = API_OPENGL_CORE;
break;
}
FALLTHROUGH;
* GL_ARB_compatibility, so returning a core profile here does more harm
* than good.
*/
- attribs.profile = ST_PROFILE_DEFAULT;
+ attribs.profile = API_OPENGL_COMPAT;
break;
case WGL_CONTEXT_ES_PROFILE_BIT_EXT:
if (majorVersion >= 2) {
- attribs.profile = ST_PROFILE_OPENGL_ES2;
+ attribs.profile = API_OPENGLES2;
} else {
- attribs.profile = ST_PROFILE_OPENGL_ES1;
+ attribs.profile = API_OPENGLES;
}
break;
default:
* their managers.
*/
-/**
- * The profile of a context.
- */
-enum st_profile_type
-{
- ST_PROFILE_DEFAULT, /**< OpenGL compatibility profile */
- ST_PROFILE_OPENGL_CORE, /**< OpenGL 3.2+ core profile */
- ST_PROFILE_OPENGL_ES1, /**< OpenGL ES 1.x */
- ST_PROFILE_OPENGL_ES2 /**< OpenGL ES 2.0 */
-};
-
/**
* New context flags for GL 3.0 and beyond.
unsigned char config_options_sha1[20];
};
-/**
- * Represent the attributes of a context.
- */
-struct st_context_attribs
-{
- /**
- * The profile and minimal version to support.
- *
- * The valid profiles and versions are rendering API dependent. The latest
- * version satisfying the request should be returned.
- */
- enum st_profile_type profile;
- int major, minor;
-
- /** Mask of ST_CONTEXT_FLAG_x bits */
- unsigned flags;
-
- /** Mask of PIPE_CONTEXT_x bits */
- unsigned context_flags;
-
- /**
- * The visual of the framebuffers the context will be bound to.
- */
- struct st_visual visual;
-
- /**
- * Configuration options.
- */
- struct st_config_options options;
-};
-
struct pipe_frontend_screen;
/**
struct st_context_attribs attribs;
memset(&attribs, 0, sizeof(attribs));
attribs.options.force_glsl_extensions_warn = false;
- attribs.profile = ST_PROFILE_DEFAULT;
+ attribs.profile = API_OPENGL_COMPAT;
attribs.visual = *context->stVisual;
attribs.major = 1;
attribs.minor = 0;
struct hash_table *hw_select_shaders;
};
+/**
+ * Represent the attributes of a context.
+ */
+struct st_context_attribs
+{
+ /**
+ * The profile and minimal version to support.
+ *
+ * The valid profiles and versions are rendering API dependent. The latest
+ * version satisfying the request should be returned.
+ */
+ gl_api profile;
+ int major, minor;
+
+ /** Mask of ST_CONTEXT_FLAG_x bits */
+ unsigned flags;
+
+ /** Mask of PIPE_CONTEXT_x bits */
+ unsigned context_flags;
+
+ /**
+ * The visual of the framebuffers the context will be bound to.
+ */
+ struct st_visual visual;
+
+ /**
+ * Configuration options.
+ */
+ struct st_config_options options;
+};
+
/*
* Get the state tracker context for the given Mesa context.
struct st_context *st;
struct pipe_context *pipe;
struct gl_config mode, *mode_ptr = &mode;
- gl_api api;
bool no_error = false;
- switch (attribs->profile) {
- case ST_PROFILE_DEFAULT:
- api = API_OPENGL_COMPAT;
- break;
- case ST_PROFILE_OPENGL_ES1:
- api = API_OPENGLES;
- break;
- case ST_PROFILE_OPENGL_ES2:
- api = API_OPENGLES2;
- break;
- case ST_PROFILE_OPENGL_CORE:
- api = API_OPENGL_CORE;
- break;
- default:
- *error = ST_CONTEXT_ERROR_BAD_API;
- return NULL;
- }
-
_mesa_initialize(attribs->options.mesa_extension_override);
/* Create a hash table for the framebuffer interface objects
st_visual_to_context_mode(&attribs->visual, &mode);
if (attribs->visual.color_format == PIPE_FORMAT_NONE)
mode_ptr = NULL;
- st = st_create_context(api, pipe, mode_ptr, shared_ctx,
+ st = st_create_context(attribs->profile, pipe, mode_ptr, shared_ctx,
&attribs->options, no_error,
!!fscreen->validate_egl_image);
if (!st) {