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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/*
* Copyright (c) 2026 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Radoslaw Kujawa.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Mesa driver for the Rendition Verite V2200 over librlgl
* (NetBSD /dev/verite3d) - "veritemesa".
*/
#ifndef VRDRV_H
#define VRDRV_H
#include "glheader.h"
#include "mtypes.h"
#include "rlgl.h"
#include "vrperf.h"
typedef struct vrmesa_context {
GLcontext glctx; /* base class -- must be first */
GLvisual glvis;
GLframebuffer glfb;
struct rlgl rl;
GLboolean hw_tris; /* state allows PE triangles */
GLboolean engine_dirty; /* PE work queued, spans must fence */
GLboolean span_front; /* swrast SetBuffer chose front */
/* hardware texture stage (vrtex.c) */
struct vr_texture *textures; /* all driver texture data */
GLuint lru_tick;
GLboolean tex_on; /* this render run is textured */
GLfloat tex_w, tex_h; /* texel scales for u/v emit */
GLfloat tex_off; /* 0.5 iff bilinear (GL footprint) */
GLfloat tex_base_w, tex_base_h; /* level-0 dims (LOD) */
/* per-polygon mipmapping (vrtris picks a level per triangle) */
struct vr_texture *tex_cur; /* validated binding */
GLboolean tex_mip; /* MIN filter is a mipmap one */
GLboolean tex_min_bilin; /* LINEAR_MIPMAP_* */
GLboolean tex_mag_bilin; /* MagFilter == LINEAR */
GLint cur_level; /* bound level (bind cache) */
GLint cur_bilin; /* SrcFilter cache (-1 unset) */
/* hardware blend: source alpha rides PE FGColor bits 31:24 */
GLboolean blend_alpha; /* hw blend factors read src alpha */
GLboolean atest_alpha; /* alpha test needs composed ColorAlpha */
GLuint fg_alpha; /* cached FGColor alpha (~0 = unset) */
/* swsetup's Render.Start, wrapped by vr_render_start */
void (*ss_render_start)(GLcontext *);
/* swsetup's current tri/quad/line/point funcs (restored on fallback) */
void (*ss_triangle)(GLcontext *, GLuint, GLuint, GLuint);
void (*ss_quad)(GLcontext *, GLuint, GLuint, GLuint,
GLuint);
void (*ss_line)(GLcontext *, GLuint, GLuint);
void (*ss_points)(GLcontext *, GLuint, GLuint);
void *ss_prim_verts, *ss_prim_elts;
GLboolean use_strips; /* VRMESA_STRIPS: opt-in native tri-fans */
GLboolean strips_ok; /* this run's state permits them */
void (*ss_build_vertices)(GLcontext *, GLuint, GLuint,
GLuint);
GLboolean use_fastbuild; /* VRMESA_NOFASTBUILD unset (default on) */
GLboolean fastbuild_ok; /* this run's inputs are fast-pathable */
GLboolean fb_tex, fb_fog; /* fast build emits texcoord0 / fog */
} vrmesa_context;
#define VRMESA_CONTEXT(ctx) ((vrmesa_context *)(ctx))
/* vrdd.c */
extern void vrInitDDFuncs(struct dd_function_table *functions);
/* VRAM base of a GL_FRONT/GL_BACK color buffer (rl.fb[back] = draw) */
extern uint32_t vr_fb_base(struct rlgl *rl, GLenum buffer);
/* vrspan.c */
extern void vrInitSpanFuncs(GLcontext *ctx);
extern void vrFence(vrmesa_context *vmesa);
/* vrtex.c */
struct vr_texture;
struct rlgl_tex;
extern void vrInitTexConsts(GLcontext *ctx);
extern void vrInitTexFuncs(struct dd_function_table *functions);
extern GLboolean vrTexHwOk(GLcontext *ctx);
extern GLboolean vrTexValidate(GLcontext *ctx);
extern struct rlgl_tex *vrTexLevel(struct vr_texture *t, GLint level);
extern GLint vrTexNumLevels(struct vr_texture *t);
extern void vrTexNewFrame(void);
/* vrtris.c */
extern void vrInitTriFuncs(GLcontext *ctx);
extern void vrCheckHwRender(GLcontext *ctx);
extern GLboolean vrBlendMap(const GLcontext *ctx, GLuint *srcf,
GLuint *dstf, GLboolean *needs_alpha);
#endif /* VRDRV_H */
|