summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-08-24 11:55:44 +0200
committerSamuel Pitoiset <[email protected]>2017-08-25 11:35:29 +0200
commit088d5cb44f9003db97c18d571e2d9d2bad0b60de (patch)
tree69ef0a35373f2d12a8dc8a88c72082538dd31896
parentb0590ace75d9f96fe11e53524993915ae0d98346 (diff)
mesa: add begin_transform_feedback() helper
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r--src/mesa/main/transformfeedback.c55
1 files changed, 35 insertions, 20 deletions
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c
index 307728c3995..f59f5a3f76c 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -381,22 +381,22 @@ get_xfb_source(struct gl_context *ctx)
}
-void GLAPIENTRY
-_mesa_BeginTransformFeedback(GLenum mode)
+static ALWAYS_INLINE void
+begin_transform_feedback(struct gl_context *ctx, GLenum mode, bool no_error)
{
struct gl_transform_feedback_object *obj;
struct gl_transform_feedback_info *info = NULL;
+ struct gl_program *source;
GLuint i;
unsigned vertices_per_prim;
- GET_CURRENT_CONTEXT(ctx);
obj = ctx->TransformFeedback.CurrentObject;
/* Figure out what pipeline stage is the source of data for transform
* feedback.
*/
- struct gl_program *source = get_xfb_source(ctx);
- if (source == NULL) {
+ source = get_xfb_source(ctx);
+ if (!no_error && source == NULL) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBeginTransformFeedback(no program active)");
return;
@@ -404,7 +404,7 @@ _mesa_BeginTransformFeedback(GLenum mode)
info = source->sh.LinkedTransformFeedback;
- if (info->NumOutputs == 0) {
+ if (!no_error && info->NumOutputs == 0) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBeginTransformFeedback(no varyings to record)");
return;
@@ -421,23 +421,30 @@ _mesa_BeginTransformFeedback(GLenum mode)
vertices_per_prim = 3;
break;
default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glBeginTransformFeedback(mode)");
- return;
+ if (!no_error) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBeginTransformFeedback(mode)");
+ return;
+ } else {
+ /* Stop compiler warnings */
+ unreachable("Error in API use when using KHR_no_error");
+ }
}
- if (obj->Active) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glBeginTransformFeedback(already active)");
- return;
- }
+ if (!no_error) {
+ if (obj->Active) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBeginTransformFeedback(already active)");
+ return;
+ }
- for (i = 0; i < ctx->Const.MaxTransformFeedbackBuffers; i++) {
- if ((info->ActiveBuffers >> i) & 1) {
- if (obj->BufferNames[i] == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glBeginTransformFeedback(binding point %d does not "
- "have a buffer object bound)", i);
- return;
+ for (i = 0; i < ctx->Const.MaxTransformFeedbackBuffers; i++) {
+ if ((info->ActiveBuffers >> i) & 1) {
+ if (obj->BufferNames[i] == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glBeginTransformFeedback(binding point %d does not "
+ "have a buffer object bound)", i);
+ return;
+ }
}
}
}
@@ -473,6 +480,14 @@ _mesa_BeginTransformFeedback(GLenum mode)
void GLAPIENTRY
+_mesa_BeginTransformFeedback(GLenum mode)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ begin_transform_feedback(ctx, mode, false);
+}
+
+
+void GLAPIENTRY
_mesa_EndTransformFeedback(void)
{
struct gl_transform_feedback_object *obj;