diff options
author | HyungKyu Song <hk76.song@samsung.com> | 2013-02-16 00:41:45 +0900 |
---|---|---|
committer | HyungKyu Song <hk76.song@samsung.com> | 2013-02-16 00:41:45 +0900 |
commit | 65db3453b2d83c113f9f7a939e386353ce348866 (patch) | |
tree | 93daea8d0cfed389b9f89b82d3a7bf739d8ebb58 /es_2_0/Get.c | |
parent | 90dff65a3ccb36853763486671163ca81274b677 (diff) | |
download | simulator-opengl-submit/tizen_2.0/20130215.192024.tar.gz simulator-opengl-submit/tizen_2.0/20130215.192024.tar.bz2 simulator-opengl-submit/tizen_2.0/20130215.192024.zip |
Tizen 2.0 Releasesubmit/tizen_2.0/20130215.192024tizen_2.0
Diffstat (limited to 'es_2_0/Get.c')
-rwxr-xr-x | es_2_0/Get.c | 455 |
1 files changed, 455 insertions, 0 deletions
diff --git a/es_2_0/Get.c b/es_2_0/Get.c new file mode 100755 index 0000000..bd2f2e8 --- /dev/null +++ b/es_2_0/Get.c @@ -0,0 +1,455 @@ +/* + * 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" +#include <GLES2/gl2ext.h> + +#ifndef GL_MAX_FRAGMENT_UNIFORM_COMPONENTS +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#endif +#ifndef GL_MAX_VARYING_FLOATS +#define GL_MAX_VARYING_FLOATS 0x8B4B +#endif +#ifndef GL_MAX_VERTEX_UNIFORM_COMPONENTS +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#endif + +const GLubyte* GL_APIENTRY ES2ENTRY(GetString)(GLenum name) { + static char buf[128]; + switch (name) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return NULL; + break; + case GL_VENDOR: + return (GLubyte*)"Huone Inc."; + break; + case GL_RENDERER: +#if defined(__pic__) + return (GLubyte*)"AlexGL ES 2.0 dynamic on OpenGL(" __DATE__ " " __TIME__ ")"; +#else + return (GLubyte*)"AlexGL ES 2.0 on OpenGL(" __DATE__ " " __TIME__ ")"; +#endif + break; + case GL_VERSION: + sprintf(buf, "OpenGL ES 2.0 (on %s)", FNPTR(GetString)(GL_VERSION)); + return (GLubyte*)buf; + break; + case GL_SHADING_LANGUAGE_VERSION: + return (GLubyte*)FNPTR(GetString)(name); + break; + case GL_EXTENSIONS: + return (GLubyte*) +#if defined(PROVIDING_OES_blend_func_separate) + "GL_OES_blend_func_separate " +#endif +#if defined(PROVIDING_OES_blend_subtract) + "GL_OES_blend_subtract " +#endif +#if defined(PROVIDING_OES_fixed_point) + "GL_OES_fixed_point " +#endif +#if defined(PROVIDING_OES_single_precision) + "GL_OES_single_precision " +#endif +#if defined(PROVIDING_OES_stencil_wrap) + "GL_OES_stencil_wrap " +#endif +#if defined(PROVIDING_OES_texture_mirrored_repeat) + "GL_OES_texture_mirrored_repeat " +#endif +#if defined(PROVIDING_OES_element_index_uint) + "GL_OES_element_index_uint " +#endif +#if defined(PROVIDING_OES_texture_3D) + "GL_OES_texture_3D " +#endif +#if defined(PROVIDING_OES_texture_npot) + "GL_OES_texture_npot " +#endif +#if defined(PROVIDING_OES_rgb8_rgba8) + "GL_OES_rgb8_rgba8 " +#endif +#if defined(PROVIDING_OES_packed_depth_stencil) + "GL_OES_packed_depth_stencil " +#endif + ""; + break; + } +} + +void GL_APIENTRY ES2ENTRY(GetFloatv)(GLenum pname, GLfloat* params) { + switch (pname) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ACTIVE_TEXTURE: + case GL_ALIASED_LINE_WIDTH_RANGE: + case GL_ALIASED_POINT_SIZE_RANGE: + case GL_ALPHA_BITS: + case GL_ARRAY_BUFFER_BINDING: + case GL_BLEND: + case GL_BLEND_COLOR: + case GL_BLEND_DST_ALPHA: + case GL_BLEND_DST_RGB: + case GL_BLEND_EQUATION_ALPHA: + case GL_BLEND_EQUATION_RGB: + case GL_BLEND_SRC_ALPHA: + case GL_BLEND_SRC_RGB: + case GL_BLUE_BITS: + case GL_COLOR_CLEAR_VALUE: + case GL_COLOR_WRITEMASK: + case GL_COMPRESSED_TEXTURE_FORMATS: + case GL_CULL_FACE: + case GL_CULL_FACE_MODE: + case GL_CURRENT_PROGRAM: + case GL_DEPTH_BITS: + case GL_DEPTH_CLEAR_VALUE: + case GL_DEPTH_FUNC: + case GL_DEPTH_RANGE: + case GL_DEPTH_TEST: + case GL_DEPTH_WRITEMASK: + case GL_DITHER: + case GL_ELEMENT_ARRAY_BUFFER_BINDING: + case GL_FRAMEBUFFER_BINDING: + case GL_FRONT_FACE: + case GL_GENERATE_MIPMAP_HINT: + case GL_GREEN_BITS: + case GL_LINE_WIDTH: + case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: + case GL_MAX_CUBE_MAP_TEXTURE_SIZE: + case GL_MAX_RENDERBUFFER_SIZE: + case GL_MAX_TEXTURE_IMAGE_UNITS: + case GL_MAX_TEXTURE_SIZE: + case GL_MAX_VERTEX_ATTRIBS: + case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: + case GL_MAX_VIEWPORT_DIMS: + case GL_NUM_COMPRESSED_TEXTURE_FORMATS: + case GL_PACK_ALIGNMENT: + case GL_POLYGON_OFFSET_FACTOR: + case GL_POLYGON_OFFSET_FILL: + case GL_POLYGON_OFFSET_UNITS: + case GL_RED_BITS: + case GL_RENDERBUFFER_BINDING: + case GL_SAMPLE_BUFFERS: + case GL_SAMPLE_COVERAGE_INVERT: + case GL_SAMPLE_COVERAGE_VALUE: + case GL_SAMPLES: + case GL_SCISSOR_BOX: + case GL_SCISSOR_TEST: + case GL_STENCIL_BACK_FAIL: + case GL_STENCIL_BACK_FUNC: + case GL_STENCIL_BACK_PASS_DEPTH_FAIL: + case GL_STENCIL_BACK_PASS_DEPTH_PASS: + case GL_STENCIL_BACK_REF: + case GL_STENCIL_BACK_VALUE_MASK: + case GL_STENCIL_BACK_WRITEMASK: + case GL_STENCIL_BITS: + case GL_STENCIL_CLEAR_VALUE: + case GL_STENCIL_FAIL: + case GL_STENCIL_FUNC: + case GL_STENCIL_PASS_DEPTH_FAIL: + case GL_STENCIL_PASS_DEPTH_PASS: + case GL_STENCIL_REF: + case GL_STENCIL_TEST: + case GL_STENCIL_VALUE_MASK: + case GL_STENCIL_WRITEMASK: + case GL_SUBPIXEL_BITS: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_CUBE_MAP: + case GL_UNPACK_ALIGNMENT: + case GL_VIEWPORT: +#if defined(PROVIDING_OES_texture_3D) + case GL_TEXTURE_BINDING_3D_OES: + case GL_MAX_3D_TEXTURE_SIZE_OES: +#endif + break; + case GL_MAX_FRAGMENT_UNIFORM_VECTORS: + FNPTR(GetFloatv)(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, params); + *params /= 4; + return; + case GL_MAX_VARYING_VECTORS: + FNPTR(GetFloatv)(GL_MAX_VARYING_FLOATS, params); + *params /= 4; + return; + case GL_MAX_VERTEX_UNIFORM_VECTORS: + FNPTR(GetFloatv)(GL_MAX_VERTEX_UNIFORM_COMPONENTS, params); + *params /= 4; + return; + case GL_IMPLEMENTATION_COLOR_READ_FORMAT: + *params = (GLfloat)GL_RGBA; + return; + case GL_IMPLEMENTATION_COLOR_READ_TYPE: + *params = (GLfloat)GL_UNSIGNED_BYTE; + return; + case GL_NUM_SHADER_BINARY_FORMATS: + *params = 0; + return; + case GL_SHADER_BINARY_FORMATS: + *params = 0; + return; + case GL_SHADER_COMPILER: + *params = (GLfloat)GL_TRUE; + return; + } + FNPTR(GetFloatv)(pname, params); +} + +void GL_APIENTRY ES2ENTRY(GetBooleanv)(GLenum pname, GLboolean* params) { + switch (pname) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ACTIVE_TEXTURE: + case GL_ALIASED_LINE_WIDTH_RANGE: + case GL_ALIASED_POINT_SIZE_RANGE: + case GL_ALPHA_BITS: + case GL_ARRAY_BUFFER_BINDING: + case GL_BLEND: + case GL_BLEND_COLOR: + case GL_BLEND_DST_ALPHA: + case GL_BLEND_DST_RGB: + case GL_BLEND_EQUATION_ALPHA: + case GL_BLEND_EQUATION_RGB: + case GL_BLEND_SRC_ALPHA: + case GL_BLEND_SRC_RGB: + case GL_BLUE_BITS: + case GL_COLOR_CLEAR_VALUE: + case GL_COLOR_WRITEMASK: + case GL_COMPRESSED_TEXTURE_FORMATS: + case GL_CULL_FACE: + case GL_CULL_FACE_MODE: + case GL_CURRENT_PROGRAM: + case GL_DEPTH_BITS: + case GL_DEPTH_CLEAR_VALUE: + case GL_DEPTH_FUNC: + case GL_DEPTH_RANGE: + case GL_DEPTH_TEST: + case GL_DEPTH_WRITEMASK: + case GL_DITHER: + case GL_ELEMENT_ARRAY_BUFFER_BINDING: + case GL_FRAMEBUFFER_BINDING: + case GL_FRONT_FACE: + case GL_GENERATE_MIPMAP_HINT: + case GL_GREEN_BITS: + case GL_LINE_WIDTH: + case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: + case GL_MAX_CUBE_MAP_TEXTURE_SIZE: + case GL_MAX_RENDERBUFFER_SIZE: + case GL_MAX_TEXTURE_IMAGE_UNITS: + case GL_MAX_TEXTURE_SIZE: + case GL_MAX_VERTEX_ATTRIBS: + case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: + case GL_MAX_VIEWPORT_DIMS: + case GL_NUM_COMPRESSED_TEXTURE_FORMATS: + case GL_PACK_ALIGNMENT: + case GL_POLYGON_OFFSET_FACTOR: + case GL_POLYGON_OFFSET_FILL: + case GL_POLYGON_OFFSET_UNITS: + case GL_RED_BITS: + case GL_RENDERBUFFER_BINDING: + case GL_SAMPLE_BUFFERS: + case GL_SAMPLE_COVERAGE_INVERT: + case GL_SAMPLE_COVERAGE_VALUE: + case GL_SAMPLES: + case GL_SCISSOR_BOX: + case GL_SCISSOR_TEST: + case GL_STENCIL_BACK_FAIL: + case GL_STENCIL_BACK_FUNC: + case GL_STENCIL_BACK_PASS_DEPTH_FAIL: + case GL_STENCIL_BACK_PASS_DEPTH_PASS: + case GL_STENCIL_BACK_REF: + case GL_STENCIL_BACK_VALUE_MASK: + case GL_STENCIL_BACK_WRITEMASK: + case GL_STENCIL_BITS: + case GL_STENCIL_CLEAR_VALUE: + case GL_STENCIL_FAIL: + case GL_STENCIL_FUNC: + case GL_STENCIL_PASS_DEPTH_FAIL: + case GL_STENCIL_PASS_DEPTH_PASS: + case GL_STENCIL_REF: + case GL_STENCIL_TEST: + case GL_STENCIL_VALUE_MASK: + case GL_STENCIL_WRITEMASK: + case GL_SUBPIXEL_BITS: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_CUBE_MAP: + case GL_UNPACK_ALIGNMENT: + case GL_VIEWPORT: +#if defined(PROVIDING_OES_texture_3D) + case GL_TEXTURE_BINDING_3D_OES: + case GL_MAX_3D_TEXTURE_SIZE_OES: +#endif + break; + case GL_MAX_FRAGMENT_UNIFORM_VECTORS: + FNPTR(GetBooleanv)(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, params); + return; + case GL_MAX_VARYING_VECTORS: + FNPTR(GetBooleanv)(GL_MAX_VARYING_FLOATS, params); + return; + case GL_MAX_VERTEX_UNIFORM_VECTORS: + FNPTR(GetBooleanv)(GL_MAX_VERTEX_UNIFORM_COMPONENTS, params); + return; + case GL_IMPLEMENTATION_COLOR_READ_FORMAT: + *params = (GLboolean)GL_TRUE; + return; + case GL_IMPLEMENTATION_COLOR_READ_TYPE: + *params = (GLboolean)GL_TRUE; + return; + case GL_NUM_SHADER_BINARY_FORMATS: + *params = (GLboolean)0; + return; + case GL_SHADER_BINARY_FORMATS: + *params = (GLboolean)0; + return; + case GL_SHADER_COMPILER: + *params = (GLboolean)GL_TRUE; + return; + } + FNPTR(GetBooleanv)(pname, params); +} + +void GL_APIENTRY ES2ENTRY(GetIntegerv)(GLenum pname, GLint* params) { + switch (pname) { + default: + ES2INTER(SetError)(GL_INVALID_ENUM); + return; + case GL_ACTIVE_TEXTURE: + case GL_ALIASED_LINE_WIDTH_RANGE: + case GL_ALIASED_POINT_SIZE_RANGE: + case GL_ALPHA_BITS: + case GL_ARRAY_BUFFER_BINDING: + case GL_BLEND: + case GL_BLEND_COLOR: + case GL_BLEND_DST_ALPHA: + case GL_BLEND_DST_RGB: + case GL_BLEND_EQUATION_ALPHA: + case GL_BLEND_EQUATION_RGB: + case GL_BLEND_SRC_ALPHA: + case GL_BLEND_SRC_RGB: + case GL_BLUE_BITS: + case GL_COLOR_CLEAR_VALUE: + case GL_COLOR_WRITEMASK: + case GL_COMPRESSED_TEXTURE_FORMATS: + case GL_CULL_FACE: + case GL_CULL_FACE_MODE: + case GL_CURRENT_PROGRAM: + case GL_DEPTH_BITS: + case GL_DEPTH_CLEAR_VALUE: + case GL_DEPTH_FUNC: + case GL_DEPTH_RANGE: + case GL_DEPTH_TEST: + case GL_DEPTH_WRITEMASK: + case GL_DITHER: + case GL_ELEMENT_ARRAY_BUFFER_BINDING: + case GL_FRAMEBUFFER_BINDING: + case GL_FRONT_FACE: + case GL_GENERATE_MIPMAP_HINT: + case GL_GREEN_BITS: + case GL_LINE_WIDTH: + case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: + case GL_MAX_CUBE_MAP_TEXTURE_SIZE: + case GL_MAX_RENDERBUFFER_SIZE: + case GL_MAX_TEXTURE_IMAGE_UNITS: + case GL_MAX_TEXTURE_SIZE: + case GL_MAX_VERTEX_ATTRIBS: + case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: + case GL_MAX_VIEWPORT_DIMS: + case GL_NUM_COMPRESSED_TEXTURE_FORMATS: + case GL_PACK_ALIGNMENT: + case GL_POLYGON_OFFSET_FACTOR: + case GL_POLYGON_OFFSET_FILL: + case GL_POLYGON_OFFSET_UNITS: + case GL_RED_BITS: + case GL_RENDERBUFFER_BINDING: + case GL_SAMPLE_BUFFERS: + case GL_SAMPLE_COVERAGE_INVERT: + case GL_SAMPLE_COVERAGE_VALUE: + case GL_SAMPLES: + case GL_SCISSOR_BOX: + case GL_SCISSOR_TEST: + case GL_STENCIL_BACK_FAIL: + case GL_STENCIL_BACK_FUNC: + case GL_STENCIL_BACK_PASS_DEPTH_FAIL: + case GL_STENCIL_BACK_PASS_DEPTH_PASS: + case GL_STENCIL_BACK_REF: + case GL_STENCIL_BACK_VALUE_MASK: + case GL_STENCIL_BACK_WRITEMASK: + case GL_STENCIL_BITS: + case GL_STENCIL_CLEAR_VALUE: + case GL_STENCIL_FAIL: + case GL_STENCIL_FUNC: + case GL_STENCIL_PASS_DEPTH_FAIL: + case GL_STENCIL_PASS_DEPTH_PASS: + case GL_STENCIL_REF: + case GL_STENCIL_TEST: + case GL_STENCIL_VALUE_MASK: + case GL_STENCIL_WRITEMASK: + case GL_SUBPIXEL_BITS: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_CUBE_MAP: + case GL_UNPACK_ALIGNMENT: + case GL_VIEWPORT: +#if defined(PROVIDING_OES_texture_3D) + case GL_TEXTURE_BINDING_3D_OES: + case GL_MAX_3D_TEXTURE_SIZE_OES: +#endif + break; + case GL_MAX_FRAGMENT_UNIFORM_VECTORS: + FNPTR(GetIntegerv)(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, params); + *params /= 4; + return; + case GL_MAX_VARYING_VECTORS: + FNPTR(GetIntegerv)(GL_MAX_VARYING_FLOATS, params); + *params /= 4; + return; + case GL_MAX_VERTEX_UNIFORM_VECTORS: + FNPTR(GetIntegerv)(GL_MAX_VERTEX_UNIFORM_COMPONENTS, params); + *params /= 4; + return; + case GL_IMPLEMENTATION_COLOR_READ_FORMAT: + *params = GL_RGBA; + return; + case GL_IMPLEMENTATION_COLOR_READ_TYPE: + *params = GL_UNSIGNED_BYTE; + return; + case GL_NUM_SHADER_BINARY_FORMATS: + *params = 0; + return; + case GL_SHADER_BINARY_FORMATS: + *params = 0; + return; + case GL_SHADER_COMPILER: + *params = (GLint)GL_TRUE; + return; + } + FNPTR(GetIntegerv)(pname, params); +} |