X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fr200%2Fr200_context.h;h=bec09e8ef6ab81fd2287bda5574fbd415bca8916;hb=eb9a5b6d5127858b01ec12672c999e7d25cd7aed;hp=f7d3d624336c2ae81cbf0b2dc1d3aad0edf6c389;hpb=3a5626cb846ad767fe1c38fe35ebe4df3e3a0454;p=mesa.git diff --git a/src/mesa/drivers/dri/r200/r200_context.h b/src/mesa/drivers/dri/r200/r200_context.h index f7d3d624336..bec09e8ef6a 100644 --- a/src/mesa/drivers/dri/r200/r200_context.h +++ b/src/mesa/drivers/dri/r200/r200_context.h @@ -1,4 +1,3 @@ -/* $XFree86: xc/lib/GL/mesa/src/drv/r200/r200_context.h,v 1.2 2002/12/16 16:18:54 dawes Exp $ */ /* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. @@ -46,13 +45,22 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "mtypes.h" #include "colormac.h" #include "r200_reg.h" +#include "r200_vertprog.h" #define ENABLE_HW_3D_TEXTURE 1 /* XXX this is temporary! */ +#ifndef R200_EMIT_VAP_PVS_CNTL +#error This driver requires a newer libdrm to compile +#endif + struct r200_context; typedef struct r200_context r200ContextRec; typedef struct r200_context *r200ContextPtr; +/* This union is used to avoid warnings/miscompilation + with float to uint32_t casts due to strict-aliasing */ +typedef union { GLfloat f; uint32_t ui32; } float_ui32_type; + #include "r200_lock.h" #include "radeon_screen.h" #include "mm.h" @@ -90,6 +98,20 @@ typedef void (*r200_point_func)( r200ContextPtr, r200Vertex * ); +struct r200_vertex_program { + struct gl_vertex_program mesa_program; /* Must be first */ + int translated; + /* need excess instr: 1 for late loop checking, 2 for + additional instr due to instr/attr, 3 for fog */ + VERTEX_SHADER_INSTRUCTION instr[R200_VSF_MAX_INST + 6]; + int pos_end; + int inputs[VERT_ATTRIB_MAX]; + GLubyte inputmap_rev[16]; + int native; + int fogpidx; + int fogmode; +}; + struct r200_colorbuffer_state { GLuint clear; #if 000 @@ -332,6 +354,34 @@ struct r200_state_atom { #define AFS_IA1 4 /* 2f0c */ #define AFS_STATE_SIZE 33 +#define PVS_CMD_0 0 +#define PVS_CNTL_1 1 +#define PVS_CNTL_2 2 +#define PVS_STATE_SIZE 3 + +/* those are quite big... */ +#define VPI_CMD_0 0 +#define VPI_OPDST_0 1 +#define VPI_SRC0_0 2 +#define VPI_SRC1_0 3 +#define VPI_SRC2_0 4 +#define VPI_OPDST_63 253 +#define VPI_SRC0_63 254 +#define VPI_SRC1_63 255 +#define VPI_SRC2_63 256 +#define VPI_STATE_SIZE 257 + +#define VPP_CMD_0 0 +#define VPP_PARAM0_0 1 +#define VPP_PARAM1_0 2 +#define VPP_PARAM2_0 3 +#define VPP_PARAM3_0 4 +#define VPP_PARAM0_95 381 +#define VPP_PARAM1_95 382 +#define VPP_PARAM2_95 383 +#define VPP_PARAM3_95 384 +#define VPP_STATE_SIZE 385 + #define TCL_CMD_0 0 #define TCL_LIGHT_MODEL_CTL_0 1 #define TCL_LIGHT_MODEL_CTL_1 2 @@ -399,9 +449,29 @@ struct r200_state_atom { /* SPR - point sprite state */ -#define SPR_CMD_0 0 -#define SPR_POINT_SPRITE_CNTL 1 -#define SPR_STATE_SIZE 2 +#define SPR_CMD_0 0 +#define SPR_POINT_SPRITE_CNTL 1 +#define SPR_STATE_SIZE 2 + +#define PTP_CMD_0 0 +#define PTP_VPORT_SCALE_0 1 +#define PTP_VPORT_SCALE_1 2 +#define PTP_VPORT_SCALE_PTSIZE 3 +#define PTP_VPORT_SCALE_3 4 +#define PTP_CMD_1 5 +#define PTP_ATT_CONST_QUAD 6 +#define PTP_ATT_CONST_LIN 7 +#define PTP_ATT_CONST_CON 8 +#define PTP_ATT_CONST_3 9 +#define PTP_EYE_X 10 +#define PTP_EYE_Y 11 +#define PTP_EYE_Z 12 +#define PTP_EYE_3 13 +#define PTP_CLAMP_MIN 14 +#define PTP_CLAMP_MAX 15 +#define PTP_CLAMP_2 16 +#define PTP_CLAMP_3 17 +#define PTP_STATE_SIZE 18 #define VTX_COLOR(v,n) (((v)>>(R200_VTX_COLOR_0_SHIFT+(n)*2))&\ R200_VTX_COLOR_MASK) @@ -563,8 +633,12 @@ struct r200_hw_state { struct r200_state_atom glt; struct r200_state_atom prf; struct r200_state_atom afs[2]; + struct r200_state_atom pvs; + struct r200_state_atom vpi[2]; + struct r200_state_atom vpp[2]; struct r200_state_atom atf; struct r200_state_atom spr; + struct r200_state_atom ptp; int max_state_size; /* Number of bytes necessary for a full state emit. */ GLboolean is_dirty, all_dirty; @@ -625,6 +699,7 @@ struct r200_dri_mirror { __DRIcontextPrivate *context; /* DRI context */ __DRIscreenPrivate *screen; /* DRI screen */ __DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */ + __DRIdrawablePrivate *readable; /* DRI readable bound to this ctx */ drm_context_t hwContext; drm_hw_lock_t *hwLock; @@ -633,7 +708,7 @@ struct r200_dri_mirror { }; -#define R200_CMD_BUF_SZ (8*1024) +#define R200_CMD_BUF_SZ (16*1024) struct r200_store { GLuint statenr; @@ -647,23 +722,16 @@ struct r200_store { /* r200_tcl.c */ struct r200_tcl_info { - GLuint vertex_format; - GLint last_offset; GLuint hw_primitive; -/* FIXME: what's the maximum number of components? */ - struct r200_dma_region *aos_components[11]; +/* hw can handle 12 components max */ + struct r200_dma_region *aos_components[12]; GLuint nr_aos_components; GLuint *Elts; struct r200_dma_region indexed_verts; - struct r200_dma_region obj; - struct r200_dma_region rgba; - struct r200_dma_region spec; - struct r200_dma_region fog; - struct r200_dma_region tex[R200_MAX_TEXTURE_UNITS]; - struct r200_dma_region norm; + struct r200_dma_region vertex_data[15]; }; @@ -733,87 +801,6 @@ struct r200_ioctl { #define R200_MAX_PRIMS 64 -/* Want to keep a cache of these around. Each is parameterized by - * only a single value which has only a small range. Only expect a - * few, so just rescan the list each time? - */ -struct dynfn { - struct dynfn *next, *prev; - int key[2]; - char *code; -}; - -struct dfn_lists { - struct dynfn Vertex2f; - struct dynfn Vertex2fv; - struct dynfn Vertex3f; - struct dynfn Vertex3fv; - struct dynfn Color4ub; - struct dynfn Color4ubv; - struct dynfn Color3ub; - struct dynfn Color3ubv; - struct dynfn Color4f; - struct dynfn Color4fv; - struct dynfn Color3f; - struct dynfn Color3fv; - struct dynfn SecondaryColor3ubEXT; - struct dynfn SecondaryColor3ubvEXT; - struct dynfn SecondaryColor3fEXT; - struct dynfn SecondaryColor3fvEXT; - struct dynfn Normal3f; - struct dynfn Normal3fv; - struct dynfn TexCoord3f; - struct dynfn TexCoord3fv; - struct dynfn TexCoord2f; - struct dynfn TexCoord2fv; - struct dynfn TexCoord1f; - struct dynfn TexCoord1fv; - struct dynfn MultiTexCoord3fARB; - struct dynfn MultiTexCoord3fvARB; - struct dynfn MultiTexCoord2fARB; - struct dynfn MultiTexCoord2fvARB; - struct dynfn MultiTexCoord1fARB; - struct dynfn MultiTexCoord1fvARB; - struct dynfn FogCoordfEXT; - struct dynfn FogCoordfvEXT; -}; - -struct dfn_generators { - struct dynfn *(*Vertex2f)( GLcontext *, const int * ); - struct dynfn *(*Vertex2fv)( GLcontext *, const int * ); - struct dynfn *(*Vertex3f)( GLcontext *, const int * ); - struct dynfn *(*Vertex3fv)( GLcontext *, const int * ); - struct dynfn *(*Color4ub)( GLcontext *, const int * ); - struct dynfn *(*Color4ubv)( GLcontext *, const int * ); - struct dynfn *(*Color3ub)( GLcontext *, const int * ); - struct dynfn *(*Color3ubv)( GLcontext *, const int * ); - struct dynfn *(*Color4f)( GLcontext *, const int * ); - struct dynfn *(*Color4fv)( GLcontext *, const int * ); - struct dynfn *(*Color3f)( GLcontext *, const int * ); - struct dynfn *(*Color3fv)( GLcontext *, const int * ); - struct dynfn *(*SecondaryColor3ubEXT)( GLcontext *, const int * ); - struct dynfn *(*SecondaryColor3ubvEXT)( GLcontext *, const int * ); - struct dynfn *(*SecondaryColor3fEXT)( GLcontext *, const int * ); - struct dynfn *(*SecondaryColor3fvEXT)( GLcontext *, const int * ); - struct dynfn *(*Normal3f)( GLcontext *, const int * ); - struct dynfn *(*Normal3fv)( GLcontext *, const int * ); - struct dynfn *(*TexCoord3f)( GLcontext *, const int * ); - struct dynfn *(*TexCoord3fv)( GLcontext *, const int * ); - struct dynfn *(*TexCoord2f)( GLcontext *, const int * ); - struct dynfn *(*TexCoord2fv)( GLcontext *, const int * ); - struct dynfn *(*TexCoord1f)( GLcontext *, const int * ); - struct dynfn *(*TexCoord1fv)( GLcontext *, const int * ); - struct dynfn *(*MultiTexCoord3fARB)( GLcontext *, const int * ); - struct dynfn *(*MultiTexCoord3fvARB)( GLcontext *, const int * ); - struct dynfn *(*MultiTexCoord2fARB)( GLcontext *, const int * ); - struct dynfn *(*MultiTexCoord2fvARB)( GLcontext *, const int * ); - struct dynfn *(*MultiTexCoord1fARB)( GLcontext *, const int * ); - struct dynfn *(*MultiTexCoord1fvARB)( GLcontext *, const int * ); - struct dynfn *(*FogCoordfEXT)( GLcontext *, const int * ); - struct dynfn *(*FogCoordfvEXT)( GLcontext *, const int * ); -}; - - struct r200_prim { GLuint start; @@ -834,43 +821,6 @@ struct r200_prim { #define R200_MAX_VERTEX_SIZE ((3*6)+11) -struct r200_vbinfo { - GLint counter, initial_counter; - GLint *dmaptr; - void (*notify)( void ); - GLint vertex_size; - - union { float f; int i; r200_color_t color; } vertex[R200_MAX_VERTEX_SIZE]; - - GLfloat *normalptr; - GLfloat *floatcolorptr; - GLfloat *fogptr; - r200_color_t *colorptr; - GLfloat *floatspecptr; - r200_color_t *specptr; - GLfloat *texcoordptr[8]; /* 6 (TMU) + 2 for r200_vtxfmt_c.c when GL_TEXTURE6/7 */ - - - GLenum *prim; /* &ctx->Driver.CurrentExecPrimitive */ - GLuint primflags; - GLboolean enabled; /* *_NO_VTXFMT / *_NO_TCL env vars */ - GLboolean installed; - GLboolean fell_back; - GLboolean recheck; - GLint nrverts; - GLuint vtxfmt_0, vtxfmt_1; - - GLuint installed_vertex_format; - GLuint installed_color_3f_sz; - - struct r200_prim primlist[R200_MAX_PRIMS]; - int nrprims; - - struct dfn_lists dfn_cache; - struct dfn_generators codegen; - GLvertexformat vtxfmt; -}; - struct r200_context { GLcontext *glCtx; /* Mesa context */ @@ -879,6 +829,7 @@ struct r200_context { */ struct r200_hw_state hw; struct r200_state state; + struct r200_vertex_program *curr_vp_hw; /* Texture object bookkeeping */ @@ -893,7 +844,7 @@ struct r200_context { GLuint TclFallback; GLuint Fallback; GLuint NewGLState; - GLuint tnl_index; /* index of bits for last tnl_install_attrs */ + DECLARE_RENDERINPUTS(tnl_index_bitset); /* index of bits for last tnl_install_attrs */ /* Vertex buffers */ @@ -961,10 +912,6 @@ struct r200_context { */ struct r200_swtcl_info swtcl; - /* r200_vtxfmt.c - */ - struct r200_vbinfo vb; - /* Mirrors of some DRI state */ struct r200_dri_mirror dri; @@ -1002,6 +949,8 @@ extern GLboolean r200CreateContext( const __GLcontextModes *glVisual, __DRIcontextPrivate *driContextPriv, void *sharedContextPrivate); extern void r200SwapBuffers( __DRIdrawablePrivate *dPriv ); +extern void r200CopySubBuffer( __DRIdrawablePrivate * dPriv, + int x, int y, int w, int h ); extern GLboolean r200MakeCurrent( __DRIcontextPrivate *driContextPriv, __DRIdrawablePrivate *driDrawPriv, __DRIdrawablePrivate *driReadPriv );