예제 #1
0
/**
 * Clear the given buffers to the specified values.
 * No masking, no scissor (clear entire buffer).
 */
void
softpipe_clear(struct pipe_context *pipe, unsigned buffers,
               const union pipe_color_union *color,
               double depth, unsigned stencil)
{
   struct softpipe_context *softpipe = softpipe_context(pipe);
   uint64_t cv;
   uint i;

   if (softpipe->no_rast)
      return;

   if (!softpipe_check_render_cond(softpipe))
      return;

#if 0
   softpipe_update_derived(softpipe, PIPE_PRIM_TRIANGLES); /* not needed?? */
#endif

   if (buffers & PIPE_CLEAR_COLOR) {
      for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
         sp_tile_cache_clear(softpipe->cbuf_cache[i], color, 0);
      }
   }

   if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
      static const union pipe_color_union zero;
      struct pipe_surface *ps = softpipe->framebuffer.zsbuf;

      cv = util_pack64_z_stencil(ps->format, depth, stencil);
      sp_tile_cache_clear(softpipe->zsbuf_cache, &zero, cv);
   }

   softpipe->dirty_render_cache = TRUE;
}
예제 #2
0
void setup_prepare( struct setup_context *setup )
{
   struct softpipe_context *sp = setup->softpipe;
   unsigned i;

   if (sp->dirty) {
      softpipe_update_derived(sp);
   }

   /* Note: nr_attrs is only used for debugging (vertex printing) */
   setup->quad.nr_attrs = draw_num_vs_outputs(sp->draw);

   for (i = 0; i < SP_NUM_QUAD_THREADS; i++) {
      sp->quad[i].first->begin( sp->quad[i].first );
   }

   if (sp->reduced_api_prim == PIPE_PRIM_TRIANGLES &&
       sp->rasterizer->fill_cw == PIPE_POLYGON_MODE_FILL &&
       sp->rasterizer->fill_ccw == PIPE_POLYGON_MODE_FILL) {
      /* we'll do culling */
      setup->winding = sp->rasterizer->cull_mode;
   }
   else {
      /* 'draw' will do culling */
      setup->winding = PIPE_WINDING_NONE;
   }
}
예제 #3
0
파일: sp_setup.c 프로젝트: nikai3d/mesa
/**
 * Called by vbuf code just before we start buffering primitives.
 */
void
sp_setup_prepare(struct setup_context *setup)
{
   struct softpipe_context *sp = setup->softpipe;

   if (sp->dirty) {
      softpipe_update_derived(sp, sp->reduced_api_prim);
   }

   /* Note: nr_attrs is only used for debugging (vertex printing) */
   setup->nr_vertex_attrs = draw_num_shader_outputs(sp->draw);

   sp->quad.first->begin( sp->quad.first );

   if (sp->reduced_api_prim == PIPE_PRIM_TRIANGLES &&
       sp->rasterizer->fill_front == PIPE_POLYGON_MODE_FILL &&
       sp->rasterizer->fill_back == PIPE_POLYGON_MODE_FILL) {
      /* we'll do culling */
      setup->cull_face = sp->rasterizer->cull_face;
   }
   else {
      /* 'draw' will do culling */
      setup->cull_face = PIPE_FACE_NONE;
   }
}
예제 #4
0
/**
 * Called by vbuf code just before we start buffering primitives.
 */
void
sp_setup_prepare(struct setup_context *setup)
{
   struct softpipe_context *sp = setup->softpipe;
   int i;
   unsigned max_layer = ~0;
   if (sp->dirty) {
      softpipe_update_derived(sp, sp->reduced_api_prim);
   }

   /* Note: nr_attrs is only used for debugging (vertex printing) */
   setup->nr_vertex_attrs = draw_num_shader_outputs(sp->draw);

   /*
    * Determine how many layers the fb has (used for clamping layer value).
    * OpenGL (but not d3d10) permits different amount of layers per rt, however
    * results are undefined if layer exceeds the amount of layers of ANY
    * attachment hence don't need separate per cbuf and zsbuf max.
    */
   for (i = 0; i < setup->softpipe->framebuffer.nr_cbufs; i++) {
      struct pipe_surface *cbuf = setup->softpipe->framebuffer.cbufs[i];
      if (cbuf) {
         max_layer = MIN2(max_layer,
                          cbuf->u.tex.last_layer - cbuf->u.tex.first_layer);

      }
   }

   /* Prepare pixel offset for rasterisation:
    *  - pixel center (0.5, 0.5) for GL, or
    *  - assume (0.0, 0.0) for other APIs.
    */
   if (setup->softpipe->rasterizer->half_pixel_center) {
      setup->pixel_offset = 0.5f;
   } else {
      setup->pixel_offset = 0.0f;
   }

   setup->max_layer = max_layer;

   sp->quad.first->begin( sp->quad.first );

   if (sp->reduced_api_prim == PIPE_PRIM_TRIANGLES &&
       sp->rasterizer->fill_front == PIPE_POLYGON_MODE_FILL &&
       sp->rasterizer->fill_back == PIPE_POLYGON_MODE_FILL) {
      /* we'll do culling */
      setup->cull_face = sp->rasterizer->cull_face;
   }
   else {
      /* 'draw' will do culling */
      setup->cull_face = PIPE_FACE_NONE;
   }
}
예제 #5
0
/**
 * Clear the given buffers to the specified values.
 * No masking, no scissor (clear entire buffer).
 */
void
softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
               double depth, unsigned stencil)
{
   struct softpipe_context *softpipe = softpipe_context(pipe);
   unsigned cv;
   uint i;

   if (softpipe->no_rast)
      return;

#if 0
   softpipe_update_derived(softpipe); /* not needed?? */
#endif

   if (buffers & PIPE_CLEAR_COLOR) {
      for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
         struct pipe_surface *ps = softpipe->framebuffer.cbufs[i];

         util_pack_color(rgba, ps->format, &cv);
         sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, cv);

#if !TILE_CLEAR_OPTIMIZATION
         /* non-cached surface */
         pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, cv);
#endif
      }
   }

   if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
      static const float zero[4] = { 0.0F, 0.0F, 0.0F, 0.0F };
      struct pipe_surface *ps = softpipe->framebuffer.zsbuf;

      cv = util_pack_z_stencil(ps->format, depth, stencil);
      sp_tile_cache_clear(softpipe->zsbuf_cache, zero, cv);

#if !TILE_CLEAR_OPTIMIZATION
      /* non-cached surface */
      pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, cv);
#endif
   }

   softpipe->dirty_render_cache = TRUE;
}
예제 #6
0
파일: sp_clear.c 프로젝트: DirectFB/mesa
/**
 * Clear the given buffers to the specified values.
 * No masking, no scissor (clear entire buffer).
 */
void
softpipe_clear(struct pipe_context *pipe, unsigned buffers,
               const union pipe_color_union *color,
               double depth, unsigned stencil)
{
   struct softpipe_context *softpipe = softpipe_context(pipe);
   struct pipe_surface *zsbuf = softpipe->framebuffer.zsbuf;
   unsigned zs_buffers = buffers & PIPE_CLEAR_DEPTHSTENCIL;
   uint64_t cv;
   uint i;

   if (softpipe->no_rast)
      return;

   if (!softpipe_check_render_cond(softpipe))
      return;

#if 0
   softpipe_update_derived(softpipe, PIPE_PRIM_TRIANGLES); /* not needed?? */
#endif

   if (buffers & PIPE_CLEAR_COLOR) {
      for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
         sp_tile_cache_clear(softpipe->cbuf_cache[i], color, 0);
      }
   }

   if (zs_buffers &&
       util_format_is_depth_and_stencil(zsbuf->texture->format) &&
       zs_buffers != PIPE_CLEAR_DEPTHSTENCIL) {
      /* Clearing only depth or stencil in a combined depth-stencil buffer. */
      util_clear_depth_stencil(pipe, zsbuf, zs_buffers, depth, stencil,
                               0, 0, zsbuf->width, zsbuf->height);
   }
   else if (zs_buffers) {
      static const union pipe_color_union zero;

      cv = util_pack64_z_stencil(zsbuf->format, depth, stencil);
      sp_tile_cache_clear(softpipe->zsbuf_cache, &zero, cv);
   }

   softpipe->dirty_render_cache = TRUE;
}
예제 #7
0
파일: sp_clear.c 프로젝트: nikai3d/mesa
/**
 * Clear the given buffers to the specified values.
 * No masking, no scissor (clear entire buffer).
 */
void
softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
               double depth, unsigned stencil)
{
   struct softpipe_context *softpipe = softpipe_context(pipe);
   union util_color uc;
   unsigned cv;
   uint i;

   if (softpipe->no_rast)
      return;

   if (!softpipe_check_render_cond(softpipe))
      return;

#if 0
   softpipe_update_derived(softpipe, PIPE_PRIM_TRIANGLES); /* not needed?? */
#endif

   if (buffers & PIPE_CLEAR_COLOR) {
      for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
         struct pipe_surface *ps = softpipe->framebuffer.cbufs[i];

         util_pack_color(rgba, ps->format, &uc);
         sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, uc.ui);
      }
   }

   if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
      static const float zero[4] = { 0.0F, 0.0F, 0.0F, 0.0F };
      struct pipe_surface *ps = softpipe->framebuffer.zsbuf;

      cv = util_pack_z_stencil(ps->format, depth, stencil);
      sp_tile_cache_clear(softpipe->zsbuf_cache, zero, cv);
   }

   softpipe->dirty_render_cache = TRUE;
}