From f2506780c8a9c2b65336f7556d6ae802ea156e5b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 24 Mar 2023 18:18:26 -0400 Subject: [PATCH] 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 Reviewed-by: Erik Faye-Lund Reviewed-by: Iago Toral Quiroga Reviewed-by: Juan A. Suarez Reviewed-by: Kenneth Graunke Reviewed-by: Emma Anholt Part-of: --- src/mesa/main/texstate.c | 17 ----------------- src/mesa/main/version.c | 10 ++++++++++ src/panfrost/ci/panfrost-t720-fails.txt | 17 ----------------- 3 files changed, 10 insertions(+), 34 deletions(-) diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 8735d9f..1b661a7 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 2f36a44..0ff505b 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); } diff --git a/src/panfrost/ci/panfrost-t720-fails.txt b/src/panfrost/ci/panfrost-t720-fails.txt index 42ed043..d5b56da 100644 --- a/src/panfrost/ci/panfrost-t720-fails.txt +++ b/src/panfrost/ci/panfrost-t720-fails.txt @@ -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 -- 2.7.4