diff options
author | Jeremy Kolb <[email protected]> | 2006-11-21 02:47:13 +0000 |
---|---|---|
committer | Jeremy Kolb <[email protected]> | 2006-11-21 02:47:13 +0000 |
commit | a20cf73053c2c834abe971c9dc824f14c31884fb (patch) | |
tree | ada4522f7ce575eababbd8181f496c95d9188584 /src/mesa/drivers/dri | |
parent | afb49fef9033d84d989d62928a03615ec5dbda04 (diff) |
More state.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv30_state.c | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nv30_state.c b/src/mesa/drivers/dri/nouveau/nv30_state.c index 66d94d19cdb..a6cbcb8c8d4 100644 --- a/src/mesa/drivers/dri/nouveau/nv30_state.c +++ b/src/mesa/drivers/dri/nouveau/nv30_state.c @@ -28,6 +28,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "nouveau_object.h" #include "nouveau_fifo.h" #include "nouveau_reg.h" +#include "nouveau_state.h" #include "tnl/t_pipeline.h" @@ -414,7 +415,7 @@ static void nv30Lightfv(GLcontext *ctx, GLenum light, GLenum pname, const GLfloa } /** 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 ) @@ -473,15 +474,37 @@ static void nv30PolygonMode(GLcontext *ctx, GLenum face, GLenum mode) } /** 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) @@ -557,16 +580,23 @@ void (*TexEnv)(GLcontext *ctx, GLenum target, GLenum pname, 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) @@ -597,13 +627,13 @@ 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; @@ -611,8 +641,8 @@ void nv30InitStateFuncs(struct dd_function_table *func) #if 0 func->TexGen = nv30TexGen; func->TexParameter = nv30TexParameter; - func->TextureMatrix = nv30TextureMatrix; #endif + func->TextureMatrix = nv30TextureMatrix; func->Viewport = nv30Viewport; } |