|
Packit |
5af8b3 |
/*
|
|
Packit |
5af8b3 |
* Copyright (c) 2016, NVIDIA CORPORATION.
|
|
Packit |
5af8b3 |
*
|
|
Packit |
5af8b3 |
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
Packit |
5af8b3 |
* copy of this software and/or associated documentation files (the
|
|
Packit |
5af8b3 |
* "Materials"), to deal in the Materials without restriction, including
|
|
Packit |
5af8b3 |
* without limitation the rights to use, copy, modify, merge, publish,
|
|
Packit |
5af8b3 |
* distribute, sublicense, and/or sell copies of the Materials, and to
|
|
Packit |
5af8b3 |
* permit persons to whom the Materials are furnished to do so, subject to
|
|
Packit |
5af8b3 |
* the following conditions:
|
|
Packit |
5af8b3 |
*
|
|
Packit |
5af8b3 |
* The above copyright notice and this permission notice shall be included
|
|
Packit |
5af8b3 |
* unaltered in all copies or substantial portions of the Materials.
|
|
Packit |
5af8b3 |
* Any additions, deletions, or changes to the original source files
|
|
Packit |
5af8b3 |
* must be clearly indicated in accompanying documentation.
|
|
Packit |
5af8b3 |
*
|
|
Packit |
5af8b3 |
* If only executable code is distributed, then the accompanying
|
|
Packit |
5af8b3 |
* documentation must state that "this software is based in part on the
|
|
Packit |
5af8b3 |
* work of the Khronos Group."
|
|
Packit |
5af8b3 |
*
|
|
Packit |
5af8b3 |
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
Packit |
5af8b3 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
Packit |
5af8b3 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
Packit |
5af8b3 |
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
Packit |
5af8b3 |
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
Packit |
5af8b3 |
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
Packit |
5af8b3 |
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
|
Packit |
5af8b3 |
*/
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
/**
|
|
Packit |
5af8b3 |
* \file
|
|
Packit |
5af8b3 |
*
|
|
Packit |
5af8b3 |
* Some declarations for the dummy vendor library used to test libEGL.
|
|
Packit |
5af8b3 |
*
|
|
Packit |
5af8b3 |
* For the EGL tests, we create two vendor libraries. They're both identical,
|
|
Packit |
5af8b3 |
* except that each one has its own vendor name string.
|
|
Packit |
5af8b3 |
*
|
|
Packit |
5af8b3 |
* The vendor name is returned for things like the EGL_VENDOR and GL_VENDOR
|
|
Packit |
5af8b3 |
* strings, so that we can check that an EGL or GL call gets dispatched to the
|
|
Packit |
5af8b3 |
* right vendor.
|
|
Packit |
5af8b3 |
*
|
|
Packit |
5af8b3 |
* In addition, you can pass the vendor name as the native display handle to
|
|
Packit |
5af8b3 |
* eglGetPlatformDisplay, with EGL_DUMMY_PLATFORM for the platform type. That
|
|
Packit |
5af8b3 |
* mainly provides an easy way to create an EGLDisplay without having to mess
|
|
Packit |
5af8b3 |
* around with EGLDeviceEXT handles.
|
|
Packit |
5af8b3 |
*
|
|
Packit |
5af8b3 |
* Using EGL_DUMMY_PLATFORM also tests whether libEGL.so can deal with a call
|
|
Packit |
5af8b3 |
* to eglGetPlatformDisplay with an unknown platform, since it does have
|
|
Packit |
5af8b3 |
* special handling for EGL_PLATFORM_DEVICE_EXT.
|
|
Packit |
5af8b3 |
*/
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
#ifndef EGL_DUMMY_H
|
|
Packit |
5af8b3 |
#define EGL_DUMMY_H
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
#include <EGL/egl.h>
|
|
Packit |
5af8b3 |
#include <EGL/eglext.h>
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
#define DUMMY_VENDOR_NAME_0 "dummy0"
|
|
Packit |
5af8b3 |
#define DUMMY_VENDOR_NAME_1 "dummy1"
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
/**
|
|
Packit |
5af8b3 |
* The number of devices that each dummy vendor library exposes. This is used
|
|
Packit |
5af8b3 |
* to figure out which vendor library should be behind each device.
|
|
Packit |
5af8b3 |
*/
|
|
Packit |
5af8b3 |
#define DUMMY_EGL_DEVICE_COUNT 2
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
/**
|
|
Packit |
5af8b3 |
* A platform enum to select a vendor library by name.
|
|
Packit |
5af8b3 |
* The native display should be a pointer to a string with the vendor name.
|
|
Packit |
5af8b3 |
*/
|
|
Packit |
5af8b3 |
#define EGL_DUMMY_PLATFORM 0x010000
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
/**
|
|
Packit |
5af8b3 |
* This attrbute tells eglCreateContext to set an error and fail. This is used
|
|
Packit |
5af8b3 |
* for testing eglGetError and the EGL_KHR_debug functions.
|
|
Packit |
5af8b3 |
*
|
|
Packit |
5af8b3 |
* For EGL_KHR_debug, the vendor will call the debug callback with its vendor
|
|
Packit |
5af8b3 |
* name for the message string.
|
|
Packit |
5af8b3 |
*/
|
|
Packit |
5af8b3 |
#define EGL_CREATE_CONTEXT_FAIL 0x010001
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
enum
|
|
Packit |
5af8b3 |
{
|
|
Packit |
5af8b3 |
DUMMY_COMMAND_GET_VENDOR_NAME,
|
|
Packit |
5af8b3 |
DUMMY_COMMAND_GET_CURRENT_CONTEXT,
|
|
Packit |
5af8b3 |
DUMMY_COMMAND_FAIL_NEXT_MAKE_CURRENT,
|
|
Packit |
5af8b3 |
};
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
/**
|
|
Packit |
5af8b3 |
* The struct that an EGLContext points to. This is used to test
|
|
Packit |
5af8b3 |
* eglCreateContext and eglMakeCurrent.
|
|
Packit |
5af8b3 |
*/
|
|
Packit |
5af8b3 |
typedef struct DummyEGLContextRec {
|
|
Packit |
5af8b3 |
const char *vendorName;
|
|
Packit |
5af8b3 |
} DummyEGLContext;
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
/**
|
|
Packit |
5af8b3 |
* A simple EGL extension function with a vendor-provided dispatch stub.
|
|
Packit |
5af8b3 |
*
|
|
Packit |
5af8b3 |
* The function will return the vendor name, so the caller can check whether it
|
|
Packit |
5af8b3 |
* gets dispatched to the correct vendor.
|
|
Packit |
5af8b3 |
*/
|
|
Packit |
5af8b3 |
typedef void * (* pfn_eglTestDispatchDisplay) (EGLDisplay dpy, EGLint command, EGLAttrib param);
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
/**
|
|
Packit |
5af8b3 |
* Does the same thing as \c eglTestDispatchDisplay, but dispatches based on an
|
|
Packit |
5af8b3 |
* EGLDeviceEXT instead of an EGLDisplay.
|
|
Packit |
5af8b3 |
*/
|
|
Packit |
5af8b3 |
typedef void * (* pfn_eglTestDispatchDevice) (EGLDeviceEXT dev, EGLint command, EGLAttrib param);
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
/**
|
|
Packit |
5af8b3 |
* Does the same thing as \c eglTestDispatchDisplay, but dispatches based on
|
|
Packit |
5af8b3 |
* the current context.
|
|
Packit |
5af8b3 |
*/
|
|
Packit |
5af8b3 |
typedef void * (* pfn_eglTestDispatchCurrent) (EGLint command, EGLAttrib param);
|
|
Packit |
5af8b3 |
|
|
Packit |
5af8b3 |
#endif // EGL_DUMMY_H
|