hostsupport/inc/GLESInterface.h
branchbug235_bringup_0
changeset 53 c2ef9095503a
parent 24 a3f46bb01be2
equal deleted inserted replaced
52:39e5f73667ba 53:c2ef9095503a
       
     1 /* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2  *
       
     3  * Permission is hereby granted, free of charge, to any person obtaining a
       
     4  * copy of this software and /or associated documentation files
       
     5  * (the "Materials "), to deal in the Materials without restriction,
       
     6  * including without limitation the rights to use, copy, modify, merge,
       
     7  * publish, distribute, sublicense, and/or sell copies of the Materials,
       
     8  * and to permit persons to whom the Materials are furnished to do so,
       
     9  * subject to the following conditions:
       
    10  *
       
    11  * The above copyright notice and this permission notice shall be included
       
    12  * in all copies or substantial portions of the Materials.
       
    13  *
       
    14  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
       
    15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
       
    16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
       
    17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
       
    18  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
       
    19  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
       
    20  * THE USE OR OTHER DEALINGS IN THE MATERIALS.
       
    21  *
       
    22  * Initial Contributors:
       
    23  * Nokia Corporation - initial contribution.
       
    24  *
       
    25  * Contributors:
       
    26  *
       
    27  * Description:
       
    28  *
       
    29  */
       
    30 
       
    31 #ifndef _GLESINTERFACE_H_
       
    32 #define _GLESINTERFACE_H_
       
    33 
       
    34 #include "ImageTarget.h"
       
    35 
       
    36 struct SurfaceDescriptor;
       
    37 
       
    38 typedef void (*fpGLProc)(void);
       
    39 
       
    40 class IGLEStoEGLInterface
       
    41     {
       
    42 public:
       
    43     virtual void* GetGLESContext() = 0;
       
    44     virtual bool IsImageInUse( void* image ) = 0;
       
    45     virtual bool LockGLESSurface( bool read, bool draw ) = 0;
       
    46     virtual bool UnlockGLESSurface() = 0;
       
    47 	virtual void* GetHostProcAddress( const char* proc ) = 0;
       
    48 	virtual void GetDescForImage( void* image, SurfaceDescriptor& ImageDesc ) = 0;
       
    49     virtual void* GetDataForImage( void* image ) = 0;
       
    50 	virtual void RegisterImageTarget( void* image, EImageTarget target, void* buffer ) = 0;
       
    51 	virtual void UnregisterImageTarget( void* image, EImageTarget target, void* buffer ) = 0;
       
    52 	virtual void UpdateImageSiblings( void* image, EImageTarget target, void* buffer ) = 0;
       
    53 	virtual void ReleaseTexImage(void* surface, int name, int level) = 0;
       
    54     };
       
    55 
       
    56 // GLES services for EGL 
       
    57 class IEGLtoGLESInterface
       
    58     {
       
    59 public:
       
    60     virtual void SetEGLInterface( IGLEStoEGLInterface* ) = 0;
       
    61 	virtual void* CreateContext( void* nativeContext ) = 0;
       
    62 	virtual bool ReleaseContext( void* context ) = 0;
       
    63 	virtual void* GetNativeContext( void* context ) = 0;
       
    64 	virtual fpGLProc GetGLProcAddress( const char *procname ) = 0;
       
    65     virtual int BindTexImage( void* surface, int level, bool generateMipmap, const SurfaceDescriptor* desc, void* buffer ) = 0;
       
    66 	virtual bool ReleaseTexImage( int name, int level ) = 0;
       
    67     virtual bool CopyBuffers( void* buf, const SurfaceDescriptor* desc ) = 0;
       
    68     virtual bool UpdateBuffers( void* buf, const SurfaceDescriptor* desc ) = 0;
       
    69     virtual void Flush() = 0;
       
    70     virtual void Finish() = 0;
       
    71     };
       
    72 
       
    73 typedef IEGLtoGLESInterface* (*fpGetGLES1Interface)(void);
       
    74 IEGLtoGLESInterface* LoadGLES1Interface( void*& libraryHandle );
       
    75 
       
    76 #endif // _GLESINTERFACE_H_