From 066f0097959fe705c57556b658a09af0ba6be8fb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 30 Mar 2010 19:59:51 -0600 Subject: [PATCH] mesa: initial data structures for transform feedback --- src/mesa/main/config.h | 5 +++++ src/mesa/main/mfeatures.h | 1 + src/mesa/main/mtypes.h | 43 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 2eac1cc2ed9..30b48e4bd08 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -262,6 +262,11 @@ /** For GL_ATI_envmap_bump - support bump mapping on first 8 units */ #define SUPPORTED_ATI_BUMP_UNITS 0xff +/** For GL_EXT_transform_feedback */ +#define MAX_FEEDBACK_ATTRIBS 32 + + + /** * \name Mesa-specific parameters */ diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 54edf9e7f01..6ed05da7ac8 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -135,6 +135,7 @@ #define FEATURE_EXT_framebuffer_object 1 #define FEATURE_EXT_pixel_buffer_object 1 #define FEATURE_EXT_texture_sRGB FEATURE_GL +#define FEATURE_EXT_transform_feedback FEATURE_GL #define FEATURE_APPLE_object_purgeable FEATURE_GL #define FEATURE_ATI_fragment_shader FEATURE_GL diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 82e004f3486..7657efb0773 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1910,6 +1910,11 @@ struct gl_query_state /** GL_NV_conditional_render */ struct gl_query_object *CondRenderQuery; + + /** GL_EXT_transform_feedback */ + struct gl_query_object *PrimitivesGenerated; + struct gl_query_object *PrimitivesWritten; + GLenum CondRenderMode; }; @@ -1976,6 +1981,13 @@ struct gl_shader_program /** User-defined attribute bindings (glBindAttribLocation) */ struct gl_program_parameter_list *Attributes; + /** Transform feedback varyings */ + struct { + GLenum BufferMode; + GLuint NumVarying; + GLchar **VaryingNames; /**< Array [NumVarying] of char * */ + } TransformFeedback; + /* post-link info: */ struct gl_vertex_program *VertexProgram; /**< Linked vertex program */ struct gl_fragment_program *FragmentProgram; /**< Linked fragment prog */ @@ -2016,6 +2028,29 @@ struct gl_shader_state }; +/** + * Context state for transform feedback. + */ +struct gl_transform_feedback +{ + GLboolean Active; /**< Is transform feedback enabled? */ + GLenum Mode; /**< GL_POINTS, GL_LINES or GL_TRIANGLES */ + /** Start of feedback data in dest buffer */ + GLintptr Offset[MAX_FEEDBACK_ATTRIBS]; + /** Max data to put into dest buffer (in bytes) */ + GLsizeiptr Size[MAX_FEEDBACK_ATTRIBS]; + GLboolean RasterDiscard; /**< GL_RASTERIZER_DISCARD */ + + /** The general binding point (GL_TRANSFORM_FEEDBACK_BUFFER) */ + struct gl_buffer_object *CurrentBuffer; + + /** The feedback buffers */ + GLuint BufferNames[MAX_FEEDBACK_ATTRIBS]; + struct gl_buffer_object *Buffers[MAX_FEEDBACK_ATTRIBS]; +}; + + + /** * State which can be shared by multiple contexts: */ @@ -2388,6 +2423,11 @@ struct gl_constants /**< OpenGL version 3.x */ GLbitfield ContextFlags; /**< Ex: GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT */ + + /** GL_EXT_transform_feedback */ + GLuint MaxTransformFeedbackSeparateAttribs; + GLuint MaxTransformFeedbackSeparateComponents; + GLuint MaxTransformFeedbackInterleavedComponents; }; @@ -2489,6 +2529,7 @@ struct gl_extensions GLboolean EXT_texture_mirror_clamp; GLboolean EXT_texture_sRGB; GLboolean EXT_texture_swizzle; + GLboolean EXT_transform_feedback; GLboolean EXT_timer_query; GLboolean EXT_vertex_array; GLboolean EXT_vertex_array_bgra; @@ -2956,6 +2997,8 @@ struct __GLcontextRec struct gl_query_state Query; /**< occlusion, timer queries */ + struct gl_transform_feedback TransformFeedback; + struct gl_buffer_object *CopyReadBuffer; /**< GL_ARB_copy_buffer */ struct gl_buffer_object *CopyWriteBuffer; /**< GL_ARB_copy_buffer */ /*@}*/ -- 2.30.2