[Mesa-dev] [PATCH v2] mesa: Fix ctx->Texture.CubeMapSeamless
Kenneth Graunke
kenneth at whitecape.org
Tue Feb 17 11:33:36 PST 2015
On Wednesday, February 11, 2015 11:35:35 AM Iago Toral Quiroga wrote:
> The intel driver code, and apparently all other Mesa drivers, call
> _mesa_initialize_context early in the CreateContext hook. That
> function will end up calling _mesa_init_texture which will do:
>
> ctx->Texture.CubeMapSeamless = _mesa_is_gles3(ctx);
>
> But this won't work at this point, since _mesa_is_gles3 requires
> ctx->Version to be set and that will not happen until late
> in the CreateContext hook, when _mesa_compute_version is called.
>
> We can't just move the call to _mesa_compute_version before
> _mesa_initialize_context since it needs that available extensions
> have been computed, which again requires other things to be
> initialized, etc. Instead, we enable seamless cube maps since
> GLES2, which should work for most implementations, and expect
> drivers that don't support this to disable it manually as part
> of their context initialization setup.
>
> Fixes the following 192 dEQP tests:
> dEQP-GLES3.functional.texture.filtering.cube.formats.*
> dEQP-GLES3.functional.texture.filtering.cube.sizes.*
> dEQP-GLES3.functional.texture.filtering.cube.combinations.*
> dEQP-GLES3.functional.texture.mipmap.cube.*
> dEQP-GLES3.functional.texture.vertex.cube.filtering.*
> dEQP-GLES3.functional.texture.vertex.cube.wrap.*
> dEQP-GLES3.functional.shaders.texture_functions.texturelod.samplercube_fixed_*
> ---
> src/mesa/main/texstate.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
> index 66fd718..c5a26dc 100644
> --- a/src/mesa/main/texstate.c
> +++ b/src/mesa/main/texstate.c
> @@ -882,8 +882,17 @@ _mesa_init_texture(struct gl_context *ctx)
> * "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_gles3(ctx);
> + ctx->Texture.CubeMapSeamless = ctx->API == API_OPENGLES2;
>
> for (u = 0; u < Elements(ctx->Texture.Unit); u++)
> init_texture_unit(ctx, u);
>
I suspect any drivers that can't do seamless cube map filtering will
just ignore this flag anyway; this looks perfectly reasonable to me.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150217/1ef0faf6/attachment-0001.sig>
More information about the mesa-dev
mailing list