all repos — mgba @ c6ff504e66f44f1480cc9a30531139ea96f37b0d

mGBA Game Boy Advance Emulator

include/mgba/internal/ds/gx/software.h (view raw)

 1/* Copyright (c) 2013-2017 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef DS_GX_SOFTWARE_H
 7#define DS_GX_SOFTWARE_H
 8
 9#include <mgba-util/common.h>
10
11CXX_GUARD_START
12
13#include <mgba/internal/ds/gx.h>
14#include <mgba/internal/ds/video.h>
15#include <mgba-util/vector.h>
16
17struct DSGXSoftwarePolygon {
18	struct DSGXPolygon* poly;
19	int32_t topY;
20	int32_t bottomY;
21	int32_t topZ;
22};
23
24struct DSGXSoftwareEdge {
25	struct DSGXPolygon* poly;
26	int32_t y0;
27	int32_t x0;
28	int32_t w0;
29	int32_t c0; // 6.6.6.6 ARGB
30	int16_t s0;
31	int16_t t0;
32
33	int32_t y1;
34	int32_t x1;
35	int32_t w1;
36	int32_t c1; // 6.6.6.6 ARGB
37	int16_t s1;
38	int16_t t1;
39};
40
41DECLARE_VECTOR(DSGXSoftwarePolygonList, struct DSGXSoftwarePolygon);
42DECLARE_VECTOR(DSGXSoftwareEdgeList, struct DSGXSoftwareEdge);
43
44struct DSGXSoftwareRenderer {
45	struct DSGXRenderer d;
46
47	struct DSGXSoftwarePolygonList activePolys;
48	struct DSGXSoftwareEdgeList activeEdges;
49
50	uint16_t depthBuffer[DS_VIDEO_HORIZONTAL_PIXELS];
51	color_t* scanlineCache;
52
53	struct DSGXVertex* verts;
54};
55
56CXX_GUARD_END
57
58#endif