当前位置: 首页>>代码示例>>C++>>正文


C++ MGA_CONTEXT函数代码示例

本文整理汇总了C++中MGA_CONTEXT函数的典型用法代码示例。如果您正苦于以下问题:C++ MGA_CONTEXT函数的具体用法?C++ MGA_CONTEXT怎么用?C++ MGA_CONTEXT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MGA_CONTEXT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mgaDDDepthFunc

static void mgaDDDepthFunc(GLcontext *ctx, GLenum func)
{
   mgaContextPtr mmesa = MGA_CONTEXT( ctx );
   int zmode;

   switch (func) {
   case GL_NEVER:
      /* can't do this in h/w, we'll use a s/w fallback */
      FALLBACK (ctx, MGA_FALLBACK_DEPTH, ctx->Depth.Test);

      /* FALLTHROUGH */
   case GL_ALWAYS:
      zmode = DC_zmode_nozcmp; break;
   case GL_LESS:
      zmode = DC_zmode_zlt; break;
   case GL_LEQUAL:
      zmode = DC_zmode_zlte; break;
   case GL_EQUAL:
      zmode = DC_zmode_ze; break;
   case GL_GREATER:
      zmode = DC_zmode_zgt; break;
   case GL_GEQUAL:
      zmode = DC_zmode_zgte; break;
   case GL_NOTEQUAL:
      zmode = DC_zmode_zne; break;
   default:
      zmode = 0; break;
   }

   MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
   mmesa->hw.zmode &= DC_zmode_MASK;
   mmesa->hw.zmode |= zmode;
}
开发者ID:Magister,项目名称:x11rdp_xorg71,代码行数:33,代码来源:mgastate.c

示例2: mgaFallback

void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
{
   TNLcontext *tnl = TNL_CONTEXT(ctx);
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);
   GLuint oldfallback = mmesa->Fallback;

   if (mode) {
      mmesa->Fallback |= bit;
      if (oldfallback == 0) {
	 FLUSH_BATCH(mmesa);
	 _swsetup_Wakeup( ctx );
	 mmesa->RenderIndex = ~0;
      }
   }
   else {
      mmesa->Fallback &= ~bit;
      if (oldfallback == bit) {
	 _swrast_flush( ctx );
	 tnl->Driver.Render.Start = mgaCheckTexSizes;
	 tnl->Driver.Render.PrimitiveNotify = mgaRenderPrimitive;
	 tnl->Driver.Render.Finish = mgaRenderFinish;
	 tnl->Driver.Render.BuildVertices = mgaBuildVertices;
	 mmesa->new_gl_state |= (_MGA_NEW_RENDERSTATE |
				 _MGA_NEW_RASTERSETUP);
      }
   }
}
开发者ID:dikerex,项目名称:theqvd,代码行数:27,代码来源:mgatris.c

示例3: mgaDDInitTextureFuncs

void
mgaDDInitTextureFuncs( GLcontext *ctx )
{
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);


   ctx->Driver.ChooseTextureFormat	= mgaChooseTextureFormat;
   ctx->Driver.TexImage1D		= _mesa_store_teximage1d;
   ctx->Driver.TexImage2D		= mgaTexImage2D;
   ctx->Driver.TexImage3D		= _mesa_store_teximage3d;
   ctx->Driver.TexSubImage1D		= _mesa_store_texsubimage1d;
   ctx->Driver.TexSubImage2D		= mgaTexSubImage2D;
   ctx->Driver.TexSubImage3D		= _mesa_store_texsubimage3d;
   ctx->Driver.CopyTexImage1D		= _swrast_copy_teximage1d;
   ctx->Driver.CopyTexImage2D		= _swrast_copy_teximage2d;
   ctx->Driver.CopyTexSubImage1D	= _swrast_copy_texsubimage1d;
   ctx->Driver.CopyTexSubImage2D	= _swrast_copy_texsubimage2d;
   ctx->Driver.CopyTexSubImage3D	= _swrast_copy_texsubimage3d;
   ctx->Driver.TestProxyTexImage	= _mesa_test_proxy_teximage;

   ctx->Driver.BindTexture		= mgaDDBindTexture;
   ctx->Driver.CreateTexture		= NULL; /* FIXME: Is this used??? */
   ctx->Driver.DeleteTexture		= mgaDDDeleteTexture;
   ctx->Driver.IsTextureResident	= driIsTextureResident;
   ctx->Driver.PrioritizeTexture	= NULL;
   ctx->Driver.ActiveTexture		= NULL;
   ctx->Driver.UpdateTexturePalette	= NULL;

   ctx->Driver.TexEnv			= mgaDDTexEnv;
   ctx->Driver.TexParameter		= mgaDDTexParameter;

   driInitTextureObjects( ctx, & mmesa->swapped,
                          (DRI_TEXMGR_DO_TEXTURE_2D |
                           DRI_TEXMGR_DO_TEXTURE_RECT) );
}
开发者ID:aosm,项目名称:X11,代码行数:35,代码来源:mgatex.c

示例4: mgaUpdateClipping

void mgaUpdateClipping(const GLcontext *ctx)
{
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);

   if (mmesa->driDrawable)
   {
      int x1 = mmesa->driDrawable->x + ctx->Scissor.X;
      int y1 = mmesa->driDrawable->y + mmesa->driDrawable->h
	 - (ctx->Scissor.Y + ctx->Scissor.Height);
      int x2 = x1 + ctx->Scissor.Width;
      int y2 = y1 + ctx->Scissor.Height;

      if (x1 < 0) x1 = 0;
      if (y1 < 0) y1 = 0;
      if (x2 < 0) x2 = 0;
      if (y2 < 0) y2 = 0;

      mmesa->scissor_rect.x1 = x1;
      mmesa->scissor_rect.y1 = y1;
      mmesa->scissor_rect.x2 = x2;
      mmesa->scissor_rect.y2 = y2;

      mmesa->dirty |= MGA_UPLOAD_CLIPRECTS;
   }
}
开发者ID:Magister,项目名称:x11rdp_xorg71,代码行数:25,代码来源:mgastate.c

示例5: mgaDDLogicOp

static void mgaDDLogicOp( GLcontext *ctx, GLenum opcode )
{
   mgaContextPtr mmesa = MGA_CONTEXT( ctx );

   MGA_STATECHANGE( mmesa, MGA_UPLOAD_CONTEXT );
   mmesa->hw.rop = mgarop_NoBLK[ opcode & 0x0f ];
}
开发者ID:Magister,项目名称:x11rdp_xorg71,代码行数:7,代码来源:mgastate.c

示例6: mgaChooseRenderState

static void mgaChooseRenderState(GLcontext *ctx)
{
   TNLcontext *tnl = TNL_CONTEXT(ctx);
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);
   GLuint flags = ctx->_TriangleCaps;
   GLuint index = 0;

   if (flags & (ANY_FALLBACK_FLAGS|ANY_RASTER_FLAGS)) {
      if (flags & ANY_RASTER_FLAGS) {
	 if (flags & DD_TRI_LIGHT_TWOSIDE)    index |= MGA_TWOSIDE_BIT;
	 if (flags & DD_TRI_OFFSET)	      index |= MGA_OFFSET_BIT;
	 if (flags & DD_TRI_UNFILLED)	      index |= MGA_UNFILLED_BIT;
	 if (flags & DD_FLATSHADE)	      index |= MGA_FLAT_BIT;
      }

      mmesa->draw_point = mga_draw_point;
      mmesa->draw_line = mga_draw_line;
      mmesa->draw_tri = mga_draw_triangle;

      /* Hook in fallbacks for specific primitives.
       */
      if (flags & ANY_FALLBACK_FLAGS)
      {
	 if (flags & POINT_FALLBACK) 
	    mmesa->draw_point = mga_fallback_point;
	 
	 if (flags & LINE_FALLBACK) 
	    mmesa->draw_line = mga_fallback_line;
	 
	 if (flags & TRI_FALLBACK) 
	    mmesa->draw_tri = mga_fallback_tri;
	 
	 if ((flags & DD_TRI_STIPPLE) && !mmesa->haveHwStipple)
	    mmesa->draw_tri = mga_fallback_tri;
      
	 index |= MGA_FALLBACK_BIT;
      }
   }

   if (mmesa->RenderIndex != index) {
      mmesa->RenderIndex = index;

      tnl->Driver.Render.Points = rast_tab[index].points;
      tnl->Driver.Render.Line = rast_tab[index].line;
      tnl->Driver.Render.Triangle = rast_tab[index].triangle;
      tnl->Driver.Render.Quad = rast_tab[index].quad;
         
      if (index == 0) {
	 tnl->Driver.Render.PrimTabVerts = mga_render_tab_verts;
	 tnl->Driver.Render.PrimTabElts = mga_render_tab_elts;
	 tnl->Driver.Render.ClippedLine = line; /* from tritmp.h */
	 tnl->Driver.Render.ClippedPolygon = mgaFastRenderClippedPoly;
      } else {
	 tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
	 tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
	 tnl->Driver.Render.ClippedLine = mgaRenderClippedLine;
	 tnl->Driver.Render.ClippedPolygon = mgaRenderClippedPoly;
      }
   }
}
开发者ID:dikerex,项目名称:theqvd,代码行数:60,代码来源:mgatris.c

示例7: mgaFallback

void mgaFallback( GLcontext *ctx, GLuint bit, GLboolean mode )
{
   TNLcontext *tnl = TNL_CONTEXT(ctx);
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);
   GLuint oldfallback = mmesa->Fallback;

   if (mode) {
      mmesa->Fallback |= bit;
      if (oldfallback == 0) {
	 FLUSH_BATCH(mmesa);
	 _swsetup_Wakeup( ctx );
	 mmesa->RenderIndex = ~0;
         if (MGA_DEBUG & DEBUG_VERBOSE_FALLBACK) {
            fprintf(stderr, "MGA begin rasterization fallback: 0x%x %s\n",
                    bit, getFallbackString(bit));
         }
      }
   }
   else {
      mmesa->Fallback &= ~bit;
      if (oldfallback == bit) {
	 _swrast_flush( ctx );
	 tnl->Driver.Render.Start = mgaCheckTexSizes;
	 tnl->Driver.Render.PrimitiveNotify = mgaRenderPrimitive;
	 tnl->Driver.Render.Finish = mgaRenderFinish;
	 tnl->Driver.Render.BuildVertices = mgaBuildVertices;
	 mmesa->NewGLState |= (_MGA_NEW_RENDERSTATE |
			       _MGA_NEW_RASTERSETUP);
         if (MGA_DEBUG & DEBUG_VERBOSE_FALLBACK) {
            fprintf(stderr, "MGA end rasterization fallback: 0x%x %s\n",
                    bit, getFallbackString(bit));
         }
      }
   }
}
开发者ID:astrofimov,项目名称:vgallium,代码行数:35,代码来源:mgatris.c

示例8: mgaDDDrawBuffer

static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode )
{
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);

   FLUSH_BATCH( mmesa );

   /*
    * _DrawDestMask is easier to cope with than <mode>.
    */
   switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
   case BUFFER_BIT_FRONT_LEFT:
      mmesa->setup.dstorg = mmesa->mgaScreen->frontOffset;
      mmesa->dirty |= MGA_UPLOAD_CONTEXT;
      mmesa->draw_buffer = MGA_FRONT;
      mgaXMesaSetFrontClipRects( mmesa );
      FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
      break;
   case BUFFER_BIT_BACK_LEFT:
      mmesa->setup.dstorg = mmesa->mgaScreen->backOffset;
      mmesa->draw_buffer = MGA_BACK;
      mmesa->dirty |= MGA_UPLOAD_CONTEXT;
      mgaXMesaSetBackClipRects( mmesa );
      FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
      break;
   default:
      /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
      FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_TRUE );
      return;
   }
}
开发者ID:Magister,项目名称:x11rdp_xorg71,代码行数:30,代码来源:mgastate.c

示例9: mgaDmaPrimitive

static void mgaDmaPrimitive( GLcontext *ctx, GLenum prim )
{
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);
   GLuint hwprim;

   switch (prim) {
   case GL_TRIANGLES:
      hwprim = MGA_WA_TRIANGLES;
      break;
   case GL_TRIANGLE_STRIP:
      if (mmesa->vertex_size == 8)
	 hwprim = MGA_WA_TRISTRIP_T0;
      else
	 hwprim = MGA_WA_TRISTRIP_T0T1;
      break;
   case GL_TRIANGLE_FAN:
      if (mmesa->vertex_size == 8)
	 hwprim = MGA_WA_TRIFAN_T0;
      else
	 hwprim = MGA_WA_TRIFAN_T0T1;
      break;
   default:
      return;
   }

   mgaRasterPrimitive( ctx, GL_TRIANGLES, hwprim );
}
开发者ID:Multi2Sim,项目名称:m2s-bench-parsec-3.0-src,代码行数:27,代码来源:mgarender.c

示例10: mgaRunPipeline

static void mgaRunPipeline( GLcontext *ctx )
{
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);

   if (mmesa->new_state) {
      mgaDDUpdateHwState( ctx );
   }

   if (!mmesa->Fallback && mmesa->new_gl_state) {
      if (mmesa->new_gl_state & _MGA_NEW_RASTERSETUP)
	 mgaChooseVertexState( ctx );
      
      if (mmesa->new_gl_state & _MGA_NEW_RENDERSTATE)
	 mgaChooseRenderState( ctx );
      
      mmesa->new_gl_state = 0;

      /* Circularity: mgaDDUpdateHwState can affect mmesa->Fallback,
       * but mgaChooseVertexState can affect mmesa->new_state.  Hence
       * the second check.  (Fix this...)
       */
      if (mmesa->new_state) {
	 mgaDDUpdateHwState( ctx );
      }
   }

   _tnl_run_pipeline( ctx );
}
开发者ID:dikerex,项目名称:theqvd,代码行数:28,代码来源:mgatris.c

示例11: mga_run_render

static GLboolean mga_run_render( GLcontext *ctx,
				  struct tnl_pipeline_stage *stage )
{
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);
   TNLcontext *tnl = TNL_CONTEXT(ctx);
   struct vertex_buffer *VB = &tnl->vb; 
   GLuint i;

   /* Don't handle clipping or indexed vertices or vertex manipulations.
    */
   if (mmesa->RenderIndex != 0 || 
       !mga_validate_render( ctx, VB )) {
      return GL_TRUE;
   }
   
   tnl->Driver.Render.Start( ctx );
   mmesa->SetupNewInputs = ~0;      

   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;

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

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

   return GL_FALSE;		/* finished the pipe */
}
开发者ID:Multi2Sim,项目名称:m2s-bench-parsec-3.0-src,代码行数:35,代码来源:mgarender.c

示例12: mgaDDDrawBuffer

static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode )
{
   mgaContextPtr mmesa = MGA_CONTEXT(ctx);

   FLUSH_BATCH( mmesa );

   /*
    * _DrawDestMask is easier to cope with than <mode>.
    */
   switch ( ctx->Color._DrawDestMask[0] ) {
   case DD_FRONT_LEFT_BIT:
      mmesa->setup.dstorg = mmesa->mgaScreen->frontOffset;
      mmesa->dirty |= MGA_UPLOAD_CONTEXT;
      mmesa->draw_buffer = MGA_FRONT;
      mgaXMesaSetFrontClipRects( mmesa );
      FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
      break;
   case DD_BACK_LEFT_BIT:
      mmesa->setup.dstorg = mmesa->mgaScreen->backOffset;
      mmesa->draw_buffer = MGA_BACK;
      mmesa->dirty |= MGA_UPLOAD_CONTEXT;
      mgaXMesaSetBackClipRects( mmesa );
      FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
      break;
   default:
      /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
      FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_TRUE );
      return;
   }

   /* We want to update the s/w rast state too so that r200SetBuffer()
    * gets called.
    */
   _swrast_DrawBuffer(ctx, mode);
}
开发者ID:BackupTheBerlios,项目名称:dri-ex-svn,代码行数:35,代码来源:mgastate.c

示例13: mgaDDLightModelfv

static void mgaDDLightModelfv(GLcontext *ctx, GLenum pname,
			      const GLfloat *param)
{
   if (pname == GL_LIGHT_MODEL_COLOR_CONTROL) {
      FLUSH_BATCH( MGA_CONTEXT(ctx) );
      updateSpecularLighting( ctx );
   }
}
开发者ID:Magister,项目名称:x11rdp_xorg71,代码行数:8,代码来源:mgastate.c

示例14: mgaDDInvalidateState

static void mgaDDInvalidateState( GLcontext *ctx, GLuint new_state )
{
   _swrast_InvalidateState( ctx, new_state );
   _swsetup_InvalidateState( ctx, new_state );
   _ac_InvalidateState( ctx, new_state );
   _tnl_InvalidateState( ctx, new_state );
   MGA_CONTEXT(ctx)->NewGLState |= new_state;
}
开发者ID:Magister,项目名称:x11rdp_xorg71,代码行数:8,代码来源:mgastate.c

示例15: mgaDDScissor

static void mgaDDScissor( GLcontext *ctx, GLint x, GLint y,
			  GLsizei w, GLsizei h )
{
   if ( ctx->Scissor.Enabled ) {
      FLUSH_BATCH( MGA_CONTEXT(ctx) );	/* don't pipeline cliprect changes */
      mgaUpdateClipping( ctx );
   }
}
开发者ID:Magister,项目名称:x11rdp_xorg71,代码行数:8,代码来源:mgastate.c


注:本文中的MGA_CONTEXT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。