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