[02/14] dsa/utils: Add check_vbo_binding()

Submitted by Fredrik Höglund on March 31, 2015, 5:26 p.m.

Details

Message ID 1427822806-18528-3-git-send-email-fredrik@kde.org
State New
Headers show

Not browsing as part of any series.

Commit Message

Fredrik Höglund March 31, 2015, 5:26 p.m.
This function returns true if the VBO binding of the given index
matches the expected values, and false otherwise.

An error message is printed if the actual parameter values don't
match the expected values.
---
 tests/spec/arb_direct_state_access/dsa-utils.c | 19 +++++++++++++++++++
 tests/spec/arb_direct_state_access/dsa-utils.h |  8 ++++++++
 2 files changed, 27 insertions(+)

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_direct_state_access/dsa-utils.c b/tests/spec/arb_direct_state_access/dsa-utils.c
index f065dbc..aaa1727 100644
--- a/tests/spec/arb_direct_state_access/dsa-utils.c
+++ b/tests/spec/arb_direct_state_access/dsa-utils.c
@@ -94,3 +94,22 @@  check_indexed_vao_param_(GLuint vao, GLuint index, GLuint param,
 
 	return true;
 }
+
+bool
+check_vbo_binding_(GLuint vao, GLuint bindingindex, GLuint vbo,
+                   GLintptr offset, GLsizeiptr stride,
+                   const char *file, int line)
+{
+	bool pass = true;
+
+	pass = check_indexed_vao_param_(vao, bindingindex,
+		GL_VERTEX_BINDING_BUFFER, vbo, file, line) && pass;
+
+	pass = check_indexed_vao_param_(vao, bindingindex,
+		GL_VERTEX_BINDING_OFFSET, offset, file, line) && pass;
+
+	pass = check_indexed_vao_param_(vao, bindingindex,
+		GL_VERTEX_BINDING_STRIDE, stride, file, line) && pass;
+
+	return pass;
+}
diff --git a/tests/spec/arb_direct_state_access/dsa-utils.h b/tests/spec/arb_direct_state_access/dsa-utils.h
index 707a967..ed3a506 100644
--- a/tests/spec/arb_direct_state_access/dsa-utils.h
+++ b/tests/spec/arb_direct_state_access/dsa-utils.h
@@ -66,6 +66,14 @@  bool check_indexed_vao_param_(GLuint vao, GLuint index, GLuint param,
 	check_indexed_vao_param_(vao, index, param, expected, \
 	                         __FILE__, __LINE__)
 
+bool check_vbo_binding_(GLuint vao, GLuint bindingindex, GLuint vbo,
+                        GLintptr offset, GLsizeiptr stride,
+                        const char *file, int line);
+
+#define check_vbo_binding(vao, bindingindex, vbo, offset, stride) \
+	check_vbo_binding_(vao, bindingindex, vbo, offset, stride, \
+	                   __FILE__, __LINE__)
+
 #ifdef __cplusplus
 } /* end extern "C" */
 #endif

Comments

LGTM.

Reviewed-by: Laura Ekstrand <laura@jlekstrand.net>

On Tue, Mar 31, 2015 at 10:26 AM, Fredrik Höglund <fredrik@kde.org> wrote:

> This function returns true if the VBO binding of the given index
> matches the expected values, and false otherwise.
>
> An error message is printed if the actual parameter values don't
> match the expected values.
> ---
>  tests/spec/arb_direct_state_access/dsa-utils.c | 19 +++++++++++++++++++
>  tests/spec/arb_direct_state_access/dsa-utils.h |  8 ++++++++
>  2 files changed, 27 insertions(+)
>
> diff --git a/tests/spec/arb_direct_state_access/dsa-utils.c
> b/tests/spec/arb_direct_state_access/dsa-utils.c
> index f065dbc..aaa1727 100644
> --- a/tests/spec/arb_direct_state_access/dsa-utils.c
> +++ b/tests/spec/arb_direct_state_access/dsa-utils.c
> @@ -94,3 +94,22 @@ check_indexed_vao_param_(GLuint vao, GLuint index,
> GLuint param,
>
>         return true;
>  }
> +
> +bool
> +check_vbo_binding_(GLuint vao, GLuint bindingindex, GLuint vbo,
> +                   GLintptr offset, GLsizeiptr stride,
> +                   const char *file, int line)
> +{
> +       bool pass = true;
> +
> +       pass = check_indexed_vao_param_(vao, bindingindex,
> +               GL_VERTEX_BINDING_BUFFER, vbo, file, line) && pass;
> +
> +       pass = check_indexed_vao_param_(vao, bindingindex,
> +               GL_VERTEX_BINDING_OFFSET, offset, file, line) && pass;
> +
> +       pass = check_indexed_vao_param_(vao, bindingindex,
> +               GL_VERTEX_BINDING_STRIDE, stride, file, line) && pass;
> +
> +       return pass;
> +}
> diff --git a/tests/spec/arb_direct_state_access/dsa-utils.h
> b/tests/spec/arb_direct_state_access/dsa-utils.h
> index 707a967..ed3a506 100644
> --- a/tests/spec/arb_direct_state_access/dsa-utils.h
> +++ b/tests/spec/arb_direct_state_access/dsa-utils.h
> @@ -66,6 +66,14 @@ bool check_indexed_vao_param_(GLuint vao, GLuint index,
> GLuint param,
>         check_indexed_vao_param_(vao, index, param, expected, \
>                                  __FILE__, __LINE__)
>
> +bool check_vbo_binding_(GLuint vao, GLuint bindingindex, GLuint vbo,
> +                        GLintptr offset, GLsizeiptr stride,
> +                        const char *file, int line);
> +
> +#define check_vbo_binding(vao, bindingindex, vbo, offset, stride) \
> +       check_vbo_binding_(vao, bindingindex, vbo, offset, stride, \
> +                          __FILE__, __LINE__)
> +
>  #ifdef __cplusplus
>  } /* end extern "C" */
>  #endif
> --
> 2.1.4
>
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>