egl/sfopenvg/riMiniEGL.h
author Jose Thachil<jose.thachil@cell-telecom.com>
Wed, 19 May 2010 09:21:10 +0100
branchEGL_MERGE
changeset 72 360f71440b77
parent 57 2bf8a359aa2f
permissions -rw-r--r--
Changes after review
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     1
#ifndef __RIMINIEGL_H
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     2
#define __RIMINIEGL_H
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     3
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     4
/*------------------------------------------------------------------------
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     5
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     6
 * EGL 1.3
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     7
 * -------
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     8
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     9
 * Copyright (c) 2007 The Khronos Group Inc.
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    10
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    11
 * Permission is hereby granted, free of charge, to any person obtaining a
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    12
 * copy of this software and /or associated documentation files
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    13
 * (the "Materials "), to deal in the Materials without restriction,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    14
 * including without limitation the rights to use, copy, modify, merge,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    15
 * publish, distribute, sublicense, and/or sell copies of the Materials,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    16
 * and to permit persons to whom the Materials are furnished to do so,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    17
 * subject to the following conditions: 
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    18
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    19
 * The above copyright notice and this permission notice shall be included 
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    20
 * in all copies or substantial portions of the Materials. 
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    21
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    22
 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    23
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    24
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    25
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    26
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    27
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    28
 * THE USE OR OTHER DEALINGS IN THE MATERIALS.
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    29
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    30
 *//**
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    31
 * \file
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    32
 * \brief	Simple implementation of EGL 1.3
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    33
 * \note	caveats:
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    34
			- always renders into the backbuffer and blits it to window (no single buffered rendering)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    35
			- no native Windows or Mac OS X pixmap support
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    36
			- no power management events
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    37
			- no support for swap interval
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    38
 * \todo	what happens in egl functions when eglTerminate has been called but the context and surface are still in use?
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    39
 * \todo	OSDeinitMutex should be called in case getEGL fails.
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    40
 *//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    41
#include "egl.h"
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    42
#include "riContext.h"
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    43
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    44
#ifdef BUILD_WITH_PRIVATE_EGL 
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    45
#include "eglinternal.h"
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    46
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    47
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    48
#ifdef BUILD_WITH_PRIVATE_OPENVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    49
#include "openvginternal.h"
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    50
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    51
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    52
//==============================================================================================
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    53
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    54
namespace OpenVGRI
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    55
{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 57
diff changeset
    56
class RIEGLSurface;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 57
diff changeset
    57
class RIEGLContext;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 57
diff changeset
    58
class RIEGLThread;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    59
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    60
/*-------------------------------------------------------------------*//*!
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    61
* \brief	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    62
* \param	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    63
* \return	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    64
* \note		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    65
*//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    66
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    67
class RIEGLConfig
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    68
{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    69
public:
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    70
	RIEGLConfig() : m_desc(Color::formatToDescriptor(VG_sRGBA_8888)), m_configID(0)	{}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    71
	~RIEGLConfig()							{}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    72
	void		set(int r, int g, int b, int a, int l, int bpp, int samples, int maskBits, int ID)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    73
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    74
		m_desc.redBits = r;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    75
		m_desc.greenBits = g;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    76
		m_desc.blueBits = b;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    77
		m_desc.alphaBits = a;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    78
		m_desc.luminanceBits = l;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    79
		m_desc.alphaShift = 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    80
		m_desc.luminanceShift = 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    81
		m_desc.blueShift = b ? a : 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    82
		m_desc.greenShift = g ? a + b : 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    83
		m_desc.redShift = r ? a + b + g : 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    84
		m_desc.format = (VGImageFormat)-1;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    85
		m_desc.internalFormat = l ? Color::sLA : Color::sRGBA;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    86
		m_desc.bitsPerPixel = bpp;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    87
		RI_ASSERT(Color::isValidDescriptor(m_desc));
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    88
		m_samples = samples;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    89
        m_maskBits = maskBits;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    90
		m_configID = ID;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    91
        m_config = (EGLConfig)ID;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    92
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    93
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    94
    Color::Descriptor configToDescriptor(bool sRGB, bool premultiplied) const
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    95
    {
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    96
        Color::Descriptor desc = m_desc;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    97
        unsigned int f = m_desc.luminanceBits ? Color::LUMINANCE : 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    98
        f |= sRGB ? Color::NONLINEAR : 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    99
        f |= premultiplied ? Color::PREMULTIPLIED : 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   100
        desc.internalFormat = (Color::InternalFormat)f;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   101
        return desc;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   102
    }
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   103
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   104
	//EGL RED SIZE bits of Red in the color buffer
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   105
	//EGL GREEN SIZE bits of Green in the color buffer
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   106
	//EGL BLUE SIZE bits of Blue in the color buffer
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   107
	//EGL ALPHA SIZE bits of Alpha in the color buffer
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   108
	//EGL LUMINANCE SIZE bits of Luminance in the color buffer
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   109
	Color::Descriptor	m_desc;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   110
	int					m_samples;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   111
    int                 m_maskBits;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   112
	EGLint				m_configID;			//EGL CONFIG ID unique EGLConfig identifier
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   113
    EGLConfig           m_config;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   114
	//EGL BUFFER SIZE depth of the color buffer (sum of channel bits)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   115
	//EGL ALPHA MASK SIZE number alpha mask bits (always 8)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   116
	//EGL BIND TO TEXTURE RGB boolean True if bindable to RGB textures. (always EGL_FALSE)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   117
	//EGL BIND TO TEXTURE RGBA boolean True if bindable to RGBA textures. (always EGL_FALSE)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   118
	//EGL COLOR BUFFER TYPE enum color buffer type (EGL_RGB_BUFFER, EGL_LUMINANCE_BUFFER)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   119
	//EGL CONFIG CAVEAT enum any caveats for the configuration (always EGL_NONE)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   120
	//EGL DEPTH SIZE integer bits of Z in the depth buffer (always 0)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   121
	//EGL LEVEL integer frame buffer level (always 0)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   122
	//EGL MAX PBUFFER WIDTH integer maximum width of pbuffer (always INT_MAX)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   123
	//EGL MAX PBUFFER HEIGHT integer maximum height of pbuffer (always INT_MAX)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   124
	//EGL MAX PBUFFER PIXELS integer maximum size of pbuffer (always INT_MAX)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   125
	//EGL MAX SWAP INTERVAL integer maximum swap interval (always 1)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   126
	//EGL MIN SWAP INTERVAL integer minimum swap interval (always 1)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   127
	//EGL NATIVE RENDERABLE boolean EGL TRUE if native rendering APIs can render to surface (always EGL_FALSE)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   128
	//EGL NATIVE VISUAL ID integer handle of corresponding native visual (always 0)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   129
	//EGL NATIVE VISUAL TYPE integer native visual type of the associated visual (always EGL_NONE)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   130
	//EGL RENDERABLE TYPE bitmask which client rendering APIs are supported. (always EGL_OPENVG_BIT)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   131
	//EGL SAMPLE BUFFERS integer number of multisample buffers (always 0)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   132
	//EGL SAMPLES integer number of samples per pixel (always 0)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   133
	//EGL STENCIL SIZE integer bits of Stencil in the stencil buffer (always 0)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   134
	//EGL SURFACE TYPE bitmask which types of EGL surfaces are supported. (always EGL WINDOW BIT | EGL PIXMAP BIT | EGL PBUFFER BIT)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   135
	//EGL TRANSPARENT TYPE enum type of transparency supported (always EGL_NONE)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   136
	//EGL TRANSPARENT RED VALUE integer transparent red value (undefined)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   137
	//EGL TRANSPARENT GREEN VALUE integer transparent green value (undefined)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   138
	//EGL TRANSPARENT BLUE VALUE integer transparent blue value (undefined)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   139
};
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   140
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   141
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   142
/*-------------------------------------------------------------------*//*!
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   143
* \brief	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   144
* \param	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   145
* \return	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   146
* \note		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   147
*//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   148
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   149
#define EGL_NUMCONFIGS		60
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   150
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   151
class RIEGLDisplay
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   152
{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   153
public:
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   154
	RIEGLDisplay(EGLDisplay id);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   155
	~RIEGLDisplay();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   156
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   157
	int                getNumConfigs() const              { return EGL_NUMCONFIGS; }
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   158
    const RIEGLConfig& getConfigByIdx(int i) const             { RI_ASSERT(i >= 0 && i < EGL_NUMCONFIGS); return m_configs[i]; }
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   159
    const RIEGLConfig& getConfig(const EGLConfig config) const        { for(int i=0;i<EGL_NUMCONFIGS;i++) { if(m_configs[i].m_config == config) return m_configs[i]; } RI_ASSERT(0); return m_configs[0]; }
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   160
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   161
    EGLDisplay        getID() const                       { return m_id; }
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   162
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   163
    void              addContext(RIEGLContext* ctx)       { RI_ASSERT(ctx); m_contexts.push_back(ctx); }  //throws bad_alloc
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   164
    void              removeContext(RIEGLContext* ctx)    { RI_ASSERT(ctx); bool res = m_contexts.remove(ctx); RI_ASSERT(res); RI_UNREF(res); }
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   165
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   166
    void              addSurface(RIEGLSurface* srf)       { RI_ASSERT(srf); m_surfaces.push_back(srf); }  //throws bad_alloc
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   167
    void              removeSurface(RIEGLSurface* srf)    { RI_ASSERT(srf); bool res = m_surfaces.remove(srf); RI_ASSERT(res); RI_UNREF(res); }
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   168
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   169
    EGLBoolean        contextExists(const EGLContext ctx) const;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   170
    EGLBoolean        surfaceExists(const EGLSurface srf) const;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   171
    EGLBoolean        configExists(const EGLConfig cfg) const;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   172
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   173
private:
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   174
	RIEGLDisplay(const RIEGLDisplay& t);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   175
	RIEGLDisplay& operator=(const RIEGLDisplay&t);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   176
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   177
	EGLDisplay              m_id;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   178
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   179
	Array<RIEGLContext*>	m_contexts;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   180
	Array<RIEGLSurface*>	m_surfaces;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   181
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   182
	RIEGLConfig             m_configs[EGL_NUMCONFIGS];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   183
};
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   184
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   185
/*-------------------------------------------------------------------*//*!
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   186
* \brief	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   187
* \param	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   188
* \return	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   189
* \note		
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   190
*//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   191
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   192
class EGL
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   193
{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   194
public:
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   195
	EGL();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   196
	~EGL();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   197
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   198
	void	addReference()				{ m_referenceCount++; }
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   199
	int		removeReference()			{ m_referenceCount--; RI_ASSERT(m_referenceCount >= 0); return m_referenceCount; }
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   200
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   201
    void                addDisplay(RIEGLDisplay* display)           { RI_ASSERT(display); m_displays.push_back(display); }  //throws bad alloc
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   202
    void                removeDisplay(RIEGLDisplay* display)        { RI_ASSERT(display); bool res = m_displays.remove(display); RI_ASSERT(res); RI_UNREF(res); }
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   203
    RIEGLDisplay*       getDisplay(const EGLDisplay displayID) const;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   204
    EGLDisplay          findDisplay(const EGLContext ctx) const;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   205
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   206
    void                addCurrentThread(RIEGLThread* thread)       { RI_ASSERT(thread); m_currentThreads.push_back(thread); }  //throws bad alloc
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   207
    void                removeCurrentThread(RIEGLThread* thread)    { RI_ASSERT(thread); bool res = m_currentThreads.remove(thread); RI_ASSERT(res); RI_UNREF(res); }
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   208
    RIEGLThread*        getCurrentThread() const;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   209
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   210
    RIEGLThread*        getThread();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   211
    void                destroyThread();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   212
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   213
    bool                isInUse(const void* image) const;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   214
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   215
private:
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   216
	EGL(const EGL&);						// Not allowed.
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   217
	const EGL& operator=(const EGL&);		// Not allowed.
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   218
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   219
	Array<RIEGLThread*>		m_threads;			//threads that have called EGL
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   220
	Array<RIEGLThread*>		m_currentThreads;	//threads that have a bound context
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   221
	Array<RIEGLDisplay*>	m_displays;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   222
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   223
	int                     m_referenceCount;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   224
};
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   225
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   226
void* eglvgGetCurrentVGContext(void);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   227
bool  eglvgIsInUse(void* image);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   228
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   229
} //end of namespace
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   230
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   231
#endif /* __RIMINIEGL_H */
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   232
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   233