[Piglit] [PATCH] KHR_debug: Support GLES2
Fabian Bieler
fabianbieler at fastmail.fm
Sat Mar 8 04:46:41 PST 2014
On Sat, Mar 8, 2014, at 03:05 AM, eu at felipetonello.com wrote:
> From: "Felipe F. Tonello" <eu at felipetonello.com>
>
> For GLES the KHR_debug extension requires a KHR suffix to all functions
> and
> tokens.
>
> Signed-off-by: Felipe F. Tonello <eu at felipetonello.com>
> ---
> tests/all.py | 3 +-
> tests/spec/khr_debug/CMakeLists.gl.txt | 2 +-
> tests/spec/khr_debug/CMakeLists.gles2.txt | 14 ++++
> tests/spec/khr_debug/debug-object-label.c | 131
> ++++++++++++++++++++++++++++++
> 4 files changed, 148 insertions(+), 2 deletions(-)
> create mode 100644 tests/spec/khr_debug/CMakeLists.gles2.txt
>
> diff --git a/tests/all.py b/tests/all.py
> index d6daed2..6e12489 100644
> --- a/tests/all.py
> +++ b/tests/all.py
> @@ -1834,7 +1834,8 @@ add_plain_test(arb_debug_output,
> 'arb_debug_output-api_error')
> # Group KHR_debug
> khr_debug = Group()
> spec['KHR_debug'] = khr_debug
> -khr_debug['object-label'] = concurrent_test('khr_debug-object-label')
> +khr_debug['object-label_gl'] =
> concurrent_test('khr_debug-object-label_gl')
> +khr_debug['object-label_gles2'] =
> concurrent_test('khr_debug-object-label_gles2')
>
> # Group ARB_occlusion_query2
> arb_occlusion_query2 = Group()
> diff --git a/tests/spec/khr_debug/CMakeLists.gl.txt
> b/tests/spec/khr_debug/CMakeLists.gl.txt
> index b0079df..2e41cb5 100644
> --- a/tests/spec/khr_debug/CMakeLists.gl.txt
> +++ b/tests/spec/khr_debug/CMakeLists.gl.txt
> @@ -9,6 +9,6 @@ link_libraries (
> ${OPENGL_glu_LIBRARY}
> )
>
> -piglit_add_executable (khr_debug-object-label debug-object-label.c)
> +piglit_add_executable (khr_debug-object-label_${piglit_target_api}
> debug-object-label.c)
>
> # vim: ft=cmake:
> diff --git a/tests/spec/khr_debug/CMakeLists.gles2.txt
> b/tests/spec/khr_debug/CMakeLists.gles2.txt
> new file mode 100644
> index 0000000..bed3d39
> --- /dev/null
> +++ b/tests/spec/khr_debug/CMakeLists.gles2.txt
> @@ -0,0 +1,14 @@
> +include_directories(
> + ${GLEXT_INCLUDE_DIR}
> + ${OPENGL_INCLUDE_PATH}
> +)
> +
> +link_libraries (
> + piglitutil_${piglit_target_api}
> + ${OPENGL_gles2_LIBRARY}
> + ${EGL_LDFLAGS}
> +)
> +
> +piglit_add_executable (khr_debug-object-label_${piglit_target_api}
> debug-object-label.c)
> +
> +# vim: ft=cmake:
> diff --git a/tests/spec/khr_debug/debug-object-label.c
> b/tests/spec/khr_debug/debug-object-label.c
> index 70c2eba..97b7915 100644
> --- a/tests/spec/khr_debug/debug-object-label.c
> +++ b/tests/spec/khr_debug/debug-object-label.c
> @@ -29,7 +29,11 @@ static const char *TestLabel = "Test Label";
>
> PIGLIT_GL_TEST_CONFIG_BEGIN
>
> +#ifdef PIGLIT_USE_OPENGL
> config.supports_gl_compat_version = 11;
> +#else /* using GLES */
> + config.supports_gl_es_version = 20;
> +#endif
>
> config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
>
> @@ -55,8 +59,13 @@ test_object_ptr_label()
> * set/get the label
> */
> sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectPtrLabel(sync, -1, TestLabel);
> glGetObjectPtrLabel(sync, TestLabelLen + 1, &length, label);
> +#else /* using GLES */
> + glObjectPtrLabelKHR(sync, -1, TestLabel);
> + glGetObjectPtrLabelKHR(sync, TestLabelLen + 1, &length, label);
> +#endif
>
> if (length != TestLabelLen || (strcmp(TestLabel, label) != 0)) {
> fprintf(stderr, "Label or length does not match\n");
> @@ -69,7 +78,11 @@ test_object_ptr_label()
> /* An INVALID_VALUE is generated if the <ptr> parameter of ObjectPtrLabel
> * is not the name of a sync object.
> */
> +#ifdef PIGLIT_USE_OPENGL
> glObjectPtrLabel(NULL, length, label);
> +#else /* using GLES */
> + glObjectPtrLabelKHR(NULL, length, label);
> +#endif
>
> if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
> fprintf(stderr, "GL_INVALID_VALUE should be generated when ObjectPtrLabel()"
> @@ -135,8 +148,13 @@ test_object_label_types()
> /* Test BUFFER */
> glGenBuffers(1, &buffer);
> glBindBuffer(GL_ARRAY_BUFFER, buffer);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_BUFFER, buffer, -1, TestLabel);
> glGetObjectLabel(GL_BUFFER, buffer, TestLabelLen + 1, &length[BUFFER_IDX], label[BUFFER_IDX]);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_BUFFER, buffer, -1, TestLabel);
> + glGetObjectLabelKHR(GL_BUFFER, buffer, TestLabelLen + 1,
> &length[BUFFER_IDX], label[BUFFER_IDX]);
> +#endif
>
> check_label_and_length(label[BUFFER_IDX], length[BUFFER_IDX], "GL_BUFFER");
>
> @@ -145,9 +163,15 @@ test_object_label_types()
> if (piglit_get_gl_version() >= 20) {
> /* Test SHADER */
> shader = glCreateShader(GL_FRAGMENT_SHADER);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_SHADER, shader, -1, TestLabel);
> glGetObjectLabel(GL_SHADER, shader, TestLabelLen + 1,
> &length[SHADER_IDX], label[SHADER_IDX]);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_SHADER, shader, -1, TestLabel);
> + glGetObjectLabelKHR(GL_SHADER, shader, TestLabelLen + 1,
> + &length[SHADER_IDX], label[SHADER_IDX]);
> +#endif
>
> check_label_and_length(label[SHADER_IDX], length[SHADER_IDX], "GL_SHADER");
>
> @@ -155,9 +179,15 @@ test_object_label_types()
>
> /* Test PROGRAM */
> program = glCreateProgram();
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_PROGRAM, program, -1, TestLabel);
> glGetObjectLabel(GL_PROGRAM, program, TestLabelLen + 1,
> &length[PROGRAM_IDX], label[PROGRAM_IDX]);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_PROGRAM, program, -1, TestLabel);
> + glGetObjectLabelKHR(GL_PROGRAM, program, TestLabelLen +
> 1,
> + &length[PROGRAM_IDX],
> label[PROGRAM_IDX]);
> +#endif
>
> check_label_and_length(label[PROGRAM_IDX], length[PROGRAM_IDX], "GL_PROGRAM");
>
> @@ -168,9 +198,15 @@ test_object_label_types()
> /* Test VERTEX_ARRAY */
> glGenVertexArrays(1, &vertexArray);
> glBindVertexArray(vertexArray);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_VERTEX_ARRAY, vertexArray, -1, TestLabel);
> glGetObjectLabel(GL_VERTEX_ARRAY, vertexArray, TestLabelLen + 1,
> &length[VERTEX_ARRAY_IDX], label[VERTEX_ARRAY_IDX]);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_VERTEX_ARRAY, vertexArray, -1,
> TestLabel);
> + glGetObjectLabelKHR(GL_VERTEX_ARRAY, vertexArray,
> TestLabelLen + 1,
> + &length[VERTEX_ARRAY_IDX],
> label[VERTEX_ARRAY_IDX]);
> +#endif
>
> check_label_and_length(label[VERTEX_ARRAY_IDX], length[VERTEX_ARRAY_IDX], "GL_VERTEX_ARRAY");
>
> @@ -179,9 +215,15 @@ test_object_label_types()
> /* Test RENDERBUFFER */
> glGenRenderbuffers(1, &renderbuffer);
> glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_RENDERBUFFER, renderbuffer, -1, TestLabel);
> glGetObjectLabel(GL_RENDERBUFFER, renderbuffer, TestLabelLen + 1,
> &length[RENDERBUFFER_IDX], label[RENDERBUFFER_IDX]);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_RENDERBUFFER, renderbuffer, -1,
> TestLabel);
> + glGetObjectLabelKHR(GL_RENDERBUFFER, renderbuffer,
> TestLabelLen + 1,
> + &length[RENDERBUFFER_IDX],
> label[RENDERBUFFER_IDX]);
> +#endif
>
> check_label_and_length(label[RENDERBUFFER_IDX], length[RENDERBUFFER_IDX], "GL_RENDERBUFFER");
>
> @@ -190,9 +232,15 @@ test_object_label_types()
> /* Test FRAMEBUFFER */
> glGenFramebuffers(1, &framebuffer);
> glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_FRAMEBUFFER, framebuffer, -1, TestLabel);
> glGetObjectLabel(GL_FRAMEBUFFER, framebuffer, TestLabelLen + 1,
> &length[FRAMEBUFFER_IDX], label[FRAMEBUFFER_IDX]);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_FRAMEBUFFER, framebuffer, -1,
> TestLabel);
> + glGetObjectLabelKHR(GL_FRAMEBUFFER, framebuffer,
> TestLabelLen + 1,
> + &length[FRAMEBUFFER_IDX],
> label[FRAMEBUFFER_IDX]);
> +#endif
>
> check_label_and_length(label[FRAMEBUFFER_IDX], length[FRAMEBUFFER_IDX], "GL_FRAMEBUFFER");
>
> @@ -203,8 +251,13 @@ test_object_label_types()
> glGenQueries(1, &query);
> glBeginQuery(GL_TIME_ELAPSED, query);
> glEndQuery(GL_TIME_ELAPSED);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_QUERY, query, -1, TestLabel);
> glGetObjectLabel(GL_QUERY, query, TestLabelLen + 1, &length[QUERY_IDX], label[QUERY_IDX]);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_QUERY, query, -1, TestLabel);
> + glGetObjectLabelKHR(GL_QUERY, query, TestLabelLen + 1,
> &length[QUERY_IDX], label[QUERY_IDX]);
> +#endif
>
> check_label_and_length(label[QUERY_IDX], length[QUERY_IDX], "GL_TEST_QUERY");
>
> @@ -214,9 +267,15 @@ test_object_label_types()
> if (piglit_is_extension_supported("GL_ARB_separate_shader_objects")) {
> glGenProgramPipelines(1, &programPipeline);
> glBindProgramPipeline(programPipeline);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_PROGRAM_PIPELINE, programPipeline, -1, TestLabel);
> glGetObjectLabel(GL_PROGRAM_PIPELINE, programPipeline, TestLabelLen + 1,
> &length[PROGRAM_PIPELINE_IDX], label[PROGRAM_PIPELINE_IDX]);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_PROGRAM_PIPELINE, programPipeline,
> -1, TestLabel);
> + glGetObjectLabelKHR(GL_PROGRAM_PIPELINE, programPipeline,
> TestLabelLen + 1,
> + &length[PROGRAM_PIPELINE_IDX],
> label[PROGRAM_PIPELINE_IDX]);
> +#endif
>
> check_label_and_length(label[PROGRAM_PIPELINE_IDX], length[PROGRAM_PIPELINE_IDX], "GL_PROGRAM_PIPELINE");
>
> @@ -227,9 +286,15 @@ test_object_label_types()
> if (piglit_is_extension_supported("GL_ARB_transform_feedback2")) {
> glGenTransformFeedbacks(1, &transformFeedback);
> glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, transformFeedback);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_TRANSFORM_FEEDBACK, transformFeedback, -1, TestLabel);
> glGetObjectLabel(GL_TRANSFORM_FEEDBACK, transformFeedback, TestLabelLen + 1,
> &length[TRANSFORM_FEEDBACK_IDX], label[TRANSFORM_FEEDBACK_IDX]);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_TRANSFORM_FEEDBACK,
> transformFeedback, -1, TestLabel);
> + glGetObjectLabelKHR(GL_TRANSFORM_FEEDBACK,
> transformFeedback, TestLabelLen + 1,
> + &length[TRANSFORM_FEEDBACK_IDX],
> label[TRANSFORM_FEEDBACK_IDX]);
> +#endif
>
> check_label_and_length(label[TRANSFORM_FEEDBACK_IDX], length[TRANSFORM_FEEDBACK_IDX], "GL_TRANSFORM_FEEDBACK");
>
> @@ -240,8 +305,13 @@ test_object_label_types()
> if (piglit_is_extension_supported("GL_ARB_sampler_objects")) {
> glGenSamplers(1, &sampler);
> glBindSampler(0, sampler);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_SAMPLER, sampler, -1, TestLabel);
> glGetObjectLabel(GL_SAMPLER, sampler, TestLabelLen + 1, &length[SAMPLER_IDX], label[SAMPLER_IDX]);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_SAMPLER, sampler, -1, TestLabel);
> + glGetObjectLabelKHR(GL_SAMPLER, sampler, TestLabelLen +
> 1, &length[SAMPLER_IDX], label[SAMPLER_IDX]);
> +#endif
>
> check_label_and_length(label[SAMPLER_IDX], length[SAMPLER_IDX], "GL_SAMPLER");
>
> @@ -251,8 +321,13 @@ test_object_label_types()
> /* Test TEXTURE */
> glGenTextures(1, &texture);
> glBindTexture(GL_TEXTURE_2D, texture);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_TEXTURE, texture, -1, TestLabel);
> glGetObjectLabel(GL_TEXTURE, texture, TestLabelLen + 1, &length[TEXTURE_IDX], label[TEXTURE_IDX]);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_TEXTURE, texture, -1, TestLabel);
> + glGetObjectLabelKHR(GL_TEXTURE, texture, TestLabelLen + 1,
> &length[TEXTURE_IDX], label[TEXTURE_IDX]);
> +#endif
>
> check_label_and_length(label[TEXTURE_IDX], length[TEXTURE_IDX], "GL_TEXTURE");
>
> @@ -262,8 +337,13 @@ test_object_label_types()
> displayList = glGenLists(1);
> glNewList(displayList, GL_COMPILE_AND_EXECUTE);
> glEndList();
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_DISPLAY_LIST, displayList, -1, TestLabel);
> glGetObjectLabel(GL_DISPLAY_LIST, displayList, TestLabelLen + 1, &length[DISPLAY_LIST_IDX], label[DISPLAY_LIST_IDX]);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_DISPLAY_LIST, displayList, -1, TestLabel);
> + glGetObjectLabelKHR(GL_DISPLAY_LIST, displayList, TestLabelLen +
> 1, &length[DISPLAY_LIST_IDX], label[DISPLAY_LIST_IDX]);
> +#endif
>
> check_label_and_length(label[DISPLAY_LIST_IDX], length[DISPLAY_LIST_IDX], "GL_DISPLAY_LIST");
>
> @@ -301,7 +381,11 @@ test_object_label()
>
> /* Test when length -1 */
> glBindBuffer(GL_ARRAY_BUFFER, buffer);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_BUFFER, buffer, -1, bigLabel);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_BUFFER, buffer, -1,
> bigLabel);
> +#endif
>
> if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
> fprintf(stderr, "GL_INVALID_VALUE should be generated when label >= MAX_LABEL_LENGTH\n");
> @@ -310,7 +394,11 @@ test_object_label()
>
> /* test with large client defined length */
> glBindBuffer(GL_ARRAY_BUFFER, buffer);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_BUFFER, buffer, maxLabelLength, bigLabel);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_BUFFER, buffer,
> maxLabelLength, bigLabel);
> +#endif
>
> if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
> fprintf(stderr, "GL_INVALID_VALUE should be generated when label length >= MAX_LABEL_LENGTH\n");
> @@ -325,9 +413,15 @@ test_object_label()
>
> /* If <label> is NULL, any debug label is effectively removed from the object.
> */
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_BUFFER, buffer, -1, TestLabel);
> glObjectLabel(GL_BUFFER, buffer, -1, NULL);
> glGetObjectLabel(GL_BUFFER, buffer, TestLabelLen + 1, &length, label);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_BUFFER, buffer, -1, TestLabel);
> + glObjectLabelKHR(GL_BUFFER, buffer, -1, NULL);
> + glGetObjectLabelKHR(GL_BUFFER, buffer, TestLabelLen + 1, &length,
> label);
> +#endif
>
> if (length != 0 || (strcmp("", label) != 0)) {
> fprintf(stderr, "Setting label to NULL should remove the label\n");
> @@ -338,7 +432,11 @@ test_object_label()
> /* An INVALID_ENUM error is generated by ObjectLabel if <identifier> is not
> * one of the object types.
> */
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_ARRAY_BUFFER, buffer, -1, TestLabel);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_ARRAY_BUFFER, buffer, -1, TestLabel);
> +#endif
>
> if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
> fprintf(stderr, "GL_INVALID_ENUM should be generated when the ObjectLabel identifier is invalid\n");
> @@ -350,7 +448,11 @@ test_object_label()
> */
> invalidBufferName = buffer;
> glDeleteBuffers(1, &buffer);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_BUFFER, invalidBufferName, -1, TestLabel);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_BUFFER, invalidBufferName, -1, TestLabel);
> +#endif
>
> if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
> fprintf(stderr, "GL_INVALID_VALUE should be generated when the ObjectLabel name is invalid\n");
> @@ -383,8 +485,13 @@ test_get_object_label()
> * <bufSize>.
> */
> glBindBuffer(GL_ARRAY_BUFFER, buffers[TEST_BUFSIZE_IDX]);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_BUFFER, buffers[TEST_BUFSIZE_IDX], -1, TestLabel);
> glGetObjectLabel(GL_BUFFER, buffers[TEST_BUFSIZE_IDX], TestLabelLen, &length, label);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_BUFFER, buffers[TEST_BUFSIZE_IDX], -1,
> TestLabel);
> + glGetObjectLabelKHR(GL_BUFFER, buffers[TEST_BUFSIZE_IDX],
> TestLabelLen, &length, label);
> +#endif
>
> if (length != 9 || (strcmp("Test Labe", label) != 0)) {
> fprintf(stderr, "BufSize should limit the maximum label length to 9\n");
> @@ -397,7 +504,11 @@ test_get_object_label()
> * in <length>.
> */
> glBindBuffer(GL_ARRAY_BUFFER, buffers[TEST_NO_LABEL_IDX]);
> +#ifdef PIGLIT_USE_OPENGL
> glGetObjectLabel(GL_BUFFER, buffers[TEST_NO_LABEL_IDX], TestLabelLen + 1, &length, label);
> +#else /* using GLES */
> + glGetObjectLabelKHR(GL_BUFFER, buffers[TEST_NO_LABEL_IDX],
> TestLabelLen + 1, &length, label);
> +#endif
>
> if (length != 0 || (strcmp("", label) != 0)) {
> fprintf(stderr, "Label should be empty and length 0\n");
> @@ -410,8 +521,13 @@ test_get_object_label()
> * <length>.
> */
> glBindBuffer(GL_ARRAY_BUFFER, buffers[TEST_NULL_LABEL_IDX]);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_BUFFER, buffers[TEST_NULL_LABEL_IDX], -1, TestLabel);
> glGetObjectLabel(GL_BUFFER, buffers[TEST_NULL_LABEL_IDX], TestLabelLen + 1, &length, NULL);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_BUFFER, buffers[TEST_NULL_LABEL_IDX], -1,
> TestLabel);
> + glGetObjectLabelKHR(GL_BUFFER, buffers[TEST_NULL_LABEL_IDX],
> TestLabelLen + 1, &length, NULL);
> +#endif
>
> if (length != TestLabelLen) {
> fprintf(stderr, "Label length should be %i\n", TestLabelLen);
> @@ -422,8 +538,13 @@ test_get_object_label()
> /* If <length> is NULL, no length is returned.
> */
> glBindBuffer(GL_ARRAY_BUFFER, buffers[TEST_NULL_LENGTH_IDX]);
> +#ifdef PIGLIT_USE_OPENGL
> glObjectLabel(GL_BUFFER, buffers[TEST_NULL_LENGTH_IDX], -1, TestLabel);
> glGetObjectLabel(GL_BUFFER, buffers[TEST_NULL_LENGTH_IDX], TestLabelLen + 1, NULL, label);
> +#else /* using GLES */
> + glObjectLabelKHR(GL_BUFFER, buffers[TEST_NULL_LENGTH_IDX], -1,
> TestLabel);
> + glGetObjectLabelKHR(GL_BUFFER, buffers[TEST_NULL_LENGTH_IDX],
> TestLabelLen + 1, NULL, label);
> +#endif
>
> if (strcmp(TestLabel, label) != 0) {
> fprintf(stderr, "Label doent match expected string when length NULL\n");
> @@ -434,7 +555,11 @@ test_get_object_label()
> /* An INVALID_ENUM error is generated by GetObjectLabel if identifier is not
> * one of the valid object types
> */
> +#ifdef PIGLIT_USE_OPENGL
> glGetObjectLabel(GL_ARRAY_BUFFER, buffers[TEST_NULL_LENGTH_IDX], TestLabelLen + 1, &length, label);
> +#else /* using GLES */
> + glGetObjectLabelKHR(GL_ARRAY_BUFFER,
> buffers[TEST_NULL_LENGTH_IDX], TestLabelLen + 1, &length, label);
> +#endif
>
> if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
> fprintf(stderr, "GL_INVALID_ENUM should be generated when GetObjectLabel identifier is invalid\n");
> @@ -446,7 +571,11 @@ test_get_object_label()
> */
> invalidBufferName = buffers[TEST_NULL_LENGTH_IDX];
> glDeleteBuffers(numBuffers, buffers);
> +#ifdef PIGLIT_USE_OPENGL
> glGetObjectLabel(GL_BUFFER, invalidBufferName, TestLabelLen + 1, &length, label);
> +#else /* using GLES */
> + glGetObjectLabelKHR(GL_BUFFER, invalidBufferName, TestLabelLen +
> 1, &length, label);
> +#endif
>
> if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
> fprintf(stderr, "GL_INVALID_VALUE should be generated when GetObjectLabel name is invalid\n");
> @@ -460,7 +589,9 @@ void piglit_init(int argc, char **argv)
> {
> bool pass = true;
>
> +#ifdef PIGLIT_USE_OPENGL
> piglit_require_gl_version(15);
> +#endif
> piglit_require_extension("GL_KHR_debug");
>
> pass = test_object_label_types() && pass;
> --
> 1.8.5.3
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
I personally think it would be nicer to add defines like
#ifdef PIGLIT_USE_OPENGL
#define DebugMessageControl glDebugMessageControl
...
#define GetObjectPtrLabel glGetObjectPtrLabel
#else
#define DebugMessageControl glDebugMessageControlKHR
...
#define GetObjectPtrLabel glGetObjectPtrLabelKHR
#endif
in one place instead of sprinkling the code with ifdefs.
This could also be put in a header in the test dir so that other
KHR_debug tests can use it.
Of course, function pointers that are statically initialized instead of
defines would be cleaner. ;)
Fabian
More information about the Piglit
mailing list