hostsupport/hostopengles20/src/GLES2/degl.h
branchbug235_bringup_0
changeset 55 09263774e342
parent 54 067180f57b12
child 56 40cc73c24bf8
equal deleted inserted replaced
54:067180f57b12 55:09263774e342
     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 associated documentation files (the "Software"),
       
     5  * to deal in the Software without restriction, including without limitation
       
     6  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
       
     7  * and/or sell copies of the Software, and to permit persons to whom the
       
     8  * Software is furnished to do so, subject to the following conditions:
       
     9  *
       
    10  * The above copyright notice and this permission notice shall be included
       
    11  * in all copies or substantial portions of the Software.
       
    12  *
       
    13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
       
    14  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
       
    15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
       
    16  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
       
    17  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
       
    18  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
       
    19  *
       
    20  * Initial Contributors:
       
    21  * Nokia Corporation - initial contribution.
       
    22  *
       
    23  * Contributors:
       
    24  *
       
    25  * Description:
       
    26  *
       
    27  */
       
    28 
       
    29 #ifndef DEGL_H_
       
    30 #define DEGL_H_
       
    31 
       
    32 #include "common.h"
       
    33 
       
    34 #ifdef __cplusplus
       
    35 
       
    36 #include "GLES2Interface.h"
       
    37 
       
    38 #include <set>
       
    39 
       
    40 extern "C"
       
    41 {
       
    42 #endif /* __cplusplus */
       
    43 
       
    44 struct DGLContext;
       
    45 
       
    46 void* deglGetHostProcAddress(char const* proc);
       
    47 struct DGLContext* deglGetCurrentContext(void);
       
    48 int deglLockSurface(int read, int draw);
       
    49 int deglUnlockSurface(void);
       
    50 void deglGetImageInfo(GLeglImageOES image, GLenum* internalformat, GLsizei* width, GLsizei* height, GLsizei* stride, GLenum* dataformat, GLenum* datatype);
       
    51 void* deglGetImageData(GLeglImageOES image);
       
    52 void deglRegisterImageTarget(GLeglImageOES image, GLenum target, GLuint name);
       
    53 void deglUnregisterImageTarget(GLeglImageOES image, GLenum target, GLuint name);
       
    54 void deglUpdateImageSiblings(GLeglImageOES image, GLenum target, GLuint name);
       
    55 void deglReleaseTexImage(void* surface, int name, int level);
       
    56 
       
    57 #ifdef __cplusplus
       
    58 DGLES2_EXPORT IEGLtoGLES2Interface* getGLES2Interface(void);
       
    59 }
       
    60 
       
    61 class EGLtoGLES2Interface : public IEGLtoGLES2Interface
       
    62 {
       
    63 public:
       
    64     EGLtoGLES2Interface();
       
    65 
       
    66 	void SetEGLInterface( IGLEStoEGLInterface* );
       
    67 	void* CreateContext( void* nativeContext );
       
    68 	bool ReleaseContext( void* context );
       
    69 	void* GetNativeContext( void* context );
       
    70 	fpGLProc GetGLProcAddress( const char *procname );
       
    71 	int BindTexImage( void* surface, int level, bool generateMipmap, const SurfaceDescriptor* desc, void* buffer );
       
    72 	bool ReleaseTexImage( int name, int level );
       
    73     EStatus GetTextureInfo( void* context, EImageTarget target, void* texture, GLint textureLevel, SurfaceDescriptor& desc );
       
    74     EStatus GetTextureData( void* context, EImageTarget target, void* texture, GLint textureLevel, void* data );
       
    75     bool CopyBuffers( void* buf, const SurfaceDescriptor* desc );
       
    76     bool UpdateBuffers( void* buf, const SurfaceDescriptor* desc );
       
    77 	bool UpdateImageSibling( EImageTarget target, void* name );
       
    78     void Flush();
       
    79     void Finish();
       
    80 
       
    81 	// Methods for local OpenGL ES -implementation. To be called only from OpenGL ES internals.
       
    82     static IGLEStoEGLInterface* GetEGLInterface();
       
    83 
       
    84 private:
       
    85     IGLEStoEGLInterface* m_egl;
       
    86 	std::set<DGLContext*> m_contexts;
       
    87 };
       
    88 
       
    89 #endif /* __cplusplus */
       
    90 
       
    91 #endif /* DEGL_H */