summaryrefslogtreecommitdiff
path: root/tcl_triangle.c
blob: 064de670e0925ac92362c700ff361a2a3ae54984 (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
#include <stdio.h>

#include "screen.h"
#include "object.h"
#include "fifo.h"
#include "nouveau_class.h"

void tcl_triangle_fixed(void)
{
	printf("-- TCL triangle, fixed pipe\n");

	SetSubchannel(NvSub3D, Nv3D);

	/*
		3 for pos
		4 for color0
	*/
	BEGIN_RING(NvSub3D, NV34TCL_VTXFMT(0), 4);
	OUT_RING((3<<NV34TCL_VTXFMT_SIZE_SHIFT)|NV34TCL_VTXFMT_TYPE_FLOAT);
        OUT_RING(NV34TCL_VTXFMT_TYPE_FLOAT);
        OUT_RING(NV34TCL_VTXFMT_TYPE_FLOAT);
        OUT_RING((4<<NV34TCL_VTXFMT_SIZE_SHIFT)|NV34TCL_VTXFMT_TYPE_FLOAT);

	BEGIN_RING(NvSub3D, NV34TCL_VERTEX_BEGIN_END, 1);
	OUT_RING(NV34TCL_VERTEX_BEGIN_END_TRIANGLES);

	BEGIN_RING(NvSub3D, NV34TCL_VERTEX_DATA|METHOD_CONSTANT, 3*(4+3));
	OUT_RINGf(1.0); OUT_RINGf(0.0); OUT_RINGf(0.0); OUT_RINGf(1.0f);
	OUT_RINGf(1.0); OUT_RINGf(0.0); OUT_RINGf(0.0);
	OUT_RINGf(0.0); OUT_RINGf(1.0); OUT_RINGf(0.0); OUT_RINGf(1.0f);
	OUT_RINGf(0.0); OUT_RINGf(1.0); OUT_RINGf(0.0);
	OUT_RINGf(0.0); OUT_RINGf(0.0); OUT_RINGf(1.0); OUT_RINGf(1.0f);
	OUT_RINGf(0.0); OUT_RINGf(0.0); OUT_RINGf(1.0);

	BEGIN_RING(NvSub3D, NV34TCL_VERTEX_BEGIN_END, 1);
	OUT_RING(NV34TCL_VERTEX_BEGIN_END_STOP);

	FIRE_RING();
}

void tcl_triangle_vtxattr(void)
{
	printf("-- TCL triangle, vertex attribs\n");

	SetSubchannel(NvSub3D, Nv3D);

	/* set color, then pos */
	BEGIN_RING(NvSub3D, NV34TCL_VERTEX_BEGIN_END, 1);
	OUT_RING(NV34TCL_VERTEX_BEGIN_END_TRIANGLES);

	BEGIN_RING(NvSub3D, NV34TCL_VTX_ATTR_3F_X(3), 3);
	OUT_RINGf(1.0);
	OUT_RINGf(0.0);
	OUT_RINGf(0.0);
	BEGIN_RING(NvSub3D, NV34TCL_VTX_ATTR_3F_X(0), 3);
	OUT_RINGf(1.0);
	OUT_RINGf(0.0);
	OUT_RINGf(0.0);
	BEGIN_RING(NvSub3D, NV34TCL_VTX_ATTR_3F_X(3), 3);
	OUT_RINGf(0.0);
	OUT_RINGf(1.0);
	OUT_RINGf(0.0);
	BEGIN_RING(NvSub3D, NV34TCL_VTX_ATTR_3F_X(0), 3);
	OUT_RINGf(0.0);
	OUT_RINGf(1.0);
	OUT_RINGf(0.0);
	BEGIN_RING(NvSub3D, NV34TCL_VTX_ATTR_3F_X(3), 3);
	OUT_RINGf(0.0);
	OUT_RINGf(0.0);
	OUT_RINGf(1.0);
	BEGIN_RING(NvSub3D, NV34TCL_VTX_ATTR_3F_X(0), 3);
	OUT_RINGf(0.0);
	OUT_RINGf(0.0);
	OUT_RINGf(1.0);

	BEGIN_RING(NvSub3D, NV34TCL_VERTEX_BEGIN_END, 1);
	OUT_RING(NV34TCL_VERTEX_BEGIN_END_STOP);

	FIRE_RING();
}