[Piglit] [PATCH 2/8] GL_ARB_copy_buffer: Add a test for syncing with glBufferSubData().

Eric Anholt eric at anholt.net
Wed Oct 30 22:53:14 CET 2013


Ian Romanick <idr at freedesktop.org> writes:

> With the (first) two comments below taken care of,
>
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
>
> On 10/08/2013 02:09 PM, Eric Anholt wrote:

>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> +
>> +	config.supports_gl_compat_version = 10;
>
> Just make this = 15 and drop the check in piglit_init.
>
>> +	config.supports_gl_core_version = 31;
>> +
>> +	config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
>> +
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +void
>> +piglit_init(int argc, char *argv[])
>> +{
>> +	bool pass = true;
>> +	uint32_t dummy_data_1[4], dummy_data_2[4];
>> +	uint32_t good_data[4] = {0, 1, 2, 3};
>> +	uint32_t result_data[4];
>> +	bool subtest_pass;
>> +	size_t size = sizeof(good_data);
>> +	GLuint buffer_handles[2];
>> +
>> +	memset(dummy_data_1, 0xaa, size);
>> +	memset(dummy_data_2, 0xbb, size);
>> +
>> +	piglit_require_gl_version(15);
>> +
>> +	piglit_require_extension("GL_ARB_copy_buffer");
>> +
>> +	glGenBuffersARB(2, buffer_handles);
>> +	glBindBufferARB(GL_COPY_READ_BUFFER, buffer_handles[0]);
>> +	glBindBufferARB(GL_COPY_WRITE_BUFFER, buffer_handles[1]);
>
> s/ARB//g since the test requires GL 1.5.

Fixed these.

>> +	glBufferData(GL_COPY_READ_BUFFER, 4096, NULL, GL_STREAM_COPY);
>> +	glBufferData(GL_COPY_WRITE_BUFFER, 4096, NULL, GL_STREAM_COPY);
>> +	glGetBufferSubData(GL_COPY_READ_BUFFER, 0, size, good_data);
>> +	glGetBufferSubData(GL_COPY_WRITE_BUFFER, 0, size, dummy_data_1);
>> +
>> +	glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER,
>> +			    0, 0, size);
>> +	glBufferSubData(GL_COPY_READ_BUFFER, 0, size, dummy_data_2);
>> +	memset(result_data, 0xd0, size);
>> +	glGetBufferSubData(GL_COPY_WRITE_BUFFER, 0, size, result_data);
>> +	subtest_pass = memcmp(good_data, result_data, size) == 0;
>> +	if (!subtest_pass) {
>> +		fprintf(stderr, "found 0x%08x 0x%08x 0x%08x 0x%08x\n",
>> +			result_data[0], result_data[1],
>> +			result_data[2], result_data[3]);
>> +		pass = false;
>> +	}
>> +	piglit_report_subtest_result(subtest_pass ? PIGLIT_PASS : PIGLIT_FAIL,
>> +				     "overwrite source data");
>> +
>> +
>> +	glBufferData(GL_COPY_READ_BUFFER, 4096, NULL, GL_STREAM_COPY);
>> +	glBufferData(GL_COPY_WRITE_BUFFER, 4096, NULL, GL_STREAM_COPY);
>
> Shouldn't this put some (non-zero) data in the buffers?  I guess it
> might not matter since the BufferSubData below overwrites the whole thing...

Yeah, we already trust the first full subdata of each one, it's the
syncing after it we're trying to poke at.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20131030/a0991458/attachment.pgp>


More information about the Piglit mailing list