<div dir="ltr">On Sat, Mar 22, 2014 at 5:03 AM, Jon Ashburn <span dir="ltr"><<a href="mailto:jon@lunarg.com" target="_blank">jon@lunarg.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
tests/texturing/getteximage-targets.c | 38 ++++++++++++++++++++++++++++-------<br>
1 file changed, 31 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/tests/texturing/getteximage-targets.c b/tests/texturing/getteximage-targets.c<br>
index 1b626db..9b471c2 100644<br>
--- a/tests/texturing/getteximage-targets.c<br>
+++ b/tests/texturing/getteximage-targets.c<br>
@@ -97,16 +97,24 @@ compare_layer(int layer, int num_elements, int tolerance,<br>
}<br>
<br>
static bool<br>
-getTexImage(GLenum target, GLubyte data[][IMAGE_SIZE],<br>
+getTexImage(bool doPBO, GLenum target, GLubyte data[][IMAGE_SIZE],<br>
GLenum internalformat, int tolerance)<br>
{<br>
int i, j;<br>
int num_layers=1, num_faces=1, layer_size;<br>
GLubyte data2[18][IMAGE_SIZE];<br>
+ GLuint packPBO;<br>
bool pass = true;<br>
<br>
-<br>
- memset(data2, 123, sizeof(data2));<br>
+ /* Setup the PBO or data array to read into from glGetTexImage */<br>
+ if (doPBO) {<br>
+ glGenBuffers(1, &packPBO);<br>
+ glBindBuffer(GL_PIXEL_PACK_BUFFER, packPBO);<br>
+ } else {<br>
+ glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);<br>
+ memset(data2, 123, sizeof(data2));<br>
+ }<br>
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
<br>
switch (target) {<br>
case GL_TEXTURE_1D:<br>
@@ -176,8 +184,20 @@ getTexImage(GLenum target, GLubyte data[][IMAGE_SIZE],<br>
}<br>
for (i = 0; i < num_faces; i++) {<br>
GLubyte *dataGet=NULL;<br>
- glGetTexImage(target + i, 0, GL_RGBA, GL_UNSIGNED_BYTE, data2[i]);<br>
- dataGet = data2[i];<br>
+ if (doPBO) {<br>
+ glBufferData(GL_PIXEL_PACK_BUFFER, layer_size * num_layers,<br>
+ NULL, GL_STREAM_READ);<br>
+ glGetTexImage(target + i, 0, GL_RGBA,<br>
+ GL_UNSIGNED_BYTE, NULL);<br>
+ dataGet = (GLubyte *) glMapBufferRange(<br>
+ GL_PIXEL_PACK_BUFFER, 0,<br>
+ layer_size * num_layers,<br>
+ GL_MAP_READ_BIT);<br></blockquote><div>No matching glUnmapBuffer?<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ } else {<br>
+ glGetTexImage(target + i, 0, GL_RGBA, GL_UNSIGNED_BYTE,<br>
+ data2[i]);<br>
+ dataGet = data2[i];<br>
+ }<br>
pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
<br>
for (j = 0; j < num_layers; j++) {<br>
@@ -238,8 +258,12 @@ piglit_init(int argc, char **argv)<br>
<br>
init_layer_data(data[0], 18);<br>
<br>
- printf("Testing %s\n", piglit_get_gl_enum_name(target));<br>
- pass = getTexImage(target, data, internalformat, tolerance) &&<br>
+ printf("Testing %s into PBO\n", piglit_get_gl_enum_name(target));<br>
+ pass = getTexImage(true, target, data, internalformat, tolerance) &&<br>
+ pass;<br>
+<br>
+ printf("Testing %s into client array\n", piglit_get_gl_enum_name(target));<br>
+ pass = getTexImage(false, target, data, internalformat, tolerance) &&<br>
pass;<br>
<br>
pass = piglit_check_gl_error(GL_NO_ERROR) && pass;<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.1.2<br>
<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>olv@LunarG.com
</div></div>