[Mesa-dev] [PATCH 08/18] gallium/u_blitter: add new union blitter_attrib to replace pipe_color_union

Nicolai Hähnle nhaehnle at gmail.com
Fri Aug 18 13:54:12 UTC 2017


On 17.08.2017 20:31, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>   src/gallium/auxiliary/util/u_blitter.c        | 93 +++++++++++++--------------
>   src/gallium/auxiliary/util/u_blitter.h        | 12 +++-
>   src/gallium/drivers/r300/r300_context.h       |  2 +-
>   src/gallium/drivers/r300/r300_render.c        | 14 ++--
>   src/gallium/drivers/radeon/r600_pipe_common.c | 20 +++---
>   src/gallium/drivers/radeon/r600_pipe_common.h |  2 +-
>   6 files changed, 72 insertions(+), 71 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
> index 6b666b2..37a92d2 100644
> --- a/src/gallium/auxiliary/util/u_blitter.c
> +++ b/src/gallium/auxiliary/util/u_blitter.c
> @@ -725,105 +725,96 @@ static void blitter_set_rectangle(struct blitter_context_priv *ctx,
>      viewport.scale[0] = width / 2.0;
>      viewport.scale[1] = height / 2.0;
>      viewport.scale[2] = 0;
>      viewport.translate[0] = width / 2.0 + x1;
>      viewport.translate[1] = height / 2.0 + y1;
>      viewport.translate[2] = depth;
>      ctx->base.pipe->set_viewport_states(ctx->base.pipe, 0, 1, &viewport);
>   }
>   
>   static void blitter_set_clear_color(struct blitter_context_priv *ctx,
> -                                    const union pipe_color_union *color)
> +                                    const uint32_t color[4])

This should be float instead of uint32_t, so one caller below can use 
attrib->color directly, without an additional cast.

Cheers,
Nicolai


>   {
>      int i;
>   
>      if (color) {
> -      for (i = 0; i < 4; i++) {
> -         uint32_t *uiverts = (uint32_t *)ctx->vertices[i][1];
> -         uiverts[0] = color->ui[0];
> -         uiverts[1] = color->ui[1];
> -         uiverts[2] = color->ui[2];
> -         uiverts[3] = color->ui[3];
> -      }
> +      for (i = 0; i < 4; i++)
> +         memcpy(&ctx->vertices[i][1][0], color, sizeof(uint32_t) * 4);
>      } else {
> -      for (i = 0; i < 4; i++) {
> -         ctx->vertices[i][1][0] = 0;
> -         ctx->vertices[i][1][1] = 0;
> -         ctx->vertices[i][1][2] = 0;
> -         ctx->vertices[i][1][3] = 0;
> -      }
> +      for (i = 0; i < 4; i++)
> +         memset(&ctx->vertices[i][1][0], 0, sizeof(uint32_t) * 4);
>      }
>   }
>   
>   static void get_texcoords(struct pipe_sampler_view *src,
>                             unsigned src_width0, unsigned src_height0,
>                             int x1, int y1, int x2, int y2, bool uses_txf,
> -                          float out[4])
> +                          union blitter_attrib *out)
>   {
>      unsigned level = src->u.tex.first_level;
>      boolean normalized = !uses_txf &&
>                           src->target != PIPE_TEXTURE_RECT &&
>                           src->texture->nr_samples <= 1;
>   
>      if (normalized) {
> -      out[0] = x1 / (float)u_minify(src_width0,  level);
> -      out[1] = y1 / (float)u_minify(src_height0, level);
> -      out[2] = x2 / (float)u_minify(src_width0,  level);
> -      out[3] = y2 / (float)u_minify(src_height0, level);
> +      out->texcoord.x1 = x1 / (float)u_minify(src_width0,  level);
> +      out->texcoord.y1 = y1 / (float)u_minify(src_height0, level);
> +      out->texcoord.x2 = x2 / (float)u_minify(src_width0,  level);
> +      out->texcoord.y2 = y2 / (float)u_minify(src_height0, level);
>      } else {
> -      out[0] = (float) x1;
> -      out[1] = (float) y1;
> -      out[2] = (float) x2;
> -      out[3] = (float) y2;
> +      out->texcoord.x1 = x1;
> +      out->texcoord.y1 = y1;
> +      out->texcoord.x2 = x2;
> +      out->texcoord.y2 = y2;
>      }
>   }
>   
> -static void set_texcoords_in_vertices(const float coord[4],
> +static void set_texcoords_in_vertices(const union blitter_attrib *attrib,
>                                         float *out, unsigned stride)
>   {
> -   out[0] = coord[0]; /*t0.s*/
> -   out[1] = coord[1]; /*t0.t*/
> +   out[0] = attrib->texcoord.x1;
> +   out[1] = attrib->texcoord.y1;
>      out += stride;
> -   out[0] = coord[2]; /*t1.s*/
> -   out[1] = coord[1]; /*t1.t*/
> +   out[0] = attrib->texcoord.x2;
> +   out[1] = attrib->texcoord.y1;
>      out += stride;
> -   out[0] = coord[2]; /*t2.s*/
> -   out[1] = coord[3]; /*t2.t*/
> +   out[0] = attrib->texcoord.x2;
> +   out[1] = attrib->texcoord.y2;
>      out += stride;
> -   out[0] = coord[0]; /*t3.s*/
> -   out[1] = coord[3]; /*t3.t*/
> +   out[0] = attrib->texcoord.x1;
> +   out[1] = attrib->texcoord.y2;
>   }
>   
>   static void blitter_set_texcoords(struct blitter_context_priv *ctx,
>                                     struct pipe_sampler_view *src,
>                                     unsigned src_width0, unsigned src_height0,
>                                     float layer, unsigned sample,
>                                     int x1, int y1, int x2, int y2,
>                                     bool uses_txf)
>   {
>      unsigned i;
> -   float coord[4];
> +   union blitter_attrib coord;
>      float face_coord[4][2];
>   
>      get_texcoords(src, src_width0, src_height0, x1, y1, x2, y2, uses_txf,
> -                 coord);
> +                 &coord);
>   
>      if (src->target == PIPE_TEXTURE_CUBE ||
>          src->target == PIPE_TEXTURE_CUBE_ARRAY) {
> -      set_texcoords_in_vertices(coord, &face_coord[0][0], 2);
> +      set_texcoords_in_vertices(&coord, &face_coord[0][0], 2);
>         util_map_texcoords2d_onto_cubemap((unsigned)layer % 6,
>                                           /* pointer, stride in floats */
>                                           &face_coord[0][0], 2,
>                                           &ctx->vertices[0][1][0], 8,
>                                           FALSE);
>      } else {
> -      set_texcoords_in_vertices(coord, &ctx->vertices[0][1][0], 8);
> +      set_texcoords_in_vertices(&coord, &ctx->vertices[0][1][0], 8);
>      }
>   
>      /* Set the layer. */
>      switch (src->target) {
>      case PIPE_TEXTURE_3D:
>         {
>            float r = layer;
>   
>            if (!uses_txf)
>               r /= u_minify(src->texture->depth0, src->u.tex.first_level);
> @@ -1257,31 +1248,31 @@ static void blitter_draw(struct blitter_context_priv *ctx,
>   
>      pipe->set_vertex_buffers(pipe, ctx->base.vb_slot, 1, &vb);
>      util_draw_arrays_instanced(pipe, PIPE_PRIM_TRIANGLE_FAN, 0, 4,
>                                 0, num_instances);
>      pipe_resource_reference(&vb.buffer.resource, NULL);
>   }
>   
>   void util_blitter_draw_rectangle(struct blitter_context *blitter,
>                                    int x1, int y1, int x2, int y2, float depth,
>                                    enum blitter_attrib_type type,
> -                                 const union pipe_color_union *attrib)
> +                                 const union blitter_attrib *attrib)
>   {
>      struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
>   
>      switch (type) {
>         case UTIL_BLITTER_ATTRIB_COLOR:
> -         blitter_set_clear_color(ctx, attrib);
> +         blitter_set_clear_color(ctx, (uint32_t*)attrib->color);
>            break;
>   
>         case UTIL_BLITTER_ATTRIB_TEXCOORD:
> -         set_texcoords_in_vertices(attrib->f, &ctx->vertices[0][1][0], 8);
> +         set_texcoords_in_vertices(attrib, &ctx->vertices[0][1][0], 8);
>            break;
>   
>         default:;
>      }
>   
>      blitter_draw(ctx, x1, y1, x2, y2, depth, 1);
>   }
>   
>   static void *get_clear_blend_state(struct blitter_context_priv *ctx,
>                                      unsigned clear_buffers)
> @@ -1370,27 +1361,30 @@ static void util_blitter_clear_custom(struct blitter_context *blitter,
>                                      custom_blend, custom_dsa);
>   
>      sr.ref_value[0] = stencil & 0xff;
>      pipe->set_stencil_ref(pipe, &sr);
>   
>      pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
>      bind_fs_write_all_cbufs(ctx);
>   
>      if (num_layers > 1 && ctx->has_layered) {
>         blitter_set_common_draw_rect_state(ctx, FALSE, TRUE);
> -      blitter_set_clear_color(ctx, color);
> +      blitter_set_clear_color(ctx, color->ui);
>         blitter_draw(ctx, 0, 0, width, height, depth, num_layers);
>      }
>      else {
> +      union blitter_attrib attrib;
> +
> +      memcpy(attrib.color, color->ui, sizeof(color->ui));
>         blitter_set_common_draw_rect_state(ctx, FALSE, FALSE);
>         blitter->draw_rectangle(blitter, 0, 0, width, height, (float) depth,
> -                              UTIL_BLITTER_ATTRIB_COLOR, color);
> +                              UTIL_BLITTER_ATTRIB_COLOR, &attrib);
>      }
>   
>      util_blitter_restore_vertex_states(blitter);
>      util_blitter_restore_fragment_states(blitter);
>      util_blitter_restore_render_cond(blitter);
>      util_blitter_unset_running_flag(blitter);
>   }
>   
>   void util_blitter_clear(struct blitter_context *blitter,
>                           unsigned width, unsigned height, unsigned num_layers,
> @@ -1606,29 +1600,25 @@ static void do_blits(struct blitter_context_priv *ctx,
>      fb_state.width = dst->width;
>      fb_state.height = dst->height;
>      fb_state.nr_cbufs = is_zsbuf ? 0 : 1;
>   
>      if ((src_target == PIPE_TEXTURE_1D ||
>           src_target == PIPE_TEXTURE_2D ||
>           src_target == PIPE_TEXTURE_RECT) &&
>          src_samples <= 1) {
>         /* Draw the quad with the draw_rectangle callback. */
>   
> -      /* Set texture coordinates. - use a pipe color union
> -       * for interface purposes.
> -       * XXX pipe_color_union is a wrong name since we use that to set
> -       * texture coordinates too.
> -       */
> -      union pipe_color_union coord;
> +      /* Set texture coordinates. */
> +      union blitter_attrib coord;
>         get_texcoords(src, src_width0, src_height0, srcbox->x, srcbox->y,
>                       srcbox->x+srcbox->width, srcbox->y+srcbox->height,
> -                    uses_txf, coord.f);
> +                    uses_txf, &coord);
>   
>         /* Set framebuffer state. */
>         if (is_zsbuf) {
>            fb_state.zsbuf = dst;
>         } else {
>            fb_state.cbufs[0] = dst;
>         }
>         pipe->set_framebuffer_state(pipe, &fb_state);
>   
>         /* Draw. */
> @@ -2088,27 +2078,30 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
>      fb_state.height = dstsurf->height;
>      fb_state.nr_cbufs = 1;
>      fb_state.cbufs[0] = dstsurf;
>      fb_state.zsbuf = 0;
>      pipe->set_framebuffer_state(pipe, &fb_state);
>      pipe->set_sample_mask(pipe, ~0);
>   
>      num_layers = dstsurf->u.tex.last_layer - dstsurf->u.tex.first_layer + 1;
>      if (num_layers > 1 && ctx->has_layered) {
>         blitter_set_common_draw_rect_state(ctx, FALSE, TRUE);
> -      blitter_set_clear_color(ctx, color);
> +      blitter_set_clear_color(ctx, color->ui);
>         blitter_draw(ctx, dstx, dsty, dstx+width, dsty+height, 0, num_layers);
>      }
>      else {
> +      union blitter_attrib attrib;
> +
> +      memcpy(attrib.color, color->ui, sizeof(color->ui));
>         blitter_set_common_draw_rect_state(ctx, FALSE, FALSE);
>         blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0,
> -                              UTIL_BLITTER_ATTRIB_COLOR, color);
> +                              UTIL_BLITTER_ATTRIB_COLOR, &attrib);
>      }
>   
>      util_blitter_restore_vertex_states(blitter);
>      util_blitter_restore_fragment_states(blitter);
>      util_blitter_restore_fb_state(blitter);
>      util_blitter_restore_render_cond(blitter);
>      util_blitter_unset_running_flag(blitter);
>   }
>   
>   /* Clear a region of a depth stencil surface. */
> diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h
> index 34f181b..07429f6 100644
> --- a/src/gallium/auxiliary/util/u_blitter.h
> +++ b/src/gallium/auxiliary/util/u_blitter.h
> @@ -37,20 +37,28 @@ extern "C" {
>   #endif
>   
>   struct pipe_context;
>   
>   enum blitter_attrib_type {
>      UTIL_BLITTER_ATTRIB_NONE,
>      UTIL_BLITTER_ATTRIB_COLOR,
>      UTIL_BLITTER_ATTRIB_TEXCOORD
>   };
>   
> +union blitter_attrib {
> +   float color[4];
> +
> +   struct {
> +      float x1, y1, x2, y2;
> +   } texcoord;
> +};
> +
>   struct blitter_context
>   {
>      /**
>       * Draw a rectangle.
>       *
>       * \param x1      An X coordinate of the top-left corner.
>       * \param y1      A Y coordinate of the top-left corner.
>       * \param x2      An X coordinate of the bottom-right corner.
>       * \param y2      A Y coordinate of the bottom-right corner.
>       * \param depth   A depth which the rectangle is rendered at.
> @@ -68,21 +76,21 @@ struct blitter_context
>       * \param attrib See type.
>       *
>       * \note A driver may optionally override this callback to implement
>       *       a specialized hardware path for drawing a rectangle, e.g. using
>       *       a rectangular point sprite.
>       */
>      void (*draw_rectangle)(struct blitter_context *blitter,
>                             int x1, int y1, int x2, int y2,
>                             float depth,
>                             enum blitter_attrib_type type,
> -                          const union pipe_color_union *color);
> +                          const union blitter_attrib *attrib);
>   
>      /* Whether the blitter is running. */
>      boolean running;
>   
>      /* Private members, really. */
>      struct pipe_context *pipe; /**< pipe context */
>   
>      void *saved_blend_state;   /**< blend state */
>      void *saved_dsa_state;     /**< depth stencil alpha state */
>      void *saved_velem_state;   /**< vertex elements state */
> @@ -141,21 +149,21 @@ struct pipe_context *util_blitter_get_pipe(struct blitter_context *blitter)
>    * Override PIPE_CAP_TEXTURE_MULTISAMPLE as reported by the driver.
>    */
>   void util_blitter_set_texture_multisample(struct blitter_context *blitter,
>                                             boolean supported);
>   
>   /* The default function to draw a rectangle. This can only be used
>    * inside of the draw_rectangle callback if the driver overrides it. */
>   void util_blitter_draw_rectangle(struct blitter_context *blitter,
>                                    int x1, int y1, int x2, int y2, float depth,
>                                    enum blitter_attrib_type type,
> -                                 const union pipe_color_union *attrib);
> +                                 const union blitter_attrib *attrib);
>   
>   
>   /*
>    * These states must be saved before any of the following functions are called:
>    * - vertex buffers
>    * - vertex elements
>    * - vertex shader
>    * - geometry shader (if supported)
>    * - stream output targets (if supported)
>    * - rasterizer state
> diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
> index ce1fab4..a99d50f 100644
> --- a/src/gallium/drivers/r300/r300_context.h
> +++ b/src/gallium/drivers/r300/r300_context.h
> @@ -739,21 +739,21 @@ void r300_translate_index_buffer(struct r300_context *r300,
>   
>   /* r300_render_stencilref.c */
>   void r300_plug_in_stencil_ref_fallback(struct r300_context *r300);
>   
>   /* r300_render.c */
>   void r500_emit_index_bias(struct r300_context *r300, int index_bias);
>   void r300_blitter_draw_rectangle(struct blitter_context *blitter,
>                                    int x1, int y1, int x2, int y2,
>                                    float depth,
>                                    enum blitter_attrib_type type,
> -                                 const union pipe_color_union *attrib);
> +                                 const union blitter_attrib *attrib);
>   
>   /* r300_state.c */
>   enum r300_fb_state_change {
>       R300_CHANGED_FB_STATE = 0,
>       R300_CHANGED_HYPERZ_FLAG,
>       R300_CHANGED_MULTIWRITE,
>       R300_CHANGED_CMASK_ENABLE,
>   };
>   
>   void r300_mark_fb_state_dirty(struct r300_context *r300,
> diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
> index 8eca143..e1fabe4 100644
> --- a/src/gallium/drivers/r300/r300_render.c
> +++ b/src/gallium/drivers/r300/r300_render.c
> @@ -1109,31 +1109,31 @@ struct draw_stage* r300_draw_stage(struct r300_context* r300)
>   
>   /* This functions is used to draw a rectangle for the blitter module.
>    *
>    * If we rendered a quad, the pixels on the main diagonal
>    * would be computed and stored twice, which makes the clear/copy codepaths
>    * somewhat inefficient. Instead we use a rectangular point sprite. */
>   void r300_blitter_draw_rectangle(struct blitter_context *blitter,
>                                    int x1, int y1, int x2, int y2,
>                                    float depth,
>                                    enum blitter_attrib_type type,
> -                                 const union pipe_color_union *attrib)
> +                                 const union blitter_attrib *attrib)
>   {
>       struct r300_context *r300 = r300_context(util_blitter_get_pipe(blitter));
>       unsigned last_sprite_coord_enable = r300->sprite_coord_enable;
>       unsigned width = x2 - x1;
>       unsigned height = y2 - y1;
>       unsigned vertex_size =
>               type == UTIL_BLITTER_ATTRIB_COLOR || !r300->draw ? 8 : 4;
>       unsigned dwords = 13 + vertex_size +
>                         (type == UTIL_BLITTER_ATTRIB_TEXCOORD ? 7 : 0);
> -    static const union pipe_color_union zeros;
> +    static const union blitter_attrib zeros;
>       CS_LOCALS(r300);
>   
>       /* XXX workaround for a lockup in MSAA resolve on SWTCL chipsets, this
>        * function most probably doesn't handle type=NONE correctly */
>       if (!r300->screen->caps.has_tcl && type == UTIL_BLITTER_ATTRIB_NONE) {
>           util_blitter_draw_rectangle(blitter, x1, y1, x2, y2, depth, type, attrib);
>           return;
>       }
>   
>       if (r300->skip_rendering)
> @@ -1154,24 +1154,24 @@ void r300_blitter_draw_rectangle(struct blitter_context *blitter,
>   
>       BEGIN_CS(dwords);
>       /* Set up GA. */
>       OUT_CS_REG(R300_GA_POINT_SIZE, (height * 6) | ((width * 6) << 16));
>   
>       if (type == UTIL_BLITTER_ATTRIB_TEXCOORD) {
>           /* Set up the GA to generate texcoords. */
>           OUT_CS_REG(R300_GB_ENABLE, R300_GB_POINT_STUFF_ENABLE |
>                      (R300_GB_TEX_STR << R300_GB_TEX0_SOURCE_SHIFT));
>           OUT_CS_REG_SEQ(R300_GA_POINT_S0, 4);
> -        OUT_CS_32F(attrib->f[0]);
> -        OUT_CS_32F(attrib->f[3]);
> -        OUT_CS_32F(attrib->f[2]);
> -        OUT_CS_32F(attrib->f[1]);
> +        OUT_CS_32F(attrib->texcoord.x1);
> +        OUT_CS_32F(attrib->texcoord.y2);
> +        OUT_CS_32F(attrib->texcoord.x2);
> +        OUT_CS_32F(attrib->texcoord.y1);
>       }
>   
>       /* Set up VAP controls. */
>       OUT_CS_REG(R300_VAP_CLIP_CNTL, R300_CLIP_DISABLE);
>       OUT_CS_REG(R300_VAP_VTE_CNTL, R300_VTX_XY_FMT | R300_VTX_Z_FMT);
>       OUT_CS_REG(R300_VAP_VTX_SIZE, vertex_size);
>       OUT_CS_REG_SEQ(R300_VAP_VF_MAX_VTX_INDX, 2);
>       OUT_CS(1);
>       OUT_CS(0);
>   
> @@ -1181,21 +1181,21 @@ void r300_blitter_draw_rectangle(struct blitter_context *blitter,
>              R300_VAP_VF_CNTL__PRIM_POINTS);
>   
>       OUT_CS_32F(x1 + width * 0.5f);
>       OUT_CS_32F(y1 + height * 0.5f);
>       OUT_CS_32F(depth);
>       OUT_CS_32F(1);
>   
>       if (vertex_size == 8) {
>           if (!attrib)
>               attrib = &zeros;
> -        OUT_CS_TABLE(attrib->f, 4);
> +        OUT_CS_TABLE(attrib->color, 4);
>       }
>       END_CS;
>   
>   done:
>       /* Restore the state. */
>       r300_mark_atom_dirty(r300, &r300->rs_state);
>       r300_mark_atom_dirty(r300, &r300->viewport_state);
>   
>       r300->sprite_coord_enable = last_sprite_coord_enable;
>   }
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index 847527a..9619031 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -200,21 +200,21 @@ void r600_gfx_wait_fence(struct r600_common_context *ctx,
>   	radeon_emit(cs, va);
>   	radeon_emit(cs, va >> 32);
>   	radeon_emit(cs, ref); /* reference value */
>   	radeon_emit(cs, mask); /* mask */
>   	radeon_emit(cs, 4); /* poll interval */
>   }
>   
>   void r600_draw_rectangle(struct blitter_context *blitter,
>   			 int x1, int y1, int x2, int y2, float depth,
>   			 enum blitter_attrib_type type,
> -			 const union pipe_color_union *attrib)
> +			 const union blitter_attrib *attrib)
>   {
>   	struct r600_common_context *rctx =
>   		(struct r600_common_context*)util_blitter_get_pipe(blitter);
>   	struct pipe_viewport_state viewport;
>   	struct pipe_resource *buf = NULL;
>   	unsigned offset = 0;
>   	float *vb;
>   
>   	/* Some operations (like color resolve on r6xx) don't work
>   	 * with the conventional primitive types.
> @@ -251,31 +251,31 @@ void r600_draw_rectangle(struct blitter_context *blitter,
>   	vb[10] = 0;
>   	vb[11] = 1;
>   
>   	vb[16] = 1;
>   	vb[17] = -1;
>   	vb[18] = 0;
>   	vb[19] = 1;
>   
>   	switch (type) {
>   	case UTIL_BLITTER_ATTRIB_COLOR:
> -		memcpy(vb+4, attrib->f, sizeof(float)*4);
> -		memcpy(vb+12, attrib->f, sizeof(float)*4);
> -		memcpy(vb+20, attrib->f, sizeof(float)*4);
> +		memcpy(vb+4, attrib->color, sizeof(float)*4);
> +		memcpy(vb+12, attrib->color, sizeof(float)*4);
> +		memcpy(vb+20, attrib->color, sizeof(float)*4);
>   		break;
>   	case UTIL_BLITTER_ATTRIB_TEXCOORD:
> -		vb[4] = attrib->f[0]; /* x1 */
> -		vb[5] = attrib->f[1]; /* y1 */
> -		vb[12] = attrib->f[0]; /* x1 */
> -		vb[13] = attrib->f[3]; /* y2 */
> -		vb[20] = attrib->f[2]; /* x2 */
> -		vb[21] = attrib->f[1]; /* y1 */
> +		vb[4] = attrib->texcoord.x1;
> +		vb[5] = attrib->texcoord.y1;
> +		vb[12] = attrib->texcoord.x1;
> +		vb[13] = attrib->texcoord.y2;
> +		vb[20] = attrib->texcoord.x2;
> +		vb[21] = attrib->texcoord.y1;
>   		break;
>   	default:; /* Nothing to do. */
>   	}
>   
>   	/* draw */
>   	util_draw_vertex_buffer(&rctx->b, NULL, buf, blitter->vb_slot, offset,
>   				R600_PRIM_RECTANGLE_LIST, 3, 2);
>   	pipe_resource_reference(&buf, NULL);
>   }
>   
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
> index c7e4c8a..d9cd659 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.h
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.h
> @@ -748,21 +748,21 @@ void r600_gfx_write_event_eop(struct r600_common_context *ctx,
>   			      unsigned event, unsigned event_flags,
>   			      unsigned data_sel,
>   			      struct r600_resource *buf, uint64_t va,
>   			      uint32_t new_fence, unsigned query_type);
>   unsigned r600_gfx_write_fence_dwords(struct r600_common_screen *screen);
>   void r600_gfx_wait_fence(struct r600_common_context *ctx,
>   			 uint64_t va, uint32_t ref, uint32_t mask);
>   void r600_draw_rectangle(struct blitter_context *blitter,
>   			 int x1, int y1, int x2, int y2, float depth,
>   			 enum blitter_attrib_type type,
> -			 const union pipe_color_union *attrib);
> +			 const union blitter_attrib *attrib);
>   bool r600_common_screen_init(struct r600_common_screen *rscreen,
>   			     struct radeon_winsys *ws);
>   void r600_destroy_common_screen(struct r600_common_screen *rscreen);
>   void r600_preflush_suspend_features(struct r600_common_context *ctx);
>   void r600_postflush_resume_features(struct r600_common_context *ctx);
>   bool r600_common_context_init(struct r600_common_context *rctx,
>   			      struct r600_common_screen *rscreen,
>   			      unsigned context_flags);
>   void r600_common_context_cleanup(struct r600_common_context *rctx);
>   bool r600_can_dump_shader(struct r600_common_screen *rscreen,
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list