📄 mtypes.h
字号:
* All values should fit in a 4-bit field. */enum register_file{ PROGRAM_TEMPORARY = 0, PROGRAM_LOCAL_PARAM = 1, PROGRAM_ENV_PARAM = 2, PROGRAM_STATE_VAR = 3, PROGRAM_INPUT = 4, PROGRAM_OUTPUT = 5, PROGRAM_NAMED_PARAM = 6, PROGRAM_CONSTANT = 7, PROGRAM_WRITE_ONLY = 8, PROGRAM_ADDRESS = 9, PROGRAM_UNDEFINED = 15 /* invalid value */};/** Vertex and fragment instructions */struct prog_instruction;struct program_parameter_list;/** * Base class for any kind of program object */struct program{ GLuint Id; GLubyte *String; /**< Null-terminated program text */ GLint RefCount; GLenum Target; GLenum Format; /**< String encoding format */ GLboolean Resident; struct prog_instruction *Instructions; GLbitfield InputsRead; /* Bitmask of which input regs are read */ GLbitfield OutputsWritten; /* Bitmask of which output regs are written to */ /** Named parameters, constants, etc. from program text */ struct program_parameter_list *Parameters; /** Numbered local parameters */ GLfloat LocalParams[MAX_PROGRAM_LOCAL_PARAMS][4]; /** Logical counts */ /*@{*/ GLuint NumInstructions; GLuint NumTemporaries; GLuint NumParameters; GLuint NumAttributes; GLuint NumAddressRegs; /*@}*/ /** Native, actual h/w counts */ /*@{*/ GLuint NumNativeInstructions; GLuint NumNativeTemporaries; GLuint NumNativeParameters; GLuint NumNativeAttributes; GLuint NumNativeAddressRegs; /*@}*/};/** Vertex program object */struct vertex_program{ struct program Base; /* base class */ GLboolean IsNVProgram; /* GL_NV_vertex_program ? */ GLboolean IsPositionInvariant; /* GL_ARB_vertex_program / GL_NV_vertex_program1_1 */ void *TnlData; /* should probably use Base.DriverData */};/** Fragment program object */struct fragment_program{ struct program Base; /**< base class */ GLbitfield TexturesUsed[MAX_TEXTURE_IMAGE_UNITS]; /**< TEXTURE_x_BIT bitmask */ GLuint NumAluInstructions; /**< GL_ARB_fragment_program */ GLuint NumTexInstructions; GLuint NumTexIndirections; GLuint NumNativeAluInstructions; /**< GL_ARB_fragment_program */ GLuint NumNativeTexInstructions; GLuint NumNativeTexIndirections; GLenum FogOption; GLboolean UsesKill;};/** * State common to vertex and fragment programs. */struct gl_program_state{ GLint ErrorPos; /* GL_PROGRAM_ERROR_POSITION_ARB/NV */ const char *ErrorString; /* GL_PROGRAM_ERROR_STRING_ARB/NV */};/** * State vars for GL_ARB/GL_NV_vertex_program */struct gl_vertex_program_state{ GLboolean Enabled; /**< GL_VERTEX_PROGRAM_ARB/NV */ GLboolean _Enabled; /**< Enabled and valid program? */ GLboolean PointSizeEnabled; /**< GL_VERTEX_PROGRAM_POINT_SIZE_ARB/NV */ GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */ struct vertex_program *Current; /**< ptr to currently bound program */ struct vertex_program *_Current; /**< ptr to currently bound program, including internal (t_vp_build.c) programs */ GLenum TrackMatrix[MAX_NV_VERTEX_PROGRAM_PARAMS / 4]; GLenum TrackMatrixTransform[MAX_NV_VERTEX_PROGRAM_PARAMS / 4]; GLfloat Parameters[MAX_NV_VERTEX_PROGRAM_PARAMS][4]; /* Env params */ /* Only used during program execution (may be moved someday): */ GLfloat Temporaries[MAX_NV_VERTEX_PROGRAM_TEMPS][4]; GLfloat Inputs[MAX_NV_VERTEX_PROGRAM_INPUTS][4]; GLuint InputsSize[MAX_NV_VERTEX_PROGRAM_INPUTS]; GLfloat Outputs[MAX_NV_VERTEX_PROGRAM_OUTPUTS][4]; GLint AddressReg[4];#if FEATURE_MESA_program_debug GLprogramcallbackMESA Callback; GLvoid *CallbackData; GLboolean CallbackEnabled; GLuint CurrentPosition;#endif};/** * Context state for GL_ARB/NV_fragment_program */struct gl_fragment_program_state{ GLboolean Enabled; /* GL_VERTEX_PROGRAM_NV */ GLboolean _Enabled; /* Enabled and valid program? */ GLboolean _Active; struct fragment_program *Current; /* ptr to currently bound program */ struct fragment_program *_Current; /* ptr to currently active program (including internal programs) */ struct fp_machine Machine; /* machine state */ GLfloat Parameters[MAX_NV_FRAGMENT_PROGRAM_PARAMS][4]; /* Env params */#if FEATURE_MESA_program_debug GLprogramcallbackMESA Callback; GLvoid *CallbackData; GLboolean CallbackEnabled; GLuint CurrentPosition;#endif};/** * ATI_fragment_shader runtime state */#define ATI_FS_INPUT_PRIMARY 0#define ATI_FS_INPUT_SECONDARY 1struct atifs_instruction;struct atifs_setupinst;/** * State for executing ATI fragment shader. */struct atifs_machine{ GLfloat Registers[6][4]; /** six temporary registers */ GLfloat PrevPassRegisters[6][4]; GLfloat Inputs[2][4]; /** Primary, secondary input colors */};/** * ATI fragment shader */struct ati_fragment_shader{ GLuint Id; GLint RefCount; struct atifs_instruction *Instructions[2]; struct atifs_setupinst *SetupInst[2]; GLfloat Constants[8][4]; GLbitfield LocalConstDef; /** Indicates which constants have been set */ GLubyte numArithInstr[2]; GLubyte regsAssigned[2]; GLubyte NumPasses; /** 1 or 2 */ GLubyte cur_pass; GLubyte last_optype; GLboolean interpinp1; GLboolean isValid; GLuint swizzlerq;};/** * Context state for GL_ATI_fragment_shader */struct gl_ati_fragment_shader_state{ GLboolean Enabled; GLboolean _Enabled; /** enabled and valid shader? */ GLboolean Compiling; GLfloat GlobalConstants[8][4]; struct atifs_machine Machine; /* machine state */ struct ati_fragment_shader *Current;};/** * Occlusion/timer query object. */struct gl_query_object{ GLuint Id; GLuint64EXT Result; /* the counter */ GLboolean Active; /* inside Begin/EndQuery */ GLboolean Ready; /* result is ready */};/** * Context state for query objects. */struct gl_query_state{ struct _mesa_HashTable *QueryObjects; struct gl_query_object *CurrentOcclusionObject; /* GL_ARB_occlusion_query */ struct gl_query_object *CurrentTimerObject; /* GL_EXT_timer_query */};/** * Context state for vertex/fragment shaders. */struct gl_shader_objects_state{ struct gl2_program_intf **CurrentProgram; GLboolean _VertexShaderPresent; GLboolean _FragmentShaderPresent;};/** * State which can be shared by multiple contexts: */struct gl_shared_state{ _glthread_Mutex Mutex; /**< for thread safety */ GLint RefCount; /**< Reference count */ struct _mesa_HashTable *DisplayList; /**< Display lists hash table */ struct _mesa_HashTable *TexObjects; /**< Texture objects hash table */ /** * \name Default texture objects (shared by all multi-texture units) */ /*@{*/ struct gl_texture_object *Default1D; struct gl_texture_object *Default2D; struct gl_texture_object *Default3D; struct gl_texture_object *DefaultCubeMap; struct gl_texture_object *DefaultRect; /*@}*/ /** * \name Vertex/fragment programs */ /*@{*/ struct _mesa_HashTable *Programs; /**< All vertex/fragment programs */#if FEATURE_ARB_vertex_program struct program *DefaultVertexProgram;#endif#if FEATURE_ARB_fragment_program struct program *DefaultFragmentProgram;#endif /*@}*/#if FEATURE_ATI_fragment_shader struct _mesa_HashTable *ATIShaders; struct ati_fragment_shader *DefaultFragmentShader;#endif#if FEATURE_ARB_vertex_buffer_object || FEATURE_ARB_pixel_buffer_object struct _mesa_HashTable *BufferObjects;#endif struct _mesa_HashTable *GL2Objects;#if FEATURE_EXT_framebuffer_object struct _mesa_HashTable *RenderBuffers; struct _mesa_HashTable *FrameBuffers;#endif void *DriverData; /**< Device driver shared state */};/** * A renderbuffer stores colors or depth values or stencil values. * A framebuffer object will have a collection of these. * Data are read/written to the buffer with a handful of Get/Put functions. * * Instances of this object are allocated with the Driver's NewRenderbuffer * hook. Drivers will likely wrap this class inside a driver-specific * class to simulate inheritance. */struct gl_renderbuffer{ _glthread_Mutex Mutex; /**< for thread safety */ GLuint ClassID; /**< Useful for drivers */ GLuint Name; GLint RefCount; GLuint Width, Height; GLenum InternalFormat; /**< The user-specified format */ GLenum _ActualFormat; /**< The driver-chosen format */ GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or GL_STENCIL_INDEX. */ GLenum DataType; /**< Type of values passed to the Get/Put functions */ GLubyte RedBits; /**< Bits of red per pixel */ GLubyte GreenBits; GLubyte BlueBits; GLubyte AlphaBits; GLubyte IndexBits; GLubyte DepthBits; GLubyte StencilBits; GLvoid *Data; /* Used to wrap one renderbuffer around another: */ struct gl_renderbuffer *Wrapped; /* Delete this renderbuffer */ void (*Delete)(struct gl_renderbuffer *rb); /* Allocate new storage for this renderbuffer */ GLboolean (*AllocStorage)(GLcontext *ctx, struct gl_renderbuffer *rb, GLenum internalFormat, GLuint width, GLuint height); /* Lock/Unlock are called before/after calling the Get/Put functions. * Not sure this is the right place for these yet. void (*Lock)(GLcontext *ctx, struct gl_renderbuffer *rb); void (*Unlock)(GLcontext *ctx, struct gl_renderbuffer *rb); */ /* Return a pointer to the element/pixel at (x,y). * Should return NULL if the buffer memory can't be directly addressed. */ void *(*GetPointer)(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y); /* Get/Read a row of values. * The values will be of format _BaseFormat and type DataType. */ void (*GetRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, void *values); /* Get/Read values at arbitrary locations. * The values will be of format _BaseFormat and type DataType. */ void (*GetValues)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], void *values); /* Put/Write a row of values. * The values will be of format _BaseFormat and type DataType. */ void (*PutRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask); /* Put/Write a row of RGB values. This is a special-case routine that's * only used for RGBA renderbuffers when the source data is GL_RGB. That's * a common case for glDrawPixels and some triangle routines. * The values will be of format GL_RGB and type DataType. */ void (*PutRowRGB)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *values, const GLubyte *mask); /* Put/Write a row of identical values. * The values will be of format _BaseFormat and type DataType. */ void (*PutMonoRow)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask); /* Put/Write values at arbitrary locations. * The values will be of format _BaseFormat and type DataType. */ void (*PutValues)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *values, const GLubyte *mask); /* Put/Write identical values at arbitrary locations. * The values will be of format _BaseFormat and type DataType. */ void (*PutMonoValues)(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLint x[], const GLint y[], const void *value, const GLubyte *mask);};/** * A renderbuffer attachment point points to either a texture object * (and specifies a mipmap level, cube face or 3D texture slice) or * points to a renderbuffer. */struct gl_renderbuffer_attachment{ GLenum Type; /* GL_NONE or GL_TEXTURE or GL_RENDERBUFFER_EXT */ GLboolean Complete; /* IF Type == GL_RENDERBUFFER_EXT: */ struct gl_renderbuffer *Renderbuffer; /* IF Type == GL_TEXTURE: */ struct gl_texture_object *Texture; GLuint TextureLevel; GLuint CubeMapFace; /* 0 .. 5, for cube map textures */ GLuint Zoffset; /* for 3D textures */};/** * A framebuffer is a collection of renderbuffers (color, depth, stencil, etc). * In C++ terms, think of this as a base class from which device drivers * will make derived classes. */struct gl_framebuffer{ _glthread_Mutex Mutex; /**< for thread safety */ GLuint Name; /* if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -