示例#1
0
static GLboolean
intel_run_render(GLcontext * ctx, struct tnl_pipeline_stage *stage)
{
   struct intel_context *intel = intel_context(ctx);
   TNLcontext *tnl = TNL_CONTEXT(ctx);
   struct vertex_buffer *VB = &tnl->vb;
   GLuint i;

   intel->vtbl.render_prevalidate( intel );

   /* Don't handle clipping or indexed vertices.
    */
   if (intel->RenderIndex != 0 ||
       !intel_validate_render(ctx, VB) || !choose_render(intel, VB)) {
      return GL_TRUE;
   }

   tnl->clipspace.new_inputs |= VERT_BIT_POS;

   tnl->Driver.Render.Start(ctx);

   for (i = 0; i < VB->PrimitiveCount; i++) {
      GLuint prim = _tnl_translate_prim(&VB->Primitive[i]);
      GLuint start = VB->Primitive[i].start;
      GLuint length = VB->Primitive[i].count;

      if (!length)
         continue;

      intel_render_tab_verts[prim & PRIM_MODE_MASK] (ctx, start,
                                                     start + length, prim);
   }

   tnl->Driver.Render.Finish(ctx);

   INTEL_FIREVERTICES(intel);

   return GL_FALSE;             /* finished the pipe */
}
示例#2
0
void
intel_flush(GLcontext *ctx, GLboolean needs_mi_flush)
{
   struct intel_context *intel = intel_context(ctx);

   if (intel->Fallback)
      _swrast_flush(ctx);

   if (intel->gen < 4)
      INTEL_FIREVERTICES(intel);

   if (intel->batch->map != intel->batch->ptr)
      intel_batchbuffer_flush(intel->batch);

   if ((ctx->DrawBuffer->Name == 0) && intel->front_buffer_dirty) {
      __DRIscreen *const screen = intel->intelScreen->driScrnPriv;

      if (screen->dri2.loader &&
          (screen->dri2.loader->base.version >= 2)
	  && (screen->dri2.loader->flushFrontBuffer != NULL) &&
          intel->driDrawable && intel->driDrawable->loaderPrivate) {
	 (*screen->dri2.loader->flushFrontBuffer)(intel->driDrawable,
						  intel->driDrawable->loaderPrivate);

	 /* Only clear the dirty bit if front-buffer rendering is no longer
	  * enabled.  This is done so that the dirty bit can only be set in
	  * glDrawBuffer.  Otherwise the dirty bit would have to be set at
	  * each of N places that do rendering.  This has worse performances,
	  * but it is much easier to get correct.
	  */
	 if (!intel->is_front_buffer_rendering) {
	    intel->front_buffer_dirty = GL_FALSE;
	 }
      }
   }
}
示例#3
0
void 
i830ClearWithTris(intelContextPtr intel, GLbitfield mask,
		  GLboolean all,
		  GLint cx, GLint cy, GLint cw, GLint ch)
{
   i830ContextPtr i830 = I830_CONTEXT( intel );
   __DRIdrawablePrivate *dPriv = intel->driDrawable;
   intelScreenPrivate *screen = intel->intelScreen;
   int x0, y0, x1, y1;

   INTEL_FIREVERTICES(intel);
   SET_STATE( i830, meta );
   set_initial_state( i830 );
/*    set_no_texture( i830 ); */
   set_vertex_format( i830 ); 

   LOCK_HARDWARE(intel);

   if(!all) {
      x0 = cx;
      y0 = cy;
      x1 = x0 + cw;
      y1 = y0 + ch;
   } else {
      x0 = 0;
      y0 = 0;
      x1 = x0 + dPriv->w;
      y1 = y0 + dPriv->h;
   }

   /* Don't do any clipping to screen - these are window coordinates.
    * The active cliprects will be applied as for any other geometry.
    */

   if(mask & BUFFER_BIT_FRONT_LEFT) {
      set_no_depth_stencil_write( i830 );
      set_color_mask( i830, GL_TRUE );
      set_draw_region( i830, &screen->front );
      draw_quad(i830, x0, x1, y0, y1,
		intel->clear_red, intel->clear_green,
		intel->clear_blue, intel->clear_alpha,
		0, 0, 0, 0);
   }

   if(mask & BUFFER_BIT_BACK_LEFT) {
      set_no_depth_stencil_write( i830 );
      set_color_mask( i830, GL_TRUE );
      set_draw_region( i830, &screen->back );

      draw_quad(i830, x0, x1, y0, y1,
		intel->clear_red, intel->clear_green,
		intel->clear_blue, intel->clear_alpha,
		0, 0, 0, 0);
   }

   if(mask & BUFFER_BIT_STENCIL) {
      set_stencil_replace( i830, 
			   intel->ctx.Stencil.WriteMask[0], 
			   intel->ctx.Stencil.Clear);

      set_color_mask( i830, GL_FALSE );
      set_draw_region( i830, &screen->front );
      draw_quad( i830, x0, x1, y0, y1, 0, 0, 0, 0, 0, 0, 0, 0 );
   }

   UNLOCK_HARDWARE(intel);

   INTEL_FIREVERTICES(intel);
   SET_STATE( i830, state );
}