egl/sfopenvg/riMiniEGL.cpp
author Faisal Memon <faisal.memon@nokia.com>
Fri, 25 Jun 2010 17:49:58 +0100
branchEGL_MERGE
changeset 105 158b2308cc08
parent 95 e97e5fe517d3
permissions -rw-r--r--
Fix def files so that the implementation agnostic interface definition has no non-standards defined entry points, and change the eglrefimpl specific implementation to place its private entry points high up in the ordinal order space in the implementation region, not the standards based entrypoints region.
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
/*------------------------------------------------------------------------
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     2
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
     3
 * 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
     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
 * 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
     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
 * 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
     9
 * 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
    10
 * (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
    11
 * 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
    12
 * 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
    13
 * 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
    14
 * 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
    15
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    16
 * 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
    17
 * 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
    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 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
    20
 * 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
    21
 * 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
    22
 * 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
    23
 * 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
    24
 * 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
    25
 * 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
    26
 *
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    27
 *//**
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    28
 * \file
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    29
 * \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
    30
 * \note	caveats:
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    31
			- always renders into the backbuffer and blits it to window (no single buffered rendering)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    32
			- no native Windows or Mac OS X pixmap support
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    33
			- no power management events
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    34
			- no support for swap interval
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    35
 * \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
    36
 * \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
    37
 *//*-------------------------------------------------------------------*/
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    38
95
e97e5fe517d3 Removed riMiniEGL.h included twice and reverted changes in directgdiadapter_vg.mmp
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 75
diff changeset
    39
//#include "riMiniEGL.h"
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    40
#include "eglprivate.h"
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    41
#include "riMath.h"
57
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 <e32debug.h>
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    43
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    44
//==============================================================================================
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    45
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    46
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
    47
{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    48
void* OSGetCurrentThreadID(void);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    49
void OSAcquireMutex(void);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    50
void OSReleaseMutex(void);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    51
void OSDeinitMutex(void);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    52
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    53
EGLDisplay OSGetDisplay(EGLNativeDisplayType display_id);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    54
void* OSCreateWindowContext(EGLNativeWindowType window);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    55
void OSDestroyWindowContext(void* context);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    56
bool OSIsWindow(const void* context);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    57
void OSGetWindowSize(const void* context, int& width, int& height);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    58
void OSBlitToWindow(void* context, const Drawable* drawable);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    59
EGLBoolean OSGetNativePixmapInfo(NativePixmapType pixmap, int* width, int* height, int* stride, VGImageFormat* format, int** data);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    60
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    61
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    62
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    63
/*-------------------------------------------------------------------*//*!
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    64
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    65
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    66
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    67
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    68
*//*-------------------------------------------------------------------*/
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    69
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    70
class RIEGLContext
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    71
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    72
public:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    73
	RIEGLContext(OpenVGRI::VGContext* vgctx, const EGLConfig config);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    74
	~RIEGLContext();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    75
	void	addReference()				{ m_referenceCount++; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    76
	int		removeReference()			{ m_referenceCount--; RI_ASSERT(m_referenceCount >= 0); return m_referenceCount; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    77
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    78
    VGContext*      getVGContext() const      { return m_vgContext; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    79
    EGLConfig getConfig() const         { return m_config; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    80
private:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    81
	RIEGLContext(const RIEGLContext&);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    82
	RIEGLContext& operator=(const RIEGLContext&);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    83
	VGContext*		m_vgContext;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    84
	const EGLConfig	m_config;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    85
	int				m_referenceCount;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    86
};
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    87
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    88
RIEGLContext* CastToRIEGLContext(EGLContext aCtxId);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    89
EGLContext CastFromRIEGLContext(RIEGLContext* aCtx);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    90
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    91
RIEGLContext::RIEGLContext(OpenVGRI::VGContext* vgctx, const EGLConfig config) :
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    92
	m_vgContext(vgctx),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    93
	m_config(config),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    94
	m_referenceCount(0)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    95
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    96
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    97
RIEGLContext::~RIEGLContext()
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
    98
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
    99
	RI_ASSERT(m_referenceCount == 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
	RI_DELETE(m_vgContext);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   101
}
57
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
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   104
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   105
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   106
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   107
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   108
*//*-------------------------------------------------------------------*/
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   109
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   110
class RIEGLSurface
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   111
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   112
public:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   113
    RIEGLSurface(void* OSWindowContext, const EGLConfig config, Drawable* drawable, bool largestPbuffer, int renderBuffer);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   114
	~RIEGLSurface();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   115
	void	addReference()				{ m_referenceCount++; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   116
	int		removeReference()			{ m_referenceCount--; RI_ASSERT(m_referenceCount >= 0); return m_referenceCount; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   117
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   118
    void*           getOSWindowContext() const { return m_OSWindowContext; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   119
    EGLConfig       getConfig() const          { return m_config; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   120
    Drawable*       getDrawable() const        { return m_drawable; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   121
    bool            isLargestPbuffer() const   { return m_largestPbuffer; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   122
    int             getRenderBuffer() const    { return m_renderBuffer; }
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   123
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   124
private:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   125
	RIEGLSurface(const RIEGLSurface&);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   126
	RIEGLSurface& operator=(const RIEGLSurface&);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   127
    void*            m_OSWindowContext;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   128
	const EGLConfig	 m_config;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   129
	Drawable*        m_drawable;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   130
	bool			 m_largestPbuffer;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   131
	int				 m_renderBuffer;		//EGL_BACK_BUFFER or EGL_SINGLE_BUFFER
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   132
	int				 m_referenceCount;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   133
};
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   134
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   135
RIEGLSurface* CastToRIEGLSurface(EGLSurface aSurfaceId);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   136
EGLSurface CastFromRIEGLSurface(RIEGLSurface* aSurface);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   137
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   138
RIEGLSurface::RIEGLSurface(void* OSWindowContext, const EGLConfig config, Drawable* drawable, bool largestPbuffer, int renderBuffer) :
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   139
    m_OSWindowContext(OSWindowContext),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   140
	m_config(config),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   141
	m_drawable(drawable),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   142
	m_largestPbuffer(largestPbuffer),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   143
	m_renderBuffer(renderBuffer),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   144
	m_referenceCount(0)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   145
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   146
    RI_ASSERT(m_renderBuffer == EGL_BACK_BUFFER);   //only back buffer rendering is supported
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   147
    m_drawable->addReference();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   148
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   149
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   150
RIEGLSurface::~RIEGLSurface()
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   151
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   152
	RI_ASSERT(m_referenceCount == 0);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   153
    OSDestroyWindowContext(m_OSWindowContext);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   154
	if(m_drawable)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   155
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   156
		if(!m_drawable->removeReference())
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   157
			RI_DELETE(m_drawable);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   158
	}
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   159
}
57
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
RIEGLDisplay::RIEGLDisplay(EGLDisplay id) :
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   162
	m_id(id),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   163
	m_contexts(),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   164
	m_surfaces()
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   165
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   166
	RI_ASSERT(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
   167
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   168
	//sorted by RGB/LUMINANCE (exact), larger total number of color bits (at least), buffer size (at least), config ID (exact)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   169
	//NOTE: 16 bit configs need to be sorted on the fly if the request ignores some channels
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   170
	//NOTE: config IDs start from 1
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   171
	//               R  B  G  A  L  bpp samples maskBits ID
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   172
	m_configs[0].set(8, 8, 8, 8, 0, 32, 1, 8, 1);	//EGL_RGB_BUFFER, buffer size = 32
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   173
	m_configs[1].set(8, 8, 8, 0, 0, 32, 1, 8, 2);	//EGL_RGB_BUFFER, buffer size = 24
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   174
	m_configs[2].set(5, 5, 5, 1, 0, 16, 1, 4, 3);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   175
	m_configs[3].set(5, 6, 5, 0, 0, 16, 1, 4, 4);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   176
	m_configs[4].set(4, 4, 4, 4, 0, 16, 1, 4, 5);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   177
	m_configs[5].set(0, 0, 0, 8, 0, 8,  1, 8, 6);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   178
	m_configs[6].set(0, 0, 0, 4, 0, 4,  1, 4, 7);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   179
	m_configs[7].set(0, 0, 0, 1, 0, 1,  1, 1, 8);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   180
	m_configs[8].set(0, 0, 0, 0, 8, 8,  1, 8, 9);	//EGL_LUMINANCE_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   181
	m_configs[9].set(0, 0, 0, 0, 1, 1,  1, 1, 10);	//EGL_LUMINANCE_BUFFER, buffer size = 1
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   182
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   183
	m_configs[10].set(8, 8, 8, 8, 0, 32, 4, 1, 11);	//EGL_RGB_BUFFER, buffer size = 32
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   184
	m_configs[11].set(8, 8, 8, 0, 0, 32, 4, 1, 12);	//EGL_RGB_BUFFER, buffer size = 24
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   185
	m_configs[12].set(5, 5, 5, 1, 0, 16, 4, 1, 13);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   186
	m_configs[13].set(5, 6, 5, 0, 0, 16, 4, 1, 14);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   187
	m_configs[14].set(4, 4, 4, 4, 0, 16, 4, 1, 15);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   188
	m_configs[15].set(0, 0, 0, 8, 0, 8,  4, 1, 16);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   189
	m_configs[16].set(0, 0, 0, 4, 0, 4,  4, 1, 17);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   190
	m_configs[17].set(0, 0, 0, 1, 0, 1,  4, 1, 18);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   191
	m_configs[18].set(0, 0, 0, 0, 8, 8,  4, 1, 19);	//EGL_LUMINANCE_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   192
	m_configs[19].set(0, 0, 0, 0, 1, 1,  4, 1, 20);	//EGL_LUMINANCE_BUFFER, buffer size = 1
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   193
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   194
	m_configs[20].set(8, 8, 8, 8, 0, 32, 32, 1, 21);	//EGL_RGB_BUFFER, buffer size = 32
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   195
	m_configs[21].set(8, 8, 8, 0, 0, 32, 32, 1, 22);	//EGL_RGB_BUFFER, buffer size = 24
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   196
	m_configs[22].set(5, 5, 5, 1, 0, 16, 32, 1, 23);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   197
	m_configs[23].set(5, 6, 5, 0, 0, 16, 32, 1, 24);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   198
	m_configs[24].set(4, 4, 4, 4, 0, 16, 32, 1, 25);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   199
	m_configs[25].set(0, 0, 0, 8, 0, 8,  32, 1, 26);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   200
	m_configs[26].set(0, 0, 0, 4, 0, 4,  32, 1, 27);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   201
	m_configs[27].set(0, 0, 0, 1, 0, 1,  32, 1, 28);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   202
	m_configs[28].set(0, 0, 0, 0, 8, 8,  32, 1, 29);	//EGL_LUMINANCE_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   203
	m_configs[29].set(0, 0, 0, 0, 1, 1,  32, 1, 30);	//EGL_LUMINANCE_BUFFER, buffer size = 1
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   204
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   205
    //configs without mask
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   206
	m_configs[30].set(8, 8, 8, 8, 0, 32, 1, 0, 31);	//EGL_RGB_BUFFER, buffer size = 32
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   207
	m_configs[31].set(8, 8, 8, 0, 0, 32, 1, 0, 32);	//EGL_RGB_BUFFER, buffer size = 24
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   208
	m_configs[32].set(5, 5, 5, 1, 0, 16, 1, 0, 33);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   209
	m_configs[33].set(5, 6, 5, 0, 0, 16, 1, 0, 34);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   210
	m_configs[34].set(4, 4, 4, 4, 0, 16, 1, 0, 35);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   211
	m_configs[35].set(0, 0, 0, 8, 0, 8,  1, 0, 36);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   212
	m_configs[36].set(0, 0, 0, 4, 0, 4,  1, 0, 37);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   213
	m_configs[37].set(0, 0, 0, 1, 0, 1,  1, 0, 38);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   214
	m_configs[38].set(0, 0, 0, 0, 8, 8,  1, 0, 39);	//EGL_LUMINANCE_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   215
	m_configs[39].set(0, 0, 0, 0, 1, 1,  1, 0, 40);	//EGL_LUMINANCE_BUFFER, buffer size = 1
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   216
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   217
	m_configs[40].set(8, 8, 8, 8, 0, 32, 4, 0, 41);	//EGL_RGB_BUFFER, buffer size = 32
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   218
	m_configs[41].set(8, 8, 8, 0, 0, 32, 4, 0, 42);	//EGL_RGB_BUFFER, buffer size = 24
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   219
	m_configs[42].set(5, 5, 5, 1, 0, 16, 4, 0, 43);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   220
	m_configs[43].set(5, 6, 5, 0, 0, 16, 4, 0, 44);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   221
	m_configs[44].set(4, 4, 4, 4, 0, 16, 4, 0, 45);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   222
	m_configs[45].set(0, 0, 0, 8, 0, 8,  4, 0, 46);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   223
	m_configs[46].set(0, 0, 0, 4, 0, 4,  4, 0, 47);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   224
	m_configs[47].set(0, 0, 0, 1, 0, 1,  4, 0, 48);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   225
	m_configs[48].set(0, 0, 0, 0, 8, 8,  4, 0, 49);	//EGL_LUMINANCE_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   226
	m_configs[49].set(0, 0, 0, 0, 1, 1,  4, 0, 50);	//EGL_LUMINANCE_BUFFER, buffer size = 1
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   227
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   228
	m_configs[50].set(8, 8, 8, 8, 0, 32, 32, 0, 51);	//EGL_RGB_BUFFER, buffer size = 32
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   229
	m_configs[51].set(8, 8, 8, 0, 0, 32, 32, 0, 52);	//EGL_RGB_BUFFER, buffer size = 24
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   230
	m_configs[52].set(5, 5, 5, 1, 0, 16, 32, 0, 53);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   231
	m_configs[53].set(5, 6, 5, 0, 0, 16, 32, 0, 54);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   232
	m_configs[54].set(4, 4, 4, 4, 0, 16, 32, 0, 55);	//EGL_RGB_BUFFER, buffer size = 16
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   233
	m_configs[55].set(0, 0, 0, 8, 0, 8,  32, 0, 56);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   234
	m_configs[56].set(0, 0, 0, 4, 0, 4,  32, 0, 57);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   235
	m_configs[57].set(0, 0, 0, 1, 0, 1,  32, 0, 58);	//EGL_RGB_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   236
	m_configs[58].set(0, 0, 0, 0, 8, 8,  32, 0, 59);	//EGL_LUMINANCE_BUFFER, buffer size = 8
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   237
	m_configs[59].set(0, 0, 0, 0, 1, 1,  32, 0, 60);	//EGL_LUMINANCE_BUFFER, buffer size = 1
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   238
/*
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   239
attrib                default        criteria order   priority
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   240
--------------------------------------------------------------
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   241
EGL_COLOR_BUFFER_TYPE EGL_RGB_BUFFER Exact    None    2 
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   242
EGL_RED_SIZE          0              AtLeast  Special 3 
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   243
EGL_GREEN_SIZE        0              AtLeast  Special 3 
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   244
EGL_BLUE_SIZE         0              AtLeast  Special 3 
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   245
EGL_LUMINANCE_SIZE    0              AtLeast  Special 3 
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   246
EGL_ALPHA_SIZE        0              AtLeast  Special 3 
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   247
EGL_BUFFER_SIZE       0              AtLeast  Smaller 4 
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   248
EGL_CONFIG_ID         EGL_DONT_CARE  Exact    Smaller 11
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   249
*/
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   250
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   251
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   252
RIEGLDisplay::~RIEGLDisplay()
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   253
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   254
	//mark everything for deletion, but don't delete the current context and surface
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   255
	for(int i=0;i<m_contexts.size();i++)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   256
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   257
		if(!m_contexts[i]->removeReference())
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   258
			RI_DELETE(m_contexts[i]);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   259
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   260
	m_contexts.clear();	//remove all contexts from the list (makes further references to the current contexts invalid)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   261
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   262
	for(int i=0;i<m_surfaces.size();i++)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   263
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   264
		if(!m_surfaces[i]->removeReference())
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   265
			RI_DELETE(m_surfaces[i]);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   266
	}
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   267
	m_surfaces.clear();	//remove all surfaces from the list (makes further references to the current surfaces invalid)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   268
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   269
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   270
EGLBoolean RIEGLDisplay::contextExists(const EGLContext ctx) const
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   271
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   272
	for(int i=0;i<m_contexts.size();i++)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   273
	{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   274
		if(m_contexts[i] == CastToRIEGLContext(ctx))
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   275
			return EGL_TRUE;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   276
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   277
	return EGL_FALSE;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   278
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   279
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   280
EGLBoolean RIEGLDisplay::surfaceExists(const EGLSurface surf) const
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   281
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   282
	for(int i=0;i<m_surfaces.size();i++)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   283
	{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   284
		if(m_surfaces[i] == CastToRIEGLSurface(surf))
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   285
			return EGL_TRUE;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   286
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   287
	return EGL_FALSE;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   288
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   289
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   290
EGLBoolean RIEGLDisplay::configExists(const EGLConfig config) const
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   291
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   292
    for(int i=0;i<EGL_NUMCONFIGS;i++)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   293
    {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   294
        if(m_configs[i].m_config == config)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   295
		return EGL_TRUE;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   296
    }
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   297
	return EGL_FALSE;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   298
}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   299
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   300
/*-------------------------------------------------------------------*//*!
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   301
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   302
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   303
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   304
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   305
*//*-------------------------------------------------------------------*/
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   306
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   307
class RIEGLThread
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   308
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   309
public:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   310
	RIEGLThread(void* currentThreadID);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   311
	~RIEGLThread();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   312
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   313
    void*           getThreadID() const       { return m_threadID; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   314
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   315
    void            makeCurrent(RIEGLContext* c, RIEGLSurface* s)       { m_context = c; m_surface = s; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   316
	RIEGLContext*	getCurrentContext() const   { return m_context; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   317
	RIEGLSurface*	getCurrentSurface() const   { return m_surface; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   318
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   319
    void            setError(EGLint error)      { m_error = error; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   320
    EGLint          getError() const            { return m_error; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   321
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   322
    void            bindAPI(EGLint api)         { m_boundAPI = api; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   323
    EGLint          getBoundAPI() const         { return m_boundAPI; }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   324
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   325
private:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   326
	RIEGLThread(const RIEGLThread&);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   327
	RIEGLThread operator=(const RIEGLThread&);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   328
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   329
	RIEGLContext*		m_context;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   330
	RIEGLSurface*		m_surface;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   331
	EGLint              m_error;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   332
	void*               m_threadID;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   333
	EGLint              m_boundAPI;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   334
};
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   335
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   336
RIEGLThread::RIEGLThread(void* currentThreadID) :
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   337
	m_context(NULL),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   338
	m_surface(NULL),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   339
	m_error(EGL_SUCCESS),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   340
	m_threadID(currentThreadID),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   341
	m_boundAPI(EGL_NONE)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   342
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   343
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   344
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   345
RIEGLThread::~RIEGLThread()
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   346
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   347
}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   348
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   349
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   350
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   351
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   352
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   353
Image* CastToImage(EGLClientBuffer aBufferId);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   354
EGLClientBuffer CastFromImage(Image* aBUffer);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   355
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   356
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   357
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   358
EGL::EGL() :
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   359
	m_threads(),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   360
	m_currentThreads(),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   361
	m_displays(),
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   362
	m_referenceCount(0)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   363
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   364
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   365
EGL::~EGL()
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   366
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   367
	for(int i=0;i<m_displays.size();i++)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   368
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   369
		RI_DELETE(m_displays[i]);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   370
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   371
	for(int i=0;i<m_threads.size();i++)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   372
	{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   373
		RI_DELETE(m_threads[i]);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   374
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   375
	//currentThreads contain just pointers to threads we just deleted
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   376
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   377
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   378
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   379
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   380
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   381
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   382
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   383
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   384
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   385
//static EGL* g_egl = NULL;	//never use this directly
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   386
EGL* getEGL()
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   387
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   388
	/*if(!g_egl)
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   389
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   390
		try
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   391
		{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   392
			g_egl = RI_NEW(EGL, ());				//throws bad_alloc
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   393
			g_egl->addReference();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   394
		}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   395
		catch(std::bad_alloc)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   396
		{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   397
			g_egl = NULL;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   398
		}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   399
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   400
	return g_egl;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   401
	*/
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   402
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   403
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   404
	//use TLS to store static global g_egl
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   405
	EGL* pEgl = NULL;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   406
	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   407
	CEglThreadSession* es = reinterpret_cast<CEglThreadSession*>(Dll::Tls());
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   408
	if (es)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   409
		{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   410
		return es->getEgl();
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   411
		}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   412
	
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   413
	const TInt err = CEglDriver::Open();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   414
	if (err != KErrNone)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   415
		{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   416
		return NULL;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   417
		}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   418
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   419
	// CEglDriver is reference counted. As we successfuly open the driver, pls.iDriver will be non-null
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   420
	// and it should be safe to cache the pointer inside CEglThreadSession
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   421
	CEglDriver* drv = CEglDriver::GetDriver();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   422
	__ASSERT_DEBUG(drv, User::Panic(KEglPanicCategory, EEglPanicDriverNull));
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   423
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   424
	// create session object on default thread's heap
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   425
	es = new CEglThreadSession(*drv);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   426
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   427
	if (!es || Dll::SetTls(es)!= KErrNone)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   428
		{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   429
		delete es;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   430
		return NULL;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   431
		}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   432
	return es->getEgl();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   433
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   434
static void releaseEGL()
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   435
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   436
/*
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   437
	if(g_egl)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   438
	{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   439
		if(!g_egl->removeReference())
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   440
		{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   441
			RI_DELETE(g_egl);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   442
			g_egl = NULL;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   443
		}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   444
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   445
	*/
74
0f98da52363f Delete EGL* from releaseEGL() in riMiEgl.cpp
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 72
diff changeset
   446
	CEglThreadSession* es = reinterpret_cast<CEglThreadSession*>(Dll::Tls());
0f98da52363f Delete EGL* from releaseEGL() in riMiEgl.cpp
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 72
diff changeset
   447
	if (es)
0f98da52363f Delete EGL* from releaseEGL() in riMiEgl.cpp
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 72
diff changeset
   448
		{
75
b3f964e007c8 Better way to delete CEglThreadSession.
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 74
diff changeset
   449
		delete es;
74
0f98da52363f Delete EGL* from releaseEGL() in riMiEgl.cpp
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 72
diff changeset
   450
		}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   451
	Dll::SetTls(NULL);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   452
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   453
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   454
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   455
* \brief	Given a display ID, return the corresponding object, or NULL
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   456
*			if the ID hasn't been initialized.
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   457
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   458
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   459
* \note		if egl has been initialized for this display, the display ID can
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   460
*			be found from egl->m_displays
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   461
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   462
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   463
RIEGLDisplay* EGL::getDisplay(EGLDisplay displayID) const
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   464
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   465
	for(int i=0;i<m_displays.size();i++)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   466
	{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   467
		if(displayID == m_displays[i]->getID())
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   468
			return m_displays[i];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   469
	}
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   470
	return NULL;		//error: the display hasn't been eglInitialized
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   471
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   472
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   473
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   474
* \brief	return EGLDisplay for the current context
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   475
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   476
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   477
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   478
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   479
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   480
EGLDisplay EGL::findDisplay(EGLContext ctx) const
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   481
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   482
	for(int i=0;i<m_displays.size();i++)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   483
	{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   484
        if(m_displays[i]->contextExists(ctx))
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   485
            return m_displays[i]->getID();
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   486
	}
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   487
    return EGL_NO_DISPLAY;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   488
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   489
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   490
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   491
* \brief	return an EGL thread struct for the thread made current, or
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   492
*            NULL if there's no current context.
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   493
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   494
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   495
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   496
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   497
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   498
RIEGLThread* EGL::getCurrentThread() const
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   499
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   500
	void* currentThreadID = OSGetCurrentThreadID();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   501
	for(int i=0;i<m_currentThreads.size();i++)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   502
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   503
		if(currentThreadID == m_currentThreads[i]->getThreadID())
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   504
			return m_currentThreads[i];
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   505
	}
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   506
	return NULL;		//thread is not current
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   507
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   508
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   509
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   510
* \brief	return an EGL thread struct corresponding to current OS thread.
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   511
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   512
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   513
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   514
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   515
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   516
RIEGLThread* EGL::getThread()
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   517
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   518
	void* currentThreadID = OSGetCurrentThreadID();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   519
	for(int i=0;i<m_threads.size();i++)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   520
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   521
		if(currentThreadID == m_threads[i]->getThreadID())
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   522
			return m_threads[i];
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   523
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   524
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   525
	//EGL doesn't have a struct for the thread yet, add it to EGL's list
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   526
	RIEGLThread* newThread = NULL;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   527
	try
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   528
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   529
		newThread = RI_NEW(RIEGLThread, (OSGetCurrentThreadID()));	//throws bad_alloc
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   530
		m_threads.push_back(newThread);	//throws bad_alloc
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   531
		return newThread;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   532
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   533
	catch(std::bad_alloc)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   534
	{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   535
		RI_DELETE(newThread);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   536
		return NULL;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   537
	}
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   538
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   539
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   540
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   541
* \brief	destroy an EGL thread struct
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   542
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   543
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   544
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   545
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   546
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   547
void EGL::destroyThread()
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   548
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   549
	void* currentThreadID = OSGetCurrentThreadID();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   550
	for(int i=0;i<m_threads.size();i++)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   551
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   552
		if(currentThreadID == m_threads[i]->getThreadID())
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   553
        {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   554
            RIEGLThread* thread = m_threads[i];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   555
            bool res = m_threads.remove(thread);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   556
            RI_ASSERT(res);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   557
            RI_UNREF(res);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   558
            RI_DELETE(thread);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   559
            break;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   560
        }
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   561
	}
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   562
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   563
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   564
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   565
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   566
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   567
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   568
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   569
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   570
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   571
bool EGL::isInUse(const void* image) const
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   572
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   573
    for(int i=0;i<m_currentThreads.size();i++)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   574
    {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   575
        RIEGLSurface* s = m_currentThreads[i]->getCurrentSurface();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   576
        if(s && s->getDrawable() && s->getDrawable()->isInUse((Image*)image))
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   577
            return true;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   578
    }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   579
    return false;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   580
}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   581
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   582
/*-------------------------------------------------------------------*//*!
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   583
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   584
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   585
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   586
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   587
*//*-------------------------------------------------------------------*/
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   588
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   589
#define EGL_GET_DISPLAY(DISPLAY, RETVAL) \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   590
	OSAcquireMutex(); \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   591
	EGL* egl = getEGL(); \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   592
    if(!egl) \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   593
    { \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   594
		OSReleaseMutex(); \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   595
		return RETVAL; \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   596
    } \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   597
	RIEGLDisplay* display = egl->getDisplay(DISPLAY); \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   598
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   599
#define EGL_GET_EGL(RETVAL) \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   600
	OSAcquireMutex(); \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   601
	EGL* egl = getEGL(); \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   602
    if(!egl) \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   603
    { \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   604
		OSReleaseMutex(); \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   605
		return RETVAL; \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   606
    } \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   607
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   608
#define EGL_IF_ERROR(COND, ERRORCODE, RETVAL) \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   609
	if(COND) { eglSetError(egl, ERRORCODE); OSReleaseMutex(); return RETVAL; } \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   610
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   611
#define EGL_RETURN(ERRORCODE, RETVAL) \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   612
	{ \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   613
		eglSetError(egl, ERRORCODE); \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   614
		OSReleaseMutex(); \
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   615
		return RETVAL; \
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   616
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   617
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   618
// Note: egl error handling model differs from OpenVG. The latest error is stored instead of the oldest one.
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   619
static void eglSetError(EGL* egl, EGLint error)
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   620
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   621
	RIEGLThread* thread = egl->getThread();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   622
	if(thread)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   623
		thread->setError(error);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   624
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   625
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   626
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   627
* \brief	Returns the OpenVG context current to the calling thread.
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   628
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   629
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   630
* \note		This function is always called from a mutexed API function
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   631
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   632
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   633
void* eglvgGetCurrentVGContext(void)
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   634
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   635
	EGL* egl = getEGL();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   636
    if(egl)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   637
    {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   638
        RIEGLThread* thread = egl->getCurrentThread();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   639
        if(thread)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   640
        {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   641
            RI_ASSERT(thread->getCurrentContext() && thread->getCurrentSurface());
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   642
            return thread->getCurrentContext()->getVGContext();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   643
        }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   644
    }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   645
	return NULL;	//not initialized or made current
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   646
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   647
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   648
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   649
* \brief	Check if the image is current in any of the displays
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   650
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   651
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   652
* \note		This function is always called from a mutexed API function
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   653
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   654
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   655
bool eglvgIsInUse(void* image)
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   656
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   657
	EGL* egl = getEGL();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   658
    if(egl)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   659
    {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   660
        return egl->isInUse(image);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   661
    }
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   662
	return false;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   663
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   664
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   665
//helper functions
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   666
RIEGLContext* CastToRIEGLContext(EGLContext aCtxId)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   667
  {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   668
  return (RIEGLContext*)(aCtxId);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   669
  }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   670
EGLContext CastFromRIEGLContext(RIEGLContext* aCtx)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   671
  {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   672
  return (EGLContext)(aCtx);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   673
  }
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   674
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   675
RIEGLSurface* CastToRIEGLSurface(EGLSurface aSurfaceId)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   676
  {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   677
  return (RIEGLSurface*)(aSurfaceId);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   678
  }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   679
EGLSurface CastFromRIEGLSurface(RIEGLSurface* aSurface)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   680
  {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   681
  return (EGLSurface)(aSurface);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   682
  }
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   683
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   684
Image* CastToImage(EGLClientBuffer aBufferId)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   685
  {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   686
  return (Image*)(aBufferId);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   687
  }
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   688
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   689
EGLClientBuffer CastFromImage(Image* aBUffer)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   690
  {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   691
  return (EGLClientBuffer)(aBUffer);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   692
  }
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   693
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   694
//==============================================================================================
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   695
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   696
}	//namespace OpenVGRI
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   697
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   698
using namespace OpenVGRI;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   699
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   700
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   701
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   702
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   703
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   704
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   705
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   706
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   707
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   708
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   709
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   710
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   711
#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
   712
RI_APIENTRY EGLint do_eglGetError()
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   713
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   714
EGLint eglGetError()
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   715
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   716
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   717
    OSAcquireMutex();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   718
    EGLint ret = EGL_SUCCESS;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   719
	EGL* egl = getEGL();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   720
    if(egl)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   721
    {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   722
        RIEGLThread* thread = egl->getThread();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   723
        if(thread)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   724
            ret = thread->getError();	//initialized, return error code
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   725
    }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   726
    else ret = EGL_NOT_INITIALIZED;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   727
    OSReleaseMutex();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   728
    return ret;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   729
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   730
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   731
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   732
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   733
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   734
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   735
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   736
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   737
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   738
#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
   739
RI_APIENTRY EGLDisplay do_eglGetDisplay(EGLNativeDisplayType display_id)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   740
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   741
EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   742
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   743
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   744
    return OSGetDisplay(display_id);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   745
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   746
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   747
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   748
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   749
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   750
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   751
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   752
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   753
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   754
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   755
RI_APIENTRY EGLBoolean do_eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   756
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   757
EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   758
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   759
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   760
	EGL_GET_DISPLAY(dpy, EGL_FALSE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   761
	EGL_IF_ERROR(display, EGL_SUCCESS, EGL_TRUE);	//already initialized
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   762
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   763
	//create the current display
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   764
	//if a context and a surface are bound by the time of eglTerminate, they remain bound until eglMakeCurrent is called
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   765
	RIEGLDisplay* newDisplay = NULL;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   766
	try
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   767
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   768
		newDisplay = RI_NEW(RIEGLDisplay, (dpy));	//throws bad_alloc
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   769
		egl->addDisplay(newDisplay);	//throws bad_alloc
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   770
		display = newDisplay;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   771
		RI_ASSERT(display);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   772
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   773
	catch(std::bad_alloc)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   774
	{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   775
		RI_DELETE(newDisplay);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   776
		EGL_RETURN(EGL_BAD_ALLOC, 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
   777
	}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   778
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   779
	if(major) *major = 1;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   780
	if(minor) *minor = 2;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   781
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   782
}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   783
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   784
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   785
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   786
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   787
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   788
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   789
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   790
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   791
#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
   792
RI_APIENTRY EGLBoolean do_eglTerminate(EGLDisplay dpy)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   793
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   794
EGLBoolean eglTerminate(EGLDisplay dpy)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   795
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   796
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   797
	EGL_GET_DISPLAY(dpy, 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
   798
	EGL_IF_ERROR(!display, EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   799
    egl->removeDisplay(display);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   800
    RI_DELETE(display);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   801
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   802
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   803
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   804
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   805
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   806
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   807
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   808
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   809
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   810
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   811
#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
   812
RI_APIENTRY const char *do_eglQueryString(EGLDisplay dpy, EGLint name)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   813
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   814
const char *eglQueryString(EGLDisplay dpy, EGLint name)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   815
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   816
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   817
	EGL_GET_DISPLAY(dpy, NULL);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   818
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, NULL);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   819
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   820
	static const char apis[] = "OpenVG";
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   821
	static const char extensions[] = "";
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   822
	static const char vendor[] = "Khronos Group";
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   823
	static const char version[] = "1.3";
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   824
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   825
	const char* ret = NULL;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   826
	switch(name)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   827
	{
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   828
	case EGL_CLIENT_APIS:
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   829
		ret = apis;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   830
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   831
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   832
	case EGL_EXTENSIONS:
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   833
		ret = extensions;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   834
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   835
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   836
	case EGL_VENDOR:
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   837
		ret = vendor;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   838
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   839
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   840
	case EGL_VERSION:
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   841
		ret = version;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   842
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   843
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   844
	default:
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   845
		EGL_RETURN(EGL_BAD_PARAMETER, NULL);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   846
	}
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   847
	EGL_RETURN(EGL_SUCCESS, ret);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   848
}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   849
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   850
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   851
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   852
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   853
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   854
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   855
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   856
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   857
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   858
RI_APIENTRY EGLBoolean do_eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   859
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   860
EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   861
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   862
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   863
	EGL_GET_DISPLAY(dpy, 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
   864
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, 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
   865
	EGL_IF_ERROR(!num_config, EGL_BAD_PARAMETER, EGL_FALSE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   866
	if(!configs)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   867
	{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   868
		*num_config = display->getNumConfigs();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   869
		EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   870
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   871
	*num_config = RI_INT_MIN(config_size, display->getNumConfigs());
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   872
	for(int i=0;i<*num_config;i++)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   873
		configs[i] = display->getConfigByIdx(i).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
   874
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   875
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   876
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   877
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   878
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   879
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   880
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   881
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   882
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   883
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   884
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   885
static bool smaller(EGLint c, EGLint filter)
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   886
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   887
	return (filter != EGL_DONT_CARE) && (c < filter);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   888
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   889
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   890
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   891
RI_APIENTRY EGLBoolean do_eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   892
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   893
EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   894
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   895
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   896
	EGL_GET_DISPLAY(dpy, 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
   897
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, 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
   898
	EGL_IF_ERROR(!num_config, EGL_BAD_PARAMETER, 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
   899
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   900
	if(!configs)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   901
	{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   902
		*num_config = display->getNumConfigs();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   903
		EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   904
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   905
	*num_config = 0;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   906
	if(!config_size)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   907
		EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   908
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   909
	int bufferSize = 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   910
	int redSize = 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   911
	int greenSize = 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   912
	int blueSize = 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   913
	int luminanceSize = 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   914
	int alphaSize = 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   915
	int colorBufferType = EGL_RGB_BUFFER;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   916
	int configID = EGL_DONT_CARE;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   917
	int sampleBuffers = 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   918
	int samples = 0;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   919
	if(attrib_list)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   920
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   921
		for(int i=0;attrib_list[i] != EGL_NONE;i+=2)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   922
		{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   923
			switch(attrib_list[i])
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   924
			{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   925
			case EGL_BUFFER_SIZE:				//depth of the color buffer
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   926
				bufferSize = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   927
				break;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   928
			case EGL_RED_SIZE:					//bits of Red in the color buffer
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   929
				redSize = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   930
				break;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   931
			case EGL_GREEN_SIZE:				//bits of Green in the color buffer
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   932
				greenSize = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   933
				break;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   934
			case EGL_BLUE_SIZE:					//bits of Blue in the color buffer
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   935
				blueSize = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   936
				break;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   937
			case EGL_LUMINANCE_SIZE:			//bits of Luminance in the color buffer
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   938
				luminanceSize = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   939
				break;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   940
			case EGL_ALPHA_SIZE:				//bits of Alpha in the color buffer
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   941
				alphaSize = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   942
				break;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   943
			case EGL_ALPHA_MASK_SIZE:			//bits of Alpha in the alpha mask buffer
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   944
				if(attrib_list[i+1] > 8)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   945
					EGL_RETURN(EGL_SUCCESS, EGL_TRUE);	//not supported
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   946
				break;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   947
			case EGL_COLOR_BUFFER_TYPE:			//enum color buffer type (EGL_RGB_BUFFER, EGL_LUMINANCE_BUFFER)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   948
				EGL_IF_ERROR(attrib_list[i+1] != EGL_RGB_BUFFER && attrib_list[i+1] != EGL_LUMINANCE_BUFFER && attrib_list[i+1] != EGL_DONT_CARE, EGL_BAD_ATTRIBUTE, EGL_FALSE);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   949
				colorBufferType = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   950
				break;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   951
			case EGL_CONFIG_ID:					//unique EGLConfig identifier
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   952
				configID = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   953
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   954
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   955
			case EGL_SAMPLE_BUFFERS:			//integer number of multisample buffers
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   956
				sampleBuffers = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   957
				break;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   958
			case EGL_SAMPLES:					//integer number of samples per pixel
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   959
				samples = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   960
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   961
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   962
			case EGL_BIND_TO_TEXTURE_RGB:		//boolean True if bindable to RGB textures. (always EGL_FALSE)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   963
			case EGL_BIND_TO_TEXTURE_RGBA:		//boolean True if bindable to RGBA textures. (always EGL_FALSE)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   964
			case EGL_DEPTH_SIZE:				//integer bits of Z in the depth buffer (always 0)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   965
			case EGL_LEVEL:						//integer frame buffer level (always 0)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   966
			case EGL_NATIVE_RENDERABLE:			//boolean EGL TRUE if native rendering APIs can render to surface (always EGL_FALSE)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   967
			case EGL_STENCIL_SIZE:				//integer bits of Stencil in the stencil buffer (always 0)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   968
				if(attrib_list[i+1])
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   969
					EGL_RETURN(EGL_SUCCESS, EGL_TRUE);	//not supported
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   970
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   971
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   972
			case EGL_CONFIG_CAVEAT:				//enum any caveats for the configuration (always EGL_NONE)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   973
			case EGL_NATIVE_VISUAL_TYPE:		//integer native visual type of the associated visual (always EGL_NONE)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   974
				if(attrib_list[i+1] != EGL_NONE)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   975
					EGL_RETURN(EGL_SUCCESS, EGL_TRUE);	//not supported
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   976
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   977
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   978
			case EGL_MAX_SWAP_INTERVAL:			//integer maximum swap interval (always 1)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   979
			case EGL_MIN_SWAP_INTERVAL:			//integer minimum swap interval (always 1)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   980
				if(attrib_list[i+1] != 1)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   981
					EGL_RETURN(EGL_SUCCESS, EGL_TRUE);	//not supported
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   982
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   983
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   984
			case EGL_RENDERABLE_TYPE:			//bitmask which client rendering APIs are supported. (always EGL_OPENVG_BIT)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   985
				if(!(attrib_list[i+1] & EGL_OPENVG_BIT))
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   986
					EGL_RETURN(EGL_SUCCESS, EGL_TRUE);	//not supported
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   987
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   988
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   989
			case EGL_SURFACE_TYPE:				//bitmask which types of EGL surfaces are supported. (always EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT | EGL_VG_COLORSPACE_LINEAR_BIT | EGL_VG_ALPHA_FORMAT_PRE_BIT)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   990
				break;	//all types are always supported
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
   991
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   992
			case EGL_TRANSPARENT_TYPE:			//enum type of transparency supported (always EGL_NONE)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   993
			case EGL_NATIVE_VISUAL_ID:			//integer handle of corresponding native visual (always 0)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   994
			case EGL_MAX_PBUFFER_WIDTH:			//integer maximum width of pbuffer (always INT_MAX)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   995
			case EGL_MAX_PBUFFER_HEIGHT:		//integer maximum height of pbuffer (always INT_MAX)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   996
			case EGL_MAX_PBUFFER_PIXELS:		//integer maximum size of pbuffer (always INT_MAX)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   997
			case EGL_TRANSPARENT_RED_VALUE:		//integer transparent red value (undefined)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   998
			case EGL_TRANSPARENT_GREEN_VALUE:	//integer transparent green value (undefined)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
   999
			case EGL_TRANSPARENT_BLUE_VALUE:	//integer transparent blue value (undefined)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1000
				break;	//ignored
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1001
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1002
			default:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1003
				EGL_RETURN(EGL_BAD_ATTRIBUTE, EGL_FALSE);	//unknown attribute
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1004
			}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1005
		}
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1006
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1007
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1008
	if(configID && configID != EGL_DONT_CARE)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1009
	{	//if CONFIG_ID is defined, ignore the rest of the attribs
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1010
        for(int i=0;i<EGL_NUMCONFIGS;i++)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1011
        {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1012
            if(display->getConfigByIdx(i).m_configID == configID)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1013
            {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1014
                *num_config = 1;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1015
                *configs = display->getConfigByIdx(i).m_config;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1016
            }
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1017
        }
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1018
		EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1019
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1020
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1021
	//go through all configs, add passed configs to return list
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1022
    //TODO take alpha mask size into account
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1023
	EGLConfig found[EGL_NUMCONFIGS];
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1024
    int keys[EGL_NUMCONFIGS];
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1025
	int numFound = 0;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1026
	for(int i=0;i<display->getNumConfigs();i++)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1027
	{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1028
		const RIEGLConfig& c = display->getConfigByIdx(i);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1029
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1030
		int colorBits = c.m_desc.redBits + c.m_desc.greenBits + c.m_desc.blueBits;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1031
		int luminanceBits = c.m_desc.luminanceBits;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1032
		int configBufferSize;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1033
		if(colorBits)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1034
		{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1035
			RI_ASSERT(!luminanceBits);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1036
			colorBits += c.m_desc.alphaBits;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1037
			configBufferSize = colorBits;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1038
		}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1039
		else if(luminanceBits)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1040
		{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1041
			luminanceBits += c.m_desc.alphaBits;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1042
			configBufferSize = luminanceBits;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1043
		}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1044
		else
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1045
		{	//alpha only surface
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1046
			colorBits = c.m_desc.alphaBits;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1047
			luminanceBits = c.m_desc.alphaBits;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1048
			configBufferSize = colorBits;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1049
		}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1050
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1051
		if (smaller(configBufferSize, bufferSize))
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1052
			continue;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1053
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1054
		int configSampleBuffers = c.m_samples == 1 ? 0 : 1;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1055
		if (smaller(configSampleBuffers, sampleBuffers))
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1056
			continue;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1057
		if (smaller(c.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
  1058
			continue;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1059
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1060
		if (smaller(c.m_desc.redBits, redSize)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1061
			|| smaller(c.m_desc.greenBits, greenSize)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1062
			|| smaller(c.m_desc.blueBits, blueSize) 
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1063
			|| smaller(c.m_desc.alphaBits, alphaSize) )
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1064
			continue;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1065
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1066
		if (smaller(c.m_desc.luminanceBits, luminanceSize))
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1067
			continue;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1068
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1069
		if ((colorBufferType == EGL_RGB_BUFFER && !colorBits) ||
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1070
			(colorBufferType == EGL_LUMINANCE_BUFFER && !luminanceBits))
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1071
			continue;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1072
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1073
		int sortKey = c.m_configID;	//sort from smaller to larger
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1074
		int sortBits = 0;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1075
		if(redSize != 0 && redSize != EGL_DONT_CARE)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1076
			sortBits += c.m_desc.redBits;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1077
		if(greenSize != 0 && greenSize != EGL_DONT_CARE)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1078
			sortBits += c.m_desc.greenBits;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1079
		if(blueSize != 0 && blueSize != EGL_DONT_CARE)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1080
			sortBits += c.m_desc.blueBits;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1081
		if(alphaSize != 0 && alphaSize != EGL_DONT_CARE)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1082
			sortBits += c.m_desc.alphaBits;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1083
		if(luminanceSize != 0 && luminanceSize != EGL_DONT_CARE)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1084
			sortBits += c.m_desc.luminanceBits;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1085
		RI_ASSERT(c.m_configID <= EGL_NUMCONFIGS);	//if there are more configs, increase the shift value
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1086
		RI_ASSERT(sortBits <= 32);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1087
		sortKey += (32-sortBits) << 4;	//sort from larger to smaller
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1088
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1089
		found[numFound] = c.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
  1090
		keys[numFound++] = sortKey;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1091
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1092
	if(!numFound)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1093
		EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1094
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1095
	//sort return list into increasing order
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1096
	for(int e=0;e<numFound-1;e++)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1097
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1098
		for(int f=e+1;f<numFound;f++)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1099
		{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1100
			if(keys[e] > keys[f])
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1101
			{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1102
                EGLConfig tmp = found[e];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1103
                found[e] = found[f];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1104
                found[f] = tmp;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1105
				RI_INT_SWAP(keys[e], keys[f]);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1106
			}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1107
		}
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1108
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1109
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1110
	//write configs into return array
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1111
	numFound = RI_INT_MIN(numFound, config_size);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1112
	for(int i=0;i<numFound;i++)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1113
	{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1114
		configs[i] = found[i];
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1115
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1116
	*num_config = numFound;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1117
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1118
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1119
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1120
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1121
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1122
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1123
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1124
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1125
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1126
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1127
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1128
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1129
RI_APIENTRY EGLBoolean do_eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1130
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1131
EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1132
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1133
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1134
	EGL_GET_DISPLAY(dpy, 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
  1135
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, 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
  1136
	EGL_IF_ERROR(!display->configExists(config), EGL_BAD_CONFIG, 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
  1137
	const RIEGLConfig& c = display->getConfig(config);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1138
	switch(attribute)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1139
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1140
	case EGL_BUFFER_SIZE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1141
		*value = RI_INT_MAX(c.m_desc.redBits + c.m_desc.greenBits + c.m_desc.blueBits + c.m_desc.alphaBits, c.m_desc.luminanceBits + c.m_desc.alphaBits);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1142
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1143
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1144
	case EGL_RED_SIZE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1145
		*value = c.m_desc.redBits;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1146
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1147
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1148
	case EGL_GREEN_SIZE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1149
		*value = c.m_desc.greenBits;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1150
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1151
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1152
	case EGL_BLUE_SIZE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1153
		*value = c.m_desc.blueBits;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1154
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1155
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1156
	case EGL_LUMINANCE_SIZE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1157
		*value = c.m_desc.luminanceBits;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1158
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1159
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1160
	case EGL_ALPHA_SIZE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1161
		*value = c.m_desc.alphaBits;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1162
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1163
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1164
	case EGL_ALPHA_MASK_SIZE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1165
		*value = c.m_maskBits;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1166
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1167
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1168
	case EGL_BIND_TO_TEXTURE_RGB:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1169
	case EGL_BIND_TO_TEXTURE_RGBA:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1170
		*value = EGL_FALSE;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1171
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1172
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1173
	case EGL_COLOR_BUFFER_TYPE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1174
		if(c.m_desc.redBits)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1175
			*value = EGL_RGB_BUFFER;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1176
		else
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1177
			*value = EGL_LUMINANCE_BUFFER;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1178
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1179
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1180
	case EGL_CONFIG_CAVEAT:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1181
		*value = EGL_NONE;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1182
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1183
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1184
	case EGL_CONFIG_ID:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1185
		*value = c.m_configID;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1186
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1187
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1188
	case EGL_DEPTH_SIZE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1189
		*value = 0;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1190
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1191
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1192
	case EGL_LEVEL:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1193
		*value = 0;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1194
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1195
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1196
	case EGL_MAX_PBUFFER_WIDTH:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1197
	case EGL_MAX_PBUFFER_HEIGHT:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1198
		*value = 16384;			//NOTE arbitrary maximum
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1199
		break;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1200
		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1201
	case EGL_MAX_PBUFFER_PIXELS:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1202
		*value = 16384*16384;	//NOTE arbitrary maximum
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1203
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1204
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1205
	case EGL_MAX_SWAP_INTERVAL:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1206
	case EGL_MIN_SWAP_INTERVAL:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1207
		*value = 1;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1208
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1209
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1210
	case EGL_NATIVE_RENDERABLE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1211
		*value = EGL_FALSE;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1212
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1213
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1214
	case EGL_NATIVE_VISUAL_ID:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1215
		*value = 0;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1216
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1217
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1218
	case EGL_NATIVE_VISUAL_TYPE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1219
		*value = EGL_NONE;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1220
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1221
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1222
	case EGL_RENDERABLE_TYPE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1223
		*value = EGL_OPENVG_BIT;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1224
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1225
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1226
	case EGL_SAMPLE_BUFFERS:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1227
		*value = c.m_samples > 1 ? 1 : 0;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1228
		break;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1229
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1230
	case EGL_SAMPLES:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1231
		*value = c.m_samples > 1 ? c.m_samples : 0;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1232
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1233
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1234
	case EGL_STENCIL_SIZE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1235
		*value = 0;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1236
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1237
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1238
	case EGL_SURFACE_TYPE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1239
		*value = EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT | EGL_VG_COLORSPACE_LINEAR_BIT | EGL_VG_ALPHA_FORMAT_PRE_BIT;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1240
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1241
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1242
	case EGL_TRANSPARENT_TYPE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1243
		*value = EGL_NONE;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1244
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1245
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1246
	case EGL_TRANSPARENT_RED_VALUE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1247
	case EGL_TRANSPARENT_GREEN_VALUE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1248
	case EGL_TRANSPARENT_BLUE_VALUE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1249
		*value = 0;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1250
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1251
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1252
    case EGL_CONFORMANT:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1253
        *value = EGL_OPENVG_BIT;  //TODO return proper value
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1254
        break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1255
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1256
	default:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1257
		EGL_RETURN(EGL_BAD_ATTRIBUTE, EGL_FALSE);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1258
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1259
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1260
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1261
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1262
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1263
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1264
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1265
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1266
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1267
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1268
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1269
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1270
RI_APIENTRY EGLSurface do_eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1271
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1272
EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1273
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1274
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1275
	EGL_GET_DISPLAY(dpy, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1276
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1277
	EGL_IF_ERROR(!display->configExists(config), EGL_BAD_CONFIG, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1278
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1279
	int renderBuffer = EGL_BACK_BUFFER;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1280
	int colorSpace = EGL_VG_COLORSPACE_sRGB;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1281
	int alphaFormat = EGL_VG_ALPHA_FORMAT_NONPRE;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1282
	if(attrib_list)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1283
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1284
		for(int i=0;attrib_list[i] != EGL_NONE;i+=2)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1285
		{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1286
			switch(attrib_list[i])
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1287
			{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1288
			case EGL_RENDER_BUFFER:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1289
				renderBuffer = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1290
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1291
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1292
			case EGL_VG_COLORSPACE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1293
				colorSpace = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1294
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1295
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1296
			case EGL_VG_ALPHA_FORMAT:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1297
				alphaFormat = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1298
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1299
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1300
			default:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1301
				EGL_RETURN(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1302
			}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1303
		}
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1304
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1305
	//we ignore the renderBuffer parameter since we can only render to double buffered surfaces
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1306
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1307
	//TODO If the attributes of win do not correspond to config, then an EGL BAD MATCH error is generated.
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1308
	//TODO If there is already an EGLConfig associated with win (as a result of a previous eglCreateWindowSurface call), then an EGL BAD ALLOC error is generated
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1309
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1310
    void* wc = NULL;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1311
    Drawable* d = NULL;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1312
	RIEGLSurface* s = NULL;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1313
	try
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1314
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1315
        wc = OSCreateWindowContext(win);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1316
		RI_ASSERT(wc);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1317
		//TODO what should happen if window width or height is zero?
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1318
		int windowWidth = 0, windowHeight = 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1319
		OSGetWindowSize(wc, windowWidth, windowHeight);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1320
        bool isWindow = OSIsWindow(wc);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1321
		if(windowWidth <= 0 || windowHeight <= 0 || !isWindow)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1322
		{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1323
            OSDestroyWindowContext(wc);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1324
            EGL_IF_ERROR(!isWindow, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1325
			EGL_IF_ERROR(windowWidth <= 0 || windowHeight <= 0, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1326
		}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1327
		d = RI_NEW(Drawable, (display->getConfig(config).configToDescriptor((colorSpace == EGL_VG_COLORSPACE_LINEAR) ? false : true, (alphaFormat == EGL_VG_ALPHA_FORMAT_PRE) ? true : false), windowWidth, windowHeight, display->getConfig(config).m_samples, display->getConfig(config).m_maskBits));	//throws bad_alloc
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1328
		RI_ASSERT(d);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1329
		s = RI_NEW(RIEGLSurface,(wc, config, d, false, renderBuffer));	//throws bad_alloc
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1330
		RI_ASSERT(s);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1331
		s->addReference();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1332
		display->addSurface(s);	//throws bad_alloc
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1333
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1334
	catch(std::bad_alloc)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1335
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1336
        OSDestroyWindowContext(wc);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1337
        RI_DELETE(d);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1338
        RI_DELETE(s);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1339
		EGL_RETURN(EGL_BAD_ALLOC, EGL_NO_SURFACE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1340
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1341
	EGL_RETURN(EGL_SUCCESS, (EGLSurface)s);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1342
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1343
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1344
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1345
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1346
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1347
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1348
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1349
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1350
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1351
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1352
RI_APIENTRY EGLSurface do_eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1353
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1354
EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1355
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1356
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1357
	EGL_GET_DISPLAY(dpy, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1358
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1359
	EGL_IF_ERROR(!display->configExists(config), EGL_BAD_CONFIG, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1360
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1361
	int width = 0, height = 0;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1362
	bool largestPbuffer = false;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1363
	int colorSpace = EGL_VG_COLORSPACE_sRGB;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1364
	int alphaFormat = EGL_VG_ALPHA_FORMAT_NONPRE;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1365
	if(attrib_list)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1366
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1367
		for(int i=0;attrib_list[i] != EGL_NONE;i+=2)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1368
		{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1369
			switch(attrib_list[i])
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1370
			{
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1371
			case EGL_WIDTH:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1372
				width = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1373
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1374
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1375
			case EGL_HEIGHT:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1376
				height = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1377
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1378
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1379
			case EGL_LARGEST_PBUFFER:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1380
				largestPbuffer = attrib_list[i+1] ? true : false;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1381
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1382
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1383
			case EGL_VG_COLORSPACE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1384
				colorSpace = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1385
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1386
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1387
			case EGL_VG_ALPHA_FORMAT:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1388
				alphaFormat = attrib_list[i+1];
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1389
				break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1390
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1391
			case EGL_TEXTURE_FORMAT:	//config doesn't support OpenGL ES
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1392
			case EGL_TEXTURE_TARGET:	//config doesn't support OpenGL ES
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1393
			case EGL_MIPMAP_TEXTURE:	//config doesn't support OpenGL ES
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1394
			default:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1395
				EGL_RETURN(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1396
			}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1397
		}
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1398
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1399
	EGL_IF_ERROR(width <= 0 || height <= 0, EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1400
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1401
    Drawable* d = NULL;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1402
	RIEGLSurface* s = NULL;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1403
	try
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1404
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1405
		d = RI_NEW(Drawable, (display->getConfig(config).configToDescriptor((colorSpace == EGL_VG_COLORSPACE_LINEAR) ? false : true, (alphaFormat == EGL_VG_ALPHA_FORMAT_PRE) ? true : false), width, height, display->getConfig(config).m_samples, display->getConfig(config).m_maskBits));	//throws bad_alloc
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1406
		RI_ASSERT(d);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1407
		s = RI_NEW(RIEGLSurface,(NULL, config, d, largestPbuffer, EGL_BACK_BUFFER));	//throws bad_alloc
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1408
		RI_ASSERT(s);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1409
		s->addReference();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1410
		display->addSurface(s);	//throws bad_alloc
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1411
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1412
	catch(std::bad_alloc)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1413
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1414
        RI_DELETE(d);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1415
        RI_DELETE(s);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1416
		EGL_RETURN(EGL_BAD_ALLOC, EGL_NO_SURFACE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1417
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1418
	EGL_RETURN(EGL_SUCCESS, (EGLSurface)s);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1419
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1420
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1421
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1422
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1423
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1424
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1425
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1426
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1427
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1428
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1429
RI_APIENTRY EGLSurface do_eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1430
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1431
EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1432
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1433
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1434
	EGL_GET_DISPLAY(dpy, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1435
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1436
	EGL_IF_ERROR(buftype != EGL_OPENVG_IMAGE, EGL_BAD_PARAMETER, EGL_NO_SURFACE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1437
	EGL_IF_ERROR(!buffer, EGL_BAD_PARAMETER, EGL_NO_SURFACE);	//TODO should also check if buffer really is a valid VGImage object (needs VG context for that)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1438
    Image* image = (Image*)buffer;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1439
	EGL_IF_ERROR(image->isInUse(), EGL_BAD_ACCESS, EGL_NO_SURFACE);	//buffer is in use by OpenVG
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1440
	EGL_IF_ERROR(!display->configExists(config), EGL_BAD_CONFIG, EGL_NO_SURFACE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1441
	EGL_IF_ERROR(attrib_list && attrib_list[0] != EGL_NONE, EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);	//there are no valid attribs for OpenVG
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1442
	const Color::Descriptor& bc = ((Image*)buffer)->getDescriptor();
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1443
	const Color::Descriptor& cc = display->getConfig(config).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
  1444
	EGL_IF_ERROR(bc.redBits != cc.redBits || bc.greenBits != cc.greenBits || bc.blueBits != cc.blueBits ||
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1445
				 bc.alphaBits != cc.alphaBits || bc.luminanceBits != cc.luminanceBits, EGL_BAD_MATCH, EGL_NO_SURFACE);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1446
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1447
	//TODO If buffer is already bound to another pbuffer, an EGL BAD ACCESS error is generated.
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1448
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1449
    Drawable* d = NULL;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1450
	RIEGLSurface* s = NULL;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1451
	try
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1452
	{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1453
		d = RI_NEW(Drawable, (image, display->getConfig(config).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
  1454
		RI_ASSERT(d);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1455
		s = RI_NEW(RIEGLSurface,(NULL, config, d, false, EGL_BACK_BUFFER));	//throws bad_alloc
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1456
		RI_ASSERT(s);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1457
		s->addReference();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1458
		display->addSurface(s);	//throws bad_alloc
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1459
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1460
	catch(std::bad_alloc)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1461
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1462
        RI_DELETE(d);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1463
        RI_DELETE(s);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1464
		EGL_RETURN(EGL_BAD_ALLOC, EGL_NO_SURFACE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1465
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1466
	EGL_RETURN(EGL_SUCCESS, (EGLSurface)s);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1467
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1468
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1469
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1470
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1471
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1472
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1473
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1474
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1475
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1476
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1477
RI_APIENTRY EGLSurface do_eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1478
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1479
EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1480
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1481
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1482
    EGL_GET_DISPLAY(dpy, EGL_NO_SURFACE);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1483
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1484
	EGL_IF_ERROR(!display->configExists(config), EGL_BAD_CONFIG, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1485
	//EGL_IF_ERROR(!pixmap || !isValidImageFormat(pixmap->format) || !pixmap->data || pixmap->width <= 0 || pixmap->height <= 0, EGL_BAD_NATIVE_PIXMAP, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1486
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1487
	RI_UNREF(attrib_list);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1488
	EGL_IF_ERROR(display->getConfig(config).m_samples != 1, EGL_BAD_MATCH, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1489
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1490
	//TODO If there is already an EGLSurface associated with pixmap (as a result of a previous eglCreatePixmapSurface call), then a EGL BAD ALLOC error is generated.
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1491
	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1492
	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1493
	EGLint  width  = -1;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1494
	EGLint  height = -1;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1495
	EGLint  stride = -1;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1496
	VGImageFormat format;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1497
	int* data = NULL;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1498
	EGLBoolean err = OSGetNativePixmapInfo(pixmap, &width, &height, &stride,&format, &data);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1499
	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1500
    Drawable* d = NULL;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1501
	RIEGLSurface* s = NULL;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1502
	try
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1503
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1504
		d = RI_NEW(Drawable, (Color::formatToDescriptor(format), width, height, stride, (RIuint8*)data, display->getConfig(config).m_maskBits));	//throws bad_alloc
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1505
		RI_ASSERT(d);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1506
		s = RI_NEW(RIEGLSurface,(NULL, config, d, false, EGL_BACK_BUFFER));	//throws bad_alloc
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1507
		RI_ASSERT(s);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1508
		s->addReference();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1509
		display->addSurface(s);	//throws bad_alloc
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1510
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1511
	catch(std::bad_alloc)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1512
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1513
        RI_DELETE(d);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1514
        RI_DELETE(s);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1515
		EGL_RETURN(EGL_BAD_ALLOC, EGL_NO_SURFACE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1516
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1517
	EGL_RETURN(EGL_SUCCESS, (EGLSurface)s);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1518
	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1519
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1520
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1521
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1522
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1523
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1524
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1525
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1526
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1527
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1528
#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
  1529
RI_APIENTRY EGLBoolean do_eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1530
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1531
EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1532
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1533
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1534
	EGL_GET_DISPLAY(dpy, 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
  1535
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, 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
  1536
	EGL_IF_ERROR(!display->surfaceExists(surface), EGL_BAD_SURFACE, 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
  1537
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1538
    display->removeSurface((RIEGLSurface*)surface);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1539
	if(!((RIEGLSurface*)surface)->removeReference())
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1540
		RI_DELETE((RIEGLSurface*)surface);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1541
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1542
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1543
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1544
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1545
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1546
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1547
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1548
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1549
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1550
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1551
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1552
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1553
RI_APIENTRY EGLBoolean do_eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1554
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1555
EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1556
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1557
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1558
	EGL_GET_DISPLAY(dpy, 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
  1559
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, 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
  1560
	EGL_IF_ERROR(!display->surfaceExists(surface), EGL_BAD_SURFACE, 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
  1561
	RI_UNREF(attribute);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1562
	RI_UNREF(value);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1563
	//do nothing
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1564
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1565
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1566
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1567
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1568
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1569
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1570
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1571
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1572
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1573
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1574
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1575
RI_APIENTRY EGLBoolean do_eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1576
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1577
EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1578
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1579
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1580
	EGL_GET_DISPLAY(dpy, 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
  1581
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, 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
  1582
	EGL_IF_ERROR(!display->surfaceExists(surface), EGL_BAD_SURFACE, 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
  1583
	//TODO give an error if value is NULL?
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1584
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1585
	RIEGLSurface* s = (RIEGLSurface*)surface;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1586
	switch(attribute)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1587
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1588
	case EGL_VG_ALPHA_FORMAT:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1589
		*value = (s->getDrawable()->getDescriptor().isPremultiplied()) ? EGL_VG_ALPHA_FORMAT_PRE : EGL_VG_ALPHA_FORMAT_NONPRE;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1590
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1591
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1592
	case EGL_VG_COLORSPACE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1593
		*value = (s->getDrawable()->getDescriptor().isNonlinear()) ? EGL_VG_COLORSPACE_sRGB : EGL_VG_COLORSPACE_LINEAR;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1594
		break;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1595
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1596
	case EGL_CONFIG_ID:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1597
		*value = display->getConfig(s->getConfig()).m_configID;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1598
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1599
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1600
	case EGL_HEIGHT:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1601
		*value = s->getDrawable()->getHeight();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1602
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1603
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1604
	case EGL_HORIZONTAL_RESOLUTION:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1605
		*value = EGL_UNKNOWN;			//TODO Horizontal dot pitch
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1606
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1607
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1608
	case EGL_LARGEST_PBUFFER:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1609
		if(!s->getOSWindowContext())
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1610
			*value = s->isLargestPbuffer() ? EGL_TRUE : EGL_FALSE;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1611
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1612
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1613
	case EGL_MIPMAP_TEXTURE:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1614
		if(!s->getOSWindowContext())
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1615
			*value = EGL_FALSE;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1616
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1617
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1618
	case EGL_MIPMAP_LEVEL:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1619
		if(!s->getOSWindowContext())
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1620
			*value = 0;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1621
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1622
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1623
	case EGL_PIXEL_ASPECT_RATIO:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1624
		*value = EGL_UNKNOWN;			//TODO Display aspect ratio
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1625
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1626
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1627
	case EGL_RENDER_BUFFER:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1628
		*value = s->getRenderBuffer();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1629
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1630
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1631
	case EGL_SWAP_BEHAVIOR:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1632
		*value = EGL_BUFFER_PRESERVED;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1633
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1634
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1635
	case EGL_TEXTURE_FORMAT:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1636
		if(!s->getOSWindowContext())
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1637
			*value = EGL_NO_TEXTURE;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1638
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1639
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1640
	case EGL_TEXTURE_TARGET:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1641
		if(!s->getOSWindowContext())
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1642
			*value = EGL_NO_TEXTURE;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1643
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1644
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1645
	case EGL_VERTICAL_RESOLUTION:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1646
		*value = EGL_UNKNOWN;			//TODO Vertical dot pitch
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1647
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1648
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1649
	case EGL_WIDTH:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1650
		*value = s->getDrawable()->getWidth();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1651
		break;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1652
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1653
	default:
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1654
		EGL_RETURN(EGL_BAD_ATTRIBUTE, EGL_FALSE);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1655
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1656
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1657
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1658
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1659
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1660
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1661
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1662
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1663
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1664
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1665
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1666
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1667
RI_APIENTRY EGLContext do_eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1668
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1669
EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1670
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1671
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1672
	EGL_GET_DISPLAY(dpy, EGL_NO_CONTEXT);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1673
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, EGL_NO_CONTEXT);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1674
	EGL_IF_ERROR(!display->configExists(config), EGL_BAD_CONFIG, EGL_NO_CONTEXT);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1675
	RI_UNREF(attrib_list);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1676
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1677
	RIEGLThread* thread = egl->getThread();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1678
	if(!thread)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1679
		EGL_RETURN(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1680
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1681
	//creation of OpenGL ES contexts is not allowed in this implementation
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1682
	if(thread->getBoundAPI() != EGL_OPENVG_API)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1683
		EGL_RETURN(EGL_BAD_MATCH, EGL_NO_CONTEXT);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1684
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1685
    OpenVGRI::VGContext* vgctx = NULL;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1686
	RIEGLContext* c = NULL;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1687
	try
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1688
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1689
		vgctx = RI_NEW(OpenVGRI::VGContext, (share_context ? ((RIEGLContext*)share_context)->getVGContext() : NULL));	//throws bad_alloc
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1690
		c = RI_NEW(RIEGLContext, (vgctx, config));	//throws bad_alloc
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1691
		c->addReference();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1692
		display->addContext(c);	//throws bad_alloc
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1693
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1694
	catch(std::bad_alloc)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1695
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1696
        RI_DELETE(vgctx);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1697
        RI_DELETE(c);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1698
		EGL_RETURN(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1699
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1700
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1701
	EGL_RETURN(EGL_SUCCESS, (EGLContext)c);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1702
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1703
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1704
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1705
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1706
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1707
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1708
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1709
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1710
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1711
#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
  1712
RI_APIENTRY EGLBoolean do_eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1713
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1714
EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1715
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1716
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1717
	EGL_GET_DISPLAY(dpy, 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
  1718
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, 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
  1719
	EGL_IF_ERROR(!display->contextExists(ctx), EGL_BAD_CONTEXT, 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
  1720
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1721
	RIEGLContext* context = (RIEGLContext*)ctx;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1722
    display->removeContext(context);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1723
	if(!context->removeReference() )
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1724
		RI_DELETE(context);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1725
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1726
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1727
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1728
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1729
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1730
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1731
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1732
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1733
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1734
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1735
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1736
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1737
RI_APIENTRY EGLBoolean do_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1738
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1739
EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1740
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1741
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1742
	EGL_GET_DISPLAY(dpy, 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
  1743
	EGL_IF_ERROR(ctx != EGL_NO_CONTEXT && !display->contextExists(ctx), EGL_BAD_CONTEXT, 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
  1744
	EGL_IF_ERROR(draw != EGL_NO_SURFACE && !display->surfaceExists(draw), EGL_BAD_SURFACE, 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
  1745
	EGL_IF_ERROR(read != EGL_NO_SURFACE && !display->surfaceExists(read), EGL_BAD_SURFACE, EGL_FALSE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1746
	EGL_IF_ERROR(draw != read, EGL_BAD_MATCH, EGL_FALSE);	//TODO what's the proper error code?
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1747
	EGL_IF_ERROR((draw != EGL_NO_SURFACE && ctx == EGL_NO_CONTEXT) || (draw == EGL_NO_SURFACE && ctx != EGL_NO_CONTEXT), EGL_BAD_MATCH, 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
  1748
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1749
	RIEGLSurface* s = NULL;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1750
	RIEGLContext* c = NULL;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1751
	if(draw != EGL_NO_SURFACE && ctx != EGL_NO_CONTEXT)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1752
	{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1753
		EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, 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
  1754
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1755
		s = (RIEGLSurface*)draw;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1756
		c = (RIEGLContext*)ctx;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1757
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1758
        //If either draw or read are pbuffers created with eglCreatePbufferFromClientBuffer, and the underlying bound client API buffers
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1759
        //are in use by the client API that created them, an EGL BAD ACCESS error is generated.
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1760
		EGL_IF_ERROR(s->getDrawable()->isInUse(), EGL_BAD_ACCESS, 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
  1761
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1762
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1763
		//TODO properly check compatibility of surface and context:
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1764
		//-both have RGB or LUMINANCE configs
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1765
		//-buffer bit depths match
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1766
		//-configs support OpenVG
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1767
		//-both have the same display
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1768
		EGL_IF_ERROR(s->getConfig() != c->getConfig(), EGL_BAD_MATCH, 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
  1769
		//TODO check if context or surfaces are already bound to another thread
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1770
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1771
		//If a native window underlying either draw or read is no longer valid, an EGL BAD NATIVE WINDOW error is generated.
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1772
        EGL_IF_ERROR(s->getOSWindowContext() && !OSIsWindow(s->getOSWindowContext()), EGL_BAD_NATIVE_WINDOW, EGL_FALSE);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1773
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1774
		//TODO If the previous context of the calling display has unflushed commands, and the previous surface is no longer valid, an EGL BAD CURRENT SURFACE error is generated. (can this happen?)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1775
		//TODO If the ancillary buffers for draw and read cannot be allocated, an EGL BAD ALLOC error is generated. (mask buffer?)
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1776
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1777
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1778
	//check if the thread is current
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1779
	RIEGLThread* thread = egl->getCurrentThread();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1780
	if(thread)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1781
	{	//thread is current, release the old bindinds and remove the thread from the current thread list
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1782
		RIEGLContext* pc = thread->getCurrentContext();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1783
		RIEGLSurface* ps = thread->getCurrentSurface();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1784
		if(pc)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1785
		{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1786
#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
  1787
			do_vgFlush();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1788
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1789
			vgFlush();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1790
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1791
			pc->getVGContext()->setDefaultDrawable(NULL);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1792
			if(!pc->removeReference())
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1793
				RI_DELETE(pc);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1794
		}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1795
		if(ps)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1796
		{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1797
			if(!ps->removeReference())
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1798
				RI_DELETE(ps);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1799
		}
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1800
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1801
        egl->removeCurrentThread(thread);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1802
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1803
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1804
	if( c && s )
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1805
	{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1806
		//bind context and surface to the current display
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1807
		RIEGLThread* newThread = egl->getThread();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1808
		if(!newThread)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1809
			EGL_RETURN(EGL_BAD_ALLOC, EGL_FALSE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1810
        newThread->makeCurrent(c, s);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1811
		c->getVGContext()->setDefaultDrawable(s->getDrawable());
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1812
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1813
		try
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1814
		{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1815
			egl->addCurrentThread(newThread);	//throws bad_alloc
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1816
		}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1817
		catch(std::bad_alloc)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1818
		{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1819
			EGL_RETURN(EGL_BAD_ALLOC, EGL_FALSE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1820
		}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1821
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1822
		c->addReference();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1823
		s->addReference();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1824
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1825
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1826
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1827
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1828
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1829
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1830
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1831
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1832
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1833
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1834
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1835
#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
  1836
RI_APIENTRY EGLContext do_eglGetCurrentContext()
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1837
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1838
EGLContext eglGetCurrentContext()
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1839
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1840
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1841
    EGL_GET_EGL(EGL_NO_CONTEXT);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1842
	EGLContext ret = EGL_NO_CONTEXT;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1843
	RIEGLThread* thread = egl->getCurrentThread();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1844
	if(thread && thread->getBoundAPI() == EGL_OPENVG_API)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1845
    {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1846
        ret = CastFromRIEGLContext(thread->getCurrentContext());
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1847
        RI_ASSERT(ret);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1848
    }
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1849
	EGL_RETURN(EGL_SUCCESS, ret);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1850
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1851
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1852
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1853
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1854
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1855
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1856
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1857
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1858
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1859
#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
  1860
RI_APIENTRY EGLSurface do_eglGetCurrentSurface(EGLint readdraw)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1861
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1862
EGLSurface eglGetCurrentSurface(EGLint readdraw)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1863
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1864
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1865
    EGL_GET_EGL(EGL_NO_SURFACE);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1866
	EGL_IF_ERROR(readdraw != EGL_READ && readdraw != EGL_DRAW, EGL_BAD_PARAMETER, EGL_NO_SURFACE);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1867
	EGLContext ret = EGL_NO_SURFACE;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1868
	RIEGLThread* thread = egl->getCurrentThread();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1869
	if(thread && thread->getBoundAPI() == EGL_OPENVG_API)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1870
    {
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1871
        ret = CastFromRIEGLSurface(thread->getCurrentSurface());
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1872
        RI_ASSERT(ret);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1873
    }
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1874
	EGL_RETURN(EGL_SUCCESS, ret);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1875
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1876
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1877
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1878
* \brief	Returns the current display
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1879
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1880
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1881
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1882
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1883
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1884
#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
  1885
RI_APIENTRY EGLDisplay do_eglGetCurrentDisplay(void)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1886
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1887
EGLDisplay eglGetCurrentDisplay(void)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1888
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1889
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1890
    EGL_GET_EGL(EGL_NO_DISPLAY);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1891
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1892
	RIEGLThread* thread = egl->getCurrentThread();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1893
	if(!thread || thread->getBoundAPI() != EGL_OPENVG_API)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1894
		EGL_RETURN(EGL_SUCCESS, EGL_NO_DISPLAY);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1895
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1896
	RIEGLContext* ctx = thread->getCurrentContext();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1897
    RI_ASSERT(ctx);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1898
    EGLDisplay ret = egl->findDisplay(CastFromRIEGLContext(ctx));
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1899
	EGL_RETURN(EGL_SUCCESS, ret);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1900
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1901
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1902
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1903
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1904
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1905
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1906
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1907
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1908
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1909
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1910
RI_APIENTRY EGLBoolean do_eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1911
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1912
EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint* value)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1913
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1914
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1915
	EGL_GET_DISPLAY(dpy, 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
  1916
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, 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
  1917
	EGL_IF_ERROR(!display->contextExists(ctx), EGL_BAD_CONTEXT, 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
  1918
	EGL_IF_ERROR(attribute != EGL_CONFIG_ID && attribute != EGL_CONTEXT_CLIENT_TYPE, EGL_BAD_ATTRIBUTE, EGL_FALSE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1919
	if(attribute == EGL_CONFIG_ID)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1920
		*value = display->getConfig(((RIEGLContext*)ctx)->getConfig()).m_configID;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1921
	if(attribute == EGL_CONTEXT_CLIENT_TYPE)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1922
		*value = EGL_OPENVG_API;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1923
	// \todo [kalle 05/Jul/05] Handling of EGL_RENDER_BUFFER attribute is missing.
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1924
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1925
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1926
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1927
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1928
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1929
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1930
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1931
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1932
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1933
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1934
#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
  1935
RI_APIENTRY EGLBoolean do_eglBindAPI(EGLenum api)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1936
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1937
EGLBoolean eglBindAPI(EGLenum api)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1938
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1939
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1940
    EGL_GET_EGL(EGL_FALSE);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1941
	EGL_IF_ERROR(api != EGL_OPENVG_API && api != EGL_OPENGL_ES_API, EGL_BAD_PARAMETER, 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
  1942
	RIEGLThread* thread = egl->getThread();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1943
	if(thread)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1944
		thread->bindAPI(api);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1945
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1946
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1947
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1948
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1949
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1950
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1951
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1952
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1953
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1954
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1955
#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
  1956
RI_APIENTRY EGLenum do_eglQueryAPI(void)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1957
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1958
EGLenum eglQueryAPI(void)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1959
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1960
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1961
    EGL_GET_EGL(EGL_NONE);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1962
	RIEGLThread* thread = egl->getThread();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1963
	if(thread)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1964
		EGL_RETURN(EGL_SUCCESS, thread->getBoundAPI());
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1965
	EGL_RETURN(EGL_SUCCESS, EGL_NONE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1966
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1967
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1968
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1969
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1970
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1971
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1972
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1973
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1974
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1975
#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
  1976
RI_APIENTRY EGLBoolean do_eglWaitClient()
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1977
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1978
EGLBoolean eglWaitClient()
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1979
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1980
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1981
    EGL_GET_EGL(EGL_FALSE);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1982
	RIEGLThread* thread = egl->getCurrentThread();
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1983
	if(thread && thread->getBoundAPI() == EGL_OPENVG_API)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1984
#ifdef BUILD_WITH_PRIVATE_OPENVG
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1985
		do_vgFlush();
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1986
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1987
		vgFinish();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1988
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1989
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1990
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1991
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1992
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1993
* \brief	Waits for OpenGL ES
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1994
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1995
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1996
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  1997
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1998
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  1999
#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
  2000
RI_APIENTRY EGLBoolean do_eglWaitGL(void)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2001
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2002
EGLBoolean eglWaitGL(void)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2003
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2004
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2005
	return EGL_TRUE;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2006
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2007
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2008
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2009
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2010
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2011
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2012
* \note		We don't support native rendering
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2013
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2014
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2015
#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
  2016
RI_APIENTRY EGLBoolean do_eglWaitNative(EGLint engine)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2017
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2018
EGLBoolean eglWaitNative(EGLint engine)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2019
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2020
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2021
	RI_UNREF(engine);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2022
	return EGL_TRUE;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2023
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2024
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2025
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2026
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2027
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2028
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2029
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2030
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2031
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2032
#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
  2033
RI_APIENTRY EGLBoolean do_eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2034
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2035
EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2036
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2037
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2038
	EGL_GET_DISPLAY(dpy, 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
  2039
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, 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
  2040
	EGL_IF_ERROR(!display->surfaceExists(surface), EGL_BAD_SURFACE, 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
  2041
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2042
	RIEGLSurface* s = (RIEGLSurface*)surface;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2043
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2044
	RIEGLThread* currentThread = egl->getCurrentThread();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2045
	EGL_IF_ERROR(!currentThread || currentThread->getCurrentSurface() != s, EGL_BAD_SURFACE, 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
  2046
	EGL_IF_ERROR(!OSIsWindow(s->getOSWindowContext()), EGL_BAD_NATIVE_WINDOW, 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
  2047
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2048
#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
  2049
	do_vgFlush();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2050
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2051
	vgFlush();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2052
#endif
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2053
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2054
	if(!s->getOSWindowContext())
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2055
	{	//do nothing for other than window surfaces (NOTE: single-buffered window surfaces should return immediately as well)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2056
		EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2057
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2058
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2059
	int windowWidth = 0, windowHeight = 0;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2060
    OSGetWindowSize(s->getOSWindowContext(), windowWidth, windowHeight);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2061
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2062
	if(windowWidth != s->getDrawable()->getWidth() || windowHeight != s->getDrawable()->getHeight())
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2063
	{	//resize the back buffer
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2064
		RIEGLContext* c = currentThread->getCurrentContext();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2065
		RI_ASSERT(c);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2066
		try
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2067
		{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2068
			s->getDrawable()->resize(windowWidth, windowHeight);	//throws bad_alloc
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2069
		}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2070
		catch(std::bad_alloc)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2071
		{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2072
			c->getVGContext()->setDefaultDrawable(NULL);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2073
			EGL_RETURN(EGL_BAD_ALLOC, 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
  2074
		}
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2075
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2076
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2077
    OSBlitToWindow(s->getOSWindowContext(), s->getDrawable());
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2078
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2079
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2080
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2081
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2082
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2083
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2084
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2085
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2086
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2087
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2088
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2089
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2090
RI_APIENTRY EGLBoolean do_eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2091
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2092
EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2093
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2094
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2095
	EGL_GET_DISPLAY(dpy, 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
  2096
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, 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
  2097
	EGL_IF_ERROR(!display->surfaceExists(surface), EGL_BAD_SURFACE, 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
  2098
	//EGL_IF_ERROR(!target || !isValidImageFormat(target->format) || !target->data || target->width <= 0 || target->height <= 0, EGL_BAD_NATIVE_PIXMAP, EGL_FALSE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2099
	EGLint  width  = -1;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2100
	EGLint  height = -1;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2101
	EGLint  stride = -1;
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2102
	VGImageFormat format;
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2103
	int* data = NULL;
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2104
	EGLBoolean err = OSGetNativePixmapInfo(target, &width, &height, &stride,&format, &data);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2105
	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2106
	TUint* fdata = (TUint*)((TUint)data + ( stride * ( height - 1  ) ) );	
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2107
	try
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2108
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2109
		Image output(Color::formatToDescriptor(format), width, height, -stride, (RIuint8*)fdata);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2110
        output.addReference();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2111
		output.blit(((RIEGLSurface*)surface)->getDrawable()->getColorBuffer(), 0, 0, 0, 0, width, height);	//throws bad_alloc
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2112
        output.removeReference();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2113
	}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2114
	catch(std::bad_alloc)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2115
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2116
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2117
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2118
	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2119
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2120
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2121
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2122
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2123
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2124
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2125
* \note		We support only swap interval one
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2126
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2127
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2128
#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
  2129
RI_APIENTRY EGLBoolean do_eglSwapInterval(EGLDisplay dpy, EGLint interval)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2130
#else
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2131
EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2132
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2133
{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2134
	EGL_GET_DISPLAY(dpy, 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
  2135
	EGL_IF_ERROR(!display, EGL_NOT_INITIALIZED, 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
  2136
	RI_UNREF(interval);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2137
	EGL_RETURN(EGL_SUCCESS, EGL_TRUE);
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2138
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2139
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2140
/*-------------------------------------------------------------------*//*!
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2141
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2142
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2143
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2144
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2145
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2146
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2147
typedef void RI_Proc();
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2148
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2149
//EGLAPI void (* EGLAPIENTRY      eglGetProcAddress(const char *procname))(void);
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2150
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2151
#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
  2152
RI_APIENTRY void (*do_eglGetProcAddress(const char *procname))(...)
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2153
#else
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2154
void (*eglGetProcAddress(const char *procname))(...)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2155
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2156
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2157
	if(!procname)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2158
		return NULL;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2159
	return NULL;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2160
}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2161
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2162
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2163
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2164
/*-------------------------------------------------------------------*//*!
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2165
* \brief	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2166
* \param	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2167
* \return	
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2168
* \note		
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2169
*//*-------------------------------------------------------------------*/
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2170
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2171
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2172
RI_APIENTRY EGLBoolean do_eglReleaseThread(void)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2173
#else
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2174
EGLBoolean eglReleaseThread(void)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2175
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2176
{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2177
    EGL_GET_EGL(EGL_FALSE);
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2178
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2179
	//check if the thread is current
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2180
	RIEGLThread* thread = egl->getCurrentThread();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2181
	if(thread)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2182
	{	//thread is current, release the old bindings and remove the thread from the current thread list
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2183
		RIEGLContext* pc = thread->getCurrentContext();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2184
		RIEGLSurface* ps = thread->getCurrentSurface();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2185
		if(pc)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2186
		{
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2187
#ifdef BUILD_WITH_PRIVATE_OPENVG
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2188
			do_vgFlush();
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2189
#else
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2190
			vgFlush();
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2191
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2192
			pc->getVGContext()->setDefaultDrawable(NULL);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2193
			if(!pc->removeReference())
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2194
				RI_DELETE(pc);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2195
		}
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2196
		if(ps)
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2197
		{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2198
			if(!ps->removeReference())
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2199
				RI_DELETE(ps);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2200
		}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2201
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2202
        egl->removeCurrentThread(thread);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2203
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2204
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2205
    //destroy EGL's thread struct
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2206
    egl->destroyThread();
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2207
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2208
	//destroy the EGL instance
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2209
	releaseEGL();
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2210
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2211
	OSReleaseMutex();
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2212
    OSDeinitMutex();
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2213
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2214
	return EGL_SUCCESS;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2215
}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2216
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2217
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2218
RI_APIENTRY EGLBoolean do_eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2219
#else
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2220
EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2221
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2222
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2223
	//not implemented
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2224
	RI_ASSERT(0);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2225
	return false;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2226
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2227
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2228
#ifdef BUILD_WITH_PRIVATE_EGL
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2229
RI_APIENTRY EGLBoolean do_eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2230
#else 
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2231
EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2232
#endif
72
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2233
	{
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2234
	//not implemented
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2235
	RI_ASSERT(0);
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2236
	return false;
360f71440b77 Changes after review
Jose Thachil<jose.thachil@cell-telecom.com>
parents: 58
diff changeset
  2237
	}
57
2bf8a359aa2f Create EGL 1.4 implementation by merging eglrefimpl and EGL from sfopenvg
Jose Thachil<jose.thachil@cell-telecom.com>
parents:
diff changeset
  2238
#undef EGL_NUMCONFIGS