diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/es/main/APIspec.xml | 25 | ||||
-rw-r--r-- | src/mesa/es/main/es_enable.c | 91 | ||||
-rw-r--r-- | src/mesa/es/main/es_texgen.c | 73 | ||||
-rw-r--r-- | src/mesa/es/main/get_gen.py | 11 | ||||
-rw-r--r-- | src/mesa/es/main/specials_es1.c | 16 | ||||
-rw-r--r-- | src/mesa/es/sources.mak | 2 |
6 files changed, 199 insertions, 19 deletions
diff --git a/src/mesa/es/main/APIspec.xml b/src/mesa/es/main/APIspec.xml index 8926007f8de..a7dbdc42499 100644 --- a/src/mesa/es/main/APIspec.xml +++ b/src/mesa/es/main/APIspec.xml @@ -3546,7 +3546,6 @@ <function name="TexGenf" template="TexGen" gltype="GLfloat" expand_vector="true"/> <function name="TexGenfv" template="TexGen" gltype="GLfloat"/> - <function name="TexGeni" template="TexGen" gltype="GLint" expand_vector="true"/> <function name="Clear" template="Clear"/> <function name="ClearColor" template="ClearColor" gltype="GLclampf"/> @@ -3873,12 +3872,12 @@ <function name="TexEnvx" template="TexEnv" gltype="GLfixed" expand_vector="true"/> <function name="TexEnvxv" template="TexEnv" gltype="GLfixed"/> - <function name="TexGenfOES" template="TexGen" gltype="GLfloat" expand_vector="true"/> - <function name="TexGenfvOES" template="TexGen" gltype="GLfloat"/> - <function name="TexGeniOES" template="TexGen" gltype="GLint" expand_vector="true"/> - <function name="TexGenivOES" template="TexGen" gltype="GLint"/> - <function name="TexGenxOES" template="TexGen" gltype="GLfixed" expand_vector="true"/> - <function name="TexGenxvOES" template="TexGen" gltype="GLfixed"/> + <function name="TexGenfOES" external="true" template="TexGen" gltype="GLfloat" expand_vector="true"/> + <function name="TexGenfvOES" external="true" template="TexGen" gltype="GLfloat"/> + <function name="TexGeniOES" external="true" template="TexGen" gltype="GLint" expand_vector="true"/> + <function name="TexGenivOES" external="true" template="TexGen" gltype="GLint"/> + <function name="TexGenxOES" external="true" template="TexGen" gltype="GLfixed" expand_vector="true"/> + <function name="TexGenxvOES" external="true" template="TexGen" gltype="GLfixed"/> <function name="Clear" template="Clear"/> <function name="ClearColor" template="ClearColor" gltype="GLclampf"/> @@ -3892,8 +3891,8 @@ <function name="ColorMask" template="ColorMask"/> <function name="DepthMask" template="DepthMask"/> - <function name="Disable" template="Disable"/> - <function name="Enable" template="Enable"/> + <function name="Disable" external="true" template="Disable"/> + <function name="Enable" external="true" template="Enable"/> <function name="Finish" template="Finish"/> <function name="Flush" template="Flush"/> @@ -3932,15 +3931,15 @@ <function name="GetTexEnviv" template="GetTexEnv" gltype="GLint"/> <function name="GetTexEnvxv" template="GetTexEnv" gltype="GLfixed"/> - <function name="GetTexGenfvOES" template="GetTexGen" gltype="GLfloat"/> - <function name="GetTexGenivOES" template="GetTexGen" gltype="GLint"/> - <function name="GetTexGenxvOES" template="GetTexGen" gltype="GLfixed"/> + <function name="GetTexGenfvOES" external="true" template="GetTexGen" gltype="GLfloat"/> + <function name="GetTexGenivOES" external="true" template="GetTexGen" gltype="GLint"/> + <function name="GetTexGenxvOES" external="true" template="GetTexGen" gltype="GLfixed"/> <function name="GetTexParameterfv" template="GetTexParameter" gltype="GLfloat"/> <function name="GetTexParameteriv" template="GetTexParameter" gltype="GLint"/> <function name="GetTexParameterxv" template="GetTexParameter" gltype="GLfixed"/> - <function name="IsEnabled" template="IsEnabled"/> + <function name="IsEnabled" external="true" template="IsEnabled"/> <function name="DepthRangef" template="DepthRange" gltype="GLclampf"/> <function name="DepthRangex" template="DepthRange" gltype="GLclampx"/> diff --git a/src/mesa/es/main/es_enable.c b/src/mesa/es/main/es_enable.c new file mode 100644 index 00000000000..351caacd776 --- /dev/null +++ b/src/mesa/es/main/es_enable.c @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2009 Chia-I Wu <[email protected]> + * + * 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 (including the next + * paragraph) 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. + */ + +#include "GLES/gl.h" +#include "GLES/glext.h" + +#include "main/compiler.h" /* for ASSERT */ + + +#ifndef GL_TEXTURE_GEN_S +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_R 0x0C62 +#endif + + +extern void GL_APIENTRY _es_Disable(GLenum cap); +extern void GL_APIENTRY _es_Enable(GLenum cap); +extern GLboolean GL_APIENTRY _es_IsEnabled(GLenum cap); + +extern void GL_APIENTRY _mesa_Disable(GLenum cap); +extern void GL_APIENTRY _mesa_Enable(GLenum cap); +extern GLboolean GL_APIENTRY _mesa_IsEnabled(GLenum cap); + + +void GL_APIENTRY +_es_Disable(GLenum cap) +{ + switch (cap) { + case GL_TEXTURE_GEN_STR_OES: + /* disable S, T, and R at the same time */ + _mesa_Disable(GL_TEXTURE_GEN_S); + _mesa_Disable(GL_TEXTURE_GEN_T); + _mesa_Disable(GL_TEXTURE_GEN_R); + break; + default: + _mesa_Disable(cap); + break; + } +} + + +void GL_APIENTRY +_es_Enable(GLenum cap) +{ + switch (cap) { + case GL_TEXTURE_GEN_STR_OES: + /* enable S, T, and R at the same time */ + _mesa_Enable(GL_TEXTURE_GEN_S); + _mesa_Enable(GL_TEXTURE_GEN_T); + _mesa_Enable(GL_TEXTURE_GEN_R); + break; + default: + _mesa_Enable(cap); + break; + } +} + + +GLboolean GL_APIENTRY +_es_IsEnabled(GLenum cap) +{ + switch (cap) { + case GL_TEXTURE_GEN_STR_OES: + cap = GL_TEXTURE_GEN_S; + default: + break; + } + + return _mesa_IsEnabled(cap); +} diff --git a/src/mesa/es/main/es_texgen.c b/src/mesa/es/main/es_texgen.c new file mode 100644 index 00000000000..c29a0a7f138 --- /dev/null +++ b/src/mesa/es/main/es_texgen.c @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2009 Chia-I Wu <[email protected]> + * + * 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 (including the next + * paragraph) 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. + */ + +#include "GLES/gl.h" +#include "GLES/glext.h" + +#include "main/compiler.h" /* for ASSERT */ + + +#ifndef GL_S +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#endif + + +extern void GL_APIENTRY _es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params); +extern void GL_APIENTRY _es_TexGenf(GLenum coord, GLenum pname, GLfloat param); +extern void GL_APIENTRY _es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params); + +extern void GL_APIENTRY _mesa_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params); +extern void GL_APIENTRY _mesa_TexGenf(GLenum coord, GLenum pname, GLfloat param); +extern void GL_APIENTRY _mesa_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params); + + +void GL_APIENTRY +_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params) +{ + ASSERT(coord == GL_TEXTURE_GEN_STR_OES); + _mesa_GetTexGenfv(GL_S, pname, params); +} + + +void GL_APIENTRY +_es_TexGenf(GLenum coord, GLenum pname, GLfloat param) +{ + ASSERT(coord == GL_TEXTURE_GEN_STR_OES); + /* set S, T, and R at the same time */ + _mesa_TexGenf(GL_S, pname, param); + _mesa_TexGenf(GL_T, pname, param); + _mesa_TexGenf(GL_R, pname, param); +} + + +void GL_APIENTRY +_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params) +{ + ASSERT(coord == GL_TEXTURE_GEN_STR_OES); + /* set S, T, and R at the same time */ + _mesa_TexGenfv(GL_S, pname, params); + _mesa_TexGenfv(GL_T, pname, params); + _mesa_TexGenfv(GL_R, pname, params); +} diff --git a/src/mesa/es/main/get_gen.py b/src/mesa/es/main/get_gen.py index 9da0b6b7421..fee66701042 100644 --- a/src/mesa/es/main/get_gen.py +++ b/src/mesa/es/main/get_gen.py @@ -391,12 +391,9 @@ StateVars_es1 = [ # OES_texture_cube_map ( "GL_TEXTURE_CUBE_MAP_ARB", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", None), - ( "GL_TEXTURE_GEN_S", GLboolean, + ( "GL_TEXTURE_GEN_STR_OES", GLboolean, + # S, T, and R are always set at the same time ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", None), - ( "GL_TEXTURE_GEN_T", GLboolean, - ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)"], "", None), - ( "GL_TEXTURE_GEN_R", GLboolean, - ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)"], "", None), # ARB_multisample ( "GL_MULTISAMPLE_ARB", GLboolean, ["ctx->Multisample.Enabled"], "", ["ARB_multisample"] ), @@ -695,6 +692,10 @@ def EmitHeader(): #define GL_PALETTE8_RGB5_A1_OES 0x8B99 #endif +/* GL_OES_texture_cube_map */ +#ifndef GL_OES_texture_cube_map +#define GL_TEXTURE_GEN_STR_OES 0x8D60 +#endif #define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE ) #define FLOAT_TO_FIXED(F) ( ((F) * 65536.0f > INT_MAX) ? INT_MAX : \\ diff --git a/src/mesa/es/main/specials_es1.c b/src/mesa/es/main/specials_es1.c index 0ace2924b37..a4f14490f31 100644 --- a/src/mesa/es/main/specials_es1.c +++ b/src/mesa/es/main/specials_es1.c @@ -195,5 +195,19 @@ _es_GetString(GLenum name) void _mesa_initialize_context_extra(GLcontext *ctx) { - /* nothing here */ + GLuint i; + + /** + * GL_OES_texture_cube_map says + * "Initially all texture generation modes are set to REFLECTION_MAP_OES" + */ + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + texUnit->GenS.Mode = GL_REFLECTION_MAP_NV; + texUnit->GenT.Mode = GL_REFLECTION_MAP_NV; + texUnit->GenR.Mode = GL_REFLECTION_MAP_NV; + texUnit->GenS._ModeBit = TEXGEN_REFLECTION_MAP_NV; + texUnit->GenT._ModeBit = TEXGEN_REFLECTION_MAP_NV; + texUnit->GenR._ModeBit = TEXGEN_REFLECTION_MAP_NV; + } } diff --git a/src/mesa/es/sources.mak b/src/mesa/es/sources.mak index f00e41b0115..84fad267733 100644 --- a/src/mesa/es/sources.mak +++ b/src/mesa/es/sources.mak @@ -8,8 +8,10 @@ LOCAL_ES1_SOURCES := \ main/specials_es1.c \ main/drawtex.c \ main/es_cpaltex.c \ + main/es_enable.c \ main/es_fbo.c \ main/es_query_matrix.c \ + main/es_texgen.c \ main/stubs.c \ glapi/glapi-es1/main/enums.c |