[Piglit] [PATCH] vbo-map-unsync: test unsynchronized buffer mapping

Brian Paul brianp at vmware.com
Tue Nov 13 07:57:25 PST 2012


On 11/09/2012 10:54 AM, Eric Anholt wrote:
> Brian Paul<brianp at vmware.com>  writes:
>> ---
>>   tests/all.tests                 |    1 +
>>   tests/general/CMakeLists.gl.txt |    1 +
>>   tests/general/vbo-map-unsync.c  |  173 +++++++++++++++++++++++++++++++++++++++
>>   3 files changed, 175 insertions(+), 0 deletions(-)
>>   create mode 100644 tests/general/vbo-map-unsync.c
>>
>> diff --git a/tests/all.tests b/tests/all.tests
>> index 09b0931..9db1038 100644
>> --- a/tests/all.tests
>> +++ b/tests/all.tests
>> @@ -1245,6 +1245,7 @@ add_plain_test(arb_vertex_buffer_object, 'fdo31934')
>>   add_plain_test(arb_vertex_buffer_object, 'pos-array')
>>   add_plain_test(arb_vertex_buffer_object, 'vbo-bufferdata')
>>   add_plain_test(arb_vertex_buffer_object, 'vbo-map-remap')
>> +add_plain_test(arb_vertex_buffer_object, 'vbo-map-unsync')
>>   add_plain_test(arb_vertex_buffer_object, 'vbo-subdata-sync')
>>   add_plain_test(arb_vertex_buffer_object, 'vbo-subdata-zero')
>
> Should be concurrent, right?
>
>> +} verts[] =
>
> trailing whitespace here and elsewhere.
>
>> +	glMatrixMode(GL_PROJECTION);
>> +	glLoadIdentity();
>> +	glOrtho(-1.0, 1.0, -1.0, 1.0, -0.1, 1.0);
>> +	glMatrixMode(GL_MODELVIEW);
>> +	glLoadIdentity();
>
> piglit_ortho_projection()?

No, I'd have to change all the vertex coords or add more 
transformation stuff to do that.


>
>> +	/* Map first half of vertex buffer */
>> +	verts_map = glMapBufferRange(GL_ARRAY_BUFFER_ARB,
>> +				     0, sizeof(verts),
>> +				     GL_MAP_WRITE_BIT |
>> +				     GL_MAP_INVALIDATE_BUFFER_BIT |
>> +				     GL_MAP_FLUSH_EXPLICIT_BIT);
>> +	elems_map = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
>> +				   GL_WRITE_ONLY_ARB);
>> +
>> +	memcpy(verts_map, verts, sizeof(verts));
>> +	memcpy(elems_map, indices, sizeof(indices));
>> +	glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
>> +	glFlushMappedBufferRange(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts));
>> +	glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
>
> It's odd to me to see FlushMappedBufferRange() with the same size as the
> mapping -- you could just drop the flush explicit bit and the flush
> call.  Was some application doing that, or is that just simplification
> for the testcase?

Yeah, the flush_explicit stuff can be removed.  It's not pertinent to 
the specific issue.

>
> I'd like to see flushexplicit mentioned in the test name if possible. I
> think of unsynchronized as just the series of mappings on the buffer:
>
> 1: (0,    size, INVALIDATE_BUFFER)
> 2: (size, ...,  INVALIDATE_RANGE | UNSYNCHRONIZED)
> 3: (...,  ...,  INVALIDATE_RANGE | UNSYNCHRONIZED)
>

I'll post a v2.

-Brian



More information about the Piglit mailing list