diff options
author | Martin Peres <[email protected]> | 2015-01-14 18:17:21 +0200 |
---|---|---|
committer | Martin Peres <[email protected]> | 2015-03-25 10:05:45 +0200 |
commit | c86cb2da255216524974eb1c92caa1ecb378e32e (patch) | |
tree | 1ff7993dcd778f4dba141ac9456e63a90793ee60 /src/mesa | |
parent | fc76fac4199f06e26d6c9b4fbb87b85f802b06f3 (diff) |
main: Added entry point for glCreateTransformFeedbacks
v2: Review from Laura Ekstrand
- generate the name of the gl method once
- shorten some lines to stay in the 78 chars limit
v3: Review from Fredrik Höglund <[email protected]>
- rename gl_mthd_name to func
- set EverBound in _mesa_create_transform_feedbacks in the dsa case
v4:
- rename _mesa_create_transform_feedbacks to create_transform_feedbacks and
make it static
Reviewed-by: Laura Ekstrand <[email protected]>
Signed-off-by: Martin Peres <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/tests/dispatch_sanity.cpp | 1 | ||||
-rw-r--r-- | src/mesa/main/transformfeedback.c | 67 | ||||
-rw-r--r-- | src/mesa/main/transformfeedback.h | 3 |
3 files changed, 56 insertions, 15 deletions
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 59ebb21443f..899a1881d34 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -922,6 +922,7 @@ const struct function gl_core_functions_possible[] = { { "glClipControl", 45, -1 }, /* GL_ARB_direct_state_access */ + { "glCreateTransformFeedbacks", 45, -1 }, { "glCreateBuffers", 45, -1 }, { "glNamedBufferStorage", 45, -1 }, { "glNamedBufferData", 45, -1 }, diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index ce678c86432..3c19406a55d 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -825,25 +825,24 @@ _mesa_lookup_transform_feedback_object(struct gl_context *ctx, GLuint name) _mesa_HashLookup(ctx->TransformFeedback.Objects, name); } - -/** - * Create new transform feedback objects. Transform feedback objects - * encapsulate the state related to transform feedback to allow quickly - * switching state (and drawing the results, below). - * Part of GL_ARB_transform_feedback2. - */ -void GLAPIENTRY -_mesa_GenTransformFeedbacks(GLsizei n, GLuint *names) +static void +create_transform_feedbacks(struct gl_context *ctx, GLsizei n, GLuint *ids, + bool dsa) { GLuint first; - GET_CURRENT_CONTEXT(ctx); + const char* func; + + if (dsa) + func = "glCreateTransformFeedbacks"; + else + func = "glGenTransformFeedbacks"; if (n < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGenTransformFeedbacks(n < 0)"); + _mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", func); return; } - if (!names) + if (!ids) return; /* we don't need contiguous IDs, but this might be faster */ @@ -854,18 +853,56 @@ _mesa_GenTransformFeedbacks(GLsizei n, GLuint *names) struct gl_transform_feedback_object *obj = ctx->Driver.NewTransformFeedback(ctx, first + i); if (!obj) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTransformFeedbacks"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func); return; } - names[i] = first + i; + ids[i] = first + i; _mesa_HashInsert(ctx->TransformFeedback.Objects, first + i, obj); + if (dsa) { + /* this is normally done at bind time in the non-dsa case */ + obj->EverBound = GL_TRUE; + } } } else { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTransformFeedbacks"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func); } } +/** + * Create new transform feedback objects. Transform feedback objects + * encapsulate the state related to transform feedback to allow quickly + * switching state (and drawing the results, below). + * Part of GL_ARB_transform_feedback2. + */ +void GLAPIENTRY +_mesa_GenTransformFeedbacks(GLsizei n, GLuint *names) +{ + GET_CURRENT_CONTEXT(ctx); + + /* GenTransformFeedbacks should just reserve the object names that a + * subsequent call to BindTransformFeedback should actively create. For + * the sake of simplicity, we reserve the names and create the objects + * straight away. + */ + + create_transform_feedbacks(ctx, n, names, false); +} + +/** + * Create new transform feedback objects. Transform feedback objects + * encapsulate the state related to transform feedback to allow quickly + * switching state (and drawing the results, below). + * Part of GL_ARB_direct_state_access. + */ +void GLAPIENTRY +_mesa_CreateTransformFeedbacks(GLsizei n, GLuint *names) +{ + GET_CURRENT_CONTEXT(ctx); + + create_transform_feedbacks(ctx, n, names, true); +} + /** * Is the given ID a transform feedback object? diff --git a/src/mesa/main/transformfeedback.h b/src/mesa/main/transformfeedback.h index 87f4080e022..9de1fef2137 100644 --- a/src/mesa/main/transformfeedback.h +++ b/src/mesa/main/transformfeedback.h @@ -102,6 +102,9 @@ _mesa_lookup_transform_feedback_object(struct gl_context *ctx, GLuint name); extern void GLAPIENTRY _mesa_GenTransformFeedbacks(GLsizei n, GLuint *names); +extern void GLAPIENTRY +_mesa_CreateTransformFeedbacks(GLsizei n, GLuint *names); + extern GLboolean GLAPIENTRY _mesa_IsTransformFeedback(GLuint name); |