本文整理汇总了C++中I810_STATECHANGE函数的典型用法代码示例。如果您正苦于以下问题:C++ I810_STATECHANGE函数的具体用法?C++ I810_STATECHANGE怎么用?C++ I810_STATECHANGE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了I810_STATECHANGE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: i810AlphaFunc
static void i810AlphaFunc(struct gl_context *ctx, GLenum func, GLfloat ref)
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
GLuint a = (ZA_UPDATE_ALPHAFUNC|ZA_UPDATE_ALPHAREF);
GLubyte refByte;
CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
switch (ctx->Color.AlphaFunc) {
case GL_NEVER: a |= ZA_ALPHA_NEVER; break;
case GL_LESS: a |= ZA_ALPHA_LESS; break;
case GL_GEQUAL: a |= ZA_ALPHA_GEQUAL; break;
case GL_LEQUAL: a |= ZA_ALPHA_LEQUAL; break;
case GL_GREATER: a |= ZA_ALPHA_GREATER; break;
case GL_NOTEQUAL: a |= ZA_ALPHA_NOTEQUAL; break;
case GL_EQUAL: a |= ZA_ALPHA_EQUAL; break;
case GL_ALWAYS: a |= ZA_ALPHA_ALWAYS; break;
default: return;
}
a |= ((refByte & 0xfc) << ZA_ALPHAREF_SHIFT);
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
imesa->Setup[I810_CTXREG_ZA] &= ~(ZA_ALPHA_MASK|ZA_ALPHAREF_MASK);
imesa->Setup[I810_CTXREG_ZA] |= a;
}
示例2: set_color_stage
static void set_color_stage( unsigned color, int stage,
i810ContextPtr imesa )
{
if ( color != imesa->Setup[I810_CTXREG_MC0 + stage] ) {
I810_STATECHANGE( imesa, I810_UPLOAD_CTX );
imesa->Setup[I810_CTXREG_MC0 + stage] = color;
}
}
示例3: set_alpha_stage
static void set_alpha_stage( unsigned alpha, int stage,
i810ContextPtr imesa )
{
if ( alpha != imesa->Setup[I810_CTXREG_MA0 + stage] ) {
I810_STATECHANGE( imesa, I810_UPLOAD_CTX );
imesa->Setup[I810_CTXREG_MA0 + stage] = alpha;
}
}
示例4: i810ShadeModel
/* In Mesa 3.5 we can reliably do native flatshading.
*/
static void i810ShadeModel(struct gl_context *ctx, GLenum mode)
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
if (mode == GL_FLAT)
imesa->Setup[I810_CTXREG_LCS] |= LCS_INTERP_FLAT;
else
imesa->Setup[I810_CTXREG_LCS] &= ~LCS_INTERP_FLAT;
}
示例5: i810UploadTexImagesLocked
/* This is called with the lock held. May have to eject our own and/or
* other client's texture objects to make room for the upload.
*/
int i810UploadTexImagesLocked( i810ContextPtr imesa, i810TextureObjectPtr t )
{
int i;
int ofs;
int numLevels;
/* Do we need to eject LRU texture objects?
*/
if (!t->base.memBlock) {
int heap;
heap = driAllocateTexture( imesa->texture_heaps, imesa->nr_heaps,
(driTextureObject *) t);
if ( heap == -1 ) {
return -1;
}
ofs = t->base.memBlock->ofs;
t->BufAddr = imesa->i810Screen->tex.map + ofs;
t->Setup[I810_TEXREG_MI3] = imesa->i810Screen->textureOffset + ofs;
if (t == imesa->CurrentTexObj[0])
I810_STATECHANGE(imesa, I810_UPLOAD_TEX0);
if (t == imesa->CurrentTexObj[1])
I810_STATECHANGE(imesa, I810_UPLOAD_TEX1);
/* i810UpdateTexLRU( imesa, t );*/
}
driUpdateTextureLRU( (driTextureObject *) t );
if (imesa->texture_heaps[0]->timestamp >= GET_DISPATCH_AGE(imesa))
i810WaitAgeLocked( imesa, imesa->texture_heaps[0]->timestamp );
numLevels = t->base.lastLevel - t->base.firstLevel + 1;
for (i = 0 ; i < numLevels ; i++)
if (t->base.dirty_images[0] & (1<<i))
i810UploadTexLevel( imesa, t, i );
t->base.dirty_images[0] = 0;
return 0;
}
示例6: i810DepthMask
static void i810DepthMask(struct gl_context *ctx, GLboolean flag)
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
if (flag)
imesa->Setup[I810_CTXREG_B2] |= B2_ZB_WRITE_ENABLE;
else
imesa->Setup[I810_CTXREG_B2] &= ~B2_ZB_WRITE_ENABLE;
}
示例7: i810BlendFuncSeparate
static void i810BlendFuncSeparate( GLcontext *ctx, GLenum sfactorRGB,
GLenum dfactorRGB, GLenum sfactorA,
GLenum dfactorA )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
GLuint a = SDM_UPDATE_SRC_BLEND | SDM_UPDATE_DST_BLEND;
GLboolean fallback = GL_FALSE;
switch (ctx->Color.BlendSrcRGB) {
case GL_ZERO: a |= SDM_SRC_ZERO; break;
case GL_SRC_ALPHA: a |= SDM_SRC_SRC_ALPHA; break;
case GL_ONE: a |= SDM_SRC_ONE; break;
case GL_DST_COLOR: a |= SDM_SRC_DST_COLOR; break;
case GL_ONE_MINUS_DST_COLOR: a |= SDM_SRC_INV_DST_COLOR; break;
case GL_ONE_MINUS_SRC_ALPHA: a |= SDM_SRC_INV_SRC_ALPHA; break;
case GL_DST_ALPHA: a |= SDM_SRC_ONE; break;
case GL_ONE_MINUS_DST_ALPHA: a |= SDM_SRC_ZERO; break;
case GL_SRC_ALPHA_SATURATE: /*a |= SDM_SRC_SRC_ALPHA; break;*/
case GL_CONSTANT_COLOR:
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
fallback = GL_TRUE;
break;
default:
return;
}
switch (ctx->Color.BlendDstRGB) {
case GL_SRC_ALPHA: a |= SDM_DST_SRC_ALPHA; break;
case GL_ONE_MINUS_SRC_ALPHA: a |= SDM_DST_INV_SRC_ALPHA; break;
case GL_ZERO: a |= SDM_DST_ZERO; break;
case GL_ONE: a |= SDM_DST_ONE; break;
case GL_SRC_COLOR: a |= SDM_DST_SRC_COLOR; break;
case GL_ONE_MINUS_SRC_COLOR: a |= SDM_DST_INV_SRC_COLOR; break;
case GL_DST_ALPHA: a |= SDM_DST_ONE; break;
case GL_ONE_MINUS_DST_ALPHA: a |= SDM_DST_ZERO; break;
case GL_CONSTANT_COLOR:
case GL_ONE_MINUS_CONSTANT_COLOR:
case GL_CONSTANT_ALPHA:
case GL_ONE_MINUS_CONSTANT_ALPHA:
fallback = GL_TRUE;
break;
default:
return;
}
FALLBACK( imesa, I810_FALLBACK_BLEND_FUNC, fallback);
if (!fallback) {
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
imesa->Setup[I810_CTXREG_SDM] &= ~(SDM_SRC_MASK|SDM_DST_MASK);
imesa->Setup[I810_CTXREG_SDM] |= a;
}
}
示例8: i810Fogfv
/* =============================================================
* Fog
*/
static void i810Fogfv(struct gl_context *ctx, GLenum pname, const GLfloat *param)
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
if (pname == GL_FOG_COLOR) {
GLuint color = (((GLubyte)(ctx->Fog.Color[0]*255.0F) << 16) |
((GLubyte)(ctx->Fog.Color[1]*255.0F) << 8) |
((GLubyte)(ctx->Fog.Color[2]*255.0F) << 0));
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
imesa->Setup[I810_CTXREG_FOG] = ((GFX_OP_FOG_COLOR | color) &
~FOG_RESERVED_MASK);
}
}
示例9: i810LightModelfv_i815
/* But the 815 has it...
*/
static void i810LightModelfv_i815(struct gl_context *ctx, GLenum pname,
const GLfloat *param)
{
if (pname == GL_LIGHT_MODEL_COLOR_CONTROL)
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
imesa->Setup[I810_CTXREG_B1] |= B1_SPEC_ENABLE;
else
imesa->Setup[I810_CTXREG_B1] &= ~B1_SPEC_ENABLE;
}
}
示例10: i810LineWidth
static void i810LineWidth( GLcontext *ctx, GLfloat widthf )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
int width = (int)ctx->Line._Width;
imesa->LcsLineWidth = 0;
if (width & 1) imesa->LcsLineWidth |= LCS_LINEWIDTH_1_0;
if (width & 2) imesa->LcsLineWidth |= LCS_LINEWIDTH_2_0;
if (imesa->reduced_primitive == GL_LINES) {
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
imesa->Setup[I810_CTXREG_LCS] &= ~LCS_LINEWIDTH_3_0;
imesa->Setup[I810_CTXREG_LCS] |= imesa->LcsLineWidth;
}
}
示例11: i810PointSize
static void i810PointSize( GLcontext *ctx, GLfloat sz )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
int size = (int)ctx->Point._Size;
imesa->LcsPointSize = 0;
if (size & 1) imesa->LcsPointSize |= LCS_LINEWIDTH_1_0;
if (size & 2) imesa->LcsPointSize |= LCS_LINEWIDTH_2_0;
if (imesa->reduced_primitive == GL_POINTS) {
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
imesa->Setup[I810_CTXREG_LCS] &= ~LCS_LINEWIDTH_3_0;
imesa->Setup[I810_CTXREG_LCS] |= imesa->LcsPointSize;
}
}
示例12: i810TexEnv
static void i810TexEnv( GLcontext *ctx, GLenum target,
GLenum pname, const GLfloat *param )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
GLuint unit = ctx->Texture.CurrentUnit;
/* Only one env color. Need a fallback if env colors are different
* and texture setup references env color in both units.
*/
switch (pname) {
case GL_TEXTURE_ENV_COLOR: {
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
GLfloat *fc = texUnit->EnvColor;
GLuint r, g, b, a, col;
CLAMPED_FLOAT_TO_UBYTE(r, fc[0]);
CLAMPED_FLOAT_TO_UBYTE(g, fc[1]);
CLAMPED_FLOAT_TO_UBYTE(b, fc[2]);
CLAMPED_FLOAT_TO_UBYTE(a, fc[3]);
col = ((a << 24) |
(r << 16) |
(g << 8) |
(b << 0));
if (imesa->Setup[I810_CTXREG_CF1] != col) {
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
imesa->Setup[I810_CTXREG_CF1] = col;
}
break;
}
case GL_TEXTURE_ENV_MODE:
imesa->TexEnvImageFmt[unit] = 0; /* force recalc of env state */
break;
case GL_TEXTURE_LOD_BIAS_EXT:
{
struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData;
t->Setup[I810_TEXREG_MLC] &= ~(MLC_LOD_BIAS_MASK);
t->Setup[I810_TEXREG_MLC] |= i810ComputeLodBias(*param);
}
break;
default:
break;
}
}
示例13: i810PolygonStipple
/* =============================================================
* Polygon stipple
*
* The i810 supports a 4x4 stipple natively, GL wants 32x32.
* Fortunately stipple is usually a repeating pattern.
*/
static void i810PolygonStipple( struct gl_context *ctx, const GLubyte *mask )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
const GLubyte *m = mask;
GLubyte p[4];
int i,j,k;
int active = (ctx->Polygon.StippleFlag &&
imesa->reduced_primitive == GL_TRIANGLES);
GLuint newMask;
if (active) {
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
imesa->Setup[I810_CTXREG_ST1] &= ~ST1_ENABLE;
}
p[0] = mask[12] & 0xf; p[0] |= p[0] << 4;
p[1] = mask[8] & 0xf; p[1] |= p[1] << 4;
p[2] = mask[4] & 0xf; p[2] |= p[2] << 4;
p[3] = mask[0] & 0xf; p[3] |= p[3] << 4;
for (k = 0 ; k < 8 ; k++)
for (j = 0 ; j < 4; j++)
for (i = 0 ; i < 4 ; i++)
if (*m++ != p[j]) {
imesa->stipple_in_hw = 0;
return;
}
newMask = ((p[0] & 0xf) << 0) |
((p[1] & 0xf) << 4) |
((p[2] & 0xf) << 8) |
((p[3] & 0xf) << 12);
if (newMask == 0xffff) {
/* this is needed to make conform pass */
imesa->stipple_in_hw = 0;
return;
}
imesa->Setup[I810_CTXREG_ST1] &= ~0xffff;
imesa->Setup[I810_CTXREG_ST1] |= newMask;
imesa->stipple_in_hw = 1;
if (active)
imesa->Setup[I810_CTXREG_ST1] |= ST1_ENABLE;
}
示例14: i810DrawBuffer
void i810DrawBuffer(GLcontext *ctx, GLenum mode )
{
i810ContextPtr imesa = I810_CONTEXT(ctx);
int front = 0;
/*
* _DrawDestMask is easier to cope with than <mode>.
*/
switch ( ctx->Color._DrawDestMask[0] ) {
case DD_FRONT_LEFT_BIT:
front = 1;
break;
case DD_BACK_LEFT_BIT:
front = 0;
break;
default:
/* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
FALLBACK( imesa, I810_FALLBACK_DRAW_BUFFER, GL_TRUE );
return;
}
if ( imesa->sarea->pf_current_page == 1 )
front ^= 1;
FALLBACK( imesa, I810_FALLBACK_DRAW_BUFFER, GL_FALSE );
I810_FIREVERTICES(imesa);
I810_STATECHANGE(imesa, I810_UPLOAD_BUFFERS);
if (front)
{
imesa->BufferSetup[I810_DESTREG_DI1] = (imesa->i810Screen->fbOffset |
imesa->i810Screen->backPitchBits);
i810XMesaSetFrontClipRects( imesa );
}
else
{
imesa->BufferSetup[I810_DESTREG_DI1] = (imesa->i810Screen->backOffset |
imesa->i810Screen->backPitchBits);
i810XMesaSetBackClipRects( imesa );
}
/* We want to update the s/w rast state too so that r200SetBuffer()
* gets called.
*/
_swrast_DrawBuffer(ctx, mode);
}
示例15: i810PointSize
static void i810PointSize( struct gl_context *ctx, GLfloat sz )
{
i810ContextPtr imesa = I810_CONTEXT( ctx );
/* AA, non-AA limits are same */
const int size = (int) CLAMP(ctx->Point.Size,
ctx->Const.MinPointSize,
ctx->Const.MaxPointSize);
imesa->LcsPointSize = 0;
if (size & 1) imesa->LcsPointSize |= LCS_LINEWIDTH_1_0;
if (size & 2) imesa->LcsPointSize |= LCS_LINEWIDTH_2_0;
if (imesa->reduced_primitive == GL_POINTS) {
I810_STATECHANGE(imesa, I810_UPLOAD_CTX);
imesa->Setup[I810_CTXREG_LCS] &= ~LCS_LINEWIDTH_3_0;
imesa->Setup[I810_CTXREG_LCS] |= imesa->LcsPointSize;
}
}