#include "nouveau_object.h"
#include "nouveau_fifo.h"
#include "nouveau_reg.h"
+#include "nouveau_state.h"
#include "tnl/t_pipeline.h"
}
/** Set the lighting model parameters */
-static void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
+void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params);
static void nv30LineStipple(GLcontext *ctx, GLint factor, GLushort pattern )
}
/** Set the scale and units used to calculate depth values */
-void (*PolygonOffset)(GLcontext *ctx, GLfloat factor, GLfloat units);
+static void nv30PolygonOffset(GLcontext *ctx, GLfloat factor, GLfloat units)
+{
+ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+ BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FACTOR, 2);
+ OUT_RINGf(factor);
+
+ /* Looks like we always multiply units by 2.0... according to the dumps.*/
+ OUT_RINGf(units * 2.0);
+}
+
/** Set the polygon stippling pattern */
-void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask );
+static void nv30PolygonStipple(GLcontext *ctx, const GLubyte *mask )
+{
+ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+ BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_POLYGON_STIPPLE_PATTERN(0), 32);
+ OUT_RINGp(mask, 32);
+}
+
/* Specifies the current buffer for reading */
void (*ReadBuffer)( GLcontext *ctx, GLenum buffer );
/** Set rasterization mode */
void (*RenderMode)(GLcontext *ctx, GLenum mode );
+
/** Define the scissor box */
-void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h);
+static void nv30Scissor(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+{
+ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+ BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_SCISSOR_WIDTH_XPOS, 2);
+ OUT_RING((w << 16) | x);
+ OUT_RING((y << 16) | y);
+}
/** Select flat or smooth shading */
static void nv30ShadeModel(GLcontext *ctx, GLenum mode)
void (*TexParameter)(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj,
GLenum pname, const GLfloat *params);
-void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat);
+
+static void nv30TextureMatrix(GLcontext *ctx, GLuint unit, const GLmatrix *mat)
+{
+ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+ BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_TX_MATRIX(unit, 0), 16);
+ /*XXX: This SHOULD work.*/
+ OUT_RINGp(mat->m, 16);
+}
/** Set the viewport */
static void nv30Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
- /* TODO: Where do the VIEWPORT_XFRM_* regs come in? */
- nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
- BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_VIEWPORT_DIMS_0, 2);
- OUT_RING((w << 16) | x);
- OUT_RING((h << 16) | y);
+ /* TODO: Where do the VIEWPORT_XFRM_* regs come in? */
+ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx);
+ BEGIN_RING_SIZE(NvSub3D, NV30_TCL_PRIMITIVE_3D_VIEWPORT_DIMS_0, 2);
+ OUT_RING((w << 16) | x);
+ OUT_RING((h << 16) | y);
}
void nv30InitStateFuncs(struct dd_function_table *func)
func->PointParameterfv = nv30PointParameterfv;
func->PointSize = nv30PointSize;
func->PolygonMode = nv30PolygonMode;
-#if 0
func->PolygonOffset = nv30PolygonOffset;
func->PolygonStipple = nv30PolygonStipple;
+#if 0
func->ReadBuffer = nv30ReadBuffer;
func->RenderMode = nv30RenderMode;
- func->Scissor = nv30Scissor;
#endif
+ func->Scissor = nv30Scissor;
func->ShadeModel = nv30ShadeModel;
func->StencilFuncSeparate = nv30StencilFuncSeparate;
func->StencilMaskSeparate = nv30StencilMaskSeparate;
#if 0
func->TexGen = nv30TexGen;
func->TexParameter = nv30TexParameter;
- func->TextureMatrix = nv30TextureMatrix;
#endif
+ func->TextureMatrix = nv30TextureMatrix;
func->Viewport = nv30Viewport;
}