#define _T_CONTEXT_H
#include "main/glheader.h"
-#include "main/imports.h"
+
#include "main/mtypes.h"
#include "math/m_vector.h"
#include "vbo/vbo.h"
+#include "tnl.h"
+
#define MAX_PIPELINE_STAGES 30
/*
* generic attribute in order to pick up per-vertex material
* data.
*/
- _TNL_ATTRIB_MAT_FRONT_AMBIENT = _TNL_ATTRIB_GENERIC0,
+ _TNL_ATTRIB_MAT_FRONT_AMBIENT=VERT_ATTRIB_MAT(MAT_ATTRIB_FRONT_AMBIENT),
_TNL_ATTRIB_MAT_BACK_AMBIENT,
_TNL_ATTRIB_MAT_FRONT_DIFFUSE,
_TNL_ATTRIB_MAT_BACK_DIFFUSE,
#define _TNL_FIRST_GENERIC _TNL_ATTRIB_GENERIC0
#define _TNL_LAST_GENERIC _TNL_ATTRIB_GENERIC15
-#define _TNL_FIRST_MAT _TNL_ATTRIB_MAT_FRONT_AMBIENT /* GENERIC0 */
-#define _TNL_LAST_MAT _TNL_ATTRIB_MAT_BACK_INDEXES /* GENERIC11 */
+#define _TNL_FIRST_MAT _TNL_ATTRIB_MAT_FRONT_AMBIENT /* GENERIC4 */
+#define _TNL_LAST_MAT _TNL_ATTRIB_MAT_BACK_INDEXES /* GENERIC15 */
/* Number of available texture attributes */
#define _TNL_NUM_TEX 8
* such as backface color or eye-space coordinates, they are stored
* here.
*/
- GLuint *Elts;
+ GLuint *Elts;
GLvector4f *EyePtr; /* _TNL_BIT_POS */
GLvector4f *ClipPtr; /* _TNL_BIT_POS */
GLvector4f *NdcPtr; /* _TNL_BIT_POS */
GLvector4f *BackfaceColorPtr;
GLvector4f *BackfaceSecondaryColorPtr;
- const struct _mesa_prim *Primitive;
- GLuint PrimitiveCount;
+ const struct _mesa_prim *Primitive;
+ GLuint PrimitiveCount;
/* Inputs to the vertex program stage */
GLvector4f *AttribPtr[_TNL_ATTRIB_MAX];
/** Contains the array of all pipeline stages.
- * The default values are defined at the end of t_pipeline.c
+ * The default values are defined at the end of t_pipeline.c
*/
struct tnl_pipeline {
-
+
GLuint last_attrib_stride[_TNL_ATTRIB_MAX];
GLuint last_attrib_size[_TNL_ATTRIB_MAX];
GLuint input_changes;
struct tnl_clipspace;
struct tnl_clipspace_attr;
-typedef void (*tnl_extract_func)( const struct tnl_clipspace_attr *a,
- GLfloat *out,
+typedef void (*tnl_extract_func)( const struct tnl_clipspace_attr *a,
+ GLfloat *out,
const GLubyte *v );
-typedef void (*tnl_insert_func)( const struct tnl_clipspace_attr *a,
- GLubyte *v,
+typedef void (*tnl_insert_func)( const struct tnl_clipspace_attr *a,
+ GLubyte *v,
const GLfloat *in );
-typedef void (*tnl_emit_func)( struct gl_context *ctx,
- GLuint count,
+typedef void (*tnl_emit_func)( struct gl_context *ctx,
+ GLuint count,
GLubyte *dest );
struct tnl_clipspace
{
GLboolean need_extras;
-
+
GLuint new_inputs;
GLubyte *vertex_buf;
/* Parameters and constants for codegen:
*/
GLboolean need_viewport;
- GLfloat vp_scale[4];
+ GLfloat vp_scale[4];
GLfloat vp_xlate[4];
GLfloat chan_scale[4];
GLfloat identity[4];
struct tnl_clipspace_fastpath *fastpath;
-
+
void (*codegen_emit)( struct gl_context *ctx );
};
void (*RunPipeline)(struct gl_context *ctx);
/* Replaces PipelineStart/PipelineFinish -- intended to allow
* drivers to wrap _tnl_run_pipeline() with code to validate state
- * and grab/release hardware locks.
+ * and grab/release hardware locks.
*/
void (*NotifyMaterialChange)(struct gl_context *ctx);
*
* This function is called only from _tnl_render_stage in tnl/t_render.c.
*/
-
+
GLboolean (*Multipass)( struct gl_context *ctx, GLuint passno );
/* Driver may request additional render passes by returning GL_TRUE
};
+/**
+ * Utility that tracks and updates the current array entries.
+ */
+struct tnl_inputs
+{
+ /**
+ * Array of inputs to be set to the _DrawArrays pointer.
+ * The array contains pointers into the _DrawVAO and to the vbo modules
+ * current values. The array of pointers is updated incrementally
+ * based on the current and vertex_processing_mode values below.
+ */
+ struct tnl_vertex_array inputs[VERT_ATTRIB_MAX];
+ /** Those VERT_BIT_'s where the inputs array point to current values. */
+ GLbitfield current;
+ /** Store which aliasing current values - generics or materials - are set. */
+ gl_vertex_processing_mode vertex_processing_mode;
+};
+
+
+/**
+ * Initialize inputs.
+ */
+void
+_tnl_init_inputs(struct tnl_inputs *inputs);
+
+
+/**
+ * Update the tnl_vertex_array array inside the tnl_inputs structure
+ * provided the current _VPMode, the provided vao and
+ * the vao's enabled arrays filtered by the filter bitmask.
+ */
+void
+_tnl_update_inputs(struct gl_context *ctx, struct tnl_inputs *inputs);
+
+
/**
* Context state for T&L context.
*/
GLvector4f tmp_inputs[VERT_ATTRIB_MAX];
- /* Temp storage for t_draw.c:
+ /* Temp storage for t_draw.c:
*/
GLubyte *block[VERT_ATTRIB_MAX];
GLuint nr_blocks;
struct tnl_shine_tab *_ShineTable[2]; /**< Active shine tables */
struct tnl_shine_tab *_ShineTabList; /**< MRU list of inactive shine tables */
/**@}*/
+
+ /* The list of tnl_vertex_array inputs. */
+ struct tnl_inputs draw_arrays;
} TNLcontext;