diff options
author | Kim Kibum <kb0929.kim@samsung.com> | 2012-04-29 17:05:54 +0900 |
---|---|---|
committer | Kim Kibum <kb0929.kim@samsung.com> | 2012-04-29 17:05:54 +0900 |
commit | af0ee32ff16f50fd25229151af7b4a9a6753ebe5 (patch) | |
tree | 23879e4123b40df9f773d4775dd64eefd914f4fe /es_2_0/Fragment.c | |
parent | 90dff65a3ccb36853763486671163ca81274b677 (diff) | |
download | simulator-opengl-af0ee32ff16f50fd25229151af7b4a9a6753ebe5.tar.gz simulator-opengl-af0ee32ff16f50fd25229151af7b4a9a6753ebe5.tar.bz2 simulator-opengl-af0ee32ff16f50fd25229151af7b4a9a6753ebe5.zip |
upload tizen1.0 source
Diffstat (limited to 'es_2_0/Fragment.c')
-rwxr-xr-x | es_2_0/Fragment.c | 419 |
1 files changed, 419 insertions, 0 deletions
diff --git a/es_2_0/Fragment.c b/es_2_0/Fragment.c new file mode 100755 index 0000000..37650d1 --- /dev/null +++ b/es_2_0/Fragment.c @@ -0,0 +1,419 @@ +/* + * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * DongKyun Yun <dk77.yun@samsung.com> + * SangJin Kim <sangjin3.kim@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: + * - S-Core Co., Ltd + * + */ + +#include "es2front.h" + + +void GL_APIENTRY ES2ENTRY(Scissor)(GLint x, GLint y, GLsizei width, GLsizei height) { + if (width < 0 || height < 0) { + ES2INTER(SetError)(GL_INVALID_VALUE); + return; + } + FNPTR(Scissor)(x, y, width, height); +} + +void GL_APIENTRY ES2ENTRY(StencilFunc)(GLenum func, GLint ref, GLuint mask) { + switch (func) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_NEVER: + case GL_LESS: + case GL_LEQUAL: + case GL_GREATER: + case GL_GEQUAL: + case GL_EQUAL: + case GL_NOTEQUAL: + case GL_ALWAYS: + break; + } + FNPTR(StencilFunc)(func, ref, mask); +} + +void GL_APIENTRY ES2ENTRY(StencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask) { + switch (face) { + default: + ES2INTER(SetError)(GL_INVALID_VALUE); + return; + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + } + switch (func) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_NEVER: + case GL_LESS: + case GL_LEQUAL: + case GL_GREATER: + case GL_GEQUAL: + case GL_EQUAL: + case GL_NOTEQUAL: + case GL_ALWAYS: + break; + } + FNPTR(StencilFuncSeparate)(face, func, ref, mask); +} + +void GL_APIENTRY ES2ENTRY(StencilOp)(GLenum fail, GLenum zfail, GLenum zpass) { + switch (fail) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ZERO: + case GL_KEEP: + case GL_REPLACE: + case GL_INCR: + case GL_INCR_WRAP: + case GL_DECR: + case GL_DECR_WRAP: + case GL_INVERT: + break; + } + switch (zfail) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ZERO: + case GL_KEEP: + case GL_REPLACE: + case GL_INCR: + case GL_INCR_WRAP: + case GL_DECR: + case GL_DECR_WRAP: + case GL_INVERT: + break; + } + switch (zpass) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ZERO: + case GL_KEEP: + case GL_REPLACE: + case GL_INCR: + case GL_INCR_WRAP: + case GL_DECR: + case GL_DECR_WRAP: + case GL_INVERT: + break; + } + FNPTR(StencilOp)(fail, zfail, zpass); +} + +void GL_APIENTRY ES2ENTRY(StencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { + switch (face) { + default: + ES2INTER(SetError)(GL_INVALID_VALUE); + return; + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + } + switch (fail) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ZERO: + case GL_KEEP: + case GL_REPLACE: + case GL_INCR: + case GL_INCR_WRAP: + case GL_DECR: + case GL_DECR_WRAP: + case GL_INVERT: + break; + } + switch (zfail) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ZERO: + case GL_KEEP: + case GL_REPLACE: + case GL_INCR: + case GL_INCR_WRAP: + case GL_DECR: + case GL_DECR_WRAP: + case GL_INVERT: + break; + } + switch (zpass) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ZERO: + case GL_KEEP: + case GL_REPLACE: + case GL_INCR: + case GL_INCR_WRAP: + case GL_DECR: + case GL_DECR_WRAP: + case GL_INVERT: + break; + } + FNPTR(StencilOpSeparate)(face, fail, zfail, zpass); +} + +void GL_APIENTRY ES2ENTRY(DepthFunc)(GLenum func) { + switch (func) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_NEVER: + case GL_LESS: + case GL_EQUAL: + case GL_LEQUAL: + case GL_GREATER: + case GL_NOTEQUAL: + case GL_GEQUAL: + case GL_ALWAYS: + break; + } + FNPTR(DepthFunc)(func); +} + +void GL_APIENTRY ES2ENTRY(BlendFunc)(GLenum sfactor, GLenum dfactor) { + switch (sfactor) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ZERO: + case GL_ONE: + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + case GL_DST_COLOR: + case GL_ONE_MINUS_DST_COLOR: + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + case GL_DST_ALPHA: + case GL_ONE_MINUS_DST_ALPHA: + case GL_CONSTANT_COLOR: + case GL_ONE_MINUS_CONSTANT_COLOR: + case GL_CONSTANT_ALPHA: + case GL_ONE_MINUS_CONSTANT_ALPHA: + case GL_SRC_ALPHA_SATURATE: + break; + } + switch (dfactor) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ZERO: + case GL_ONE: + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + case GL_DST_COLOR: + case GL_ONE_MINUS_DST_COLOR: + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + case GL_DST_ALPHA: + case GL_ONE_MINUS_DST_ALPHA: + case GL_CONSTANT_COLOR: + case GL_ONE_MINUS_CONSTANT_COLOR: + case GL_CONSTANT_ALPHA: + case GL_ONE_MINUS_CONSTANT_ALPHA: + break; + } + FNPTR(BlendFunc)(sfactor, dfactor); +} + +void GL_APIENTRY ES2ENTRY(BlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, + GLenum srcAlpha, GLenum dstAlpha) { + switch (srcRGB) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ZERO: + case GL_ONE: + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + case GL_DST_COLOR: + case GL_ONE_MINUS_DST_COLOR: + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + case GL_DST_ALPHA: + case GL_ONE_MINUS_DST_ALPHA: + case GL_CONSTANT_COLOR: + case GL_ONE_MINUS_CONSTANT_COLOR: + case GL_CONSTANT_ALPHA: + case GL_ONE_MINUS_CONSTANT_ALPHA: + case GL_SRC_ALPHA_SATURATE: + break; + } + switch (dstRGB) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ZERO: + case GL_ONE: + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + case GL_DST_COLOR: + case GL_ONE_MINUS_DST_COLOR: + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + case GL_DST_ALPHA: + case GL_ONE_MINUS_DST_ALPHA: + case GL_CONSTANT_COLOR: + case GL_ONE_MINUS_CONSTANT_COLOR: + case GL_CONSTANT_ALPHA: + case GL_ONE_MINUS_CONSTANT_ALPHA: + break; + } + switch (srcAlpha) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ZERO: + case GL_ONE: + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + case GL_DST_COLOR: + case GL_ONE_MINUS_DST_COLOR: + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + case GL_DST_ALPHA: + case GL_ONE_MINUS_DST_ALPHA: + case GL_CONSTANT_COLOR: + case GL_ONE_MINUS_CONSTANT_COLOR: + case GL_CONSTANT_ALPHA: + case GL_ONE_MINUS_CONSTANT_ALPHA: + case GL_SRC_ALPHA_SATURATE: + break; + } + switch (dstAlpha) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ZERO: + case GL_ONE: + case GL_SRC_COLOR: + case GL_ONE_MINUS_SRC_COLOR: + case GL_DST_COLOR: + case GL_ONE_MINUS_DST_COLOR: + case GL_SRC_ALPHA: + case GL_ONE_MINUS_SRC_ALPHA: + case GL_DST_ALPHA: + case GL_ONE_MINUS_DST_ALPHA: + case GL_CONSTANT_COLOR: + case GL_ONE_MINUS_CONSTANT_COLOR: + case GL_CONSTANT_ALPHA: + case GL_ONE_MINUS_CONSTANT_ALPHA: + break; + } + FNPTR(BlendFuncSeparate)(srcRGB, dstRGB, srcAlpha, dstAlpha); +} + +void GL_APIENTRY ES2ENTRY(BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + FNPTR(BlendColor)(red, green, blue, alpha); +} + +void GL_APIENTRY ES2ENTRY(BlendEquation)(GLenum mode) { + switch (mode) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_FUNC_ADD: + case GL_FUNC_SUBTRACT: + case GL_FUNC_REVERSE_SUBTRACT: + break; + } + FNPTR(BlendEquation)(mode); +} + +void GL_APIENTRY ES2ENTRY(BlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha) { + switch (modeRGB) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_FUNC_ADD: + case GL_FUNC_SUBTRACT: + case GL_FUNC_REVERSE_SUBTRACT: + break; + } + switch (modeAlpha) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_FUNC_ADD: + case GL_FUNC_SUBTRACT: + case GL_FUNC_REVERSE_SUBTRACT: + break; + } + FNPTR(BlendEquationSeparate)(modeRGB, modeAlpha); +} + +void GL_APIENTRY ES2ENTRY(SampleCoverage)(GLclampf value, GLboolean invert) { + FNPTR(SampleCoverage)(value, invert); +} + +void GL_APIENTRY ES2ENTRY(ReadPixels)(GLint x, GLint y, + GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) { + switch (format) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ALPHA: + case GL_RGB: + case GL_RGBA: + break; + } + switch (type) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_UNSIGNED_BYTE: + break; + case GL_UNSIGNED_SHORT_5_6_5: + if (format != GL_RGB) { + ES2INTER(SetError)(GL_INVALID_OPERATION); + return; + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_5_5_5_1: + if (format != GL_RGBA) { + ES2INTER(SetError)(GL_INVALID_OPERATION); + return; + } + break; + } + if (width < 0 || height < 0) { + ES2INTER(SetError)(GL_INVALID_VALUE); + return; + } + + FNPTR(ReadPixels)(x, y, width, height, format, type, pixels); +} |