<div dir="ltr"><div>Looks good to me<br><br></div>Reviewed-by: Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 16, 2015 at 6:13 AM, Martin Peres <span dir="ltr"><<a href="mailto:martin.peres@linux.intel.com" target="_blank">martin.peres@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">v2: Review from Laura Ekstrand<br>
- generate the name of the gl method once<br>
- shorten some lines to stay in the 78 chars limit<br>
<br>
v3: Review from Fredrik Höglund <<a href="mailto:fredrik@kde.org">fredrik@kde.org</a>><br>
- rename gl_mthd_name to func<br>
- set EverBound in _mesa_create_transform_feedbacks in the dsa case<br>
<br>
v4:<br>
- rename _mesa_create_transform_feedbacks to create_transform_feedbacks and<br>
make it static<br>
<br>
Signed-off-by: Martin Peres <<a href="mailto:martin.peres@linux.intel.com">martin.peres@linux.intel.com</a>><br>
---<br>
src/mapi/glapi/gen/ARB_direct_state_access.xml | 7 +++<br>
src/mesa/main/tests/dispatch_sanity.cpp | 1 +<br>
src/mesa/main/transformfeedback.c | 67 ++++++++++++++++++++------<br>
src/mesa/main/transformfeedback.h | 3 ++<br>
4 files changed, 63 insertions(+), 15 deletions(-)<br>
<br>
diff --git a/src/mapi/glapi/gen/ARB_direct_state_access.xml b/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
index 2fe1638..15b00c2 100644<br>
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
@@ -7,6 +7,13 @@<br>
<enum name="QUERY_TARGET" value="0x82EA"/><br>
<enum name="TEXTURE_BINDING" value="0x82EB"/><br>
<br>
+ <!-- Transform Feedback object functions --><br>
+<br>
+ <function name="CreateTransformFeedbacks" offset="assign"><br>
+ <param name="n" type="GLsizei" /><br>
+ <param name="ids" type="GLuint *" /><br>
+ </function><br>
+<br>
<!-- Texture object functions --><br>
<br>
<function name="CreateTextures" offset="assign"><br>
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp<br>
index 1f1a3a8..bf320bf 100644<br>
--- a/src/mesa/main/tests/dispatch_sanity.cpp<br>
+++ b/src/mesa/main/tests/dispatch_sanity.cpp<br>
@@ -955,6 +955,7 @@ const struct function gl_core_functions_possible[] = {<br>
{ "glClipControl", 45, -1 },<br>
<br>
/* GL_ARB_direct_state_access */<br>
+ { "glCreateTransformFeedbacks", 45, -1 },<br>
{ "glCreateTextures", 45, -1 },<br>
{ "glTextureStorage1D", 45, -1 },<br>
{ "glTextureStorage2D", 45, -1 },<br>
diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c<br>
index a737463..10bb6a1 100644<br>
--- a/src/mesa/main/transformfeedback.c<br>
+++ b/src/mesa/main/transformfeedback.c<br>
@@ -825,25 +825,24 @@ _mesa_lookup_transform_feedback_object(struct gl_context *ctx, GLuint name)<br>
_mesa_HashLookup(ctx->TransformFeedback.Objects, name);<br>
}<br>
<br>
-<br>
-/**<br>
- * Create new transform feedback objects. Transform feedback objects<br>
- * encapsulate the state related to transform feedback to allow quickly<br>
- * switching state (and drawing the results, below).<br>
- * Part of GL_ARB_transform_feedback2.<br>
- */<br>
-void GLAPIENTRY<br>
-_mesa_GenTransformFeedbacks(GLsizei n, GLuint *names)<br>
+static void<br>
+create_transform_feedbacks(struct gl_context *ctx, GLsizei n, GLuint *ids,<br>
+ bool dsa)<br>
{<br>
GLuint first;<br>
- GET_CURRENT_CONTEXT(ctx);<br>
+ const char* func;<br>
+<br>
+ if (dsa)<br>
+ func = "glCreateTransformFeedbacks";<br>
+ else<br>
+ func = "glGenTransformFeedbacks";<br>
<br>
if (n < 0) {<br>
- _mesa_error(ctx, GL_INVALID_VALUE, "glGenTransformFeedbacks(n < 0)");<br>
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(n < 0)", func);<br>
return;<br>
}<br>
<br>
- if (!names)<br>
+ if (!ids)<br>
return;<br>
<br>
/* we don't need contiguous IDs, but this might be faster */<br>
@@ -854,18 +853,56 @@ _mesa_GenTransformFeedbacks(GLsizei n, GLuint *names)<br>
struct gl_transform_feedback_object *obj<br>
= ctx->Driver.NewTransformFeedback(ctx, first + i);<br>
if (!obj) {<br>
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTransformFeedbacks");<br>
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);<br>
return;<br>
}<br>
- names[i] = first + i;<br>
+ ids[i] = first + i;<br>
_mesa_HashInsert(ctx->TransformFeedback.Objects, first + i, obj);<br>
+ if (dsa) {<br>
+ /* this is normally done at bind time in the non-dsa case */<br>
+ obj->EverBound = GL_TRUE;<br>
+ }<br>
}<br>
}<br>
else {<br>
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTransformFeedbacks");<br>
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", func);<br>
}<br>
}<br>
<br>
+/**<br>
+ * Create new transform feedback objects. Transform feedback objects<br>
+ * encapsulate the state related to transform feedback to allow quickly<br>
+ * switching state (and drawing the results, below).<br>
+ * Part of GL_ARB_transform_feedback2.<br>
+ */<br>
+void GLAPIENTRY<br>
+_mesa_GenTransformFeedbacks(GLsizei n, GLuint *names)<br>
+{<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+<br>
+ /* GenTransformFeedbacks should just reserve the object names that a<br>
+ * subsequent call to BindTransformFeedback should actively create. For<br>
+ * the sake of simplicity, we reserve the names and create the objects<br>
+ * straight away.<br>
+ */<br>
+<br>
+ create_transform_feedbacks(ctx, n, names, false);<br>
+}<br>
+<br>
+/**<br>
+ * Create new transform feedback objects. Transform feedback objects<br>
+ * encapsulate the state related to transform feedback to allow quickly<br>
+ * switching state (and drawing the results, below).<br>
+ * Part of GL_ARB_direct_state_access.<br>
+ */<br>
+void GLAPIENTRY<br>
+_mesa_CreateTransformFeedbacks(GLsizei n, GLuint *names)<br>
+{<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+<br>
+ create_transform_feedbacks(ctx, n, names, true);<br>
+}<br>
+<br>
<br>
/**<br>
* Is the given ID a transform feedback object?<br>
diff --git a/src/mesa/main/transformfeedback.h b/src/mesa/main/transformfeedback.h<br>
index 87f4080..9de1fef 100644<br>
--- a/src/mesa/main/transformfeedback.h<br>
+++ b/src/mesa/main/transformfeedback.h<br>
@@ -102,6 +102,9 @@ _mesa_lookup_transform_feedback_object(struct gl_context *ctx, GLuint name);<br>
extern void GLAPIENTRY<br>
_mesa_GenTransformFeedbacks(GLsizei n, GLuint *names);<br>
<br>
+extern void GLAPIENTRY<br>
+_mesa_CreateTransformFeedbacks(GLsizei n, GLuint *names);<br>
+<br>
extern GLboolean GLAPIENTRY<br>
_mesa_IsTransformFeedback(GLuint name);<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.3.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>