mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-06 14:20:39 +01:00
glx: Claim to support more GL versions in __glX_send_client_info
It's a little unclear from the GLX_ARB_create_context spec whether the list of supported extensions means what the client supports at all, or what it knows an indirect GLX encoding for. You'd think it could only really matter for indirect, since the only way the server would know about GL commands (as opposed to GLX commands) is if the context was indirect. And indeed for Xorg's GLX it doesn't matter, because it doesn't check this, assuming that anything a direct client says works works, and clamping the GL version based on the protocol it has code for. But if you're NVIDIA, apparently, you check this even for direct contexts. And since drisw creates a nominally "direct" context, this means llvmpipe and friends get clamped to 3.0 for desktop GL (since that's as far as the protocol is defined) and can't do GLES at all. So, whatever, just go ahead and claim to support everything. The wire representation of the supported versions is strange (see comments in the code) but it matches what NVIDIA does. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7369>
This commit is contained in:
parent
f39fd3dce7
commit
c0aa3c8323
2 changed files with 71 additions and 15 deletions
|
|
@ -39,11 +39,56 @@ __glX_send_client_info(struct glx_display *glx_dpy)
|
|||
Bool any_screen_has_ARB_create_context = False;
|
||||
Bool any_screen_has_ARB_create_context_profile = False;
|
||||
unsigned i;
|
||||
/* You need GLX_ARB_create_context_profile to get beyond 3.1 anyway */
|
||||
static const uint32_t gl_versions[] = {
|
||||
1, 4,
|
||||
2, 1,
|
||||
3, 0,
|
||||
3, 1,
|
||||
};
|
||||
/*
|
||||
* This is weird, but it matches what NVIDIA does/expects. For big-GL
|
||||
* below 3.2 there is no such thing as a "profile", so we name them all
|
||||
* with no profile bits. Except we don't name anything lower than 2.1,
|
||||
* since GLX_ARB_create_context_profile says:
|
||||
*
|
||||
* "Only the highest supported version below 3.0 should be sent, since
|
||||
* OpenGL 2.1 is backwards compatible with all earlier versions."
|
||||
*
|
||||
* In order to also support GLES below 3.2, we name every possible GLES
|
||||
* version with the ES2 bit set, which happens to just mean GLES generally
|
||||
* and not a particular major version. 3.2 happens to be a legal version
|
||||
* number for both big-GL and GLES, so it gets all three bits set.
|
||||
* Everything 3.3 and above is big-GL only so gets the core and compat
|
||||
* bits set.
|
||||
*/
|
||||
static const uint32_t gl_versions_profiles[] = {
|
||||
1, 4, 0x00000000,
|
||||
1, 0, GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
|
||||
1, 1, GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
|
||||
2, 0, GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
|
||||
2, 1, 0x0,
|
||||
3, 0, 0x0,
|
||||
3, 0, GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
|
||||
3, 1, 0x0,
|
||||
3, 1, GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
|
||||
3, 2, GLX_CONTEXT_CORE_PROFILE_BIT_ARB |
|
||||
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB |
|
||||
GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
|
||||
3, 3, GLX_CONTEXT_CORE_PROFILE_BIT_ARB |
|
||||
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
4, 0, GLX_CONTEXT_CORE_PROFILE_BIT_ARB |
|
||||
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
4, 1, GLX_CONTEXT_CORE_PROFILE_BIT_ARB |
|
||||
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
4, 2, GLX_CONTEXT_CORE_PROFILE_BIT_ARB |
|
||||
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
4, 3, GLX_CONTEXT_CORE_PROFILE_BIT_ARB |
|
||||
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
4, 4, GLX_CONTEXT_CORE_PROFILE_BIT_ARB |
|
||||
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
4, 5, GLX_CONTEXT_CORE_PROFILE_BIT_ARB |
|
||||
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
4, 6, GLX_CONTEXT_CORE_PROFILE_BIT_ARB |
|
||||
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
};
|
||||
static const char glx_extensions[] =
|
||||
"GLX_ARB_create_context GLX_ARB_create_context_profile";
|
||||
|
|
@ -70,8 +115,6 @@ __glX_send_client_info(struct glx_display *glx_dpy)
|
|||
* imagine an implementation that supports GLX_SGIX_fbconfig and
|
||||
* GLX_ARB_create_context but not GLX 1.4. Making GLX 1.4 a hard
|
||||
* requirement in this case does not seem like a limitation.
|
||||
*
|
||||
* This library currently only supports struct GLXClientInfo.
|
||||
*/
|
||||
|
||||
if (glx_dpy->majorVersion == 1 && glx_dpy->minorVersion == 0)
|
||||
|
|
|
|||
|
|
@ -576,6 +576,7 @@ TEST_F(glX_send_client_info_test, gl_versions_and_profiles_are_sane)
|
|||
|
||||
const uint32_t all_valid_bits = GLX_CONTEXT_CORE_PROFILE_BIT_ARB
|
||||
| GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||
const uint32_t es_bit = GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
|
||||
|
||||
unsigned versions_below_3_0 = 0;
|
||||
|
||||
|
|
@ -588,14 +589,24 @@ TEST_F(glX_send_client_info_test, gl_versions_and_profiles_are_sane)
|
|||
*/
|
||||
switch (gl_versions[i * 3]) {
|
||||
case 1:
|
||||
EXPECT_GE(5u, gl_versions[i * 3 + 1]);
|
||||
EXPECT_EQ(0u, gl_versions[i * 3 + 2]);
|
||||
versions_below_3_0++;
|
||||
if (gl_versions[i * 3 + 2] & es_bit) {
|
||||
EXPECT_GE(1u, gl_versions[i * 3 + 1]);
|
||||
EXPECT_EQ(es_bit, gl_versions[i * 3 + 2]);
|
||||
} else {
|
||||
EXPECT_GE(5u, gl_versions[i * 3 + 1]);
|
||||
EXPECT_EQ(0u, gl_versions[i * 3 + 2]);
|
||||
versions_below_3_0++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
EXPECT_GE(1u, gl_versions[i * 3 + 1]);
|
||||
EXPECT_EQ(0u, gl_versions[i * 3 + 2]);
|
||||
versions_below_3_0++;
|
||||
if (gl_versions[i * 3 + 2] & es_bit) {
|
||||
EXPECT_EQ(0u, gl_versions[i * 3 + 1]);
|
||||
EXPECT_EQ(es_bit, gl_versions[i * 3 + 2]);
|
||||
} else {
|
||||
EXPECT_GE(1u, gl_versions[i * 3 + 1]);
|
||||
EXPECT_EQ(0u, gl_versions[i * 3 + 2]);
|
||||
versions_below_3_0++;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
EXPECT_GE(3u, gl_versions[i * 3 + 1]);
|
||||
|
|
@ -603,14 +614,16 @@ TEST_F(glX_send_client_info_test, gl_versions_and_profiles_are_sane)
|
|||
/* Profiles were not introduced until OpenGL 3.2.
|
||||
*/
|
||||
if (gl_versions[i * 3 + 1] < 2) {
|
||||
EXPECT_EQ(0u, gl_versions[i * 3 + 2]);
|
||||
EXPECT_EQ(0u, gl_versions[i * 3 + 2] & ~(es_bit));
|
||||
} else if (gl_versions[i * 3 + 1] == 2) {
|
||||
EXPECT_EQ(0u, gl_versions[i * 3 + 2] & ~(all_valid_bits | es_bit));
|
||||
} else {
|
||||
EXPECT_EQ(0u, gl_versions[i * 3 + 2] & ~all_valid_bits);
|
||||
}
|
||||
EXPECT_EQ(0u, gl_versions[i * 3 + 2] & ~(all_valid_bits));
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
EXPECT_GE(2u, gl_versions[i * 3 + 1]);
|
||||
EXPECT_EQ(0u, gl_versions[i * 3 + 2] & ~all_valid_bits);
|
||||
EXPECT_GE(6u, gl_versions[i * 3 + 1]);
|
||||
EXPECT_EQ(0u, gl_versions[i * 3 + 2] & ~(all_valid_bits));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue