diff options
Diffstat (limited to 'es_1_1')
-rwxr-xr-x | es_1_1/60get.c | 3 | ||||
-rw-r--r-- | es_1_1/81framebuffer.c | 343 | ||||
-rw-r--r-- | es_1_1/EGLImage.c | 33 | ||||
-rwxr-xr-x | es_1_1/funcaction.inl | 14 | ||||
-rwxr-xr-x | es_1_1/gl_context.h | 15 | ||||
-rwxr-xr-x | es_1_1/makefile-dynamic | 10 |
6 files changed, 416 insertions, 2 deletions
diff --git a/es_1_1/60get.c b/es_1_1/60get.c index fba2f28..3e5b05f 100755 --- a/es_1_1/60get.c +++ b/es_1_1/60get.c @@ -203,6 +203,9 @@ GL_API const GLubyte* GL_APIENTRY EXTFN(GetString)(GLenum name) { #if defined(PROVIDING_OES_element_index_uint) "GL_OES_element_index_uint " #endif +#if defined(PROVIDING_OES_framebuffer_object) + "GL_OES_framebuffer_object " +#endif ""; break; default: diff --git a/es_1_1/81framebuffer.c b/es_1_1/81framebuffer.c new file mode 100644 index 0000000..1882f91 --- /dev/null +++ b/es_1_1/81framebuffer.c @@ -0,0 +1,343 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * SangJin Kim <sangjin3.kim@samsung.com> + * YeongKyoon Lee <yeongkyoon.lee@samsung.com> + * HyunGoo Kang <hyungoo1.kang@samsung.com> + * DongKyun Yun + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#include "gl_imp.h" +#include <GLES/glext.h> + + +GL_API void GL_APIENTRY EXTFN(GenFramebuffersOES)(GLsizei n, GLuint* framebuffers) { + if (n < 0) { + INTFN(SetError)(GL_INVALID_VALUE); + return; + } else if (n == 0) { + return; + } + FNPTR(GenFramebuffers)(n, framebuffers); +} + +GL_API void GL_APIENTRY EXTFN(GenRenderbuffersOES)(GLsizei n, GLuint* renderbuffers) { + if (n < 0) { + INTFN(SetError)(GL_INVALID_VALUE); + return; + } else if (n == 0) { + return; + } + FNPTR(GenRenderbuffers)(n, renderbuffers); +} + +GL_API void GL_APIENTRY EXTFN(DeleteFramebuffersOES)(GLsizei n, const GLuint* framebuffers) { + if (n < 0) { + INTFN(SetError)(GL_INVALID_VALUE); + return; + } + + FNPTR(DeleteFramebuffers)(n, framebuffers); +} + +GL_API void GL_APIENTRY EXTFN(DeleteRenderbuffersOES)(GLsizei n, const GLuint* renderbuffers) { + if (n < 0) { + INTFN(SetError)(GL_INVALID_VALUE); + return; + } + FNPTR(DeleteRenderbuffers)(n, renderbuffers); +} + +GL_API GLboolean GL_APIENTRY EXTFN(IsFramebufferOES)(GLuint framebuffer) { + register GLboolean bAnswer; + bAnswer = FNPTR(IsFramebuffer)(framebuffer); + return bAnswer; +} + +GL_API GLboolean GL_APIENTRY EXTFN(IsRenderbufferOES)(GLuint renderbuffer) { + register GLboolean bAnswer; + bAnswer = FNPTR(IsRenderbuffer)(renderbuffer); + return bAnswer; +} + +GL_API void GL_APIENTRY EXTFN(BindFramebufferOES)(GLenum target, GLuint framebuffer) { + if (target != GL_FRAMEBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + FNPTR(BindFramebuffer)(target, framebuffer); +} + +GL_API void GL_APIENTRY EXTFN(BindRenderbufferOES)(GLenum target, GLuint renderbuffer) { + if (target != GL_RENDERBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + FNPTR(BindRenderbuffer)(target, renderbuffer); +} + +GL_API void GL_APIENTRY EXTFN(RenderbufferStorageOES)(GLenum target, + GLenum internalformat, GLsizei width, GLsizei height) { + int iMaxSize; + GLuint uRenderBuffer; + if (target != GL_RENDERBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + switch (internalformat) { + default: +#if defined(PROVIDING_OES_packed_depth_stencil) + case GL_DEPTH24_STENCIL8_OES: +#endif + case GL_DEPTH_STENCIL_OES: + INTFN(SetError)(GL_INVALID_ENUM); + return; +#if defined(PROVIDING_OES_rgb8_rgba8) + case GL_RGB8_OES: + case GL_RGBA8_OES: +#endif + case GL_RGBA4_OES: + case GL_RGB5_A1_OES: + case GL_DEPTH_COMPONENT16_OES: + case GL_DEPTH_COMPONENT24_OES: + case GL_DEPTH_COMPONENT32_OES: + case GL_STENCIL_INDEX1_OES: + case GL_STENCIL_INDEX4_OES: + case GL_STENCIL_INDEX8_OES: + break; + case GL_RGB565_OES: + internalformat = GL_RGB5_A1_OES; + break; + } + FNPTR(GetIntegerv)(GL_MAX_RENDERBUFFER_SIZE_OES, &iMaxSize); + if (width < 0 || iMaxSize < width || height < 0 || iMaxSize < height) { + INTFN(SetError)(GL_INVALID_VALUE); + return; + } + FNPTR(GetIntegerv)(GL_RENDERBUFFER_BINDING_OES, &uRenderBuffer); + if (uRenderBuffer == 0) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + FNPTR(RenderbufferStorage)(target, internalformat, width, height); +} + +GL_API void GL_APIENTRY EXTFN(GetRenderbufferParameterivOES)(GLenum target, GLenum pname, GLint* params) { + GLuint uRenderBuffer; + if (target != GL_RENDERBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + switch (pname) { + default: + INTFN(SetError)(GL_INVALID_ENUM); + return; + case GL_RENDERBUFFER_WIDTH_OES: + case GL_RENDERBUFFER_HEIGHT_OES: + case GL_RENDERBUFFER_INTERNAL_FORMAT_OES: + case GL_RENDERBUFFER_RED_SIZE_OES: + case GL_RENDERBUFFER_GREEN_SIZE_OES: + case GL_RENDERBUFFER_BLUE_SIZE_OES: + case GL_RENDERBUFFER_ALPHA_SIZE_OES: + case GL_RENDERBUFFER_DEPTH_SIZE_OES: + case GL_RENDERBUFFER_STENCIL_SIZE_OES: + break; + } + FNPTR(GetIntegerv)(GL_RENDERBUFFER_BINDING_OES, &uRenderBuffer); + if (uRenderBuffer == 0) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + FNPTR(GetRenderbufferParameteriv)(target, pname, params); +} + +GL_API void GL_APIENTRY EXTFN(FramebufferRenderbufferOES)(GLenum target, GLenum attachment, + GLenum renderbuffertarget, GLuint renderbuffer) { + GLuint uBuffer; + if (target != GL_FRAMEBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + FNPTR(GetIntegerv)(GL_FRAMEBUFFER_BINDING_OES, &uBuffer); + if (uBuffer == 0) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + if (renderbuffertarget != GL_RENDERBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + if (renderbuffer != 0 && FNPTR(IsRenderbuffer)(renderbuffer) == GL_FALSE) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + switch (attachment) { + default: + INTFN(SetError)(GL_INVALID_ENUM); + return; + case GL_COLOR_ATTACHMENT0_OES: + case GL_DEPTH_ATTACHMENT_OES: + case GL_STENCIL_ATTACHMENT_OES: + break; + } + FNPTR(FramebufferRenderbuffer)(target, attachment, renderbuffertarget, renderbuffer); +} + +GL_API void GL_APIENTRY EXTFN(FramebufferTexture2DOES)(GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, GLint level) { + GLuint uBuffer; + if (target != GL_FRAMEBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + FNPTR(GetIntegerv)(GL_FRAMEBUFFER_BINDING_OES, &uBuffer); + if (uBuffer == 0) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + switch (attachment) { + default: + INTFN(SetError)(GL_INVALID_ENUM); + return; + case GL_COLOR_ATTACHMENT0_OES: + case GL_DEPTH_ATTACHMENT_OES: + case GL_STENCIL_ATTACHMENT_OES: + break; + } + if (texture == 0) { + FNPTR(FramebufferTexture2D)(target, attachment, textarget, texture, level); + return; + } + if (FNPTR(IsTexture)(texture) == GL_FALSE) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + if (level != 0) { + INTFN(SetError)(GL_INVALID_VALUE); + return; + } + // disable GenMipmap which caused driver crash on Ubuntu with Intel graphic card. +#if 0 + switch (textarget) { + default: + INTFN(SetError)(GL_INVALID_ENUM); + return; + case GL_TEXTURE_2D: + FNPTR(GenerateMipmap)(GL_TEXTURE_2D); + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + FNPTR(GenerateMipmap)(GL_TEXTURE_CUBE_MAP); + break; + } +#endif + FNPTR(FramebufferTexture2D)(target, attachment, textarget, texture, level); +} + +GL_API void GL_APIENTRY EXTFN(GetFramebufferAttachmentParameterivOES)(GLenum target, + GLenum attachment, GLenum pname, GLint* params) { + GLuint uBuffer; + if (target != GL_FRAMEBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + return; + } + FNPTR(GetIntegerv)(GL_FRAMEBUFFER_BINDING_OES, &uBuffer); + if (uBuffer == 0) { + INTFN(SetError)(GL_INVALID_OPERATION); + return; + } + switch (attachment) { + default: + INTFN(SetError)(GL_INVALID_ENUM); + return; + case GL_COLOR_ATTACHMENT0_OES: + case GL_DEPTH_ATTACHMENT_OES: + case GL_STENCIL_ATTACHMENT_OES: + break; + } + switch (pname) { + default: + INTFN(SetError)(GL_INVALID_ENUM); + return; + case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES: + case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES: + case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES: + case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES: + break; + } + FNPTR(GetFramebufferAttachmentParameteriv)(target, attachment, pname, params); +} + +#if ! defined(GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT_OES) +#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT_OES 0x8CD8 +#endif +#if ! defined(GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES) +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES 0x8CDB +#endif +#if ! defined(GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES) +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES 0x8CDC +#endif +#if ! defined(GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT_OES) +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT_OES 0x8CDA +#endif +#if ! defined(GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_OES) +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_OES 0x8D56 +#endif + +GL_API GLenum GL_APIENTRY EXTFN(CheckFramebufferStatusOES)(GLenum target) { + register GLenum eValue; + if (target != GL_FRAMEBUFFER_OES) { + INTFN(SetError)(GL_INVALID_ENUM); + } + eValue = FNPTR(CheckFramebufferStatus)(target); + switch (eValue) { + default: + case GL_FRAMEBUFFER_COMPLETE_OES: + case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES: + case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES: + case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES: + case GL_FRAMEBUFFER_UNSUPPORTED_OES: + break; + case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT_OES: + case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES: + case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES: + eValue = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES; + break; + case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT_OES: + case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_OES: + eValue = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES; + break; + case 0: + eValue = GL_FRAMEBUFFER_UNSUPPORTED_OES; + break; + } + return (eValue == 0) ? GL_FRAMEBUFFER_UNSUPPORTED_OES : eValue; +} + diff --git a/es_1_1/EGLImage.c b/es_1_1/EGLImage.c index cadb554..e628583 100644 --- a/es_1_1/EGLImage.c +++ b/es_1_1/EGLImage.c @@ -1,3 +1,36 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Edwin Zhai <edwin.zhai@intel.com> + * SangJin Kim <sangjin3.kim@samsung.com> + * Yeongkyoon Lee <yeongkyoon.lee@samsung.com> + * HyunGoo Kang <hyungoo1.kang@samsung.com> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Contributors: + * - Intel Corporation + * - S-Core Co., Ltd + * + */ + /* * EGLImage.c * diff --git a/es_1_1/funcaction.inl b/es_1_1/funcaction.inl index 4ecc24a..1762086 100755 --- a/es_1_1/funcaction.inl +++ b/es_1_1/funcaction.inl @@ -106,3 +106,17 @@ ACTION( GetTexGeniv ); ACTION( GetTexGenfv ); #endif + ACTION( GenFramebuffers ); + ACTION( GenRenderbuffers ); + ACTION( DeleteFramebuffers ); + ACTION( DeleteRenderbuffers ); + ACTION( IsFramebuffer ); + ACTION( IsRenderbuffer ); + ACTION( BindFramebuffer ); + ACTION( BindRenderbuffer ); + ACTION( RenderbufferStorage ); + ACTION( GetRenderbufferParameteriv ); + ACTION( FramebufferRenderbuffer ); + ACTION( FramebufferTexture2D ); + ACTION( GetFramebufferAttachmentParameteriv ); + ACTION( CheckFramebufferStatus ); diff --git a/es_1_1/gl_context.h b/es_1_1/gl_context.h index 604190a..4eaabca 100755 --- a/es_1_1/gl_context.h +++ b/es_1_1/gl_context.h @@ -207,6 +207,21 @@ struct AGContext { void (*fpGetTexGeniv)(GLenum, GLenum, GLint*); void (*fpGetTexGenfv)(GLenum, GLenum, GLfloat*); #endif + void (*fpGenFramebuffers)(GLsizei n, GLuint* framebuffers); + void (*fpGenRenderbuffers)(GLsizei n, GLuint* renderbuffers); + void (*fpDeleteFramebuffers)(GLsizei n, const GLuint* framebuffers); + void (*fpDeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers); + GLboolean (*fpIsFramebuffer)(GLuint framebuffer); + GLboolean (*fpIsRenderbuffer)(GLuint renderbuffer); + void (*fpBindFramebuffer)(GLenum target, GLuint framebuffer); + void (*fpBindRenderbuffer)(GLenum target, GLuint renderbuffer); + void (*fpRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); + void (*fpGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params); + void (*fpFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); + void (*fpFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); + void (*fpGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params); + GLenum (*fpCheckFramebufferStatus)(GLenum target); + }; diff --git a/es_1_1/makefile-dynamic b/es_1_1/makefile-dynamic index de5adb6..488e66e 100755 --- a/es_1_1/makefile-dynamic +++ b/es_1_1/makefile-dynamic @@ -17,11 +17,15 @@ CFLAGS += -DPROVIDING_OES_texture_cube_map CFLAGS += -DPROVIDING_OES_texture_env_crossbar CFLAGS += -DPROVIDING_OES_texture_mirrored_repeat CFLAGS += -DPROVIDING_OES_element_index_uint +CFLAGS += -DPROVIDING_OES_framebuffer_object # never CFLAGS += -DPROVIDING_OES_texture_3D # only for ES 2.0 # never CFLAGS += -DPROVIDING_OES_texture_npot # only for ES 2.0 LIBBASE = libGLESv1_CM.so -LIBVER = 1.0 +LIBMAJOR = 1 +LIBMINOR = 0 +LIBVER = $(LIBMAJOR).$(LIBMINOR) +LIBSONAME = $(LIBBASE).$(LIBMAJOR) LIB = $(LIBBASE).$(LIBVER) END = @@ -49,6 +53,7 @@ SRCS = \ 50flush.c \ 60get.c \ 80ext.c \ + 81framebuffer.c \ gl_real.c \ gl_context.c \ EGLImage.c \ @@ -63,10 +68,11 @@ __touch__: touch 60get.c $(LIB): $(OBJS) - $(CC) -shared -Wl,-soname,$(LIBBASE).1 -o $@ $(OBJS) -ldl + $(CC) -shared -Wl,-soname,$(LIBSONAME) -o $@ $(OBJS) -ldl install: $(LIB) cp $(LIB) ../lib/host-gl/ + ln -s $(LIB) ../lib/host-gl/$(LIBSONAME) # supports |