summaryrefslogtreecommitdiff
path: root/src/mesa/tnl/t_context.h
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2004-06-30 11:48:21 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2004-06-30 11:48:21 +0000
commit009aa3ef5ea6bc13c903d6f902b7039adef8fc74 (patch)
tree5a5cf488e21fc1445732af4d86a0f8622c343023 /src/mesa/tnl/t_context.h
parent8e77da1cd7d63af5e7ffcf7ea220cdaf1bdc8162 (diff)
Add infrastructure for t_vertex.c codegen. Add an example driver
for this which spits out C code for the generated functions.
Diffstat (limited to 'src/mesa/tnl/t_context.h')
-rw-r--r--src/mesa/tnl/t_context.h43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index 3d099b205a..7e1aaead88 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -524,6 +524,7 @@ struct tnl_pipeline {
GLuint nr_stages;
};
+struct tnl_clipspace;
struct tnl_clipspace_attr;
typedef void (*extract_func)( const struct tnl_clipspace_attr *a, GLfloat *out,
@@ -532,6 +533,9 @@ typedef void (*extract_func)( const struct tnl_clipspace_attr *a, GLfloat *out,
typedef void (*insert_func)( const struct tnl_clipspace_attr *a, GLubyte *v,
const GLfloat *in );
+typedef void (*emit_func)( GLcontext *ctx, GLuint start,
+ GLuint end, void *dest );
+
/**
* Describes how to convert/move a vertex attribute from a vertex array
@@ -540,6 +544,7 @@ typedef void (*insert_func)( const struct tnl_clipspace_attr *a, GLubyte *v,
struct tnl_clipspace_attr
{
GLuint attrib; /* which vertex attrib (0=position, etc) */
+ GLuint format;
GLuint vertoffset; /* position of the attrib in the vertex struct */
GLuint vertattrsize; /* size of the attribute in bytes */
GLubyte *inputptr;
@@ -551,6 +556,40 @@ struct tnl_clipspace_attr
};
+struct tnl_clipspace_codegen {
+ GLboolean (*emit_header)( struct tnl_clipspace_codegen *,
+ struct tnl_clipspace *);
+ GLboolean (*emit_footer)( struct tnl_clipspace_codegen * );
+ GLboolean (*emit_attr_header)( struct tnl_clipspace_codegen *,
+ struct tnl_clipspace_attr *,
+ GLint j, GLenum out_type,
+ GLboolean need_vp );
+ GLboolean (*emit_attr_footer)( struct tnl_clipspace_codegen * );
+ GLboolean (*emit_mov)( struct tnl_clipspace_codegen *,
+ GLint, GLint );
+ GLboolean (*emit_const)( struct tnl_clipspace_codegen *,
+ GLint, GLfloat );
+ GLboolean (*emit_mad)( struct tnl_clipspace_codegen *,
+ GLint, GLint, GLint, GLint );
+ GLboolean (*emit_float_to_chan)( struct tnl_clipspace_codegen *,
+ GLint, GLint );
+ GLboolean (*emit_const_chan)( struct tnl_clipspace_codegen *,
+ GLint, GLchan );
+ GLboolean (*emit_float_to_ubyte)( struct tnl_clipspace_codegen *,
+ GLint, GLint );
+ GLboolean (*emit_const_ubyte)( struct tnl_clipspace_codegen *,
+ GLint, GLubyte );
+ emit_func (*emit_store_func)( struct tnl_clipspace_codegen * );
+
+ struct _tnl_dynfn codegen_list;
+
+ char *buf;
+ int buf_size;
+ int buf_used;
+ int out_offset;
+};
+
+
typedef void (*points_func)( GLcontext *ctx, GLuint first, GLuint last );
typedef void (*line_func)( GLcontext *ctx, GLuint v1, GLuint v2 );
@@ -586,9 +625,11 @@ struct tnl_clipspace
struct tnl_clipspace_attr attr[_TNL_ATTRIB_MAX];
GLuint attr_count;
- void (*emit)( GLcontext *ctx, GLuint start, GLuint end, void *dest );
+ emit_func emit;
interp_func interp;
copy_pv_func copy_pv;
+
+ struct tnl_clipspace_codegen codegen;
};