diff options
author | Stephane Marchesin <[email protected]> | 2007-02-04 03:17:06 +0100 |
---|---|---|
committer | Stephane Marchesin <[email protected]> | 2007-02-04 03:20:01 +0100 |
commit | 63568745863a54308fecc32dbb96397c35b22496 (patch) | |
tree | e5b982241080f1fb1f64e3bb8b1dd646d8b80587 /src/mesa | |
parent | f8ec7f1398e600f4ed2ff3d0fb8d77d706f0fc18 (diff) |
nouveau: fix nv04 and nv10 swtcl, more work on nv04 state.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_swtcl.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv04_state.c | 20 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv04_swtcl.c | 52 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nv10_swtcl.c | 56 |
4 files changed, 118 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_swtcl.c b/src/mesa/drivers/dri/nouveau/nouveau_swtcl.c index f5c92a1b4e6..8a013bd9995 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_swtcl.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_swtcl.c @@ -84,7 +84,7 @@ void nouveauFallback(struct nouveau_context *nmesa, GLuint bit, GLboolean mode) if (nmesa->screen->card->type<NV_10) { //nv04FinishPrimitive(nmesa); } else { - nv10FinishPrimitive(nmesa); + //nv10FinishPrimitive(nmesa); } _swsetup_Wakeup(ctx); @@ -97,7 +97,7 @@ void nouveauFallback(struct nouveau_context *nmesa, GLuint bit, GLboolean mode) _swrast_flush( ctx ); if (nmesa->screen->card->type<NV_10) { - //nv04TriInitFunctions(ctx); + nv04TriInitFunctions(ctx); } else { nv10TriInitFunctions(ctx); } diff --git a/src/mesa/drivers/dri/nouveau/nv04_state.c b/src/mesa/drivers/dri/nouveau/nv04_state.c index ec4cd40d877..4129ecc50ea 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state.c @@ -35,9 +35,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "mtypes.h" #include "colormac.h" -static uint32_t nv04_compare_func(GLcontext *ctx,GLuint f) +static uint32_t nv04_compare_func(GLuint f) { - switch ( ctx->Color.AlphaFunc ) { + switch ( f ) { case GL_NEVER: return 1; case GL_LESS: return 2; case GL_EQUAL: return 3; @@ -51,9 +51,9 @@ static uint32_t nv04_compare_func(GLcontext *ctx,GLuint f) return 0; } -static uint32_t nv04_blend_func(GLcontext *ctx,GLuint f) +static uint32_t nv04_blend_func(GLuint f) { - switch ( ctx->Color.AlphaFunc ) { + switch ( f ) { case GL_ZERO: return 0x1; case GL_ONE: return 0x2; case GL_SRC_COLOR: return 0x3; @@ -66,7 +66,7 @@ static uint32_t nv04_blend_func(GLcontext *ctx,GLuint f) case GL_ONE_MINUS_DST_COLOR: return 0xA; case GL_SRC_ALPHA_SATURATE: return 0xB; } - WARN_ONCE("Unable to find the function\n"); + WARN_ONCE("Unable to find the function 0x%x\n",f); return 0; } @@ -78,11 +78,11 @@ static void nv04_emit_control(GLcontext *ctx) CLAMPED_FLOAT_TO_UBYTE(alpha_ref, ctx->Color.AlphaRef); control=alpha_ref; - control|=(nv04_compare_func(ctx,ctx->Color.AlphaFunc)<<8); + control|=(nv04_compare_func(ctx->Color.AlphaFunc)<<8); control|=(ctx->Color.AlphaEnabled<<12); control|=(1<<13); control|=(ctx->Depth.Test<<14); - control|=(nv04_compare_func(ctx,ctx->Depth.Func)<<16); + control|=(nv04_compare_func(ctx->Depth.Func)<<16); if ((ctx->Polygon.CullFlag)&&(ctx->Polygon.CullFaceMode!=GL_FRONT_AND_BACK)) { if ((ctx->Polygon.FrontFace==GL_CW)&&(ctx->Polygon.CullFaceMode==GL_FRONT)) @@ -126,8 +126,8 @@ static void nv04_emit_blend(GLcontext *ctx) blend|=(1<<8); blend|=(ctx->Fog.Enabled<<16); blend|=(ctx->Color.BlendEnabled<<20); - blend|=(nv04_blend_func(ctx,ctx->Color.BlendSrcRGB)<<24); - blend|=(nv04_blend_func(ctx,ctx->Color.BlendDstRGB)<<28); + blend|=(nv04_blend_func(ctx->Color.BlendSrcRGB)<<24); + blend|=(nv04_blend_func(ctx->Color.BlendDstRGB)<<28); BEGIN_RING_CACHE(NvSub3D, NV04_DX5_TEXTURED_TRIANGLE_BLEND, 1); OUT_RING_CACHE(blend); @@ -463,7 +463,7 @@ static GLboolean nv04BindBuffers(nouveauContextPtr nmesa, int num_color, /* FIXME pitches have to be aligned ! */ BEGIN_RING_SIZE(NvSubCtxSurf3D, NV04_CONTEXT_SURFACES_3D_PITCH, 2); - OUT_RING(color[0]->pitch|(depth->pitch<<16)); + OUT_RING(color[0]->pitch|(depth?(depth->pitch<<16):0)); OUT_RING(color[0]->offset); if (depth) { diff --git a/src/mesa/drivers/dri/nouveau/nv04_swtcl.c b/src/mesa/drivers/dri/nouveau/nv04_swtcl.c index f31c0d692de..9b5332b77a7 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_swtcl.c +++ b/src/mesa/drivers/dri/nouveau/nv04_swtcl.c @@ -84,6 +84,43 @@ static inline void nv04_1quad(struct nouveau_context *nmesa,nouveauVertex* v0,no OUT_RING(0xFECEDC); } +static inline void nv04_render_points(GLcontext *ctx,GLuint first,GLuint last) +{ + WARN_ONCE("Unimplemented\n"); +} + +static inline void nv04_render_line(GLcontext *ctx,GLuint v1,GLuint v2) +{ + WARN_ONCE("Unimplemented\n"); +} + +static inline void nv04_render_triangle(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3) +{ + struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); + GLubyte *vertptr = (GLubyte *)nmesa->verts; + GLuint vertsize = nmesa->vertex_size; + + nv04_1triangle(nmesa, + (nouveauVertex*)(vertptr+v1*vertsize), + (nouveauVertex*)(vertptr+v2*vertsize), + (nouveauVertex*)(vertptr+v3*vertsize) + ); +} + +static inline void nv04_render_quad(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3,GLuint v4) +{ + struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); + GLubyte *vertptr = (GLubyte *)nmesa->verts; + GLuint vertsize = nmesa->vertex_size; + + nv04_1quad(nmesa, + (nouveauVertex*)(vertptr+v1*vertsize), + (nouveauVertex*)(vertptr+v2*vertsize), + (nouveauVertex*)(vertptr+v3*vertsize), + (nouveauVertex*)(vertptr+v4*vertsize) + ); +} + /**********************************************************************/ /* Render unclipped begin/end objects */ /**********************************************************************/ @@ -404,6 +441,13 @@ do { \ nmesa->vertex_attr_count++; \ } while (0) +static void nv04_render_clipped_line(GLcontext *ctx,GLuint ii,GLuint jj) +{ +} + +static void nv04_render_clipped_poly(GLcontext *ctx,const GLuint *elts,GLuint n) +{ +} static void nv04ChooseRenderState(GLcontext *ctx) { @@ -411,8 +455,12 @@ static void nv04ChooseRenderState(GLcontext *ctx) tnl->Driver.Render.PrimTabVerts = nv04_render_tab_verts; tnl->Driver.Render.PrimTabElts = nv04_render_tab_elts; - tnl->Driver.Render.ClippedLine = NULL; - tnl->Driver.Render.ClippedPolygon = NULL; + tnl->Driver.Render.ClippedLine = nv04_render_clipped_line; + tnl->Driver.Render.ClippedPolygon = nv04_render_clipped_poly; + tnl->Driver.Render.Points = nv04_render_points; + tnl->Driver.Render.Line = nv04_render_line; + tnl->Driver.Render.Triangle = nv04_render_triangle; + tnl->Driver.Render.Quad = nv04_render_quad; } diff --git a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c index c9bfac8c4ac..9891b363cbe 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_swtcl.c +++ b/src/mesa/drivers/dri/nouveau/nv10_swtcl.c @@ -303,6 +303,58 @@ static void nv10_render_clipped_poly(GLcontext *ctx,const GLuint *elts,GLuint n) VB->Elts = tmp; } +static inline void nv10_render_points(GLcontext *ctx,GLuint first,GLuint last) +{ + WARN_ONCE("Unimplemented\n"); +} + +static inline void nv10_render_line(GLcontext *ctx,GLuint v1,GLuint v2) +{ + struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); + GLubyte *vertptr = (GLubyte *)nmesa->verts; + GLuint vertsize = nmesa->vertex_size; + GLuint size_dword = vertsize*(2)/4; + + nv10ExtendPrimitive(nmesa, size_dword); + nv10StartPrimitive(nmesa,GL_LINES+1,size_dword); + OUT_RINGp((nouveauVertex*)(vertptr+(v1*vertsize)),vertsize); + OUT_RINGp((nouveauVertex*)(vertptr+(v2*vertsize)),vertsize); + nv10FinishPrimitive(nmesa); +} + +static inline void nv10_render_triangle(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3) +{ + struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); + GLubyte *vertptr = (GLubyte *)nmesa->verts; + GLuint vertsize = nmesa->vertex_size; + GLuint size_dword = vertsize*(3)/4; + + nv10ExtendPrimitive(nmesa, size_dword); + nv10StartPrimitive(nmesa,GL_TRIANGLES+1,size_dword); + OUT_RINGp((nouveauVertex*)(vertptr+(v1*vertsize)),vertsize); + OUT_RINGp((nouveauVertex*)(vertptr+(v2*vertsize)),vertsize); + OUT_RINGp((nouveauVertex*)(vertptr+(v3*vertsize)),vertsize); + nv10FinishPrimitive(nmesa); +} + +static inline void nv10_render_quad(GLcontext *ctx,GLuint v1,GLuint v2,GLuint v3,GLuint v4) +{ + struct nouveau_context *nmesa = NOUVEAU_CONTEXT(ctx); + GLubyte *vertptr = (GLubyte *)nmesa->verts; + GLuint vertsize = nmesa->vertex_size; + GLuint size_dword = vertsize*(4)/4; + + nv10ExtendPrimitive(nmesa, size_dword); + nv10StartPrimitive(nmesa,GL_QUADS+1,size_dword); + OUT_RINGp((nouveauVertex*)(vertptr+(v1*vertsize)),vertsize); + OUT_RINGp((nouveauVertex*)(vertptr+(v2*vertsize)),vertsize); + OUT_RINGp((nouveauVertex*)(vertptr+(v3*vertsize)),vertsize); + OUT_RINGp((nouveauVertex*)(vertptr+(v4*vertsize)),vertsize); + nv10FinishPrimitive(nmesa); +} + + + static void nv10ChooseRenderState(GLcontext *ctx) { TNLcontext *tnl = TNL_CONTEXT(ctx); @@ -312,6 +364,10 @@ static void nv10ChooseRenderState(GLcontext *ctx) tnl->Driver.Render.PrimTabElts = nv10_render_tab_elts; tnl->Driver.Render.ClippedLine = nv10_render_clipped_line; tnl->Driver.Render.ClippedPolygon = nv10_render_clipped_poly; + tnl->Driver.Render.Points = nv10_render_points; + tnl->Driver.Render.Line = nv10_render_line; + tnl->Driver.Render.Triangle = nv10_render_triangle; + tnl->Driver.Render.Quad = nv10_render_quad; } |