X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Ftnl%2Ft_vb_render.c;h=aff5b9a6832e651f3b6b5e3ac907070d4af57dca;hb=bd69f65f90ecfa45e43a72504d277cb39f00e1c1;hp=cbeb9d5f71fafd5aa75d8d0f1cc20636942e8b08;hpb=3d38361b718d490e1e7fda64519952ec887cd149;p=mesa.git diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c index cbeb9d5f71f..aff5b9a6832 100644 --- a/src/mesa/tnl/t_vb_render.c +++ b/src/mesa/tnl/t_vb_render.c @@ -1,9 +1,7 @@ - /* * Mesa 3-D graphics library - * Version: 5.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -18,12 +16,13 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * * Authors: - * Keith Whitwell + * Keith Whitwell */ @@ -39,14 +38,12 @@ */ -#include "glheader.h" -#include "context.h" -#include "enums.h" -#include "macros.h" -#include "imports.h" -#include "mtypes.h" -#include "nvfragprog.h" -#include "math/m_matrix.h" +#include "main/glheader.h" +#include "main/context.h" +#include "main/enums.h" +#include "main/macros.h" +#include "main/imports.h" +#include "main/mtypes.h" #include "math/m_xform.h" #include "t_pipeline.h" @@ -77,7 +74,8 @@ #define EDGEFLAG_SET(idx, val) VB->EdgeFlag[idx] = val -#define CLIPMASK (CLIP_ALL_BITS|CLIP_CULL_BIT) +/* This does NOT include the CLIP_USER_BIT! */ +#define CLIPMASK (CLIP_FRUSTUM_BITS | CLIP_CULL_BIT) /* Vertices, with the possibility of clipping. @@ -133,7 +131,6 @@ do { \ #define TAG(x) clip_##x##_verts #define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) #define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) -#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE #define PRESERVE_VB_DEFS #include "t_vb_rendertmp.h" @@ -149,7 +146,7 @@ do { \ /* TODO: do this for all primitives, verts and elts: */ -static void clip_elt_triangles( GLcontext *ctx, +static void clip_elt_triangles( struct gl_context *ctx, GLuint start, GLuint count, GLuint flags ) @@ -220,7 +217,6 @@ static void clip_elt_triangles( GLcontext *ctx, (void) elt; (void) stipple #define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx ) -#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE #define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x ) #define RENDER_TAB_QUALIFIER #define PRESERVE_VB_DEFS @@ -239,7 +235,7 @@ static void clip_elt_triangles( GLcontext *ctx, /* Helper functions for drivers */ /**********************************************************************/ -void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) +void _tnl_RenderClippedPolygon( struct gl_context *ctx, const GLuint *elts, GLuint n ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; @@ -250,7 +246,7 @@ void _tnl_RenderClippedPolygon( GLcontext *ctx, const GLuint *elts, GLuint n ) VB->Elts = tmp; } -void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) +void _tnl_RenderClippedLine( struct gl_context *ctx, GLuint ii, GLuint jj ) { TNLcontext *tnl = TNL_CONTEXT(ctx); tnl->Driver.Render.Line( ctx, ii, jj ); @@ -263,12 +259,11 @@ void _tnl_RenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) /**********************************************************************/ -static GLboolean run_render( GLcontext *ctx, +static GLboolean run_render( struct gl_context *ctx, struct tnl_pipeline_stage *stage ) { TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; - GLuint new_inputs = stage->changed_inputs; tnl_render_func *tab; GLint pass = 0; @@ -293,7 +288,7 @@ static GLboolean run_render( GLcontext *ctx, ASSERT(tnl->Driver.Render.ClippedPolygon); ASSERT(tnl->Driver.Render.Finish); - tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, new_inputs ); + tnl->Driver.Render.BuildVertices( ctx, 0, VB->Count, ~0 ); if (VB->ClipOrMask) { tab = VB->Elts ? clip_render_tab_elts : clip_render_tab_verts; @@ -311,11 +306,11 @@ static GLboolean run_render( GLcontext *ctx, for (i = 0 ; i < VB->PrimitiveCount ; i++) { - GLuint prim = VB->Primitive[i].mode; + GLuint prim = _tnl_translate_prim(&VB->Primitive[i]); GLuint start = VB->Primitive[i].start; GLuint length = VB->Primitive[i].count; - assert((prim & PRIM_MODE_MASK) < GL_POLYGON+1); + assert((prim & PRIM_MODE_MASK) <= GL_POLYGON); if (MESA_VERBOSE & VERBOSE_PRIMS) _mesa_debug(NULL, "MESA prim %s %d..%d\n", @@ -340,41 +335,14 @@ static GLboolean run_render( GLcontext *ctx, -/* Quite a bit of work involved in finding out the inputs for the - * render stage. - */ -static void check_render( GLcontext *ctx, struct tnl_pipeline_stage *stage ) -{ - stage->inputs = TNL_CONTEXT(ctx)->render_inputs; -} - - - - -static void dtr( struct tnl_pipeline_stage *stage ) -{ -} const struct tnl_pipeline_stage _tnl_render_stage = { "render", /* name */ - (_NEW_BUFFERS | - _DD_NEW_SEPARATE_SPECULAR | - _DD_NEW_FLATSHADE | - _NEW_TEXTURE| - _NEW_LIGHT| - _NEW_POINT| - _NEW_FOG| - _DD_NEW_TRI_UNFILLED | - _NEW_RENDERMODE), /* re-check (new inputs, interp function) */ - 0, /* re-run (always runs) */ - GL_TRUE, /* active? */ - 0, /* inputs (set in check_render) */ - 0, /* outputs */ - 0, /* changed_inputs */ NULL, /* private data */ - dtr, /* destructor */ - check_render, /* check */ + NULL, /* creator */ + NULL, /* destructor */ + NULL, /* validate */ run_render /* run */ };