[Mesa-dev] [Mesa-stable] [PATCH 2/9] ff_fragment_shader: Use binding to set the sampler unit

Chris Forbes chrisf at ijw.co.nz
Fri Oct 9 18:56:25 PDT 2015


The comment above this about the cast to int can probably go away?

- Chris

On Sat, Oct 10, 2015 at 2:52 PM, Ian Romanick <idr at freedesktop.org> wrote:

> From: Ian Romanick <ian.d.romanick at intel.com>
>
> This is the way layout(binding=xxx) works from GLSL.  The old method
> just happened to work (and significantly predated support for
> layout(binding=xxx)), but future changes will break this.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> Cc: "10.6 11.0" <mesa-stable at lists.freedesktop.org>
> ---
>  src/mesa/main/ff_fragment_shader.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/ff_fragment_shader.cpp
> b/src/mesa/main/ff_fragment_shader.cpp
> index e4e2a18..f5a4fa5 100644
> --- a/src/mesa/main/ff_fragment_shader.cpp
> +++ b/src/mesa/main/ff_fragment_shader.cpp
> @@ -981,7 +981,8 @@ static void load_texture( texenv_fragment_program *p,
> GLuint unit )
>      * NOTE: The cast to int is important.  Without it, the constant will
> have
>      * type uint, and things later on may get confused.
>      */
> -   sampler->constant_value = new(p->mem_ctx) ir_constant(int(unit));
> +   sampler->data.explicit_binding = true;
> +   sampler->data.binding = unit;
>
>     deref = new(p->mem_ctx) ir_dereference_variable(sampler);
>     tex->set_sampler(deref, glsl_type::vec4_type);
> --
> 2.1.0
>
> _______________________________________________
> mesa-stable mailing list
> mesa-stable at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-stable
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151010/03bff806/attachment.html>


More information about the mesa-dev mailing list