<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 29, 2015 at 4:55 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>
- use the refactored code to lookup the objects<br>
- improve some error messages<br>
- factor out the gl method name computation<br>
- better handle the spec differences between the DSA and non-DSA cases<br>
- quote the spec a little more<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 | 8 +++<br>
src/mesa/main/bufferobj.c | 3 +-<br>
src/mesa/main/tests/dispatch_sanity.cpp | 1 +<br>
src/mesa/main/transformfeedback.c | 94 +++++++++++++++++++++-----<br>
src/mesa/main/transformfeedback.h | 6 +-<br>
5 files changed, 94 insertions(+), 18 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 35d6906..b3c090f 100644<br>
--- a/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
+++ b/src/mapi/glapi/gen/ARB_direct_state_access.xml<br>
@@ -20,6 +20,14 @@<br>
<param name="buffer" type="GLuint" /><br>
</function><br>
<br>
+ <function name="TransformFeedbackBufferRange" offset="assign"><br>
+ <param name="xfb" type="GLuint" /><br>
+ <param name="index" type="GLuint" /><br>
+ <param name="buffer" type="GLuint" /><br>
+ <param name="offset" type="GLintptr" /><br>
+ <param name="size" type="GLsizeiptr" /><br>
+ </function><br>
+<br>
<!-- Texture object functions --><br>
<br>
<function name="CreateTextures" offset="assign"><br>
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c<br>
index 86532ea..7558e17 100644<br>
--- a/src/mesa/main/bufferobj.c<br>
+++ b/src/mesa/main/bufferobj.c<br>
@@ -3548,7 +3548,8 @@ _mesa_BindBufferRange(GLenum target, GLuint index,<br>
case GL_TRANSFORM_FEEDBACK_BUFFER:<br>
_mesa_bind_buffer_range_transform_feedback(ctx,<br>
ctx->TransformFeedback.CurrentObject,<br>
- index, bufObj, offset, size);<br>
+ index, bufObj, offset, size,<br>
+ false);<br>
return;<br>
case GL_UNIFORM_BUFFER:<br>
bind_buffer_range_uniform_buffer(ctx, index, bufObj, offset, size);<br>
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp<br>
index 166401a..3b34f7b 100644<br>
--- a/src/mesa/main/tests/dispatch_sanity.cpp<br>
+++ b/src/mesa/main/tests/dispatch_sanity.cpp<br>
@@ -957,6 +957,7 @@ const struct function gl_core_functions_possible[] = {<br>
/* GL_ARB_direct_state_access */<br>
{ "glCreateTransformFeedbacks", 45, -1 },<br>
{ "glTransformFeedbackBufferBase", 45, -1 },<br>
+ { "glTransformFeedbackBufferRange", 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 6583974..7564b6f 100644<br>
--- a/src/mesa/main/transformfeedback.c<br>
+++ b/src/mesa/main/transformfeedback.c<br>
@@ -541,7 +541,8 @@ bind_buffer_range(struct gl_context *ctx,<br>
/**<br>
* Specify a buffer object to receive transform feedback results. Plus,<br>
* specify the starting offset to place the results, and max size.<br>
- * Called from the glBindBufferRange() function.<br>
+ * Called from the glBindBufferRange() and glTransformFeedbackBufferRange<br>
+ * functions.<br>
*/<br>
void<br>
_mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,<br>
@@ -549,35 +550,72 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,<br>
GLuint index,<br>
struct gl_buffer_object *bufObj,<br>
GLintptr offset,<br>
- GLsizeiptr size)<br>
+ GLsizeiptr size,<br>
+ bool dsa)<br>
{<br>
+ const char *gl_methd_name;<br>
+ if (dsa)<br>
+ gl_methd_name = "glTransformFeedbackBufferRange";<br>
+ else<br>
+ gl_methd_name = "glBindBufferRange";<br>
+<br>
+<br>
if (obj->Active) {<br>
- _mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "glBindBufferRange(transform feedback active)");<br>
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(transform feedback active)",<br>
+ gl_methd_name);<br>
return;<br>
}<br>
<br>
if (index >= ctx->Const.MaxTransformFeedbackBuffers) {<br>
- _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(index=%d "<br>
- "out of bounds)", index);<br>
+ /* An INVALID_VALUE error is generated if index is greater than or equal<br>
+ * to the number of binding points for transform feedback, as described<br>
+ * in section 6.7.1.<br>
+ */<br>
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%d out of bounds)",<br>
+ gl_methd_name, index);<br>
return;<br>
}<br>
<br>
if (size & 0x3) {<br>
- /* must a multiple of four */<br>
- _mesa_error(ctx, GL_INVALID_VALUE, "glBindBufferRange(size=%d)",<br>
- (int) size);<br>
+ /* must a be multiple of four */<br>
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d must be a multiple of "<br>
+ "four)", gl_methd_name, (int) size);<br>
return;<br>
}<br>
<br>
if (offset & 0x3) {<br>
/* must be multiple of four */<br>
- _mesa_error(ctx, GL_INVALID_VALUE,<br>
- "glBindBufferRange(offset=%d)", (int) offset);<br>
+ _mesa_error(ctx, GL_INVALID_VALUE, "gl%s(offset=%d must be a multiple "<br>
+ "of four)", gl_methd_name, (int) offset);<br>
return;<br>
- }<br>
+ }<br>
+<br></blockquote><div>I think you got your offset and size comments in the wrong functions. They are mixed up. <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ if (offset < 0) {<br>
+ /* An INVALID_VALUE error is generated by BindBufferRange if offset is<br>
+ * negative.<br>
+ */<br>
+ /* An INVALID_VALUE error is generated by TransformFeedbackBufferRange<br>
+ * if size is less than or equal to zero.<br>
+ */<br>
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(offset=%d must be >= 0)",<br>
+ gl_methd_name,<br>
+ (int) offset);<br>
+ return;<br>
+ }<br>
<br>
- bind_buffer_range(ctx, obj, index, bufObj, offset, size, false);<br>
+ if (size <= 0 && (dsa || bufObj != ctx->Shared->NullBufferObj)) {<br>
+ /* An INVALID_VALUE error is generated by BindBufferRange if buffer is<br>
+ * non-zero and size is less than or equal to zero.<br>
+ */<br>
+ /* An INVALID_VALUE error is generated by TransformFeedbackBufferRange<br>
+ * if offset is negative.<br>
+ */<br>
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(size=%d must be > 0)",<br>
+ gl_methd_name, (int) size);<br>
+ return;<br>
+ }<br>
+<br>
+ bind_buffer_range(ctx, obj, index, bufObj, offset, size, dsa);<br>
}<br></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
@@ -596,14 +634,14 @@ _mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx,<br>
{<br>
if (obj->Active) {<br>
_mesa_error(ctx, GL_INVALID_OPERATION,<br>
- "%s(transform feedback active)",<br>
- dsa?"glTransformFeedbackBufferBase":"glBindBufferBase");<br>
+ "gl%s(transform feedback active)",<br>
+ dsa?"TransformFeedbackBufferBase":"BindBufferBase");<br>
return;<br>
}<br>
<br>
if (index >= ctx->Const.MaxTransformFeedbackBuffers) {<br>
_mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%d out of bounds)",<br>
- dsa?"glTransformFeedbackBufferBase":"glBindBufferBase",<br>
+ dsa ? "glTransformFeedbackBufferBase" : "glBindBufferBase",<br>
index);<br>
return;<br>
}<br>
@@ -679,6 +717,30 @@ _mesa_TransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer)<br>
_mesa_bind_buffer_base_transform_feedback(ctx, obj, index, bufObj, true);<br>
}<br>
<br>
+void GLAPIENTRY<br>
+_mesa_TransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer,<br>
+ GLintptr offset, GLsizeiptr size)<br>
+{<br>
+ GET_CURRENT_CONTEXT(ctx);<br>
+ struct gl_transform_feedback_object *obj;<br>
+ struct gl_buffer_object *bufObj;<br>
+<br>
+ obj = _mesa_lookup_transform_feedback_object_err(ctx, xfb,<br>
+ "glTransformFeedbackBufferRange");<br>
+ if(!obj) {<br>
+ return;<br>
+ }<br>
+<br>
+ bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,<br>
+ "glTransformFeedbackBufferRange");<br>
+ if(!bufObj) {<br>
+ return;<br>
+ }<br>
+<br>
+ _mesa_bind_buffer_range_transform_feedback(ctx, obj, index, bufObj, offset,<br>
+ size, true);<br>
+}<br>
+<br>
/**<br>
* Specify a buffer object to receive transform feedback results, plus the<br>
* offset in the buffer to start placing results.<br>
diff --git a/src/mesa/main/transformfeedback.h b/src/mesa/main/transformfeedback.h<br>
index 2c4ce58..1178169 100644<br>
--- a/src/mesa/main/transformfeedback.h<br>
+++ b/src/mesa/main/transformfeedback.h<br>
@@ -69,7 +69,7 @@ _mesa_bind_buffer_range_transform_feedback(struct gl_context *ctx,<br>
GLuint index,<br>
struct gl_buffer_object *bufObj,<br>
GLintptr offset,<br>
- GLsizeiptr size);<br>
+ GLsizeiptr size, bool dsa);<br>
<br>
extern void<br>
_mesa_bind_buffer_base_transform_feedback(struct gl_context *ctx,<br>
@@ -162,4 +162,8 @@ _mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,<br>
extern void GLAPIENTRY<br>
_mesa_TransformFeedbackBufferBase(GLuint xfb, GLuint index, GLuint buffer);<br>
<br>
+extern void GLAPIENTRY<br>
+_mesa_TransformFeedbackBufferRange(GLuint xfb, GLuint index, GLuint buffer,<br>
+ GLintptr offset, GLsizeiptr size);<br>
+<br>
#endif /* TRANSFORM_FEEDBACK_H */<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.2.2<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></div>