/* * Copyright (c) 2013 Timothy Arceri * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * on the rights to use, copy, modify, merge, publish, distribute, sub * license, and/or sell copies of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NON-INFRINGEMENT. IN NO EVENT SHALL AUTHORS AND/OR THEIR SUPPLIERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "piglit-util-gl.h" static const char *TestLabel = "Test Label"; #define TestLabelLen 10 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; config.khr_no_error_support = PIGLIT_HAS_ERRORS; PIGLIT_GL_TEST_CONFIG_END #ifdef PIGLIT_USE_OPENGL #define GET_FUNC(x) x #else /* using GLES */ #define GET_FUNC(x) x ## KHR #endif /* These functions are assigned in the init function */ static PFNGLOBJECTPTRLABELPROC ObjectPtrLabel; static PFNGLGETOBJECTPTRLABELPROC GetObjectPtrLabel; static PFNGLOBJECTLABELPROC ObjectLabel; static PFNGLGETOBJECTLABELPROC GetObjectLabel; enum piglit_result piglit_display(void) { return PIGLIT_PASS; } static bool test_object_ptr_label() { GLsync sync; GLsizei length; GLchar label[TestLabelLen + 1]; bool pass = true; puts("Test ObjectPtrLabel"); /* basic check to see if glObjectPtrLabel/glGetObjectPtrLabel * set/get the label */ sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); ObjectPtrLabel(sync, -1, TestLabel); GetObjectPtrLabel(sync, TestLabelLen + 1, &length, label); if (length != TestLabelLen || (strcmp(TestLabel, label) != 0)) { fprintf(stderr, "Label or length does not match\n"); printf(" actual label: %s actual length: %i\n", label, length); printf(" expected label: %s expected length: %i\n", TestLabel, TestLabelLen); pass = false; } glDeleteSync(sync); /* An INVALID_VALUE is generated if the parameter of ObjectPtrLabel * is not the name of a sync object. */ ObjectPtrLabel(NULL, length, label); if (!piglit_check_gl_error(GL_INVALID_VALUE)) { fprintf(stderr, "GL_INVALID_VALUE should be generated when ObjectPtrLabel()" " ptr is not the name of a sync object\n"); pass = false; } return pass; } /*