libglvnd/tests/dummy/EGL_dummy.h
Kyle Brenneman 579e0acdb0 tests: Add a test for eglGetProcAddress.
Added a test for eglGetProcAddress and dispatching for EGL and GL functions.

Added three EGL extension functions to the EGL dummy vendor, to test
dispatching extensions by display, device, and current context.

Added a simple implementation of eglCreateContext, eglDestroyContext, and
eglMakeCurrent, and glGetString.
2016-11-02 17:03:18 -06:00

94 lines
3.4 KiB
C

/*
* Copyright (c) 2016, NVIDIA CORPORATION.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and/or associated documentation files (the
* "Materials"), to deal in the Materials without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Materials, and to
* permit persons to whom the Materials are furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* unaltered in all copies or substantial portions of the Materials.
* Any additions, deletions, or changes to the original source files
* must be clearly indicated in accompanying documentation.
*
* If only executable code is distributed, then the accompanying
* documentation must state that "this software is based in part on the
* work of the Khronos Group."
*
* THE MATERIALS ARE 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 NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 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
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/**
* \file
*
* Some declarations for the dummy vendor library used to test libEGL.
*
* For the EGL tests, we create two vendor libraries. They're both identical,
* except that each one has its own vendor name string.
*
* The vendor name is returned for things like the EGL_VENDOR and GL_VENDOR
* strings, so that we can check that an EGL or GL call gets dispatched to the
* right vendor.
*
* In addition, you can pass the vendor name as the native display handle to
* eglGetPlatformDisplay, with EGL_DUMMY_PLATFORM for the platform type. That
* mainly provides an easy way to create an EGLDisplay without having to mess
* around with EGLDeviceEXT handles.
*
* Using EGL_DUMMY_PLATFORM also tests whether libEGL.so can deal with a call
* to eglGetPlatformDisplay with an unknown platform, since it does have
* special handling for EGL_PLATFORM_DEVICE_EXT.
*/
#ifndef EGL_DUMMY_H
#define EGL_DUMMY_H
#include <EGL/egl.h>
#include <EGL/eglext.h>
#define DUMMY_VENDOR_NAME_0 "dummy0"
#define DUMMY_VENDOR_NAME_1 "dummy1"
/**
* A platform enum to select a vendor library by name.
* The native display should be a pointer to a string with the vendor name.
*/
#define EGL_DUMMY_PLATFORM 0x010000
enum
{
DUMMY_COMMAND_GET_VENDOR_NAME
};
/**
* A simple EGL extension function with a vendor-provided dispatch stub.
*
* The function will return the vendor name, so the caller can check whether it
* gets dispatched to the correct vendor.
*/
typedef void * (* pfn_eglTestDispatchDisplay) (EGLDisplay dpy, EGLint command, EGLAttrib param);
/**
* Does the same thing as \c eglTestDispatchDisplay, but dispatches based on an
* EGLDeviceEXT instead of an EGLDisplay.
*/
typedef void * (* pfn_eglTestDispatchDevice) (EGLDeviceEXT dev, EGLint command, EGLAttrib param);
/**
* Does the same thing as \c eglTestDispatchDisplay, but dispatches based on
* the current context.
*/
typedef void * (* pfn_eglTestDispatchCurrent) (EGLint command, EGLAttrib param);
#endif // EGL_DUMMY_H