[Mesa-dev,10/17] st/mesa: make Z/S drawpix shaders independent of variants, don't use Mesa IR

Submitted by Marek Olšák on Oct. 8, 2015, 12:02 a.m.

Details

Message ID CAAxE2A5gQj5EFfvjxFGHBaiDztkuU92sJBwUuqed+fpfbtr5qw@mail.gmail.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Marek Olšák Oct. 8, 2015, 12:02 a.m.
Hi Brian,

This is the commit that broke DrawPixels on llvmpipe, but not radeonsi
and softpipe. It's fixed in v2, which is attached.

Marek

On Tue, Oct 6, 2015 at 3:26 AM, Marek Olšák <maraeo@gmail.com> wrote:
> From: Marek Olšák <marek.olsak@amd.com>
>
> - there is no connection to user fragment shaders, so having these as
>   shader variants makes no sense
> - don't use Mesa IR, use TGSI
> - don't create gl_fragment_program, just create the shader CSO
> ---

Patch hide | download patch | download mbox

From cd092aa6b47f669b45cb822498db947aafc447b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= <marek.olsak@amd.com>
Date: Sun, 4 Oct 2015 18:23:33 +0200
Subject: [PATCH] st/mesa: make Z/S drawpix shaders independent of variants,
 don't use Mesa IR v2

- there is no connection to user fragment shaders, so having these as
  shader variants makes no sense
- don't use Mesa IR, use TGSI
- don't create gl_fragment_program, just create the shader CSO

v2: generate exactly the same shader as before to fix llvmpipe

Reviewed-by: Dave Airlie <airlied@redhat.com>
---
 src/mesa/state_tracker/st_cb_drawpixels.c | 171 ++++++++++--------------------
 src/mesa/state_tracker/st_cb_drawpixels.h |   6 --
 src/mesa/state_tracker/st_context.h       |   2 +-
 src/mesa/state_tracker/st_program.c       |  15 +--
 src/mesa/state_tracker/st_program.h       |   2 -
 5 files changed, 60 insertions(+), 136 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 152160e..f77d304 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -189,100 +189,70 @@  st_make_drawpix_fragment_program(struct st_context *st,
  * stencil value value, then writes to FRAG_RESULT_DEPTH/FRAG_RESULT_STENCIL.
  * Used for glDrawPixels(GL_DEPTH_COMPONENT / GL_STENCIL_INDEX).
  * Pass fragment color through as-is.
- * \return pointer to the gl_fragment program
+ *
+ * \return CSO of the fragment shader.
  */
-struct gl_fragment_program *
-st_make_drawpix_z_stencil_program(struct st_context *st,
-                                  GLboolean write_depth,
-                                  GLboolean write_stencil)
+static void *
+get_drawpix_z_stencil_program(struct st_context *st,
+                              GLboolean write_depth,
+                              GLboolean write_stencil)
 {
-   struct gl_context *ctx = st->ctx;
-   struct gl_program *p;
-   struct gl_fragment_program *fp;
-   GLuint ic = 0;
+   struct ureg_program *ureg;
+   struct ureg_src depth_sampler, stencil_sampler;
+   struct ureg_src texcoord, color;
+   struct ureg_dst out_color, out_depth, out_stencil;
    const GLuint shaderIndex = write_depth * 2 + write_stencil;
+   void *cso;
 
-   assert(shaderIndex < ARRAY_SIZE(st->drawpix.shaders));
+   assert(shaderIndex < ARRAY_SIZE(st->drawpix.zs_shaders));
 
-   if (st->drawpix.shaders[shaderIndex]) {
+   if (st->drawpix.zs_shaders[shaderIndex]) {
       /* already have the proper shader */
-      return st->drawpix.shaders[shaderIndex];
+      return st->drawpix.zs_shaders[shaderIndex];
    }
 
-   /*
-    * Create shader now
-    */
-   p = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
-   if (!p)
+   ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT);
+   if (ureg == NULL)
       return NULL;
 
-   p->NumInstructions = write_depth ? 3 : 1;
-   p->NumInstructions += write_stencil ? 1 : 0;
-
-   p->Instructions = _mesa_alloc_instructions(p->NumInstructions);
-   if (!p->Instructions) {
-      ctx->Driver.DeleteProgram(ctx, p);
-      return NULL;
-   }
-   _mesa_init_instructions(p->Instructions, p->NumInstructions);
+   ureg_property(ureg, TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS, TRUE);
 
    if (write_depth) {
-      /* TEX result.depth, fragment.texcoord[0], texture[0], 2D; */
-      p->Instructions[ic].Opcode = OPCODE_TEX;
-      p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
-      p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPTH;
-      p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Z;
-      p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
-      p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_TEX0;
-      p->Instructions[ic].TexSrcUnit = 0;
-      p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX;
-      ic++;
-      /* MOV result.color, fragment.color; */
-      p->Instructions[ic].Opcode = OPCODE_MOV;
-      p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
-      p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR;
-      p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
-      p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_COL0;
-      ic++;
+      color = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_COLOR, 0,
+                                 TGSI_INTERPOLATE_COLOR);
+      out_color = ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 0);
+
+      depth_sampler = ureg_DECL_sampler(ureg, 0);
+      out_depth = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0);
    }
 
    if (write_stencil) {
-      /* TEX result.stencil, fragment.texcoord[0], texture[0], 2D; */
-      p->Instructions[ic].Opcode = OPCODE_TEX;
-      p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT;
-      p->Instructions[ic].DstReg.Index = FRAG_RESULT_STENCIL;
-      p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Y;
-      p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT;
-      p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_TEX0;
-      p->Instructions[ic].TexSrcUnit = 1;
-      p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX;
-      ic++;
+      stencil_sampler = ureg_DECL_sampler(ureg, 1);
+      out_stencil = ureg_DECL_output(ureg, TGSI_SEMANTIC_STENCIL, 0);
    }
 
-   /* END; */
-   p->Instructions[ic++].Opcode = OPCODE_END;
+   texcoord = ureg_DECL_fs_input(ureg,
+                                 st->needs_texcoord_semantic ?
+                                    TGSI_SEMANTIC_TEXCOORD :
+                                    TGSI_SEMANTIC_GENERIC,
+                                 0, TGSI_INTERPOLATE_LINEAR);
 
-   assert(ic == p->NumInstructions);
-
-   p->InputsRead = VARYING_BIT_TEX0 | VARYING_BIT_COL0;
-   p->OutputsWritten = 0;
    if (write_depth) {
-      p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_DEPTH);
-      p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_COLOR);
+      ureg_TEX(ureg, ureg_writemask(out_depth, TGSI_WRITEMASK_Z),
+               TGSI_TEXTURE_2D, texcoord, depth_sampler);
+      ureg_MOV(ureg, out_color, color);
    }
-   if (write_stencil)
-      p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_STENCIL);
 
-   p->SamplersUsed =  0x1;  /* sampler 0 (bit 0) is used */
    if (write_stencil)
-      p->SamplersUsed |= 1 << 1;
+      ureg_TEX(ureg, ureg_writemask(out_stencil, TGSI_WRITEMASK_Y),
+               TGSI_TEXTURE_2D, texcoord, stencil_sampler);
 
-   fp = (struct gl_fragment_program *) p;
+   ureg_END(ureg);
+   cso = ureg_create_shader_and_destroy(ureg, st->pipe);
 
    /* save the new shader */
-   st->drawpix.shaders[shaderIndex] = fp;
-
-   return fp;
+   st->drawpix.zs_shaders[shaderIndex] = cso;
+   return cso;
 }
 
 
@@ -1048,30 +1018,6 @@  get_color_fp_variant(struct st_context *st)
 
 
 /**
- * Get fragment program variant for a glDrawPixels or glCopyPixels
- * command for depth/stencil data.
- */
-static struct st_fp_variant *
-get_depth_stencil_fp_variant(struct st_context *st, GLboolean write_depth,
-                             GLboolean write_stencil)
-{
-   struct st_fp_variant_key key;
-   struct st_fp_variant *fpv;
-
-   memset(&key, 0, sizeof(key));
-
-   key.st = st;
-   key.drawpixels = 1;
-   key.drawpixels_z = write_depth;
-   key.drawpixels_stencil = write_stencil;
-
-   fpv = st_get_fp_variant(st, st->fp, &key);
-
-   return fpv;
-}
-
-
-/**
  * Clamp glDrawPixels width and height to the maximum texture size.
  */
 static void
@@ -1109,7 +1055,6 @@  st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
    GLboolean write_stencil = GL_FALSE, write_depth = GL_FALSE;
    struct pipe_sampler_view *sv[2] = { NULL };
    int num_sampler_view = 1;
-   struct st_fp_variant *fpv;
    struct gl_pixelstore_attrib clippedUnpack;
 
    /* Mesa state should be up to date by now */
@@ -1144,19 +1089,15 @@  st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
     * Get vertex/fragment shaders
     */
    if (write_depth || write_stencil) {
-      fpv = get_depth_stencil_fp_variant(st, write_depth, write_stencil);
-
-      driver_fp = fpv->driver_shader;
-
+      driver_fp = get_drawpix_z_stencil_program(st, write_depth,
+                                                write_stencil);
       driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
-
       color = ctx->Current.RasterColor;
    }
    else {
-      fpv = get_color_fp_variant(st);
+      struct st_fp_variant *fpv = get_color_fp_variant(st);
 
       driver_fp = fpv->driver_shader;
-
       driver_vp = make_passthrough_vertex_shader(st, GL_FALSE);
 
       color = NULL;
@@ -1165,10 +1106,10 @@  st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
                                      st->pixel_xfer.pixelmap_sampler_view);
          num_sampler_view++;
       }
-   }
 
-   /* update fragment program constants */
-   st_upload_constants(st, fpv->parameters, PIPE_SHADER_FRAGMENT);
+      /* update fragment program constants */
+      st_upload_constants(st, fpv->parameters, PIPE_SHADER_FRAGMENT);
+   }
 
    /* draw with textured quad */
    {
@@ -1459,7 +1400,6 @@  st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
    GLboolean invertTex = GL_FALSE;
    GLint readX, readY, readW, readH;
    struct gl_pixelstore_attrib pack = ctx->DefaultPacking;
-   struct st_fp_variant *fpv;
 
    st_validate_state(st);
 
@@ -1491,12 +1431,12 @@  st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
     * Get vertex/fragment shaders
     */
    if (type == GL_COLOR) {
+      struct st_fp_variant *fpv = get_color_fp_variant(st);
+
       rbRead = st_get_color_read_renderbuffer(ctx);
       color = NULL;
 
-      fpv = get_color_fp_variant(st);
       driver_fp = fpv->driver_shader;
-
       driver_vp = make_passthrough_vertex_shader(st, GL_FALSE);
 
       if (st->pixel_xfer.pixelmap_enabled) {
@@ -1504,6 +1444,9 @@  st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
                                      st->pixel_xfer.pixelmap_sampler_view);
          num_sampler_view++;
       }
+
+      /* update fragment program constants */
+      st_upload_constants(st, fpv->parameters, PIPE_SHADER_FRAGMENT);
    }
    else {
       assert(type == GL_DEPTH);
@@ -1511,15 +1454,10 @@  st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
                                Attachment[BUFFER_DEPTH].Renderbuffer);
       color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
 
-      fpv = get_depth_stencil_fp_variant(st, GL_TRUE, GL_FALSE);
-      driver_fp = fpv->driver_shader;
-
+      driver_fp = get_drawpix_z_stencil_program(st, GL_TRUE, GL_FALSE);
       driver_vp = make_passthrough_vertex_shader(st, GL_TRUE);
    }
 
-   /* update fragment program constants */
-   st_upload_constants(st, fpv->parameters, PIPE_SHADER_FRAGMENT);
-
    /* Choose the format for the temporary texture. */
    srcFormat = rbRead->texture->format;
    srcBind = PIPE_BIND_SAMPLER_VIEW |
@@ -1666,9 +1604,10 @@  st_destroy_drawpix(struct st_context *st)
 {
    GLuint i;
 
-   for (i = 0; i < ARRAY_SIZE(st->drawpix.shaders); i++) {
-      if (st->drawpix.shaders[i])
-         _mesa_reference_fragprog(st->ctx, &st->drawpix.shaders[i], NULL);
+   for (i = 0; i < ARRAY_SIZE(st->drawpix.zs_shaders); i++) {
+      if (st->drawpix.zs_shaders[i])
+         cso_delete_fragment_shader(st->cso_context,
+                                    st->drawpix.zs_shaders[i]);
    }
 
    st_reference_fragprog(st, &st->pixel_xfer.combined_prog, NULL);
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.h b/src/mesa/state_tracker/st_cb_drawpixels.h
index c707ace..c6649cb 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.h
+++ b/src/mesa/state_tracker/st_cb_drawpixels.h
@@ -45,10 +45,4 @@  st_make_drawpix_fragment_program(struct st_context *st,
                                  struct gl_fragment_program *fpIn,
                                  struct gl_fragment_program **fpOut);
 
-extern struct gl_fragment_program *
-st_make_drawpix_z_stencil_program(struct st_context *st,
-                                  GLboolean write_depth,
-                                  GLboolean write_stencil);
-
-
 #endif /* ST_CB_DRAWPIXELS_H */
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index a4cda29..262581e 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -184,7 +184,7 @@  struct st_context
 
    /** for glDraw/CopyPixels */
    struct {
-      struct gl_fragment_program *shaders[4];
+      void *zs_shaders[4];
       void *vert_shaders[2];   /**< ureg shaders */
    } drawpix;
 
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index fba661b..d900ede 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -568,19 +568,12 @@  st_translate_fragment_program(struct st_context *st,
    memset(inputSlotToAttr, ~0, sizeof(inputSlotToAttr));
 
    if (key->drawpixels) {
-      /* glDrawPixels drawing */
+      /* glDrawPixels color drawing */
       struct gl_fragment_program *fp; /* we free this temp program below */
 
-      if (key->drawpixels_z || key->drawpixels_stencil) {
-         fp = st_make_drawpix_z_stencil_program(st, key->drawpixels_z,
-                                                key->drawpixels_stencil);
-      }
-      else {
-         /* RGBA */
-         st_make_drawpix_fragment_program(st, &stfp->Base, &fp);
-         variant->parameters = _mesa_clone_parameter_list(fp->Base.Parameters);
-         deleteFP = GL_TRUE;
-      }
+      st_make_drawpix_fragment_program(st, &stfp->Base, &fp);
+      variant->parameters = _mesa_clone_parameter_list(fp->Base.Parameters);
+      deleteFP = GL_TRUE;
       stfp = st_fragment_program(fp);
    }
 
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index c60d2d5..2927d54 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -59,8 +59,6 @@  struct st_fp_variant_key
    GLuint drawpixels:1;           /**< glDrawPixels variant */
    GLuint scaleAndBias:1;         /**< glDrawPixels w/ scale and/or bias? */
    GLuint pixelMaps:1;            /**< glDrawPixels w/ pixel lookup map? */
-   GLuint drawpixels_z:1;         /**< glDrawPixels(GL_DEPTH) */
-   GLuint drawpixels_stencil:1;   /**< glDrawPixels(GL_STENCIL) */
 
    /** for ARB_color_buffer_float */
    GLuint clamp_color:1;
-- 
2.1.4


Comments

Am 08.10.2015 um 02:02 schrieb Marek Olšák:
> Hi Brian,
> 
> This is the commit that broke DrawPixels on llvmpipe, but not radeonsi
> and softpipe. It's fixed in v2, which is attached.
> 
> Marek
> 
> On Tue, Oct 6, 2015 at 3:26 AM, Marek Olšák <maraeo@gmail.com> wrote:
>> From: Marek Olšák <marek.olsak@amd.com>
>>
>> - there is no connection to user fragment shaders, so having these as
>>   shader variants makes no sense
>> - don't use Mesa IR, use TGSI
>> - don't create gl_fragment_program, just create the shader CSO
>> ---
>>

I don't quite get from the differences, was the shader actually
incorrect or is this something which should be fixed in llvmpipe?

Roland
The problem was that it declared SVIEW but llvmpipe didn't like that for
some reason.

Marek
On Oct 8, 2015 5:12 AM, "Roland Scheidegger" <sroland@vmware.com> wrote:

> Am 08.10.2015 um 02:02 schrieb Marek Olšák:
> > Hi Brian,
> >
> > This is the commit that broke DrawPixels on llvmpipe, but not radeonsi
> > and softpipe. It's fixed in v2, which is attached.
> >
> > Marek
> >
> > On Tue, Oct 6, 2015 at 3:26 AM, Marek Olšák <maraeo@gmail.com> wrote:
> >> From: Marek Olšák <marek.olsak@amd.com>
> >>
> >> - there is no connection to user fragment shaders, so having these as
> >>   shader variants makes no sense
> >> - don't use Mesa IR, use TGSI
> >> - don't create gl_fragment_program, just create the shader CSO
> >> ---
> >>
>
> I don't quite get from the differences, was the shader actually
> incorrect or is this something which should be fixed in llvmpipe?
>
> Roland
>
>
Was that because stencil used sampler 1 but sview 0 which looks
definitely wrong as there needs o be a 1:1 mapping between these when
the tex opcodes are used?

Roland

Am 08.10.2015 um 10:45 schrieb Marek Olšák:
> The problem was that it declared SVIEW but llvmpipe didn't like that for
> some reason.
> 
> Marek
> 
> On Oct 8, 2015 5:12 AM, "Roland Scheidegger" <sroland@vmware.com
> <mailto:sroland@vmware.com>> wrote:
> 
>     Am 08.10.2015 um 02:02 schrieb Marek Olšák:
>     > Hi Brian,
>     >
>     > This is the commit that broke DrawPixels on llvmpipe, but not radeonsi
>     > and softpipe. It's fixed in v2, which is attached.
>     >
>     > Marek
>     >
>     > On Tue, Oct 6, 2015 at 3:26 AM, Marek Olšák <maraeo@gmail.com
>     <mailto:maraeo@gmail.com>> wrote:
>     >> From: Marek Olšák <marek.olsak@amd.com <mailto:marek.olsak@amd.com>>
>     >>
>     >> - there is no connection to user fragment shaders, so having these as
>     >>   shader variants makes no sense
>     >> - don't use Mesa IR, use TGSI
>     >> - don't create gl_fragment_program, just create the shader CSO
>     >> ---
>     >>
> 
>     I don't quite get from the differences, was the shader actually
>     incorrect or is this something which should be fixed in llvmpipe?
> 
>     Roland
>
On 10/07/2015 06:02 PM, Marek Olšák wrote:
> Hi Brian,
>
> This is the commit that broke DrawPixels on llvmpipe, but not radeonsi
> and softpipe. It's fixed in v2, which is attached.

Thanks.  That fixes the conform and piglit regressions.

For the series,

Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>

-Brian
On Oct 8, 2015 4:03 PM, "Roland Scheidegger" <sroland@vmware.com> wrote:
>
> Was that because stencil used sampler 1 but sview 0 which looks
> definitely wrong as there needs o be a 1:1 mapping between these when
> the tex opcodes are used?

I don't remember how the SVIEW declarations work. It was TEX and there were
2 declarations, one was float and the other one was int. I think it's only
required for freedreno with TEX.

Marek

>
> Roland
>
> Am 08.10.2015 um 10:45 schrieb Marek Olšák:
> > The problem was that it declared SVIEW but llvmpipe didn't like that for
> > some reason.
> >
> > Marek
> >
> > On Oct 8, 2015 5:12 AM, "Roland Scheidegger" <sroland@vmware.com
> > <mailto:sroland@vmware.com>> wrote:
> >
> >     Am 08.10.2015 um 02:02 schrieb Marek Olšák:
> >     > Hi Brian,
> >     >
> >     > This is the commit that broke DrawPixels on llvmpipe, but not
radeonsi
> >     > and softpipe. It's fixed in v2, which is attached.
> >     >
> >     > Marek
> >     >
> >     > On Tue, Oct 6, 2015 at 3:26 AM, Marek Olšák <maraeo@gmail.com
> >     <mailto:maraeo@gmail.com>> wrote:
> >     >> From: Marek Olšák <marek.olsak@amd.com <mailto:
marek.olsak@amd.com>>
> >     >>
> >     >> - there is no connection to user fragment shaders, so having
these as
> >     >>   shader variants makes no sense
> >     >> - don't use Mesa IR, use TGSI
> >     >> - don't create gl_fragment_program, just create the shader CSO
> >     >> ---
> >     >>
> >
> >     I don't quite get from the differences, was the shader actually
> >     incorrect or is this something which should be fixed in llvmpipe?
> >
> >     Roland
> >
>
Am 08.10.2015 um 16:46 schrieb Marek Olšák:
> 
> On Oct 8, 2015 4:03 PM, "Roland Scheidegger" <sroland@vmware.com
> <mailto:sroland@vmware.com>> wrote:
>>
>> Was that because stencil used sampler 1 but sview 0 which looks
>> definitely wrong as there needs o be a 1:1 mapping between these when
>> the tex opcodes are used?
> 
> I don't remember how the SVIEW declarations work. It was TEX and there
> were 2 declarations, one was float and the other one was int. I think
> it's only required for freedreno with TEX.

I was just saying the sampler index (for stencil texturing) was 1, but
the sview declaration was only for index 0. Thus probably the reason why
it broke (llvmpipe should handle sview declarations just fine even with
tex opcodes, but if you have them they MUST be correct and they must be
present for either all or none of the samplers). Thus what probably
happened was since there was a sview declaration, llvmpipe tried to
figure out the texture from it rather than using the sampler decl, but
there wasn't any for index 1 (thus skipping texturing completely). But
in any case, I'm fine without using them (though I forgot if freedreno
would require it for this particular case).


Roland


> Marek
> 
>>
>> Roland
>>
>> Am 08.10.2015 um 10:45 schrieb Marek Olšák:
>> > The problem was that it declared SVIEW but llvmpipe didn't like that for
>> > some reason.
>> >
>> > Marek
>> >
>> > On Oct 8, 2015 5:12 AM, "Roland Scheidegger" <sroland@vmware.com
> <mailto:sroland@vmware.com>
>> > <mailto:sroland@vmware.com <mailto:sroland@vmware.com>>> wrote:
>> >
>> >     Am 08.10.2015 um 02:02 schrieb Marek Olšák:
>> >     > Hi Brian,
>> >     >
>> >     > This is the commit that broke DrawPixels on llvmpipe, but not
> radeonsi
>> >     > and softpipe. It's fixed in v2, which is attached.
>> >     >
>> >     > Marek
>> >     >
>> >     > On Tue, Oct 6, 2015 at 3:26 AM, Marek Olšák <maraeo@gmail.com
> <mailto:maraeo@gmail.com>
>> >     <mailto:maraeo@gmail.com <mailto:maraeo@gmail.com>>> wrote:
>> >     >> From: Marek Olšák <marek.olsak@amd.com
> <mailto:marek.olsak@amd.com> <mailto:marek.olsak@amd.com
> <mailto:marek.olsak@amd.com>>>
>> >     >>
>> >     >> - there is no connection to user fragment shaders, so having
> these as
>> >     >>   shader variants makes no sense
>> >     >> - don't use Mesa IR, use TGSI
>> >     >> - don't create gl_fragment_program, just create the shader CSO
>> >     >> ---
>> >     >>
>> >
>> >     I don't quite get from the differences, was the shader actually
>> >     incorrect or is this something which should be fixed in llvmpipe?
>> >
>> >     Roland
>> >
>>
>