[Mesa-dev] [PATCH 2/3] meta: Unset the textures_used_by_txf bitfield.
Jason Ekstrand
jason at jlekstrand.net
Thu Oct 12 23:09:42 UTC 2017
On Wed, Oct 11, 2017 at 12:15 PM, Kenneth Graunke <kenneth at whitecape.org>
wrote:
> Drivers that use Meta are happily using blitting data using texelFetch
> and GL_SKIP_DECODE_EXT, but the GL_EXT_texture_sRGB spec unfortunately
> makes GL_SKIP_DECODE_EXT not necessarily work with texelFetch.
>
> As a hack, just unset the texture_used_by_txf bitfield so we can
> continue with the old desired behavior.
> ---
> src/mesa/drivers/common/meta.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/
> meta.c
> index 73143842485..658a62885bd 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -87,6 +87,7 @@
> #include "main/glformats.h"
> #include "util/bitscan.h"
> #include "util/ralloc.h"
> +#include "compiler/nir/nir.h"
>
> /** Return offset in bytes of the field within a vertex struct */
> #define OFFSET(FIELD) ((void *) offsetof(struct vertex, FIELD))
> @@ -195,6 +196,17 @@ _mesa_meta_compile_and_link_program(struct
> gl_context *ctx,
>
> _mesa_meta_link_program_with_debug(ctx, sh_prog);
>
> + struct gl_program *fp =
> + sh_prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program;
> +
> + /* texelFetch() can break GL_SKIP_DECODE_EXT, but many meta passes want
> + * to use both together; pretend that we're not using texelFetch to
> hack
> + * around this bad interaction.
> + */
> + fp->info.textures_used_by_txf = 0;
> + if (fp->nir)
> + fp->nir->info.textures_used_by_txf = 0;
> +
>
This is garbage but also, it's meta, so I'm not that inclined to care. The
biggest problem I see here is that it will break if we ever switching
things to run nir_gather_info post-linking. I doubt we will, but it might
be worth a small addition to the above comment. With that, all three are
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171012/e1e1e8e0/attachment.html>
More information about the mesa-dev
mailing list