aboutsummaryrefslogtreecommitdiff
path: root/src/mesa/drivers/verite/vrdrv.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/verite/vrdrv.h')
-rw-r--r--src/mesa/drivers/verite/vrdrv.h125
1 files changed, 125 insertions, 0 deletions
diff --git a/src/mesa/drivers/verite/vrdrv.h b/src/mesa/drivers/verite/vrdrv.h
new file mode 100644
index 0000000..9762e95
--- /dev/null
+++ b/src/mesa/drivers/verite/vrdrv.h
@@ -0,0 +1,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 */