From 252d1de05430cbed532b5a716cbd7da0ee7dd0d1 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Fri, 16 Feb 2007 19:46:54 +0100 Subject: nouveau: nv10: fix viewport scale and origin --- src/mesa/drivers/dri/nouveau/nv10_state.c | 45 ++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nv10_state.c b/src/mesa/drivers/dri/nouveau/nv10_state.c index d69c6824ed..e64fcb12f5 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state.c @@ -34,6 +34,29 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "mtypes.h" #include "colormac.h" +static void nv10ViewportScale(nouveauContextPtr nmesa) +{ + GLcontext *ctx = nmesa->glCtx; + GLuint w = ctx->Viewport.Width; + GLuint h = ctx->Viewport.Height; + + GLfloat max_depth = (ctx->Viewport.Near + ctx->Viewport.Far) * 0.5; + switch (ctx->DrawBuffer->_DepthBuffer->DepthBits) { + case 16: + max_depth *= 32767.0; + break; + case 24: + max_depth *= 16777215.0; + break; + } + + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_SCALE_X, 4); + OUT_RING_CACHEf ((((GLfloat) w) * 0.5) - 2048.0); + OUT_RING_CACHEf ((((GLfloat) h) * 0.5) - 2048.0); + OUT_RING_CACHEf (max_depth); + OUT_RING_CACHEf (0.0); +} + static void nv10AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); @@ -167,6 +190,8 @@ static void nv10DepthRange(GLcontext *ctx, GLclampd nearval, GLclampd farval) BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DEPTH_RANGE_NEAR, 2); OUT_RING_CACHEf(nearval); OUT_RING_CACHEf(farval); + + nv10ViewportScale(nmesa); } /** Specify the current buffer for writing */ @@ -628,18 +653,7 @@ static void nv10WindowMoved(nouveauContextPtr nmesa) OUT_RING_CACHE(0); } - /* viewport transform */ - BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_X, 4); - OUT_RING_CACHEf ((GLfloat) x); - OUT_RING_CACHEf ((GLfloat) (y+h)); - OUT_RING_CACHEf (0.0); - OUT_RING_CACHEf (0.0); - - BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_SCALE_X, 4); - OUT_RING_CACHEf ((((GLfloat) w) * 0.5) - 2048.0); - OUT_RING_CACHEf ((((GLfloat) h) * 0.5) - 2048.0); - OUT_RING_CACHEf (16777215.0 * 0.5); - OUT_RING_CACHEf (0.0); + nv10ViewportScale(nmesa); } /* Initialise any card-specific non-GL related state */ @@ -700,6 +714,13 @@ static GLboolean nv10BindBuffers(nouveauContextPtr nmesa, int num_color, OUT_RING_CACHE(color[0]->offset); OUT_RING_CACHE(depth ? depth->offset : color[0]->offset); + /* Always set to bottom left of buffer */ + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_X, 4); + OUT_RING_CACHEf (0.0); + OUT_RING_CACHEf ((GLfloat) h); + OUT_RING_CACHEf (0.0); + OUT_RING_CACHEf (0.0); + return GL_TRUE; } -- cgit v1.2.3 From 9131536f00cca586be7dfc1cfbc47188c78e4920 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Fri, 16 Feb 2007 19:54:55 +0100 Subject: nouveau: nv10: rescale depth near and far --- src/mesa/drivers/dri/nouveau/nv10_state.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nv10_state.c b/src/mesa/drivers/dri/nouveau/nv10_state.c index e64fcb12f5..803dd962b5 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state.c @@ -187,9 +187,15 @@ static void nv10DepthMask(GLcontext *ctx, GLboolean flag) static void nv10DepthRange(GLcontext *ctx, GLclampd nearval, GLclampd farval) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); + + GLfloat depth_scale = 16777216.0; + if (ctx->DrawBuffer->_DepthBuffer->DepthBits == 16) { + depth_scale = 32768.0; + } + BEGIN_RING_CACHE(NvSub3D, NV10_TCL_PRIMITIVE_3D_DEPTH_RANGE_NEAR, 2); - OUT_RING_CACHEf(nearval); - OUT_RING_CACHEf(farval); + OUT_RING_CACHEf(nearval * depth_scale); + OUT_RING_CACHEf(farval * depth_scale); nv10ViewportScale(nmesa); } -- cgit v1.2.3 From f942dc5522682b70fb05df5b2d5d732bb65e6fe2 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Fri, 16 Feb 2007 20:26:57 +0100 Subject: nouveau: nv10: set clear value for 16 and 24 bits depth --- src/mesa/drivers/dri/nouveau/nv10_state.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nv10_state.c b/src/mesa/drivers/dri/nouveau/nv10_state.c index 803dd962b5..cc0f5a7220 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state.c @@ -121,16 +121,27 @@ static void nv10ClearColor(GLcontext *ctx, const GLfloat color[4]) static void nv10ClearDepth(GLcontext *ctx, GLclampd d) { - /* FIXME: check if 16 or 24/32 bits depth buffer */ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - nmesa->clear_value=((nmesa->clear_value&0x000000FF)|(((uint32_t)(d*0xFFFFFF))<<8)); + + switch (ctx->DrawBuffer->_DepthBuffer->DepthBits) { + case 16: + nmesa->clear_value = (uint32_t)(d*0x7FFF); + break; + case 24: + nmesa->clear_value = ((nmesa->clear_value&0x000000FF) | + (((uint32_t)(d*0xFFFFFF))<<8)); + break; + } } static void nv10ClearStencil(GLcontext *ctx, GLint s) { - /* FIXME: not valid for 16 bits depth buffer (0 stencil bits) */ nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - nmesa->clear_value=((nmesa->clear_value&0xFFFFFF00)|(s&0x000000FF)); + + if (ctx->DrawBuffer->_DepthBuffer->DepthBits == 24) { + nmesa->clear_value = ((nmesa->clear_value&0xFFFFFF00)| + (s&0x000000FF)); + } } static void nv10ClipPlane(GLcontext *ctx, GLenum plane, const GLfloat *equation) -- cgit v1.2.3 From 66d8e55184ff8ebfdfef174336dbb5560c45e735 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Fri, 16 Feb 2007 22:03:31 +0100 Subject: nouveau: nv20: update --- src/mesa/drivers/dri/nouveau/nv20_state.c | 208 +++++++++++++++++++++++++----- 1 file changed, 176 insertions(+), 32 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nv20_state.c b/src/mesa/drivers/dri/nouveau/nv20_state.c index 8e38d6eba0..bcca69daf0 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state.c @@ -41,8 +41,8 @@ static void nv20AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref) CLAMPED_FLOAT_TO_UBYTE(ubRef, ref); BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC, 2); - OUT_RING_CACHE(func); /* NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_FUNC */ - OUT_RING_CACHE(ubRef); /* NV20_TCL_PRIMITIVE_3D_ALPHA_FUNC_REF */ + OUT_RING_CACHE(func); + OUT_RING_CACHE(ubRef); } static void nv20BlendColor(GLcontext *ctx, const GLfloat color[4]) @@ -76,6 +76,11 @@ static void nv20BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB, GLenum dfac OUT_RING_CACHE((dfactorA<<16) | dfactorRGB); } +static void nv20Clear(GLcontext *ctx, GLbitfield mask) +{ + /* TODO */ +} + static void nv20ClearColor(GLcontext *ctx, const GLfloat color[4]) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); @@ -297,7 +302,11 @@ static void nv20Enable(GLcontext *ctx, GLenum cap, GLboolean state) // case GL_POST_COLOR_MATRIX_COLOR_TABLE: // case GL_POST_CONVOLUTION_COLOR_TABLE: // case GL_RESCALE_NORMAL: -// case GL_SCISSOR_TEST: + case GL_SCISSOR_TEST: + /* No enable bit, nv20Scissor will adjust to max range */ + ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y, + ctx->Scissor.Width, ctx->Scissor.Height); + break; // case GL_SEPARABLE_2D: case GL_STENCIL_TEST: // TODO BACK and FRONT ? @@ -511,9 +520,22 @@ static void nv20PolygonMode(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 nv20PolygonOffset(GLcontext *ctx, GLfloat factor, GLfloat units) +{ + nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_OFFSET_FACTOR, 2); + OUT_RING_CACHEf(factor); + OUT_RING_CACHEf(units); +} + /** Set the polygon stippling pattern */ -void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask ); +static void nv20PolygonStipple(GLcontext *ctx, const GLubyte *mask ) +{ + nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_POLYGON_STIPPLE_PATTERN(0), 32); + OUT_RING_CACHEp(mask, 32); +} + /* Specifies the current buffer for reading */ void (*ReadBuffer)( GLcontext *ctx, GLenum buffer ); /** Set rasterization mode */ @@ -522,6 +544,22 @@ void (*RenderMode)(GLcontext *ctx, GLenum mode ); /** Define the scissor box */ static void nv20Scissor(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { + nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); + + /* There's no scissor enable bit, so adjust the scissor to cover the + * maximum draw buffer bounds + */ + if (!ctx->Scissor.Enabled) { + x = y = 0; + w = h = 4095; + } else { + x += nmesa->drawX; + y += nmesa->drawY; + } + + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_SCISSOR_X2_X1, 2); + OUT_RING_CACHE(((x+w-1) << 16) | x); + OUT_RING_CACHE(((y+h-1) << 16) | y); } /** Select flat or smooth shading */ @@ -576,22 +614,98 @@ 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); -/** Set the viewport */ -static void nv20Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) +static void nv20TextureMatrix(GLcontext *ctx, GLuint unit, const GLmatrix *mat) { - /* TODO: Where do the VIEWPORT_XFRM_* regs come in? */ - nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 2); - OUT_RING_CACHE((w << 16) | x); - OUT_RING_CACHE((h << 16) | y); + /* TODO */ +} + +/* Update anything that depends on the window position/size */ +static void nv20WindowMoved(nouveauContextPtr nmesa) +{ + GLcontext *ctx = nmesa->glCtx; + GLfloat *v = nmesa->viewport.m; + GLuint w = ctx->Viewport.Width; + GLuint h = ctx->Viewport.Height; + GLuint x = ctx->Viewport.X + nmesa->drawX; + GLuint y = ctx->Viewport.Y + nmesa->drawY; + int i; + + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 2); + OUT_RING_CACHE((w << 16) | x); + OUT_RING_CACHE((h << 16) | y); + + BEGIN_RING_SIZE(NvSub3D, 0x02b4, 1); + OUT_RING(0); + + BEGIN_RING_CACHE(NvSub3D, + NV20_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 2); + OUT_RING_CACHE((4095 << 16) | 0); + OUT_RING_CACHE((4095 << 16) | 0); + for (i=1; i<8; i++) { + BEGIN_RING_CACHE(NvSub3D, + NV20_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(i), 1); + OUT_RING_CACHE(0); + BEGIN_RING_CACHE(NvSub3D, + NV20_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(i), 1); + OUT_RING_CACHE(0); + } + + ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y, + ctx->Scissor.Width, ctx->Scissor.Height); + + /* TODO: recalc viewport scale coefs */ } /* Initialise any card-specific non-GL related state */ static GLboolean nv20InitCard(nouveauContextPtr nmesa) { - return GL_TRUE; + nouveauObjectOnSubchannel(nmesa, NvSub3D, Nv3D); + + BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_SET_OBJECT1, 2); + OUT_RING(NvDmaFB); /* 184 dma_object1 */ + OUT_RING(NvDmaFB); /* 188 dma_object2 */ + BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_SET_OBJECT3, 2); + OUT_RING(NvDmaFB); /* 194 dma_object3 */ + OUT_RING(NvDmaFB); /* 198 dma_object4 */ + BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_SET_OBJECT8, 1); + OUT_RING(NvDmaFB); /* 1a8 dma_object8 */ + + BEGIN_RING_SIZE(NvSub3D, 0x17e0, 3); + OUT_RINGf(0.0); + OUT_RINGf(0.0); + OUT_RINGf(1.0); + + BEGIN_RING_SIZE(NvSub3D, 0x1e6c, 1); + OUT_RING(0x0db6); + BEGIN_RING_SIZE(NvSub3D, 0x0290, 1); + OUT_RING(0x00100001); + BEGIN_RING_SIZE(NvSub3D, 0x09fc, 1); + OUT_RING(0); + BEGIN_RING_SIZE(NvSub3D, 0x1d80, 1); + OUT_RING(1); + BEGIN_RING_SIZE(NvSub3D, 0x09f8, 1); + OUT_RING(4); + + BEGIN_RING_SIZE(NvSub3D, 0x17ec, 3); + OUT_RINGf(0.0); + OUT_RINGf(1.0); + OUT_RINGf(0.0); + + BEGIN_RING_SIZE(NvSub3D, 0x1d88, 1); + OUT_RING(3); + + /* FIXME: More dma objects to setup ? */ + + BEGIN_RING_SIZE(NvSub3D, 0x1e98, 1); + OUT_RING(0); + + BEGIN_RING_SIZE(NvSub3D, 0x120, 3); + OUT_RING(0); + OUT_RING(1); + OUT_RING(2); + + return GL_TRUE; } /* Update buffer offset/pitch/format */ @@ -599,26 +713,57 @@ static GLboolean nv20BindBuffers(nouveauContextPtr nmesa, int num_color, nouveau_renderbuffer **color, nouveau_renderbuffer *depth) { - return GL_TRUE; -} + GLuint x, y, w, h; + GLuint pitch, format, depth_pitch; + + w = color[0]->mesa.Width; + h = color[0]->mesa.Height; + x = nmesa->drawX; + y = nmesa->drawY; + + if (num_color != 1) + return GL_FALSE; + + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_VIEWPORT_HORIZ, 6); + OUT_RING_CACHE((w << 16) | x); + OUT_RING_CACHE((h << 16) | y); + depth_pitch = (depth ? depth->pitch : color[0]->pitch); + pitch = (depth_pitch<<16) | color[0]->pitch; + format = 0x128; + if (color[0]->mesa._ActualFormat != GL_RGBA8) { + format = 0x123; /* R5G6B5 color buffer */ + } + OUT_RING_CACHE(format); + OUT_RING_CACHE(pitch); + OUT_RING_CACHE(color[0]->offset); + OUT_RING_CACHE(depth ? depth->offset : color[0]->offset); + + if (depth) { + BEGIN_RING_SIZE(NvSub3D, NV20_TCL_PRIMITIVE_3D_LMA_DEPTH_BUFFER_PITCH, 2); + /* TODO: use a different buffer */ + OUT_RING(depth->pitch); + OUT_RING(depth->offset); + } -/* Update anything that depends on the window position/size */ -static void nv20WindowMoved(nouveauContextPtr nmesa) -{ + /* Always set to bottom left of buffer */ + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_VIEWPORT_ORIGIN_X, 4); + OUT_RING_CACHEf (0.0); + OUT_RING_CACHEf ((GLfloat) h); + OUT_RING_CACHEf (0.0); + OUT_RING_CACHEf (0.0); + + return GL_TRUE; } void nv20InitStateFuncs(GLcontext *ctx, struct dd_function_table *func) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); - nmesa->hw_func.InitCard = nv20InitCard; - nmesa->hw_func.BindBuffers = nv20BindBuffers; - nmesa->hw_func.WindowMoved = nv20WindowMoved; - func->AlphaFunc = nv20AlphaFunc; func->BlendColor = nv20BlendColor; func->BlendEquationSeparate = nv20BlendEquationSeparate; func->BlendFuncSeparate = nv20BlendFuncSeparate; + func->Clear = nv20Clear; func->ClearColor = nv20ClearColor; func->ClearDepth = nv20ClearDepth; func->ClearStencil = nv20ClearStencil; @@ -641,22 +786,21 @@ void nv20InitStateFuncs(GLcontext *ctx, struct dd_function_table *func) func->PointParameterfv = nv20PointParameterfv; func->PointSize = nv20PointSize; func->PolygonMode = nv20PolygonMode; -#if 0 func->PolygonOffset = nv20PolygonOffset; func->PolygonStipple = nv20PolygonStipple; - func->ReadBuffer = nv20ReadBuffer; - func->RenderMode = nv20RenderMode; -#endif +/* func->ReadBuffer = nv20ReadBuffer;*/ +/* func->RenderMode = nv20RenderMode;*/ func->Scissor = nv20Scissor; func->ShadeModel = nv20ShadeModel; func->StencilFuncSeparate = nv20StencilFuncSeparate; func->StencilMaskSeparate = nv20StencilMaskSeparate; func->StencilOpSeparate = nv20StencilOpSeparate; -#if 0 - func->TexGen = nv20TexGen; - func->TexParameter = nv20TexParameter; +/* func->TexGen = nv20TexGen;*/ +/* func->TexParameter = nv20TexParameter;*/ func->TextureMatrix = nv20TextureMatrix; -#endif - func->Viewport = nv20Viewport; + + nmesa->hw_func.InitCard = nv20InitCard; + nmesa->hw_func.BindBuffers = nv20BindBuffers; + nmesa->hw_func.WindowMoved = nv20WindowMoved; } -- cgit v1.2.3 From 0fccb646e0c83f6bb4c8b453cc2e915e8cee21f1 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Fri, 16 Feb 2007 22:09:42 +0100 Subject: nouveau: nv20: texture matrix --- src/mesa/drivers/dri/nouveau/nv20_state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/nouveau/nv20_state.c b/src/mesa/drivers/dri/nouveau/nv20_state.c index bcca69daf0..417590d729 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state.c @@ -617,7 +617,10 @@ void (*TexParameter)(GLcontext *ctx, GLenum target, static void nv20TextureMatrix(GLcontext *ctx, GLuint unit, const GLmatrix *mat) { - /* TODO */ + nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); + BEGIN_RING_CACHE(NvSub3D, NV20_TCL_PRIMITIVE_3D_TX_MATRIX(unit, 0), 16); + /*XXX: This SHOULD work.*/ + OUT_RING_CACHEp(mat->m, 16); } /* Update anything that depends on the window position/size */ -- cgit v1.2.3 From 4cc4a753fa3c41e5ef1890a9a03c97d3c39b6535 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Fri, 16 Feb 2007 22:39:12 +0100 Subject: nouveau: nv10,20: wrong viewport clip setup --- src/mesa/drivers/dri/nouveau/nv10_state.c | 4 +++- src/mesa/drivers/dri/nouveau/nv20_state.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nv10_state.c b/src/mesa/drivers/dri/nouveau/nv10_state.c index cc0f5a7220..e0475bb3da 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state.c @@ -658,8 +658,10 @@ static void nv10WindowMoved(nouveauContextPtr nmesa) OUT_RING(0); BEGIN_RING_CACHE(NvSub3D, - NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 2); + NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 1); OUT_RING_CACHE(((w+x-1) << 16) | x | 0x08000800); + BEGIN_RING_CACHE(NvSub3D, + NV10_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(0), 1); OUT_RING_CACHE(((h+y-1) << 16) | y | 0x08000800); for (i=1; i<8; i++) { BEGIN_RING_CACHE(NvSub3D, diff --git a/src/mesa/drivers/dri/nouveau/nv20_state.c b/src/mesa/drivers/dri/nouveau/nv20_state.c index 417590d729..030713c0db 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_state.c +++ b/src/mesa/drivers/dri/nouveau/nv20_state.c @@ -642,8 +642,10 @@ static void nv20WindowMoved(nouveauContextPtr nmesa) OUT_RING(0); BEGIN_RING_CACHE(NvSub3D, - NV20_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 2); + NV20_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 1); OUT_RING_CACHE((4095 << 16) | 0); + BEGIN_RING_CACHE(NvSub3D, + NV20_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_VERT(0), 1); OUT_RING_CACHE((4095 << 16) | 0); for (i=1; i<8; i++) { BEGIN_RING_CACHE(NvSub3D, -- cgit v1.2.3 From 21f2f7f26b5b9ab9f219f2bd22c68bcaa8cbdfe3 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Fri, 16 Feb 2007 22:39:28 +0100 Subject: nouveau: nv50: update --- src/mesa/drivers/dri/nouveau/nv50_state.c | 76 ++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/nouveau/nv50_state.c b/src/mesa/drivers/dri/nouveau/nv50_state.c index d03c6bf6f2..818e268615 100644 --- a/src/mesa/drivers/dri/nouveau/nv50_state.c +++ b/src/mesa/drivers/dri/nouveau/nv50_state.c @@ -293,7 +293,11 @@ static void nv50Enable(GLcontext *ctx, GLenum cap, GLboolean state) // case GL_POST_COLOR_MATRIX_COLOR_TABLE: // case GL_POST_CONVOLUTION_COLOR_TABLE: // case GL_RESCALE_NORMAL: -// case GL_SCISSOR_TEST: + case GL_SCISSOR_TEST: + /* No enable bit, nv50Scissor will adjust to max range */ + ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y, + ctx->Scissor.Width, ctx->Scissor.Height); + break; // case GL_SEPARABLE_2D: case GL_STENCIL_TEST: // TODO BACK and FRONT ? @@ -416,6 +420,21 @@ void (*RenderMode)(GLcontext *ctx, GLenum mode ); static void nv50Scissor(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { nouveauContextPtr nmesa = NOUVEAU_CONTEXT(ctx); + + /* There's no scissor enable bit, so adjust the scissor to cover the + * maximum draw buffer bounds + */ + if (!ctx->Scissor.Enabled) { + x = y = 0; + w = h = 8191; + } else { + x += nmesa->drawX; + y += nmesa->drawY; + } + + BEGIN_RING_CACHE(NvSub3D, NV50_TCL_PRIMITIVE_3D_SCISSOR_WIDTH_XPOS, 2); + OUT_RING_CACHE(((w) << 16) | x); + OUT_RING_CACHE(((h) << 16) | y); } /** Select flat or smooth shading */ @@ -503,10 +522,65 @@ static void nv50TextureMatrix(GLcontext *ctx, GLuint unit, const GLmatrix *mat) static void nv50WindowMoved(nouveauContextPtr nmesa) { + GLcontext *ctx = nmesa->glCtx; + GLfloat *v = nmesa->viewport.m; + GLuint w = ctx->Viewport.Width; + GLuint h = ctx->Viewport.Height; + GLuint x = ctx->Viewport.X + nmesa->drawX; + GLuint y = ctx->Viewport.Y + nmesa->drawY; + int i; + + BEGIN_RING_CACHE(NvSub3D, + NV50_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(0), 2); + OUT_RING_CACHE((8191 << 16) | 0); + OUT_RING_CACHE((8191 << 16) | 0); + for (i=1; i<8; i++) { + BEGIN_RING_CACHE(NvSub3D, + NV50_TCL_PRIMITIVE_3D_VIEWPORT_CLIP_HORIZ(i), 2); + OUT_RING_CACHE(0); + OUT_RING_CACHE(0); + } + + ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y, + ctx->Scissor.Width, ctx->Scissor.Height); } static GLboolean nv50InitCard(nouveauContextPtr nmesa) { + int i,j; + + nouveauObjectOnSubchannel(nmesa, NvSub3D, Nv3D); + + BEGIN_RING_SIZE(NvSub3D, 0x1558, 1); + OUT_RING(1); + + BEGIN_RING_SIZE(NvSub3D, NV50_TCL_PRIMITIVE_3D_SET_OBJECT_1(0), 8); + for (i=0; i<8; i++) { + OUT_RING(NvDmaFB); + } + + BEGIN_RING_SIZE(NvSub3D, NV50_TCL_PRIMITIVE_3D_SET_OBJECT_0(0), 12); + for (i=0; i<12; i++) { + OUT_RING(NvDmaFB); + } + + BEGIN_RING_SIZE(NvSub3D, 0x121c, 1); + OUT_RING(1); + + for (i=0; i<8; i++) { + BEGIN_RING_SIZE(NvSub3D, 0x0200 + (i*0x20), 5); + for (j=0; j<5; j++) { + OUT_RING(0); + } + } + + BEGIN_RING_SIZE(NvSub3D, 0x0fe0, 5); + OUT_RING(0); + OUT_RING(0); + OUT_RING(0x16); + OUT_RING(0); + OUT_RING(0); + return GL_FALSE; } -- cgit v1.2.3 From c2e0570831ae130fce1fa374bebe25bb9c561e29 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 16 Feb 2007 23:18:56 +0100 Subject: Update doxygen doc to reflet vbo changes. Update doxygen doc, array_cache no longuer exist, new shiny vbo modules is there. Tested on unix, but i think i didn't broke that bat :). --- doxygen/Makefile | 2 +- doxygen/array_cache.doxy | 50 ----------------------------------------------- doxygen/doxy.bat | 4 ++-- doxygen/glapi.doxy | 2 +- doxygen/header.html | 2 +- doxygen/main.doxy | 2 +- doxygen/math.doxy | 2 +- doxygen/shader.doxy | 2 +- doxygen/swrast.doxy | 2 +- doxygen/swrast_setup.doxy | 2 +- doxygen/tnl.doxy | 2 +- doxygen/tnl_dd.doxy | 2 +- doxygen/vbo.doxy | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 13 files changed, 62 insertions(+), 62 deletions(-) delete mode 100644 doxygen/array_cache.doxy create mode 100644 doxygen/vbo.doxy diff --git a/doxygen/Makefile b/doxygen/Makefile index 055b17386d..e67900474e 100644 --- a/doxygen/Makefile +++ b/doxygen/Makefile @@ -9,7 +9,7 @@ all: full subset FULL = \ main.doxy \ math.doxy \ - array_cache.doxy \ + vbo.doxy \ glapi.doxy \ shader.doxy \ swrast.doxy \ diff --git a/doxygen/array_cache.doxy b/doxygen/array_cache.doxy deleted file mode 100644 index ae0b1fa139..0000000000 --- a/doxygen/array_cache.doxy +++ /dev/null @@ -1,50 +0,0 @@ -# Doxyfile 0.1 - -@INCLUDE = common.doxy - -#--------------------------------------------------------------------------- -# General configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = "Mesa array_cache" -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src/mesa/array_cache/ -FILE_PATTERNS = *.c \ - *.h -RECURSIVE = NO -EXCLUDE = -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -HTML_OUTPUT = array_cache -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::addtions related to external references -#--------------------------------------------------------------------------- -TAGFILES = main.tag=../core \ - math.tag=../math \ - shader.tag=../shader \ - swrast.tag=../swrast \ - swrast_setup.tag=../swrast_setup \ - tnl.tag=../tnl \ - tnl_dd.tag=../tnl_dd -GENERATE_TAGFILE = array_cache.tag diff --git a/doxygen/doxy.bat b/doxygen/doxy.bat index 2d8b567ce3..7a53f6ebc2 100644 --- a/doxygen/doxy.bat +++ b/doxygen/doxy.bat @@ -1,5 +1,5 @@ doxygen tnl_dd.doxy -doxygen array_cache.doxy +doxygen vbo.doxy doxygen math.doxy doxygen swrast.doxy doxygen swrast_setup.doxy @@ -10,7 +10,7 @@ doxygen shader.doxy echo Building again, to resolve tags doxygen tnl_dd.doxy -doxygen array_cache.doxy +doxygen vbo.doxy doxygen math.doxy doxygen swrast.doxy doxygen swrast_setup.doxy diff --git a/doxygen/glapi.doxy b/doxygen/glapi.doxy index eafc2a109a..3290f8455a 100644 --- a/doxygen/glapi.doxy +++ b/doxygen/glapi.doxy @@ -45,5 +45,5 @@ TAGFILES = main.tag=../core \ swrast.tag=../swrast \ swrast_setup.tag=../swrast_setup \ tnl.tag=../tnl \ - array_cache.tag=array_cache + vbo.tag=vbo GENERATE_TAGFILE = swrast.tag diff --git a/doxygen/header.html b/doxygen/header.html index 5ca2763e0d..7fca3ee5d3 100644 --- a/doxygen/header.html +++ b/doxygen/header.html @@ -7,7 +7,7 @@
core | glapi | -array_cache | +vbo | math | shader | swrast | diff --git a/doxygen/main.doxy b/doxygen/main.doxy index 3cb05967aa..416b4338e8 100644 --- a/doxygen/main.doxy +++ b/doxygen/main.doxy @@ -40,7 +40,7 @@ SKIP_FUNCTION_MACROS = YES # Configuration::addtions related to external references #--------------------------------------------------------------------------- TAGFILES = tnl_dd.tag=../tnl_dd \ - array_cache.tag=../array_cache \ + vbo.tag=../vbo \ glapi.tag=../glapi \ math.tag=../math \ shader.tag=../shader \ diff --git a/doxygen/math.doxy b/doxygen/math.doxy index 72ec2e3cd2..388af40fe5 100644 --- a/doxygen/math.doxy +++ b/doxygen/math.doxy @@ -45,5 +45,5 @@ TAGFILES = tnl_dd.tag=../tnl_dd \ swrast.tag=../swrast \ swrast_setup.tag=../swrast_setup \ tnl.tag=../tnl \ - array_cache.tag=../array_cache + vbo.tag=../vbo GENERATE_TAGFILE = math.tag diff --git a/doxygen/shader.doxy b/doxygen/shader.doxy index 44fc7c4cfe..d8ad14cc76 100644 --- a/doxygen/shader.doxy +++ b/doxygen/shader.doxy @@ -45,5 +45,5 @@ TAGFILES = main.tag=../core \ swrast.tag=../swrast \ swrast_setup.tag=../swrast_setup \ tnl.tag=../tnl \ - array_cache.tag=array_cache + vbo.tag=vbo GENERATE_TAGFILE = swrast.tag diff --git a/doxygen/swrast.doxy b/doxygen/swrast.doxy index b0ba953676..fa07afd594 100644 --- a/doxygen/swrast.doxy +++ b/doxygen/swrast.doxy @@ -44,5 +44,5 @@ TAGFILES = main.tag=../core \ tnl_dd.tag=../tnl_dd \ swrast_setup.tag=../swrast_setup \ tnl.tag=../tnl \ - array_cache.tag=array_cache + vbo.tag=vbo GENERATE_TAGFILE = swrast.tag diff --git a/doxygen/swrast_setup.doxy b/doxygen/swrast_setup.doxy index 9e2d72e36e..ee6f3ffdc8 100644 --- a/doxygen/swrast_setup.doxy +++ b/doxygen/swrast_setup.doxy @@ -45,5 +45,5 @@ TAGFILES = tnl_dd.tag=../tnl_dd \ math.tag=../math \ swrast.tag=../swrast \ tnl.tag=../tnl \ - array_cache.tag=../array_cache + vbo.tag=../vbo GENERATE_TAGFILE = swrast_setup.tag diff --git a/doxygen/tnl.doxy b/doxygen/tnl.doxy index 67f992f11e..a4f76a2953 100644 --- a/doxygen/tnl.doxy +++ b/doxygen/tnl.doxy @@ -46,5 +46,5 @@ TAGFILES = tnl_dd.tag=../tnl \ shader.tag=../shader \ swrast.tag=../swrast \ swrast_setup.tag=swrast_setup \ - array_cache.tag=array_cache + vbo.tag=vbo GENERATE_TAGFILE = tnl.tag diff --git a/doxygen/tnl_dd.doxy b/doxygen/tnl_dd.doxy index b7bd6e9744..b241f67f4b 100644 --- a/doxygen/tnl_dd.doxy +++ b/doxygen/tnl_dd.doxy @@ -45,5 +45,5 @@ TAGFILES = main.tag=../core \ swrast.tag=../swrast \ swrast_setup.tag=../swrast_setup \ tnl.tag=../tnl \ - array_cache.tag=array_cache + vbo.tag=vbo GENERATE_TAGFILE = tnl_dd.tag diff --git a/doxygen/vbo.doxy b/doxygen/vbo.doxy new file mode 100644 index 0000000000..6dfb21cf4f --- /dev/null +++ b/doxygen/vbo.doxy @@ -0,0 +1,50 @@ +# Doxyfile 0.1 + +@INCLUDE = common.doxy + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = "Mesa vbo" +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = ../src/mesa/vbo/ +FILE_PATTERNS = *.c \ + *.h +RECURSIVE = NO +EXCLUDE = +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +HTML_OUTPUT = vbo +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- +TAGFILES = main.tag=../core \ + math.tag=../math \ + shader.tag=../shader \ + swrast.tag=../swrast \ + swrast_setup.tag=../swrast_setup \ + tnl.tag=../tnl \ + tnl_dd.tag=../tnl_dd +GENERATE_TAGFILE = vbo.tag -- cgit v1.2.3 From 515f495f4ee7b9618082135900e1c1ec5cfd0e2d Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Fri, 16 Feb 2007 23:22:04 +0100 Subject: doxygen: update doxygen project number to 6.5 doxygen number was laggin behind a bit. --- doxygen/common.doxy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doxygen/common.doxy b/doxygen/common.doxy index 1b5e5fece6..48f0c95d6d 100644 --- a/doxygen/common.doxy +++ b/doxygen/common.doxy @@ -23,7 +23,7 @@ PROJECT_NAME = Mesa # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 6.2 +PROJECT_NUMBER = 6.5 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. -- cgit v1.2.3