mesa/st: Only set seamless for GLES3
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 24 Mar 2023 22:18:26 +0000 (18:18 -0400)
committerMarge Bot <emma+marge@anholt.net>
Tue, 28 Mar 2023 21:30:12 +0000 (21:30 +0000)
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>

src/mesa/main/texstate.c
src/mesa/main/version.c
src/panfrost/ci/panfrost-t720-fails.txt

index 8735d9f..1b661a7 100644 (file)
@@ -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;
index 2f36a44..0ff505b 100644 (file)
@@ -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);
 }
index 42ed043..d5b56da 100644 (file)
@@ -19,26 +19,9 @@ dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.73,Fail
 dEQP-GLES2.functional.fragment_ops.interaction.basic_shader.81,Fail
 dEQP-GLES2.functional.fragment_ops.random.43,Fail
 dEQP-GLES2.functional.fbo.completeness.renderable.texture.color0.rgb_half_float_oes,Fail
-dEQP-GLES2.functional.shaders.texture_functions.vertex.texturecubelod,Fail
-dEQP-GLES2.functional.texture.mipmap.cube.basic.linear_linear,Fail
-dEQP-GLES2.functional.texture.mipmap.cube.basic.linear_nearest,Fail
-dEQP-GLES2.functional.texture.mipmap.cube.bias.linear_linear,Fail
-dEQP-GLES2.functional.texture.mipmap.cube.bias.linear_nearest,Fail
-dEQP-GLES2.functional.texture.mipmap.cube.projected.linear_linear,Fail
-dEQP-GLES2.functional.texture.mipmap.cube.projected.linear_nearest,Fail
-dEQP-GLES2.functional.texture.vertex.cube.filtering.linear_mipmap_linear_linear_clamp,Fail
-dEQP-GLES2.functional.texture.vertex.cube.filtering.linear_mipmap_linear_linear_mirror,Fail
-dEQP-GLES2.functional.texture.vertex.cube.filtering.linear_mipmap_linear_nearest_clamp,Fail
-dEQP-GLES2.functional.texture.vertex.cube.filtering.linear_mipmap_linear_nearest_mirror,Fail
 dEQP-GLES2.functional.texture.vertex.cube.filtering.nearest_mipmap_linear_linear_clamp,Fail
 dEQP-GLES2.functional.texture.vertex.cube.filtering.nearest_mipmap_linear_linear_mirror,Fail
 dEQP-GLES2.functional.texture.vertex.cube.filtering.nearest_mipmap_linear_linear_repeat,Fail
 dEQP-GLES2.functional.texture.vertex.cube.filtering.nearest_mipmap_nearest_linear_clamp,Fail
 dEQP-GLES2.functional.texture.vertex.cube.filtering.nearest_mipmap_nearest_linear_mirror,Fail
 dEQP-GLES2.functional.texture.vertex.cube.filtering.nearest_mipmap_nearest_linear_repeat,Fail
-dEQP-GLES2.functional.texture.vertex.cube.wrap.clamp_clamp,Fail
-dEQP-GLES2.functional.texture.vertex.cube.wrap.clamp_mirror,Fail
-dEQP-GLES2.functional.texture.vertex.cube.wrap.clamp_repeat,Fail
-dEQP-GLES2.functional.texture.vertex.cube.wrap.mirror_clamp,Fail
-dEQP-GLES2.functional.texture.vertex.cube.wrap.mirror_mirror,Fail
-dEQP-GLES2.functional.texture.vertex.cube.wrap.mirror_repeat,Fail