void nv10_emit_blend_color(struct gl_context *ctx, int emit) { struct nouveau_pushbuf *push = context_push(ctx); BEGIN_NV04(push, NV10_3D(BLEND_COLOR), 1); PUSH_DATA (push, FLOAT_TO_UBYTE(ctx->Color.BlendColor[3]) << 24 | FLOAT_TO_UBYTE(ctx->Color.BlendColor[0]) << 16 | FLOAT_TO_UBYTE(ctx->Color.BlendColor[1]) << 8 | FLOAT_TO_UBYTE(ctx->Color.BlendColor[2]) << 0); }
static void nv04_emit_fog_color(GLcontext *ctx) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); GLubyte c[4]; c[0] = FLOAT_TO_UBYTE( ctx->Fog.Color[0] ); c[1] = FLOAT_TO_UBYTE( ctx->Fog.Color[1] ); c[2] = FLOAT_TO_UBYTE( ctx->Fog.Color[2] ); c[3] = FLOAT_TO_UBYTE( ctx->Fog.Color[3] ); BEGIN_RING_CACHE(NvSub3D, NV04_DX5_TEXTURED_TRIANGLE_FOG_COLOR, 1); OUT_RING_CACHE(PACK_COLOR_8888_REV(c[0],c[1],c[2],c[3])); }
void nv10_emit_alpha_func(struct gl_context *ctx, int emit) { struct nouveau_pushbuf *push = context_push(ctx); BEGIN_NV04(push, NV10_3D(ALPHA_FUNC_ENABLE), 1); PUSH_DATAb(push, ctx->Color.AlphaEnabled); BEGIN_NV04(push, NV10_3D(ALPHA_FUNC_FUNC), 2); PUSH_DATA (push, nvgl_comparison_op(ctx->Color.AlphaFunc)); PUSH_DATA (push, FLOAT_TO_UBYTE(ctx->Color.AlphaRef)); }
static void sis6326DDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *params ) { sisContextPtr smesa = SIS_CONTEXT(ctx); __GLSiSHardware *current = &smesa->current; __GLSiSHardware *prev = &smesa->prev; GLint fogColor; switch(pname) { case GL_FOG_COLOR: fogColor = FLOAT_TO_UBYTE( ctx->Fog.Color[0] ) << 16; fogColor |= FLOAT_TO_UBYTE( ctx->Fog.Color[1] ) << 8; fogColor |= FLOAT_TO_UBYTE( ctx->Fog.Color[2] ); current->hwFog = 0x01000000 | fogColor; if (current->hwFog != prev->hwFog) { prev->hwFog = current->hwFog; smesa->GlobalFlag |= GFLAG_FOGSETTING; } break; } }
void nv04_emit_control(struct gl_context *ctx, int emit) { struct nv04_context *nv04 = to_nv04_context(ctx); struct gl_framebuffer *fb = ctx->DrawBuffer; int cull = ctx->Polygon.CullFaceMode; int front = ctx->Polygon.FrontFace; nv04->ctrl[0] = NV04_TEXTURED_TRIANGLE_CONTROL_Z_FORMAT_FIXED | NV04_TEXTURED_TRIANGLE_CONTROL_ORIGIN_CORNER; nv04->ctrl[1] = 0; nv04->ctrl[2] = 0; /* Dithering. */ if (ctx->Color.DitherFlag) nv04->ctrl[0] |= NV04_TEXTURED_TRIANGLE_CONTROL_DITHER_ENABLE; /* Cull mode. */ if (!ctx->Polygon.CullFlag) nv04->ctrl[0] |= NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_NONE; else if (cull == GL_FRONT_AND_BACK) nv04->ctrl[0] |= NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_BOTH; else nv04->ctrl[0] |= (cull == GL_FRONT) ^ (front == GL_CCW) ? NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_CW : NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_CCW; /* Depth test. */ if (ctx->Depth.Test && fb->Visual.depthBits > 0) nv04->ctrl[0] |= NV04_TEXTURED_TRIANGLE_CONTROL_Z_ENABLE; if (ctx->Depth.Mask && fb->Visual.depthBits > 0) nv04->ctrl[0] |= NV04_TEXTURED_TRIANGLE_CONTROL_Z_WRITE; nv04->ctrl[0] |= get_comparison_op(ctx->Depth.Func) << 16; /* Alpha test. */ if (ctx->Color.AlphaEnabled) nv04->ctrl[0] |= NV04_TEXTURED_TRIANGLE_CONTROL_ALPHA_ENABLE; nv04->ctrl[0] |= get_comparison_op(ctx->Color.AlphaFunc) << 8 | FLOAT_TO_UBYTE(ctx->Color.AlphaRef); /* Color mask. */ if (ctx->Color.ColorMask[0][RCOMP]) nv04->ctrl[0] |= NV04_MULTITEX_TRIANGLE_CONTROL0_RED_WRITE; if (ctx->Color.ColorMask[0][GCOMP]) nv04->ctrl[0] |= NV04_MULTITEX_TRIANGLE_CONTROL0_GREEN_WRITE; if (ctx->Color.ColorMask[0][BCOMP]) nv04->ctrl[0] |= NV04_MULTITEX_TRIANGLE_CONTROL0_BLUE_WRITE; if (ctx->Color.ColorMask[0][ACOMP]) nv04->ctrl[0] |= NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_WRITE; /* Stencil test. */ if (ctx->Stencil.WriteMask[0]) nv04->ctrl[0] |= NV04_MULTITEX_TRIANGLE_CONTROL0_STENCIL_WRITE; if (_mesa_stencil_is_enabled(ctx)) nv04->ctrl[1] |= NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_ENABLE; nv04->ctrl[1] |= get_comparison_op(ctx->Stencil.Function[0]) << 4 | _mesa_get_stencil_ref(ctx, 0) << 8 | ctx->Stencil.ValueMask[0] << 16 | ctx->Stencil.WriteMask[0] << 24; nv04->ctrl[2] |= get_stencil_op(ctx->Stencil.ZPassFunc[0]) << 8 | get_stencil_op(ctx->Stencil.ZFailFunc[0]) << 4 | get_stencil_op(ctx->Stencil.FailFunc[0]); }