summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>2023-03-24 18:18:26 -0400
committerMarge Bot <emma+marge@anholt.net>2023-03-28 21:30:12 +0000
commitf2506780c8a9c2b65336f7556d6ae802ea156e5b (patch)
treee000a4eff9f386036ccc5322301299e59b022ec3 /src/mesa
parent1646f7d977ab7ef6c6925495e9990eda356cb15d (diff)
downloadmesa-f2506780c8a9c2b65336f7556d6ae802ea156e5b.tar.gz
mesa/st: Only set seamless for GLES3
6148e3aae7e ("mesa: Fix ctx->Texture.CubeMapSeamless") introduced a hack, where seamless cube maps would be requested even for GLES2 contexts despite the spec, on the assumption that GLES2 gallium drivers would ignore the bit. But that requires Gallium drivers to know what GLES version they advertise, which is a horrible layering violation. When the commit was written 8 years ago, there were classic drivers to contend with so it made sense as a fix to get GLES 3.0 up and running. With classic drivers gone, it's time to sunset the hack and restore the intended behaviour by setting ctx->Texture.CubeMapSeamless only once we know the version. In addition to fixing a semantic issue in the Gallium contract and preventing a regression from the next commit, this fixes cube maps on Mali-T720 under Panfrost. In general, Panfrost supports GLES3 (and honours the seamless flag everywhere) but on T720 we only advertise GLES2 due to missing MRT support on older Midgard devices, so we need the flag set properly to distinguish these cases. Cc: mesa-stable Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Reviewed-by: Juan A. Suarez <jasuarez@igalia.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21978>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/texstate.c17
-rw-r--r--src/mesa/main/version.c10
2 files changed, 10 insertions, 17 deletions
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 8735d9f7437..1b661a7f60a 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -1032,23 +1032,6 @@ _mesa_init_texture(struct gl_context *ctx)
/* Texture group */
ctx->Texture.CurrentUnit = 0; /* multitexture */
- /* Appendix F.2 of the OpenGL ES 3.0 spec says:
- *
- * "OpenGL ES 3.0 requires that all cube map filtering be
- * seamless. OpenGL ES 2.0 specified that a single cube map face be
- * selected and used for filtering."
- *
- * Unfortunatley, a call to _mesa_is_gles3 below will only work if
- * the driver has already computed and set ctx->Version, however drivers
- * seem to call _mesa_initialize_context (which calls this) early
- * in the CreateContext hook and _mesa_compute_version much later (since
- * it needs information about available extensions). So, we will
- * enable seamless cubemaps by default since GLES2. This should work
- * for most implementations and drivers that don't support seamless
- * cubemaps for GLES2 can still disable it.
- */
- ctx->Texture.CubeMapSeamless = _mesa_is_gles2(ctx);
-
for (u = 0; u < ARRAY_SIZE(ctx->Texture.Unit); u++) {
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[u];
GLuint tex;
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index 2f36a44ddee..0ff505b3753 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -679,6 +679,16 @@ done:
if (_mesa_has_tessellation(ctx))
ctx->SupportedPrimMask |= 1 << GL_PATCHES;
+ /* Appendix F.2 of the OpenGL ES 3.0 spec says:
+ *
+ * "OpenGL ES 3.0 requires that all cube map filtering be
+ * seamless. OpenGL ES 2.0 specified that a single cube map face be
+ * selected and used for filtering."
+ *
+ * Now that we know our version, enable seamless filtering for GLES3 only.
+ */
+ ctx->Texture.CubeMapSeamless = _mesa_is_gles3(ctx);
+
/* First time initialization. */
_mesa_update_valid_to_render_state(ctx);
}