Merge branch 'lp-offset-twoside'
[mesa.git] / src / mesa / drivers / dri / nouveau / nv04_state_raster.c
index 89c6753694c752bec0177e06ba37151124865cc9..98f2f98f1d0f9b48353dbe7dfc76fc47ee8f2244 100644 (file)
@@ -27,7 +27,8 @@
 #include "nouveau_driver.h"
 #include "nouveau_context.h"
 #include "nouveau_util.h"
-#include "nouveau_class.h"
+#include "nv_object.xml.h"
+#include "nv04_3d.xml.h"
 #include "nv04_driver.h"
 
 static unsigned
@@ -71,6 +72,10 @@ get_stencil_op(unsigned op)
                return 0x5;
        case GL_INVERT:
                return 0x6;
+       case GL_INCR_WRAP:
+               return 0x7;
+       case GL_DECR_WRAP:
+               return 0x8;
        default:
                assert(0);
        }
@@ -123,13 +128,13 @@ get_blend_func(unsigned func)
 }
 
 void
-nv04_defer_control(GLcontext *ctx, int emit)
+nv04_defer_control(struct gl_context *ctx, int emit)
 {
        context_dirty(ctx, CONTROL);
 }
 
 void
-nv04_emit_control(GLcontext *ctx, int emit)
+nv04_emit_control(struct gl_context *ctx, int emit)
 {
        struct nouveau_channel *chan = context_chan(ctx);
        struct nouveau_grobj *fahrenheit = nv04_context_engine(ctx);
@@ -138,7 +143,7 @@ nv04_emit_control(GLcontext *ctx, int emit)
                int cull_mode = ctx->Polygon.CullFaceMode;
                int front_face = ctx->Polygon.FrontFace;
                uint32_t ctrl0 = 1 << 30 |
-                       NV04_MULTITEX_TRIANGLE_CONTROL0_ORIGIN;
+                       NV04_MULTITEX_TRIANGLE_CONTROL0_ORIGIN_CORNER;
                uint32_t ctrl1 = 0, ctrl2 = 0;
 
                /* Color mask. */
@@ -206,7 +211,7 @@ nv04_emit_control(GLcontext *ctx, int emit)
                int cull_mode = ctx->Polygon.CullFaceMode;
                int front_face = ctx->Polygon.FrontFace;
                uint32_t ctrl = 1 << 30 |
-                       NV04_TEXTURED_TRIANGLE_CONTROL_ORIGIN;
+                       NV04_TEXTURED_TRIANGLE_CONTROL_ORIGIN_CORNER;
 
                /* Dithering. */
                if (ctx->Color.DitherFlag)
@@ -243,13 +248,13 @@ nv04_emit_control(GLcontext *ctx, int emit)
 }
 
 void
-nv04_defer_blend(GLcontext *ctx, int emit)
+nv04_defer_blend(struct gl_context *ctx, int emit)
 {
        context_dirty(ctx, BLEND);
 }
 
 void
-nv04_emit_blend(GLcontext *ctx, int emit)
+nv04_emit_blend(struct gl_context *ctx, int emit)
 {
        struct nouveau_channel *chan = context_chan(ctx);
        struct nouveau_grobj *fahrenheit = nv04_context_engine(ctx);
@@ -271,6 +276,10 @@ nv04_emit_blend(GLcontext *ctx, int emit)
                else
                        blend |= NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_FLAT;
 
+               /* Secondary color */
+               if (NEED_SECONDARY_COLOR(ctx))
+                       blend |= NV04_MULTITEX_TRIANGLE_BLEND_SPECULAR_ENABLE;
+
                /* Fog. */
                if (ctx->Fog.Enabled)
                        blend |= NV04_MULTITEX_TRIANGLE_BLEND_FOG_ENABLE;
@@ -305,6 +314,10 @@ nv04_emit_blend(GLcontext *ctx, int emit)
                else
                        blend |= get_texenv_mode(GL_MODULATE);
 
+               /* Secondary color */
+               if (NEED_SECONDARY_COLOR(ctx))
+                       blend |= NV04_TEXTURED_TRIANGLE_BLEND_SPECULAR_ENABLE;
+
                /* Fog. */
                if (ctx->Fog.Enabled)
                        blend |= NV04_TEXTURED_TRIANGLE_BLEND_FOG_ENABLE;