X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fi915%2Fi830_texblend.c;h=c29b5727fab30dd712799e76dd25587c23f8a566;hb=ca4d1def392249209a5980fadb1678ffba95b381;hp=09f7f37e7650753a8175b4a7fffcfb19348eeb28;hpb=2b66417402bc595be301ab9ed7b9ea2a5f79e180;p=mesa.git diff --git a/src/mesa/drivers/dri/i915/i830_texblend.c b/src/mesa/drivers/dri/i915/i830_texblend.c index 09f7f37e765..c29b5727fab 100644 --- a/src/mesa/drivers/dri/i915/i830_texblend.c +++ b/src/mesa/drivers/dri/i915/i830_texblend.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2003 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -18,7 +18,7 @@ * 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 NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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. @@ -28,10 +28,7 @@ #include "main/glheader.h" #include "main/macros.h" #include "main/mtypes.h" -#include "main/simple_list.h" #include "main/enums.h" -#include "main/texformat.h" -#include "main/texstore.h" #include "main/mm.h" #include "intel_screen.h" @@ -95,7 +92,7 @@ emit_factor(GLuint blendUnit, GLuint * state, GLuint count, } -static INLINE GLuint +static inline GLuint GetTexelOp(GLint unit) { switch (unit) { @@ -120,7 +117,7 @@ GetTexelOp(GLint unit) * environments are treated identically. * * \todo - * This function should return \c GLboolean. When \c GL_FALSE is returned, + * This function should return \c bool. When \c false is returned, * it means that an environment is selected that the hardware cannot do. This * is the way the Radeon and R200 drivers work. * @@ -138,7 +135,7 @@ i830SetTexEnvCombine(struct i830_context * i830, GLuint texel_op, GLuint * state, const GLfloat * factor) { const GLuint numColorArgs = combine->_NumArgsRGB; - const GLuint numAlphaArgs = combine->_NumArgsA; + GLuint numAlphaArgs = combine->_NumArgsA; GLuint blendop; GLuint ablendop; @@ -146,7 +143,7 @@ i830SetTexEnvCombine(struct i830_context * i830, GLuint args_A[3]; GLuint rgb_shift; GLuint alpha_shift; - GLboolean need_factor = 0; + bool need_factor = 0; int i; unsigned used; static const GLuint tex_blend_rgb[3] = { @@ -161,7 +158,7 @@ i830SetTexEnvCombine(struct i830_context * i830, }; if (INTEL_DEBUG & DEBUG_TEXTURE) - fprintf(stderr, "%s\n", __FUNCTION__); + fprintf(stderr, "%s\n", __func__); /* The EXT version of the DOT3 extension does not support the @@ -211,7 +208,7 @@ i830SetTexEnvCombine(struct i830_context * i830, break; case GL_DOT3_RGBA_EXT: case GL_DOT3_RGBA: - blendop = TEXBLENDOP_DOT3; + blendop = TEXBLENDOP_DOT4; break; default: return pass_through(state, blendUnit); @@ -275,6 +272,7 @@ i830SetTexEnvCombine(struct i830_context * i830, if (combine->ModeRGB == GL_DOT3_RGBA_EXT || combine->ModeRGB == GL_DOT3_RGBA) { ablendop = TEXBLENDOP_DOT4; + numAlphaArgs = 2; args_A[0] = TEXBLENDARG_FACTOR; /* the global factor */ args_A[1] = TEXBLENDARG_FACTOR; args_A[2] = TEXBLENDARG_FACTOR; @@ -389,14 +387,14 @@ i830SetTexEnvCombine(struct i830_context * i830, static void emit_texblend(struct i830_context *i830, GLuint unit, GLuint blendUnit, - GLboolean last_stage) + bool last_stage) { struct gl_texture_unit *texUnit = &i830->intel.ctx.Texture.Unit[unit]; GLuint tmp[I830_TEXBLEND_SIZE], tmp_sz; if (0) - fprintf(stderr, "%s unit %d\n", __FUNCTION__, unit); + fprintf(stderr, "%s unit %d\n", __func__, unit); /* Update i830->state.TexBlend */ @@ -415,7 +413,7 @@ emit_texblend(struct i830_context *i830, GLuint unit, GLuint blendUnit, i830->state.TexBlendWordsUsed[blendUnit] = tmp_sz; } - I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND(blendUnit), GL_TRUE); + I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND(blendUnit), true); } static void @@ -435,27 +433,23 @@ emit_passthrough(struct i830_context *i830) i830->state.TexBlendWordsUsed[unit] = tmp_sz; } - I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND(unit), GL_TRUE); + I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND(unit), true); } void i830EmitTextureBlend(struct i830_context *i830) { - GLcontext *ctx = &i830->intel.ctx; - GLuint unit, last_stage = 0, blendunit = 0; - - I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND_ALL, GL_FALSE); + struct gl_context *ctx = &i830->intel.ctx; + GLuint unit, blendunit = 0; - if (ctx->Texture._EnabledUnits) { - for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) - if (ctx->Texture.Unit[unit]._ReallyEnabled) - last_stage = unit; + I830_ACTIVESTATE(i830, I830_UPLOAD_TEXBLEND_ALL, false); - for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) - if (ctx->Texture.Unit[unit]._ReallyEnabled) - emit_texblend(i830, unit, blendunit++, last_stage == unit); - } - else { + if (ctx->Texture._MaxEnabledTexImageUnit != -1) { + for (unit = 0; unit <= ctx->Texture._MaxEnabledTexImageUnit; unit++) + if (ctx->Texture.Unit[unit]._Current) + emit_texblend(i830, unit, blendunit++, + unit == ctx->Texture._MaxEnabledTexImageUnit); + } else { emit_passthrough(i830); } }