X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Ftexgen.c;h=45f86fd911f02d7f394f521b390000a78852bab7;hb=fa18a427e929ecc04a9980e517db96663debea29;hp=3ce413d5c98f2e97470e96caeb6bbac9b6798359;hpb=5708e2711366e4dd1f19275c943b04706fd9c633;p=mesa.git diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c index 3ce413d5c98..45f86fd911f 100644 --- a/src/mesa/main/texgen.c +++ b/src/mesa/main/texgen.c @@ -1,6 +1,5 @@ /* * Mesa 3-D graphics library - * Version: 7.5 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * Copyright (C) 2009 VMware, Inc. All Rights Reserved. @@ -18,9 +17,10 @@ * 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 - * BRIAN PAUL 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. + * 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. */ /** @@ -34,7 +34,6 @@ #include "main/context.h" #include "main/enums.h" #include "main/macros.h" -#include "main/mfeatures.h" #include "main/texgen.h" #include "main/texstate.h" #include "math/m_matrix.h" @@ -45,7 +44,7 @@ * Return texgen state for given coordinate */ static struct gl_texgen * -get_texgen(struct gl_context *ctx, struct gl_texture_unit *texUnit, +get_texgen(struct gl_context *ctx, struct gl_fixedfunc_texture_unit *texUnit, GLenum coord) { if (ctx->API == API_OPENGLES) { @@ -71,24 +70,23 @@ get_texgen(struct gl_context *ctx, struct gl_texture_unit *texUnit, void GLAPIENTRY _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) { - struct gl_texture_unit *texUnit; + struct gl_fixedfunc_texture_unit *texUnit; struct gl_texgen *texgen; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) _mesa_debug(ctx, "glTexGen %s %s %.1f(%s)...\n", - _mesa_lookup_enum_by_nr(coord), - _mesa_lookup_enum_by_nr(pname), + _mesa_enum_to_string(coord), + _mesa_enum_to_string(pname), *params, - _mesa_lookup_enum_by_nr((GLenum) (GLint) *params)); + _mesa_enum_to_string((GLenum) (GLint) *params)); if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexGen(current unit)"); return; } - texUnit = _mesa_get_current_tex_unit(ctx); + texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx); texgen = get_texgen(ctx, texUnit, coord); if (!texgen) { @@ -129,13 +127,13 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); return; } - if (ctx->API != API_OPENGL + if (ctx->API != API_OPENGL_COMPAT && (bit & (TEXGEN_REFLECTION_MAP_NV | TEXGEN_NORMAL_MAP_NV)) == 0) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); return; } - FLUSH_VERTICES(ctx, _NEW_TEXTURE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); texgen->Mode = mode; texgen->_ModeBit = bit; } @@ -143,13 +141,13 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) case GL_OBJECT_PLANE: { - if (ctx->API != API_OPENGL) { + if (ctx->API != API_OPENGL_COMPAT) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); return; } if (TEST_EQ_4V(texgen->ObjectPlane, params)) return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); COPY_4FV(texgen->ObjectPlane, params); } break; @@ -158,7 +156,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) { GLfloat tmp[4]; - if (ctx->API != API_OPENGL) { + if (ctx->API != API_OPENGL_COMPAT) { _mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); return; } @@ -171,7 +169,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) ctx->ModelviewMatrixStack.Top->inv); if (TEST_EQ_4V(texgen->EyePlane, tmp)) return; - FLUSH_VERTICES(ctx, _NEW_TEXTURE); + FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE); COPY_4FV(texgen->EyePlane, tmp); } break; @@ -186,7 +184,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) } -static void GLAPIENTRY +void GLAPIENTRY _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) { GLfloat p[4]; @@ -203,7 +201,7 @@ _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) } -static void GLAPIENTRY +void GLAPIENTRY _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) { GLfloat p[4]; @@ -250,7 +248,7 @@ _es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params) } -static void GLAPIENTRY +void GLAPIENTRY _mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) { GLfloat p[4]; @@ -288,20 +286,19 @@ _mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) -static void GLAPIENTRY +void GLAPIENTRY _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) { - struct gl_texture_unit *texUnit; + struct gl_fixedfunc_texture_unit *texUnit; struct gl_texgen *texgen; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGendv(current unit)"); return; } - texUnit = _mesa_get_current_tex_unit(ctx); + texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx); texgen = get_texgen(ctx, texUnit, coord); if (!texgen) { @@ -329,17 +326,16 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) void GLAPIENTRY _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) { - struct gl_texture_unit *texUnit; + struct gl_fixedfunc_texture_unit *texUnit; struct gl_texgen *texgen; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGenfv(current unit)"); return; } - texUnit = _mesa_get_current_tex_unit(ctx); + texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx); texgen = get_texgen(ctx, texUnit, coord); if (!texgen) { @@ -352,14 +348,14 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) params[0] = ENUM_TO_FLOAT(texgen->Mode); break; case GL_OBJECT_PLANE: - if (ctx->API != API_OPENGL) { + if (ctx->API != API_OPENGL_COMPAT) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" ); return; } COPY_4V(params, texgen->ObjectPlane); break; case GL_EYE_PLANE: - if (ctx->API != API_OPENGL) { + if (ctx->API != API_OPENGL_COMPAT) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGenfv(param)" ); return; } @@ -375,17 +371,16 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) void GLAPIENTRY _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) { - struct gl_texture_unit *texUnit; + struct gl_fixedfunc_texture_unit *texUnit; struct gl_texgen *texgen; GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END(ctx); if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexGeniv(current unit)"); return; } - texUnit = _mesa_get_current_tex_unit(ctx); + texUnit = _mesa_get_current_fixedfunc_tex_unit(ctx); texgen = get_texgen(ctx, texUnit, coord); if (!texgen) { @@ -398,7 +393,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) params[0] = texgen->Mode; break; case GL_OBJECT_PLANE: - if (ctx->API != API_OPENGL) { + if (ctx->API != API_OPENGL_COMPAT) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(param)" ); return; } @@ -408,7 +403,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) params[3] = (GLint) texgen->ObjectPlane[3]; break; case GL_EYE_PLANE: - if (ctx->API != API_OPENGL) { + if (ctx->API != API_OPENGL_COMPAT) { _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(param)" ); return; } @@ -421,20 +416,3 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexGeniv(pname)" ); } } - - -void -_mesa_init_texgen_dispatch(struct gl_context *ctx, struct _glapi_table *disp) -{ - SET_GetTexGenfv(disp, _mesa_GetTexGenfv); - SET_GetTexGeniv(disp, _mesa_GetTexGeniv); - SET_TexGenf(disp, _mesa_TexGenf); - SET_TexGenfv(disp, _mesa_TexGenfv); - SET_TexGeni(disp, _mesa_TexGeni); - SET_TexGeniv(disp, _mesa_TexGeniv); - if (ctx->API == API_OPENGL) { - SET_GetTexGendv(disp, _mesa_GetTexGendv); - SET_TexGend(disp, _mesa_TexGend); - SET_TexGendv(disp, _mesa_TexGendv); - } -}