summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/ffb/ffb_points.c
blob: 5bf4f8f070777a1e7c76f0f350b7a8ee755f4615 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* 
 *
 * GLX Hardware Device Driver for Sun Creator/Creator3D
 * Copyright (C) 2000, 2001 David S. Miller
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * 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
 * DAVID MILLER, OR ANY OTHER CONTRIBUTORS 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.
 *
 *
 *    David S. Miller <davem@redhat.com>
 */

#include "main/mtypes.h"
#include "ffb_dd.h"
#include "ffb_context.h"
#include "ffb_vb.h"
#include "ffb_points.h"


#undef FFB_POINT_TRACE

#define FFB_POINT_AA_BIT	0x01

static ffb_point_func ffb_point_tab[0x08];

#define IND (0)
#define TAG(x) x
#include "ffb_pointtmp.h"

#define IND (FFB_POINT_AA_BIT)
#define TAG(x) x##_aa
#include "ffb_pointtmp.h"

void ffbDDPointfuncInit(void)
{
	init();
	init_aa();
}

static void ffb_dd_points( GLcontext *ctx, GLuint first, GLuint last )
{
	struct vertex_buffer *VB = &TNL_CONTEXT( ctx )->vb;
	ffbContextPtr fmesa = FFB_CONTEXT(ctx);
	ffb_vertex *fverts = fmesa->verts;
	int i;

	if (VB->Elts == 0) {
		for ( i = first ; i < last ; i++ ) {
			if ( VB->ClipMask[i] == 0 ) {
				fmesa->draw_point( ctx, &fverts[i] );
			}
		}
	} else {
		for ( i = first ; i < last ; i++ ) {
			GLuint e = VB->Elts[i];
			if ( VB->ClipMask[e] == 0 ) {
				fmesa->draw_point( ctx, &fverts[e] );
			}
		}
	}
}

void ffbChoosePointState(GLcontext *ctx)
{
	ffbContextPtr fmesa = FFB_CONTEXT(ctx);
 	TNLcontext *tnl = TNL_CONTEXT(ctx);
	GLuint flags = ctx->_TriangleCaps;
	GLuint ind = 0;

	tnl->Driver.Render.Points = ffb_dd_points;

	if (flags & DD_POINT_SMOOTH)
		ind |= FFB_POINT_AA_BIT;

	fmesa->draw_point = ffb_point_tab[ind];
}