hostsupport/hostegl/src/EGLState.cpp
author Matt Plumtree <matt.plumtree@nokia.com>
Wed, 06 Oct 2010 17:59:01 +0100
branchbug235_bringup_0
changeset 53 c2ef9095503a
child 56 40cc73c24bf8
permissions -rw-r--r--
Copy code from the holdingarea into the target locations. Some initial rework of CMakeLists.txt files, but not yet tested.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     1
/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     2
 *
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     3
 * Permission is hereby granted, free of charge, to any person obtaining a
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     4
 * copy of this software and /or associated documentation files
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     5
 * (the "Materials "), to deal in the Materials without restriction,
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     6
 * including without limitation the rights to use, copy, modify, merge,
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     7
 * publish, distribute, sublicense, and/or sell copies of the Materials,
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     8
 * and to permit persons to whom the Materials are furnished to do so,
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     9
 * subject to the following conditions:
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    10
 *
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    11
 * The above copyright notice and this permission notice shall be included
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    12
 * in all copies or substantial portions of the Materials.
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    13
 *
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    14
 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    15
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    16
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    17
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    18
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    19
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    20
 * THE USE OR OTHER DEALINGS IN THE MATERIALS.
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    21
 *
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    22
 * Initial Contributors:
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    23
 * Nokia Corporation - initial contribution.
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    24
 *
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    25
 * Contributors:
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    26
 *
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    27
 * Description:
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    28
 *
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    29
 */
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    30
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    31
#include "EGLState.h"
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    32
#include "EGLDisplay.h"
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    33
#include "EGLProcess.h"
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    34
#include "EGLThread.h"
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    35
#include "EGLContext.h"
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    36
#include "EGLConfig.h"
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    37
#include "EGLOs.h"
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    38
#include "EGLImage.h"
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    39
#include "EGLPbufferSurface.h"
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    40
#include "EGLWindowSurface.h"
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    41
#include <EGL/eglext.h>
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    42
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    43
#include <string.h>
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    44
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    45
CEGLState::CEGLState(void) :
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    46
    m_initialized( false ),
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    47
    m_currentProcess( NULL ),
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    48
    m_VGLib( NULL ),
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    49
    m_VGInterface( NULL ),
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    50
    m_GLES1Lib( NULL ),
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    51
    m_GLES1Interface( NULL ),
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    52
    m_GLES2Lib( NULL ),
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    53
    m_GLES2Interface( NULL ),
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    54
	m_hostGL( NULL ),
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    55
    m_supportedApis( 0 ),
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    56
	m_defaultDisplay( NULL ),
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    57
	m_dummyWindow( NULL )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    58
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    59
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    60
#if !defined(EGLI_USE_PLATSIM_EXTENSIONS)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    61
    CEGLProcess* p = EGLI_NEW CEGLProcess(0);
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    62
    EGLI_ASSERT( p != NULL );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    63
    AddObject<CEGLProcess>( m_processes, p );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    64
    m_currentProcess = p;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    65
#endif
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    66
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    67
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    68
CEGLState::~CEGLState(void)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    69
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    70
    DestroyPointerVector<CEGLProcess>( m_processes );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    71
    DestroyPointerVector<CEGLDisplay>( m_displays );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    72
    DestroyPointerVector<CEGLConfig>( m_configs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    73
    if( m_VGLib ) EGLI_ASSERT( CEGLOs::FreeClientLibrary(m_VGLib) );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    74
    if( m_GLES1Lib ) EGLI_ASSERT( CEGLOs::FreeClientLibrary(m_GLES1Lib) );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    75
    if( m_GLES2Lib ) EGLI_ASSERT( CEGLOs::FreeClientLibrary(m_GLES2Lib) );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    76
#if defined(_WIN32)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    77
#   if !defined(EGLI_USE_PLATSIM_EXTENSIONS)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    78
    if( m_defaultDisplay )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    79
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    80
        // \todo If at some point EGL_DEFAULT_DISPLAY is created
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    81
        //       with CreateDC() the DC needs to be released by
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    82
        //       calling DeleteDC().
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    83
        //CEGLOs::DestroyDefaultDisplay( m_defaultDisplay );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    84
        ReleaseDC( m_dummyWindow, m_defaultDisplay );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    85
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    86
    // \note Dummy window created in CEGLDisplay::Initialize(). See comment
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    87
    //       in CEGLOs::CreateDefaultDisplay().
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    88
    if( m_dummyWindow )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    89
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    90
        CEGLOs::DestroyNativeWindow( m_dummyWindow );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    91
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    92
#   endif
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    93
#endif
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    94
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    95
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    96
bool CEGLState::Initialize()
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    97
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    98
    if( !m_initialized )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    99
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   100
        if( !(CreateConfigs()) ) return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   101
        m_initialized = true;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   102
        m_VGInterface = CEGLOs::LoadVGInterface( m_VGLib );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   103
        if( m_VGInterface ) 
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   104
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   105
            m_VGInterface->SetEGLInterface( this );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   106
            m_supportedApis |= EGL_OPENVG_BIT;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   107
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   108
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   109
        m_GLES1Interface = CEGLOs::LoadGLES1Interface( m_GLES1Lib );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   110
        if( m_GLES1Interface ) 
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   111
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   112
            m_GLES1Interface->SetEGLInterface( this );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   113
            m_supportedApis |= EGL_OPENGL_ES_BIT;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   114
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   115
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   116
	    m_GLES2Interface = CEGLOs::LoadGLES2Interface( m_GLES2Lib );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   117
        if( m_GLES2Interface ) 
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   118
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   119
            m_GLES2Interface->SetEGLInterface( this );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   120
            m_supportedApis |= EGL_OPENGL_ES2_BIT;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   121
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   122
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   123
        if( m_supportedApis & EGL_OPENGL_ES_BIT || (m_supportedApis & EGL_OPENGL_ES2_BIT) )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   124
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   125
            m_hostGL = CEGLOs::LoadHostGL();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   126
            if( !m_hostGL ) m_initialized = false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   127
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   128
        if( !m_supportedApis )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   129
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   130
            m_initialized = false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   131
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   132
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   133
		//m_defaultDisplay = CEGLOs::CreateDefaultDisplay();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   134
        // \note Creating a dummy window to get DC from. See comment
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   135
        //       in CEGLOs::CreateDefaultDisplay().
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   136
		m_dummyWindow = CEGLOs::CreateNativeWindow(0, 0);
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   137
        if( m_dummyWindow )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   138
			{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   139
#if defined(_WIN32)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   140
			m_defaultDisplay = (EGLINativeDisplayType)GetDC( (HWND)m_dummyWindow );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   141
#else // Linux
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   142
			EGLI_ASSERT( false );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   143
#endif
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   144
			if( !m_defaultDisplay )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   145
				{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   146
				CEGLOs::DestroyNativeWindow( m_dummyWindow );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   147
				m_initialized = false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   148
				}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   149
			}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   150
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   151
    return m_initialized;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   152
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   153
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   154
CEGLDisplay* CEGLState::AddDisplay( EGLINativeDisplayType nativeType, EGLint processId )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   155
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   156
#if defined(EGLI_USE_PLATSIM_EXTENSIONS)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   157
    CEGLDisplay* display = EGLI_NEW CEGLDisplay( nativeType, processId );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   158
#else
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   159
    CEGLDisplay* display = EGLI_NEW CEGLDisplay( nativeType, m_currentProcess->Id() );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   160
#endif
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   161
    if( display )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   162
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   163
        AddObject<CEGLDisplay>( m_displays, display );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   164
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   165
    return display;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   166
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   167
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   168
void CEGLState::RemoveDisplay( EGLDisplay display )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   169
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   170
    DeleteObjectByPointer<CEGLDisplay>( m_displays, display );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   171
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   172
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   173
CEGLDisplay* CEGLState::GetDisplayByNativeType( EGLINativeDisplayType nativeType, EGLint processId ) const
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   174
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   175
    CEGLDisplay* ret = NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   176
    for( std::vector<CEGLDisplay*>::const_iterator iter = m_displays.begin();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   177
        iter != m_displays.end();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   178
        iter++)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   179
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   180
#if defined(EGLI_USE_PLATSIM_EXTENSIONS)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   181
        if( (*iter)->NativeType() == nativeType && (*iter)->ProcessId() == processId )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   182
#else
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   183
        if( (*iter)->NativeType() == nativeType )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   184
#endif
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   185
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   186
            ret = (*iter);
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   187
            break;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   188
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   189
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   190
    return ret;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   191
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   192
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   193
CEGLDisplay* CEGLState::GetDisplay( EGLDisplay display ) const
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   194
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   195
    return FindObjectByPointer<CEGLDisplay>( m_displays, display, NULL);
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   196
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   197
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   198
CEGLProcess* CEGLState::AddProcess( EGLint processId, bool setCurrent )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   199
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   200
#if defined(EGLI_USE_PLATSIM_EXTENSIONS)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   201
    CEGLProcess* process = EGLI_NEW CEGLProcess( processId );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   202
    if( process )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   203
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   204
        AddObject<CEGLProcess>( m_processes, process );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   205
        if( setCurrent && process )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   206
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   207
            m_currentProcess = process;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   208
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   209
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   210
    return process;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   211
#else
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   212
    EGLI_ASSERT( false );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   213
    return NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   214
#endif
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   215
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   216
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   217
void CEGLState::RemoveProcess( EGLint processId )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   218
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   219
#if defined(EGLI_USE_PLATSIM_EXTENSIONS)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   220
    if( m_currentProcess && m_currentProcess->Id() == processId )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   221
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   222
        m_currentProcess = NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   223
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   224
    DeleteObjectById<CEGLProcess>( m_processes, processId );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   225
#else
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   226
    EGLI_ASSERT( false );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   227
#endif
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   228
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   229
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   230
CEGLProcess* CEGLState::GetProcess( EGLint processId ) const
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   231
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   232
#if defined(EGLI_USE_PLATSIM_EXTENSIONS)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   233
    return FindObjectById<CEGLProcess>( m_processes, processId, NULL );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   234
#else
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   235
    return m_currentProcess;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   236
#endif
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   237
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   238
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   239
void CEGLState::SetCurrentProcessThread( EGLint processId, EGLI_THREAD_ID threadId )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   240
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   241
#if defined(EGLI_USE_PLATSIM_EXTENSIONS)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   242
    if( m_currentProcess && m_currentProcess->Id() == processId )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   243
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   244
        m_currentProcess->SetCurrentThread( threadId );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   245
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   246
    else
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   247
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   248
        CEGLProcess* process = FindObjectById<CEGLProcess>( m_processes, processId, NULL);
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   249
        // processes are created in eglPlatsimSetProcessInformation()
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   250
        EGLI_ASSERT( process != NULL );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   251
        process->SetCurrentThread( threadId );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   252
        m_currentProcess = process;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   253
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   254
#else
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   255
    EGLI_ASSERT( false );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   256
#endif
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   257
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   258
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   259
void CEGLState::FillConfigs( EGLConfig* configs, EGLint size ) const
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   260
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   261
    EGLI_ASSERT( size <= ConfigCount() );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   262
    for( EGLint i=0; i < size; i++ )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   263
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   264
        configs[i] = (EGLConfig)m_configs[i];
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   265
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   266
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   267
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   268
CEGLConfig* CEGLState::FindConfigById( EGLint id ) const
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   269
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   270
    return FindObjectById<CEGLConfig>( m_configs, id, NULL );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   271
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   272
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   273
EGLint CEGLState::MatchConfigs( CEGLConfig* filter, EGLConfig* configs, EGLint maxCount ) const
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   274
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   275
    maxCount = EGLI_MIN( m_configs.size(), (unsigned int)maxCount );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   276
    EGLint count = 0;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   277
    std::vector<CEGLConfig*>::const_iterator iter = m_configs.begin();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   278
    while( iter != m_configs.end() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   279
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   280
        if( (*iter)->Match( *filter ) )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   281
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   282
            if( configs && count < maxCount )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   283
                configs[count++] = (EGLConfig)(*iter);
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   284
            else if( configs )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   285
                break;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   286
            else
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   287
                count++;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   288
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   289
        iter++;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   290
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   291
    if( configs && count > 1 )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   292
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   293
        for( int i=0; i < count-1; i++ )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   294
            for( int j=i+1; j < count; j++ )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   295
                {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   296
                if( *((CEGLConfig*)configs[j]) > *((CEGLConfig*)configs[i]) )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   297
                    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   298
                    EGLConfig tmp = configs[i];
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   299
                    configs[i] = configs[j];
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   300
                    configs[j] = tmp;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   301
                    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   302
                }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   303
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   304
    return count;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   305
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   306
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   307
CEGLConfig* CEGLState::GetConfig( EGLConfig config ) const
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   308
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   309
    return FindObjectByPointer<CEGLConfig>( m_configs, config, NULL );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   310
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   311
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   312
void* CEGLState::GetVGContext()
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   313
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   314
    CEGLOs::GetLock( &g_eglLock );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   315
    void* ret = NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   316
    if( m_currentProcess &&
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   317
        m_currentProcess->CurrentThread() &&
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   318
        m_currentProcess->CurrentThread()->CurrentVGContext() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   319
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   320
        ret = m_currentProcess->CurrentThread()->CurrentVGContext()->ClientContext();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   321
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   322
    CEGLOs::ReleaseLock( &g_eglLock );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   323
    return ret;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   324
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   325
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   326
void* CEGLState::GetHostProcAddress(const char* proc)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   327
	{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   328
    return CEGLOs::GetGLProcAddress(m_hostGL, proc);
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   329
	}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   330
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   331
void* CEGLState::GetGLESContext()
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   332
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   333
    CEGLOs::GetLock( &g_eglLock );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   334
    void* ret = NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   335
    if( m_currentProcess &&
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   336
        m_currentProcess->CurrentThread() &&
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   337
        m_currentProcess->CurrentThread()->CurrentGLESContext() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   338
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   339
        ret = m_currentProcess->CurrentThread()->CurrentGLESContext()->ClientContext();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   340
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   341
    CEGLOs::ReleaseLock( &g_eglLock );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   342
    return ret;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   343
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   344
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   345
bool CEGLState::IsImageInUse( void* image )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   346
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   347
    //TODO
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   348
    return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   349
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   350
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   351
bool CEGLState::LockVGSurface( bool read, bool write )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   352
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   353
    return LockSurface( EGL_OPENVG_API, read, write );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   354
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   355
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   356
bool CEGLState::UnlockVGSurface()
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   357
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   358
    return UnlockSurface( EGL_OPENVG_API );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   359
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   360
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   361
void CEGLState::GetDescForImage( void* image, SurfaceDescriptor& ImageDesc )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   362
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   363
    CEGLImage* eglImage = (CEGLImage*)image;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   364
    ImageDesc.m_stride = -1;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   365
    ImageDesc.m_height = -1;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   366
    ImageDesc.m_width  = -1;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   367
    // Check that image is not null.
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   368
    if( !eglImage )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   369
        {        
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   370
        return;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   371
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   372
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   373
    // Check that image is not from VGImage target. -> EGL_VG_PARENT_IMAGE_KHR
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   374
    if( eglImage->Target() == EGL_VG_PARENT_IMAGE_KHR )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   375
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   376
        return;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   377
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   378
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   379
	memcpy(&ImageDesc, &eglImage->SurfaceDesc(), sizeof(ImageDesc));
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   380
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   381
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   382
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   383
void* CEGLState::GetDataForImage( void* image )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   384
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   385
    CEGLImage* eglImage = (CEGLImage*)image;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   386
    // Check that image is not null.
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   387
    if( !eglImage )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   388
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   389
        // if null then error
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   390
        return NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   391
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   392
	return eglImage->Data();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   393
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   394
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   395
void CEGLState::RegisterImageTarget( void* image, EImageTarget target, void* buffer )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   396
	{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   397
	// \todo Implement
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   398
	}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   399
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   400
void CEGLState::UnregisterImageTarget( void* image, EImageTarget target, void* buffer )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   401
	{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   402
	// \todo Implement
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   403
	}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   404
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   405
void CEGLState::UpdateImageSiblings( void* image, EImageTarget target, void* buffer )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   406
	{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   407
	// \todo Implement
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   408
	}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   409
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   410
void CEGLState::ReleaseTexImage(void* surface, int name, int level)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   411
{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   412
	CEGLSurface* eglSurface = (CEGLSurface*)surface;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   413
	EGLITextureBinding& binding = eglSurface->TextureBinding();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   414
	if(binding.name == name && binding.level == level)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   415
	{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   416
		eglSurface->Unlock();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   417
		binding.name = 0;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   418
	}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   419
}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   420
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   421
bool CEGLState::LockGLESSurface( bool read, bool write )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   422
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   423
    return LockSurface( EGL_OPENGL_ES_API, read, write );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   424
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   425
bool CEGLState::UnlockGLESSurface()
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   426
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   427
    return UnlockSurface( EGL_OPENGL_ES_API );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   428
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   429
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   430
bool CEGLState::SyncSurface( EGLenum api, EGLint apiVersion, CEGLSurface* surface, CEGLSurface* currentGLESReadSurface )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   431
	{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   432
	switch( api )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   433
		{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   434
		case EGL_OPENVG_API:
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   435
			{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   436
			EGLint glesVersion = 0;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   437
			if( surface->IsGLES1Dirty() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   438
				{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   439
				glesVersion = 1;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   440
				}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   441
			else if( surface->IsGLES2Dirty() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   442
				{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   443
				glesVersion = 2;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   444
				}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   445
			if( glesVersion )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   446
				{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   447
				if( surface != currentGLESReadSurface )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   448
					{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   449
					EGLINativeContextType glesCopyContext = NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   450
                    EGLINativeDisplayType glesCopyDisplay = NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   451
                    EGLINativeGLFunctions* funcs = NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   452
					bool pbuffer = ( surface->Type() == CEGLSurface::PBUFFER_SURFACE );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   453
					if( pbuffer )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   454
						{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   455
						if( !(((CEGLPbufferSurface*)surface)->BindCopyContext()) )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   456
							{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   457
							((CEGLPbufferSurface*)surface)->ReleaseCopyContext();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   458
							
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   459
							return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   460
							}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   461
						}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   462
					else if( surface->Type() == CEGLSurface::WINDOW_SURFACE )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   463
						{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   464
						// \todo Remove this or handle window surface sync properly
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   465
						/*
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   466
						funcs = thread->CurrentGLESContext()->NativeGLFunctions();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   467
						glesCopyContext = thread->CurrentGLESContext()->NativeContext();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   468
						glesCopyDisplay = ((CEGLWindowSurface*)surface)->OsContext()->glesDisplay;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   469
						*/
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   470
						}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   471
					if( !(GLESInterface(glesVersion)->CopyBuffers(surface->GLESColorBuffer(), surface->Descriptor())) )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   472
						{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   473
						if( pbuffer )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   474
							{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   475
							((CEGLPbufferSurface*)surface)->ReleaseCopyContext();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   476
							}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   477
						return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   478
						}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   479
					if( pbuffer )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   480
						{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   481
						((CEGLPbufferSurface*)surface)->ReleaseCopyContext();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   482
						}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   483
					else if( surface->Type() == CEGLSurface::WINDOW_SURFACE )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   484
						{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   485
						// \todo Remove this or handle window surface sync properly
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   486
						//EGLI_ASSERT( false );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   487
						}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   488
					}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   489
				else
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   490
					{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   491
					if( !(GLESInterface(glesVersion)->CopyBuffers(surface->GLESColorBuffer(), surface->Descriptor())) )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   492
						return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   493
					}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   494
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   495
				if( VGInterface() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   496
                    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   497
                    VGInterface()->UpdateBuffers(surface->GLESColorBuffer(), surface->Stride(), surface->Descriptor());
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   498
                    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   499
                surface->SetGLES1Dirty( false );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   500
				surface->SetGLES2Dirty( false );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   501
				}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   502
			break;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   503
			}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   504
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   505
		case EGL_OPENGL_ES_API:
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   506
			{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   507
			if( surface->IsVGDirty() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   508
                {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   509
				if( !(GLESInterface(apiVersion)->UpdateBuffers(surface->VGColorBuffer(), surface->Descriptor())) )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   510
                    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   511
                    return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   512
                    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   513
                surface->SetVGDirty( false );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   514
                }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   515
			break;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   516
			}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   517
		}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   518
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   519
	return true;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   520
	}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   521
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   522
bool CEGLState::LockSurface( EGLenum api, bool read, bool write )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   523
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   524
    CEGLOs::GetLock( &g_eglLock );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   525
    CEGLSurface* readSurface = NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   526
    CEGLSurface* drawSurface = NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   527
	CEGLSurface* glesReadSurface = NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   528
	EGLint apiVersion;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   529
    CEGLThread* thread = m_currentProcess->CurrentThread();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   530
    if( !thread )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   531
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   532
        CEGLOs::ReleaseLock( &g_eglLock );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   533
        return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   534
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   535
    switch( api )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   536
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   537
        case EGL_OPENVG_API:
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   538
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   539
            drawSurface = thread->CurrentVGSurface();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   540
            readSurface = drawSurface;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   541
			apiVersion = 0;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   542
            break;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   543
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   544
        case EGL_OPENGL_ES_API:
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   545
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   546
            thread->CurrentGLESSurfaces( &readSurface, &drawSurface );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   547
			apiVersion = thread->CurrentGLESContext()->ClientVersion();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   548
            break;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   549
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   550
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   551
    if( !readSurface && !drawSurface )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   552
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   553
        CEGLOs::ReleaseLock( &g_eglLock );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   554
        return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   555
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   556
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   557
	if( api == EGL_OPENVG_API )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   558
		{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   559
		thread->CurrentGLESSurfaces( &readSurface, NULL );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   560
		}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   561
    
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   562
    if( read && readSurface )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   563
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   564
        readSurface->Lock();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   565
		if( !SyncSurface( api, apiVersion, readSurface, glesReadSurface ) )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   566
			{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   567
			CEGLOs::ReleaseLock( &g_eglLock );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   568
			return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   569
			}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   570
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   571
    if( write && drawSurface && (!read || drawSurface != readSurface) )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   572
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   573
        drawSurface->Lock();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   574
		if( !SyncSurface( api, apiVersion, drawSurface, glesReadSurface ) )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   575
			{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   576
			CEGLOs::ReleaseLock( &g_eglLock );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   577
			return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   578
			}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   579
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   580
    CEGLOs::ReleaseLock( &g_eglLock );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   581
    return true;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   582
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   583
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   584
bool CEGLState::UnlockSurface( EGLenum api )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   585
    {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   586
    CEGLOs::GetLock( &g_eglLock );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   587
    CEGLSurface* drawSurface = NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   588
	CEGLSurface* readSurface = NULL;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   589
    CEGLThread* thread = m_currentProcess->CurrentThread();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   590
    if( !thread )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   591
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   592
        CEGLOs::ReleaseLock( &g_eglLock );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   593
        return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   594
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   595
    switch( api )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   596
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   597
        case EGL_OPENVG_API:
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   598
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   599
            drawSurface = thread->CurrentVGSurface();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   600
			readSurface = drawSurface;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   601
			if( drawSurface && drawSurface->IsLocked() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   602
                drawSurface->SetVGDirty( true );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   603
            break;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   604
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   605
        case EGL_OPENGL_ES_API:
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   606
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   607
            thread->CurrentGLESSurfaces( &readSurface, &drawSurface );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   608
			if( drawSurface && drawSurface->IsLocked() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   609
				{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   610
				EGLint glesVersion = thread->CurrentGLESContext()->ClientVersion();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   611
				if(glesVersion == 1)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   612
					{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   613
					drawSurface->SetGLES1Dirty( true );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   614
					}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   615
				else
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   616
					{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   617
					EGLI_ASSERT(glesVersion == 2);
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   618
					drawSurface->SetGLES2Dirty( true );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   619
					}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   620
				}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   621
            break;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   622
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   623
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   624
    if( drawSurface && drawSurface->IsLocked() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   625
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   626
        drawSurface->Unlock();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   627
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   628
    if( readSurface && readSurface->IsLocked() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   629
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   630
        readSurface->Unlock();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   631
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   632
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   633
    CEGLOs::ReleaseLock( &g_eglLock );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   634
    return true;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   635
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   636
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   637
bool CEGLState::CreateConfigs()
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   638
    {    
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   639
    // ** Config list START **
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   640
    // Initial config count. If adding configs to the list below
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   641
    // remember to add this count too.
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   642
    int count = 21;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   643
    for( int i=0; i < count; i++ )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   644
        {        
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   645
        CEGLConfig* config = EGLI_NEW CEGLConfig();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   646
        // \note AddObject destroys the object if fails to take ownership 
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   647
        AddObject<CEGLConfig>( m_configs, config );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   648
        if( !config )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   649
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   650
            DestroyPointerVector<CEGLConfig>( m_configs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   651
            return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   652
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   653
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   654
    int configId = 0;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   655
    CEGLConfig* config = m_configs[configId];
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   656
    //                                                 r, g, b, l, a, am, s, bpp, id
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   657
    // XRGB_8888 and ARGB_8888
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   658
                                  config->SetUpConfig( 8, 8, 8, 0, 8, 0,  0, 32,  ++configId ); //  1
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   659
    config = m_configs[configId]; config->SetUpConfig( 8, 8, 8, 0, 8, 1,  0, 32,  ++configId ); //  2
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   660
    config = m_configs[configId]; config->SetUpConfig( 8, 8, 8, 0, 8, 4,  0, 32,  ++configId ); //  3
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   661
    config = m_configs[configId]; config->SetUpConfig( 8, 8, 8, 0, 8, 8,  0, 32,  ++configId ); //  4    
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   662
    config = m_configs[configId]; config->SetUpConfig( 8, 8, 8, 0, 0, 0,  0, 32,  ++configId ); //  5
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   663
    config = m_configs[configId]; config->SetUpConfig( 8, 8, 8, 0, 0, 1,  0, 32,  ++configId ); //  6
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   664
    config = m_configs[configId]; config->SetUpConfig( 8, 8, 8, 0, 0, 4,  0, 32,  ++configId ); //  7
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   665
    config = m_configs[configId]; config->SetUpConfig( 8, 8, 8, 0, 0, 8,  0, 32,  ++configId ); //  8
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   666
    // RGB_565
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   667
    config = m_configs[configId]; config->SetUpConfig( 5, 6, 5, 0, 0, 0,  0, 16,  ++configId ); //  9
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   668
    config = m_configs[configId]; config->SetUpConfig( 5, 6, 5, 0, 0, 1,  0, 16,  ++configId ); // 10
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   669
    config = m_configs[configId]; config->SetUpConfig( 5, 6, 5, 0, 0, 4,  0, 16,  ++configId ); // 11
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   670
    config = m_configs[configId]; config->SetUpConfig( 5, 6, 5, 0, 0, 8,  0, 16,  ++configId ); // 12
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   671
    // LA_88
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   672
    config = m_configs[configId]; config->SetUpConfig( 0, 0, 0, 8, 8, 0,  0, 16,  ++configId ); // 13
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   673
    config = m_configs[configId]; config->SetUpConfig( 0, 0, 0, 8, 8, 1,  0, 16,  ++configId ); // 14
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   674
    config = m_configs[configId]; config->SetUpConfig( 0, 0, 0, 8, 8, 4,  0, 16,  ++configId ); // 15
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   675
    config = m_configs[configId]; config->SetUpConfig( 0, 0, 0, 8, 8, 8,  0, 16,  ++configId ); // 16
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   676
    // L_8
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   677
    config = m_configs[configId]; config->SetUpConfig( 0, 0, 0, 8, 0, 0,  0,  8,  ++configId ); // 17
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   678
    config = m_configs[configId]; config->SetUpConfig( 0, 0, 0, 8, 0, 1,  0,  8,  ++configId ); // 18
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   679
    config = m_configs[configId]; config->SetUpConfig( 0, 0, 0, 8, 0, 4,  0,  8,  ++configId ); // 19
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   680
    config = m_configs[configId]; config->SetUpConfig( 0, 0, 0, 8, 0, 8,  0,  8,  ++configId ); // 20
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   681
    // A_8
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   682
    config = m_configs[configId]; config->SetUpConfig( 0, 0, 0, 0, 8, 0,  0,  8,  ++configId ); // 21
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   683
    // ** Config list END **
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   684
    
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   685
    std::vector<CEGLConfig*> newConfigs;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   686
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   687
    // stencil buffers
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   688
    std::vector<CEGLConfig*>::const_iterator iter = m_configs.begin();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   689
    while( iter != m_configs.end() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   690
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   691
        config = EGLI_NEW CEGLConfig();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   692
        if( config )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   693
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   694
            *config = *(*iter);
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   695
            config->SetId( ++configId );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   696
            config->SetAttribute( EGL_STENCIL_SIZE, 8 );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   697
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   698
        // \note AddObject destroys the object if fails to take ownership 
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   699
        AddObject<CEGLConfig>( newConfigs, config );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   700
        if( !config )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   701
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   702
            DestroyPointerVector<CEGLConfig>( newConfigs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   703
            DestroyPointerVector<CEGLConfig>( m_configs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   704
            return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   705
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   706
        iter++;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   707
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   708
    try
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   709
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   710
        m_configs.insert( m_configs.end(), newConfigs.begin(), newConfigs.end() );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   711
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   712
    catch( std::exception )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   713
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   714
        DestroyPointerVector<CEGLConfig>( newConfigs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   715
        DestroyPointerVector<CEGLConfig>( m_configs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   716
        return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   717
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   718
    newConfigs.clear();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   719
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   720
    // depth buffers
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   721
    // 32bpp, 24bpp and 16bpp support
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   722
    for(int depthSize = 32; depthSize >= 16; depthSize -= 8 )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   723
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   724
        iter = m_configs.begin();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   725
        while( iter != m_configs.end() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   726
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   727
            config = EGLI_NEW CEGLConfig();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   728
            if( config )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   729
                {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   730
                *config = *(*iter);
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   731
                config->SetId( ++configId );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   732
                config->SetAttribute( EGL_DEPTH_SIZE, depthSize );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   733
                }            
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   734
            // \note AddObject destroys the object if fails to take ownership    
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   735
            AddObject<CEGLConfig>( newConfigs, config );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   736
            if( !config )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   737
                {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   738
                DestroyPointerVector<CEGLConfig>( newConfigs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   739
                DestroyPointerVector<CEGLConfig>( m_configs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   740
                return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   741
                }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   742
            iter++;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   743
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   744
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   745
    try
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   746
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   747
        m_configs.insert( m_configs.end(), newConfigs.begin(), newConfigs.end() );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   748
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   749
    catch( std::exception )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   750
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   751
        DestroyPointerVector<CEGLConfig>( newConfigs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   752
        DestroyPointerVector<CEGLConfig>( m_configs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   753
        return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   754
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   755
    newConfigs.clear();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   756
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   757
    // multi sampling
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   758
    for( int samples = 16; samples >= 4; samples -= 12 )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   759
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   760
        iter = m_configs.begin();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   761
        while( iter != m_configs.end() )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   762
            {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   763
            config = EGLI_NEW CEGLConfig();
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   764
            if( config )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   765
                {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   766
                *config = *(*iter);
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   767
                config->SetId( ++configId );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   768
                config->SetAttribute( EGL_SAMPLES, samples );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   769
                config->SetAttribute( EGL_SAMPLE_BUFFERS, 1 );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   770
                }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   771
            // \note AddObject destroys the object if fails to take ownership
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   772
            AddObject<CEGLConfig>( newConfigs, config );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   773
            if( !config )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   774
                {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   775
                DestroyPointerVector<CEGLConfig>( newConfigs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   776
                DestroyPointerVector<CEGLConfig>( m_configs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   777
                return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   778
                }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   779
            iter++;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   780
            }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   781
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   782
    try
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   783
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   784
        m_configs.insert( m_configs.end(), newConfigs.begin(), newConfigs.end() );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   785
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   786
    catch( std::exception )
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   787
        {
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   788
        DestroyPointerVector<CEGLConfig>( newConfigs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   789
        DestroyPointerVector<CEGLConfig>( m_configs );
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   790
        return false;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   791
        }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   792
    newConfigs.clear();  
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   793
    return true;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   794
    }
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   795
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   796
IEGLtoGLESInterface* CEGLState::GLESInterface( EGLint clientVersion ) const
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   797
	{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   798
	EGLI_ASSERT(clientVersion == 1 || clientVersion == 2);
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   799
	return clientVersion == 1 ? m_GLES1Interface : m_GLES2Interface;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   800
	}