[Mesa-dev] [PATCH 2/2] nir/drawpix: add missing samplers for draw pixel lowering.
Marek Olšák
maraeo at gmail.com
Fri Oct 19 21:57:20 UTC 2018
For the series:
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Sun, Oct 14, 2018 at 8:48 PM Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> The drawpixel lowering references undeclared samplers, but also
> missing a texture handle.
> ---
> src/compiler/nir/nir_lower_drawpixels.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/src/compiler/nir/nir_lower_drawpixels.c
> b/src/compiler/nir/nir_lower_drawpixels.c
> index 462b9c308b2..3e86cc08470 100644
> --- a/src/compiler/nir/nir_lower_drawpixels.c
> +++ b/src/compiler/nir/nir_lower_drawpixels.c
> @@ -66,6 +66,24 @@ get_texcoord(lower_drawpixels_state *state)
> return nir_load_var(&state->b, state->texcoord);
> }
>
> +static void
> +add_samplers(lower_drawpixels_state *state)
> +{
> + nir_variable *sampler = nir_variable_create(state->shader,
> + nir_var_uniform,
> +
> glsl_sampler_type(GLSL_SAMPLER_DIM_2D, false, false, GLSL_TYPE_FLOAT),
> + "s_drawpix");
> + sampler->data.location = state->options->drawpix_sampler;
> +
> + if (state->options->pixel_maps) {
> + nir_variable *sampler = nir_variable_create(state->shader,
> + nir_var_uniform,
> +
> glsl_sampler_type(GLSL_SAMPLER_DIM_2D, false, false, GLSL_TYPE_FLOAT),
> + "s_pixelmap");
> + sampler->data.location = state->options->pixelmap_sampler;
> + }
> +}
> +
> static nir_variable *
> create_uniform(nir_shader *shader, const char *name,
> const gl_state_index16 state_tokens[STATE_LENGTH])
> @@ -123,6 +141,7 @@ lower_color(lower_drawpixels_state *state,
> nir_intrinsic_instr *intr)
>
> b->cursor = nir_before_instr(&intr->instr);
>
> + add_samplers(state);
> texcoord = get_texcoord(state);
>
> /* replace load_var(gl_Color) w/ texture sample:
> @@ -175,6 +194,7 @@ lower_color(lower_drawpixels_state *state,
> nir_intrinsic_instr *intr)
> tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
> tex->coord_components = 2;
> tex->sampler_index = state->options->pixelmap_sampler;
> + tex->texture_index = state->options->pixelmap_sampler;
> tex->dest_type = nir_type_float;
> tex->src[0].src_type = nir_tex_src_coord;
> tex->src[0].src = nir_src_for_ssa(nir_channels(b, def, 0xc));
> --
> 2.17.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181019/c3f4d50d/attachment.html>
More information about the mesa-dev
mailing list