hostsupport/hostopengles11/inc/glesInternal.h
author Matt Plumtree <matt.plumtree@nokia.com>
Tue, 26 Oct 2010 14:14:43 +0100
branchbug235_bringup_0
changeset 68 8d4efe9fa1cf
parent 67 ca7e6949bf7a
permissions -rw-r--r--
Add a new FLM for building the host side DLLs (based on the x86build FLM). Fixup the OpenGL ES 1.1 code to remove warnings when built with GCC(some remain).
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
#ifndef _GLINTERNAL_H_
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    32
#define _GLINTERNAL_H_
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    33
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    34
#include "glesOS.h"
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    35
#include <GLES/gl.h>
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    36
#include <new>
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    37
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    38
#define X_TO_D(x) ((x) / 65536.0)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    39
#define X_TO_F(x) ((x) / 65536.0f)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    40
#define D_TO_X(d) ((d) > 32767.65535 ? 32767 * 65536 + 65535 : \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    41
                   (d) < -32768.65535 ? -32768 * 65536 + 65535 : \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    42
                   ((GLfixed) ((d) * 65536)))
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    43
#define F_TO_X(f) D_TO_X(f)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    44
#define F_TO_D(f) ((double) (f))
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    45
#define I_TO_X(i) ((GLfixed) ((i) * 65536))
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    46
#define X_TO_I(x) ((x) / 65536)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    47
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    48
#include <assert.h>
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    49
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    50
#if defined(_DEBUG)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    51
#define GLES_ASSERT assert
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    52
#else // defined(_DEBUG)
68
8d4efe9fa1cf Add a new FLM for building the host side DLLs (based on the x86build FLM).
Matt Plumtree <matt.plumtree@nokia.com>
parents: 67
diff changeset
    53
#define GLES_ASSERT (void)
53
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    54
#endif // !defined(_DEBUG)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    55
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    56
#define GLES_NEW new(std::nothrow)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    57
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    58
// Types not in OpenGL ES
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    59
typedef double GLdouble;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    60
typedef double GLclampd;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    61
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    62
// Definitions not in OpenGL ES
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    63
#define GL_POINT_SIZE_ARRAY 			0x8B9C
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    64
#define GL_POINT_SPRITE					0x8861
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    65
#define GL_COORD_REPLACE				0x8862
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    66
#define GL_BGR              			0x80E0
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    67
#define GL_BGRA             			0x80E1
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    68
#define GL_RGB8             			0x8051
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    69
#define GL_RGBA8            			0x8058
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    70
#ifndef GLES_NO_SRGB
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    71
#define GL_SRGB8						0x8C41
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    72
#define GL_SRGB8_ALPHA8					0x8C43
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    73
#define GL_SLUMINANCE8					0x8C47
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    74
#else
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    75
// No sRGB support in OpenGL 2.0.
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    76
#define GL_SRGB8						GL_RGB8
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    77
#define GL_SRGB8_ALPHA8					GL_RGBA8
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    78
#define GL_SLUMINANCE8					GL_LUMINANCE8
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    79
#endif
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    80
#define GL_LUMINANCE8					0x8040
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    81
#define GL_ALPHA8						0x803C
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    82
#define GL_UNSIGNED_INT_8_8_8_8_REV		0x8367
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    83
#define GL_UNSIGNED_SHORT_1_5_5_5_REV   0x8366
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    84
#define GL_UNSIGNED_SHORT_4_4_4_4_REV   0x8365
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
#define GLES_API_CALL GL_API
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    87
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    88
#define GLES_MIN(A, B) (A < B ? A : B)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    89
#define GLES_MAX(A, B) (A > B ? A : B)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    90
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    91
#define GLES_NO_RETVAL ;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    92
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    93
// Surface locking
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    94
#define GLES_LOCK_SURFACE_RET(READ, DRAW, RETVAL) \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    95
	do \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    96
	{ \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    97
		if(!EGLtoGLESInterface::GetEGLInterface()->LockGLESSurface(READ, DRAW)) \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    98
		{ \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    99
			GLES_LEAVE_NO_ERROR_CHECK_RET(RETVAL); \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   100
		} \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   101
	} while(0)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   102
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   103
#define GLES_LOCK_SURFACE(READ, DRAW) GLES_LOCK_SURFACE_RET(READ, DRAW, GLES_NO_RETVAL)
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
#define GLES_LOCK_DRAW_SURFACE_RET(RETVAL) GLES_LOCK_SURFACE_RET(false, true, RETVAL)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   106
#define GLES_LOCK_READ_SURFACE_RET(RETVAL) GLES_LOCK_SURFACE_RET(true, false, RETVAL)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   107
#define GLES_LOCK_DRAW_SURFACE() GLES_LOCK_SURFACE_RET(false, true, GLES_NO_RETVAL)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   108
#define GLES_LOCK_READ_SURFACE() GLES_LOCK_SURFACE_RET(true, false, GLES_NO_RETVAL)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   109
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   110
#define GLES_UNLOCK_SURFACE_RET(RETVAL) \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   111
	do \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   112
	{ \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   113
		if(!EGLtoGLESInterface::GetEGLInterface()->UnlockGLESSurface()) \
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
			GLES_LEAVE_RET(RETVAL); \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   116
		} \
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   117
	} while(0)
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
#define GLES_UNLOCK_SURFACE() GLES_UNLOCK_SURFACE_RET(GLES_NO_RETVAL)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   120
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   121
inline bool glesIsPowerOfTwo(int x)
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
	return (x != 0) && ((x & (x - 1)) == 0);
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
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   126
inline int glesLog2(unsigned int x)
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
	int r = 0;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   129
	while(x >>= 1)
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   130
	{
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   131
		r++;
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
	return r;
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   134
}
c2ef9095503a Copy code from the holdingarea into the target locations.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   135
67
ca7e6949bf7a Add hostegl bld.inf info for building exporting and building the library.
Matt Plumtree <matt.plumtree@nokia.com>
parents: 53
diff changeset
   136
#endif // _GLINTERNAL_H_