1/* 2 * Mesa 3-D graphics library 3 * 4 * Copyright (C) 2010 VMware, Inc. All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the "Software"), 8 * to deal in the Software without restriction, including without limitation 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 * and/or sell copies of the Software, and to permit persons to whom the 11 * Software is furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included 14 * in all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 * OTHER DEALINGS IN THE SOFTWARE. 23 */ 24 25 26#ifndef TRANSFORM_FEEDBACK_H 27#define TRANSFORM_FEEDBACK_H 28 29#include <stdbool.h> 30#include "bufferobj.h" 31#include "compiler.h" 32#include "glheader.h" 33#include "mtypes.h" 34 35struct _glapi_table; 36struct dd_function_table; 37struct gl_context; 38 39extern void 40_mesa_init_transform_feedback(struct gl_context *ctx); 41 42extern void 43_mesa_free_transform_feedback(struct gl_context *ctx); 44 45extern GLboolean 46_mesa_validate_transform_feedback_buffers(struct gl_context *ctx); 47 48 49extern void 50_mesa_init_transform_feedback_functions(struct dd_function_table *driver); 51 52extern unsigned 53_mesa_compute_max_transform_feedback_vertices( struct gl_context *ctx, 54 const struct gl_transform_feedback_object *obj, 55 const struct gl_transform_feedback_info *info); 56 57 58/*** GL_EXT_transform_feedback ***/ 59 60extern void GLAPIENTRY 61_mesa_BeginTransformFeedback(GLenum mode); 62 63extern void GLAPIENTRY 64_mesa_EndTransformFeedback(void); 65 66extern void 67_mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx, 68 struct gl_transform_feedback_object *obj, 69 GLuint index, 70 struct gl_buffer_object *bufObj, 71 GLintptr offset, 72 GLsizeiptr size, bool dsa); 73 74extern void 75_mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx, 76 struct gl_transform_feedback_object *obj, 77 GLuint index, 78 struct gl_buffer_object *bufObj, 79 bool dsa); 80 81extern void GLAPIENTRY 82_mesa_BindBufferOffsetEXT(GLenum target, GLuint index, GLuint buffer, 83 GLintptr offset); 84 85extern void GLAPIENTRY 86_mesa_TransformFeedbackVaryings(GLuint program, GLsizei count, 87 const GLchar * const *varyings, 88 GLenum bufferMode); 89 90extern void GLAPIENTRY 91_mesa_GetTransformFeedbackVarying(GLuint program, GLuint index, 92 GLsizei bufSize, GLsizei *length, 93 GLsizei *size, GLenum *type, GLchar *name); 94 95 96 97/*** GL_ARB_transform_feedback2 ***/ 98extern void 99_mesa_init_transform_feedback_object(struct gl_transform_feedback_object *obj, 100 GLuint name); 101 102struct gl_transform_feedback_object * 103_mesa_lookup_transform_feedback_object(struct gl_context *ctx, GLuint name); 104 105extern void GLAPIENTRY 106_mesa_GenTransformFeedbacks(GLsizei n, GLuint *names); 107 108extern void GLAPIENTRY 109_mesa_CreateTransformFeedbacks(GLsizei n, GLuint *names); 110 111extern GLboolean GLAPIENTRY 112_mesa_IsTransformFeedback(GLuint name); 113 114extern void GLAPIENTRY 115_mesa_BindTransformFeedback(GLenum target, GLuint name); 116 117extern void GLAPIENTRY 118_mesa_DeleteTransformFeedbacks(GLsizei n, const GLuint *names); 119 120extern void GLAPIENTRY 121_mesa_PauseTransformFeedback(void); 122 123extern void GLAPIENTRY 124_mesa_ResumeTransformFeedback(void); 125 126static inline bool 127_mesa_is_xfb_active_and_unpaused(const struct gl_context *ctx) 128{ 129 return ctx->TransformFeedback.CurrentObject->Active && 130 !ctx->TransformFeedback.CurrentObject->Paused; 131} 132 133extern bool 134_mesa_transform_feedback_is_using_program(struct gl_context *ctx, 135 struct gl_shader_program *shProg); 136 137static inline void 138_mesa_set_transform_feedback_binding(struct gl_context *ctx, 139 struct gl_transform_feedback_object *tfObj, GLuint index, 140 struct gl_buffer_object *bufObj, 141 GLintptr offset, GLsizeiptr size) 142{ 143 _mesa_reference_buffer_object(ctx, &tfObj->Buffers[index], bufObj); 144 145 tfObj->BufferNames[index] = bufObj->Name; 146 tfObj->Offset[index] = offset; 147 tfObj->RequestedSize[index] = size; 148 149 if (bufObj != ctx->Shared->NullBufferObj) 150 bufObj->UsageHistory |= USAGE_TRANSFORM_FEEDBACK_BUFFER; 151} 152 153/*** GL_ARB_direct_state_access ***/ 154 155extern void GLAPIENTRY 156_mesa_TransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer); 157 158extern void GLAPIENTRY 159_mesa_TransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer, 160 GLintptr offset, GLsizeiptr size); 161 162extern void GLAPIENTRY 163_mesa_GetTransformFeedbackiv(GLuint xfb, GLenum pname, GLint *param); 164 165extern void GLAPIENTRY 166_mesa_GetTransformFeedbacki_v(GLuint xfb, GLenum pname, GLuint index, 167 GLint *param); 168 169extern void GLAPIENTRY 170_mesa_GetTransformFeedbacki64_v(GLuint xfb, GLenum pname, GLuint index, 171 GLint64 *param); 172 173#endif /* TRANSFORM_FEEDBACK_H */ 174