X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Ftnl%2Ft_context.h;h=a5bcdb80dbba1d01edadeaa8f9fee7c8563a6e33;hb=30f4ccff5bd7304a623d2909aaf8de35727ce03d;hp=67a87f26af552061441e00375b171365504a0c35;hpb=2116b974189b4d58d02bc1c9810aef820eed71b6;p=mesa.git diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 67a87f26af5..a5bcdb80dbb 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -50,13 +50,15 @@ #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 /* @@ -77,7 +79,6 @@ */ enum { _TNL_ATTRIB_POS, - _TNL_ATTRIB_WEIGHT, _TNL_ATTRIB_NORMAL, _TNL_ATTRIB_COLOR0, _TNL_ATTRIB_COLOR1, @@ -127,7 +128,7 @@ enum { * 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, @@ -150,7 +151,7 @@ enum { /** * Handy attribute ranges: */ -#define _TNL_FIRST_PROG _TNL_ATTRIB_WEIGHT +#define _TNL_FIRST_PROG _TNL_ATTRIB_NORMAL #define _TNL_LAST_PROG _TNL_ATTRIB_TEX7 #define _TNL_FIRST_TEX _TNL_ATTRIB_TEX0 @@ -159,8 +160,8 @@ enum { #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 @@ -204,7 +205,7 @@ struct vertex_buffer * 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 */ @@ -217,8 +218,8 @@ struct vertex_buffer 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]; @@ -263,10 +264,10 @@ struct tnl_pipeline_stage /** 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; @@ -279,16 +280,16 @@ struct tnl_pipeline { 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 ); @@ -356,7 +357,7 @@ struct tnl_clipspace_fastpath { struct tnl_clipspace { GLboolean need_extras; - + GLuint new_inputs; GLubyte *vertex_buf; @@ -373,13 +374,13 @@ struct tnl_clipspace /* 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 ); }; @@ -407,7 +408,7 @@ struct tnl_device_driver 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); @@ -482,7 +483,7 @@ struct tnl_device_driver * * 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 @@ -497,6 +498,41 @@ struct tnl_device_driver }; +/** + * 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. */ @@ -527,7 +563,7 @@ typedef struct 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; @@ -537,6 +573,9 @@ typedef struct 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;