/* $Id: Exp $ *************************************************************************** X server for LibGLTEX - XGLTEX specific data- and prototypes Copyright (C) 2002 Christopher Alexander North-Keys http://www.talisman.org/~erlkonig/ *************************************************************************** */ #ifndef _INCLUDED_XGLTEX_H #define _INCLUDED_XGLTEX_H #include #include "scrnintstr.h" typedef struct _xgltexArgument_t { char *option_long; char *option_short; /* exactly 2 chars, '-' and one more */ int optarg_required; /* if 0, the unsigned int target is set to 1 */ char *sscanf_format; /* should be 0 if optarg_required is false */ void *sscanf_target; /* no support for multiple optargs */ char *help; } xgltexArgument_t; typedef enum { XGLTEX_RESREQ_NONE = 0, /* no request */ XGLTEX_RESREQ_SHMAT, /* attach to indicated shared memory id */ XGLTEX_RESREQ_SHMGET, /* create a shmem segm and report the shmid */ XGLTEX_RESREQ_INVALID, /* end of list */ } xgltexResource_t; /* using "unsigned int" instead of "bool" because 1) this isn't C++ and */ /* 2) sscanf is too stupid to read a number into an "unsigned char". */ typedef struct _xgltexTexture_t { /* (comp_bits == 1) not initially supported */ /* (comp_lsb == ?) not initially supported */ /* OUTPUT */ unsigned long int xsize; /* pixels >= 1 */ unsigned long int ysize; /* pixels >= 1, == 1 for mono/luminance */ unsigned long int zsize; /* bytes >= 1, typically 1/2/3/4 */ unsigned int comp_bits; /* { 1 8 16 32 } for component size */ unsigned int pixel_bits; /* { 1 8 16 24 32 48 64 } w/padding */ unsigned int alloc_fail; /* bool: did alloc of shmid/image fail? */ unsigned int comp_lsb; /* bool: must image comp's little-endian?*/ unsigned long int image_bytes; /* total size in bytes of the used image */ unsigned long int xsize2; /* xsize rounded up to nearest 2^N */ unsigned long int ysize2; /* ysize rounded up to nearest 2^N */ unsigned long int image_bytes2;/* total size in bytes of texture arena */ unsigned long int xsize2pad; /* gap between xsize and xsize2 */ unsigned long int ysize2pad; /* gap between xsize and xsize2 */ void *image; /* data vector for pixels (not layers), not * allocated: points in shmem or the like */ xgltexResource_t resource; /* how memory for tex is acquired */ int shmid; /* shared memory id */ unsigned long int shmbytes; /* bytes actually allocated for shmid */ void *shmaddr; /* location of shmem - matches .image */ /* X */ ScreenPtr xscreen; /* from xgltexFBInitProc */ /* INPUT */ /* not yet implemented */ } xgltexTexture_t; typedef struct _xgltexVars_t { unsigned char initted; /* false if init is needed, MUST BE FIRST */ xgltexTexture_t tex; /* parsed command line arguments */ xgltexTexture_t cmd; /* x/y/zsize, *_bits, comp_lsb, shmid/bytes */ } xgltexVars_t; extern xgltexVars_t xgltexVars; extern void xgltexVarsTexClear(xgltexTexture_t *tex, int finalize); extern void xgltexVarsClear(); /* deallocates resources in use */ extern int xgltexVarsActivate(); /* .tex << .cmd , then full setup */ extern int xgltexSetPixel(unsigned int x, unsigned int y, float r, float g, float b, float a); extern int xgltexSetRectangle(unsigned int x0, unsigned int y0, unsigned int w, unsigned int h, float r, float g, float b, float a); extern void xgltexTestPattern(); extern const char *xgltexResourceToString(xgltexResource_t r); extern void xgltexVarsTexPrint(FILE *out, xgltexTexture_t *tex); extern void xgltexVarsPrint(FILE *out); extern void xgltexUsage(void); extern int xgltexProcessArg(int argc, char *argv[], int argi); #endif /* _INCLUDED_XGLTEX_H - put nothing after this line */