hostsupport/hostopengles20/src/GLES2/fbo.c
author Matt Plumtree <matt.plumtree@nokia.com>
Wed, 06 Oct 2010 17:59:01 +0100
branchbug235_bringup_0
changeset 53 c2ef9095503a
parent 20 holdingarea/libGLESv2/src/GLES2/fbo.c@d2d6724aef32
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:
20
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     1
/* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     2
 *
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     3
 * Permission is hereby granted, free of charge, to any person obtaining a
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     4
 * copy of this software and associated documentation files (the "Software"),
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     5
 * to deal in the Software without restriction, including without limitation
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     6
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     7
 * and/or sell copies of the Software, and to permit persons to whom the
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     8
 * Software is furnished to do so, subject to the following conditions:
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
     9
 *
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    10
 * The above copyright notice and this permission notice shall be included
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    11
 * in all copies or substantial portions of the Software.
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    12
 *
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    13
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    14
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    15
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    16
 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    17
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    18
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    19
 *
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    20
 * Initial Contributors:
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    21
 * Nokia Corporation - initial contribution.
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    22
 *
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    23
 * Contributors:
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    24
 *
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    25
 * Description:
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    26
 *
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    27
 */
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    28
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    29
#include "common.h"
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    30
#include "hgl.h"
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    31
#include "context.h"
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    32
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    33
DGLRenderbuffer* DGLRenderbuffer_create(GLuint name)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    34
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    35
	DGLRenderbuffer* buffer = malloc(sizeof(DGLRenderbuffer));
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    36
	if(buffer == NULL)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    37
	{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    38
		return NULL;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    39
	}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    40
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    41
	buffer->obj.name = name;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    42
	buffer->obj.next = NULL;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    43
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    44
	buffer->egl_image = NULL;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    45
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    46
	return buffer;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    47
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    48
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    49
void DGLRenderbuffer_destroy(DGLRenderbuffer *buffer)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    50
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    51
	DGLES2_ASSERT(buffer != NULL);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    52
	if(buffer->egl_image != NULL)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    53
	{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    54
		deglUnregisterImageTarget(buffer->egl_image, GL_RENDERBUFFER, buffer->obj.name);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    55
		buffer->egl_image = NULL;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    56
	}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    57
	free(buffer);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    58
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    59
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    60
GL_APICALL_BUILD void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    61
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    62
	DGLES2_ENTER();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    63
	DGLContext_getHostError(ctx);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    64
	ctx->hgl.BindFramebufferEXT(target, framebuffer);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    65
	if(DGLContext_getHostError(ctx) == GL_NO_ERROR)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    66
	{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    67
		ctx->framebuffer_binding = framebuffer;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    68
	}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    69
	DGLES2_LEAVE();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    70
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    71
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    72
GL_APICALL_BUILD void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    73
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    74
	DGLES2_ENTER();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    75
	DGLContext_getHostError(ctx);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    76
	ctx->hgl.BindRenderbufferEXT(target, renderbuffer);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    77
	if(DGLContext_getHostError(ctx) == GL_NO_ERROR)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    78
	{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    79
		if(!DGLContext_bindRenderbuffer(ctx, renderbuffer))
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    80
		{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    81
			DGLES2_ERROR(GL_OUT_OF_MEMORY);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    82
		}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    83
	}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    84
	DGLES2_LEAVE_NO_ERROR_CHECK();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    85
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    86
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    87
GL_APICALL_BUILD GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    88
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    89
	DGLES2_ENTER_RET(GL_FALSE);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    90
	DGLES2_LEAVE_RET(ctx->hgl.CheckFramebufferStatusEXT(target));
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    91
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    92
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    93
GL_APICALL_BUILD void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    94
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    95
	DGLES2_ENTER();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    96
	DGLContext_getHostError(ctx);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    97
	ctx->hgl.DeleteFramebuffersEXT(n, framebuffers);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    98
	if(DGLContext_getHostError(ctx) == GL_NO_ERROR)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
    99
	{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   100
		// Unbind framebuffer when deleted.
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   101
		int i;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   102
		for(i = 0; i < n; i++)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   103
		{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   104
			if(ctx->framebuffer_binding == framebuffers[i])
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   105
			{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   106
				ctx->framebuffer_binding = 0;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   107
				break;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   108
			}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   109
		}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   110
	}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   111
	DGLES2_LEAVE_NO_ERROR_CHECK();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   112
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   113
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   114
GL_APICALL_BUILD void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   115
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   116
	DGLES2_ENTER();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   117
	DGLContext_getHostError(ctx);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   118
	ctx->hgl.DeleteRenderbuffersEXT(n, renderbuffers);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   119
	if(DGLContext_getHostError(ctx) == GL_NO_ERROR)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   120
	{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   121
		int i;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   122
		for(i = 0; i < n; i++)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   123
		{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   124
			DGLContext_destroyRenderbuffer(ctx, renderbuffers[n]);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   125
		}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   126
	}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   127
	DGLES2_LEAVE();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   128
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   129
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   130
GL_APICALL_BUILD void GL_APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   131
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   132
	DGLES2_ENTER();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   133
	DGLES2_ERROR_IF(attachment != GL_COLOR_ATTACHMENT0 &&
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   134
					attachment != GL_DEPTH_ATTACHMENT &&
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   135
					attachment != GL_STENCIL_ATTACHMENT,
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   136
					GL_INVALID_ENUM);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   137
	ctx->hgl.FramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   138
	DGLES2_LEAVE();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   139
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   140
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   141
GL_APICALL_BUILD void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   142
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   143
	DGLES2_ENTER();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   144
	DGLES2_ERROR_IF(attachment != GL_COLOR_ATTACHMENT0 &&
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   145
					attachment != GL_DEPTH_ATTACHMENT &&
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   146
					attachment != GL_STENCIL_ATTACHMENT,
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   147
					GL_INVALID_ENUM);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   148
	ctx->hgl.FramebufferTexture2DEXT(target, attachment, textarget, texture, level);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   149
	DGLES2_LEAVE();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   150
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   151
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   152
GL_APICALL_BUILD void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   153
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   154
	DGLES2_ENTER();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   155
	ctx->hgl.GenFramebuffersEXT(n, framebuffers);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   156
	DGLES2_LEAVE();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   157
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   158
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   159
GL_APICALL_BUILD void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   160
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   161
	DGLES2_ENTER();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   162
	ctx->hgl.GenRenderbuffersEXT(n, renderbuffers);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   163
	DGLES2_LEAVE();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   164
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   165
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   166
GL_APICALL_BUILD void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   167
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   168
	DGLES2_ENTER();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   169
	DGLES2_ERROR_IF(attachment != GL_COLOR_ATTACHMENT0 &&
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   170
					attachment != GL_DEPTH_ATTACHMENT &&
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   171
					attachment != GL_STENCIL_ATTACHMENT,
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   172
					GL_INVALID_ENUM);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   173
	DGLES2_ERROR_IF(pname != GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE &&
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   174
					pname != GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME &&
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   175
					pname != GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL &&
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   176
					pname != GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE,
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   177
					GL_INVALID_ENUM);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   178
	ctx->hgl.GetFramebufferAttachmentParameterivEXT(target, attachment, pname, params);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   179
	DGLES2_LEAVE();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   180
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   181
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   182
GL_APICALL_BUILD void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   183
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   184
	DGLES2_ENTER();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   185
	ctx->hgl.GetRenderbufferParameterivEXT(target, pname, params);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   186
	DGLES2_LEAVE();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   187
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   188
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   189
GL_APICALL_BUILD GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   190
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   191
	DGLES2_ENTER_RET(GL_FALSE);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   192
	ctx->hgl.IsFramebufferEXT(framebuffer);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   193
	DGLES2_LEAVE_RET(GL_FALSE);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   194
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   195
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   196
GL_APICALL_BUILD GLboolean    GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   197
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   198
	DGLES2_ENTER_RET(GL_FALSE);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   199
	ctx->hgl.IsRenderbufferEXT(renderbuffer);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   200
	DGLES2_LEAVE_RET(GL_FALSE);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   201
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   202
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   203
GL_APICALL_BUILD void GL_APIENTRY glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   204
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   205
	DGLES2_ENTER();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   206
	
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   207
	switch(internalformat)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   208
	{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   209
		case GL_DEPTH_COMPONENT16:
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   210
		case GL_RGBA4:
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   211
		case GL_RGB5_A1:
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   212
		case GL_STENCIL_INDEX8:
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   213
			break;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   214
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   215
		case GL_RGB565:	// RGB565 is not supported in desktop GL.
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   216
			internalformat = GL_RGB8;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   217
			break;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   218
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   219
		case GL_DEPTH_COMPONENT24_OES: // extension GL_OES_depth24
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   220
			internalformat = GL_DEPTH_COMPONENT24;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   221
			break;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   222
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   223
		case GL_DEPTH_COMPONENT32_OES: // extension GL_OES_depth32
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   224
			internalformat = GL_DEPTH_COMPONENT32;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   225
			break;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   226
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   227
		case GL_RGB8_OES: // extension GL_OES_rgb8_rgba8
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   228
			internalformat = GL_RGB8;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   229
			break;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   230
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   231
		case GL_RGBA8_OES: // extension GL_OES_rgb8_rgba8
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   232
			internalformat = GL_RGBA8;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   233
			break;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   234
	}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   235
	
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   236
	DGLContext_getHostError(ctx);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   237
	ctx->hgl.RenderbufferStorageEXT(target, internalformat, width, height);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   238
	if(DGLContext_getHostError(ctx) == GL_NO_ERROR)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   239
	{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   240
		DGLRenderbuffer* buffer = DGLContext_findRenderbuffer(ctx, ctx->renderbuffer_binding);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   241
		DGLES2_ASSERT(buffer != NULL);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   242
		if(buffer->egl_image != NULL)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   243
		{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   244
			// Renderbuffer is respecified. It is no longer an EGLImage sibling.
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   245
			deglUnregisterImageTarget(buffer->egl_image, GL_RENDERBUFFER, buffer->obj.name);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   246
			buffer->egl_image = NULL;
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   247
		}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   248
	}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   249
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   250
	DGLES2_LEAVE_NO_ERROR_CHECK();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   251
}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   252
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   253
GL_APICALL_BUILD void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   254
{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   255
	DGLES2_ENTER();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   256
	DGLES2_ERROR_IF(target != GL_RENDERBUFFER, GL_INVALID_ENUM);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   257
	DGLES2_ERROR_IF(image == NULL, GL_INVALID_OPERATION);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   258
	DGLContext_getHostError(ctx);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   259
	if(!DGLContext_specifyRenderbufferFromEGLImage(ctx, image))
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   260
	{
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   261
		DGLES2_ERROR(GL_INVALID_OPERATION);
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   262
	}
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   263
	DGLES2_LEAVE_NO_ERROR_CHECK();
d2d6724aef32 Initial contribution of Khronos API implmentations suitable for simulator host-side.
Matt Plumtree <matt.plumtree@nokia.com>
parents:
diff changeset
   264
}