Added ctx->Texture._EnabledCoordUnits bitfield.
Fixed some vertex array / vertex program glitches with glDrawElements. Fixed some fragment program runtime bugs. Non-trivial Cg programs are running now.
This commit is contained in:
@@ -1,10 +1,8 @@
|
|||||||
/* $Id: ac_import.c,v 1.23 2003/03/01 01:50:24 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 4.1
|
* Version: 5.1
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -183,61 +181,13 @@ static void reset_edgeflag( GLcontext *ctx )
|
|||||||
static void reset_attrib( GLcontext *ctx, GLuint index )
|
static void reset_attrib( GLcontext *ctx, GLuint index )
|
||||||
{
|
{
|
||||||
ACcontext *ac = AC_CONTEXT(ctx);
|
ACcontext *ac = AC_CONTEXT(ctx);
|
||||||
GLboolean fallback = GL_FALSE;
|
|
||||||
|
|
||||||
/*
|
if (ctx->Array.VertexAttrib[index].Enabled) {
|
||||||
* The 16 NV vertex attribute arrays have top priority. If one of those
|
|
||||||
* is not enabled, look if a corresponding conventional array is enabled.
|
|
||||||
* If nothing else, use the fallback (ctx->Current.Attrib) values.
|
|
||||||
*/
|
|
||||||
if (ctx->Array._Enabled & _NEW_ARRAY_ATTRIB(index)) {
|
|
||||||
ac->Raw.Attrib[index] = ctx->Array.VertexAttrib[index];
|
ac->Raw.Attrib[index] = ctx->Array.VertexAttrib[index];
|
||||||
STRIDE_ARRAY(ac->Raw.Attrib[index], ac->start);
|
STRIDE_ARRAY(ac->Raw.Attrib[index], ac->start);
|
||||||
}
|
}
|
||||||
else if (ctx->Array._Enabled & (1 << index)) {
|
|
||||||
/* use conventional vertex array if possible */
|
|
||||||
if (index == VERT_ATTRIB_POS) {
|
|
||||||
ac->Raw.Attrib[index] = ctx->Array.Vertex;
|
|
||||||
}
|
|
||||||
else if (index == VERT_ATTRIB_NORMAL) {
|
|
||||||
ac->Raw.Attrib[index] = ctx->Array.Normal;
|
|
||||||
}
|
|
||||||
else if (index == VERT_ATTRIB_COLOR0) {
|
|
||||||
ac->Raw.Attrib[index] = ctx->Array.Color;
|
|
||||||
}
|
|
||||||
else if (index == VERT_ATTRIB_COLOR1) {
|
|
||||||
ac->Raw.Attrib[index] = ctx->Array.SecondaryColor;
|
|
||||||
}
|
|
||||||
else if (index == VERT_ATTRIB_FOG) {
|
|
||||||
ac->Raw.Attrib[index] = ctx->Array.FogCoord;
|
|
||||||
}
|
|
||||||
else if (index >= VERT_ATTRIB_TEX0 && index <= VERT_ATTRIB_TEX7) {
|
|
||||||
GLuint unit = index - VERT_ATTRIB_TEX0;
|
|
||||||
ASSERT(unit < MAX_TEXTURE_COORD_UNITS);
|
|
||||||
ac->Raw.Attrib[index] = ctx->Array.TexCoord[unit];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* missing conventional array (vertex weight, for example) */
|
|
||||||
fallback = GL_TRUE;
|
|
||||||
}
|
|
||||||
if (!fallback)
|
|
||||||
STRIDE_ARRAY(ac->Raw.Attrib[index], ac->start);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fallback = GL_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fallback) {
|
|
||||||
/* fallback to ctx->Current.Attrib values */
|
|
||||||
ac->Raw.Attrib[index] = ac->Fallback.Attrib[index];
|
|
||||||
|
|
||||||
if (ctx->Current.Attrib[index][3] != 1.0)
|
|
||||||
ac->Raw.Attrib[index].Size = 4;
|
|
||||||
else if (ctx->Current.Attrib[index][2] != 0.0)
|
|
||||||
ac->Raw.Attrib[index].Size = 3;
|
|
||||||
else
|
else
|
||||||
ac->Raw.Attrib[index].Size = 2;
|
ac->Raw.Attrib[index] = ac->Fallback.Attrib[index];
|
||||||
}
|
|
||||||
|
|
||||||
ac->IsCached.Attrib[index] = GL_FALSE;
|
ac->IsCached.Attrib[index] = GL_FALSE;
|
||||||
ac->NewArrayState &= ~_NEW_ARRAY_ATTRIB(index);
|
ac->NewArrayState &= ~_NEW_ARRAY_ATTRIB(index);
|
||||||
@@ -806,13 +756,8 @@ struct gl_client_array *_ac_import_attrib( GLcontext *ctx,
|
|||||||
|
|
||||||
/* Can we keep the existing version?
|
/* Can we keep the existing version?
|
||||||
*/
|
*/
|
||||||
if (ac->NewArrayState & _NEW_ARRAY_ATTRIB(index)) {
|
if (ac->NewArrayState & _NEW_ARRAY_ATTRIB(index))
|
||||||
reset_attrib( ctx, index );
|
reset_attrib( ctx, index );
|
||||||
}
|
|
||||||
else if (ac->NewArrayState & (1 << index)) {
|
|
||||||
/* Also need to check conventional attributes */
|
|
||||||
reset_attrib( ctx, index );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Is the request impossible?
|
/* Is the request impossible?
|
||||||
*/
|
*/
|
||||||
|
@@ -1,10 +1,8 @@
|
|||||||
/* $Id: mtypes.h,v 1.109 2003/04/05 00:38:09 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 4.1
|
* Version: 5.1
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -1006,6 +1004,7 @@ struct gl_texture_attrib {
|
|||||||
GLuint CurrentUnit; /* Active texture unit */
|
GLuint CurrentUnit; /* Active texture unit */
|
||||||
|
|
||||||
GLuint _EnabledUnits; /* one bit set for each really-enabled unit */
|
GLuint _EnabledUnits; /* one bit set for each really-enabled unit */
|
||||||
|
GLuint _EnabledCoordUnits; /* one bit per enabled coordinate unit */
|
||||||
GLuint _GenFlags; /* for texgen */
|
GLuint _GenFlags; /* for texgen */
|
||||||
GLuint _TexGenEnabled;
|
GLuint _TexGenEnabled;
|
||||||
GLuint _TexMatEnabled;
|
GLuint _TexMatEnabled;
|
||||||
@@ -1562,7 +1561,7 @@ struct matrix_stack
|
|||||||
#define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5
|
#define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5
|
||||||
#define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6
|
#define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6
|
||||||
#define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7
|
#define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7
|
||||||
#define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */
|
#define _NEW_ARRAY_ATTRIB_0 0x1 /* alias conventional arrays */
|
||||||
#define _NEW_ARRAY_ALL 0xffffffff
|
#define _NEW_ARRAY_ALL 0xffffffff
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
/* $Id: nvfragparse.c,v 1.19 2003/04/07 23:12:00 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 5.1
|
* Version: 5.1
|
||||||
@@ -24,7 +22,6 @@
|
|||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file nvfragparse.c
|
* \file nvfragparse.c
|
||||||
* \brief NVIDIA fragment program parser.
|
* \brief NVIDIA fragment program parser.
|
||||||
@@ -42,20 +39,6 @@
|
|||||||
#include "nvprogram.h"
|
#include "nvprogram.h"
|
||||||
|
|
||||||
|
|
||||||
/* XXX move into imports.[ch] eventually */
|
|
||||||
static void *
|
|
||||||
_mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize)
|
|
||||||
{
|
|
||||||
size_t copySize = MIN2(oldSize, newSize);
|
|
||||||
void *newBuffer = _mesa_malloc(newSize);
|
|
||||||
if (newBuffer && copySize > 0)
|
|
||||||
_mesa_memcpy(newBuffer, oldBuffer, copySize);
|
|
||||||
if (oldBuffer)
|
|
||||||
_mesa_free(oldBuffer);
|
|
||||||
return newBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define INPUT_1V 1
|
#define INPUT_1V 1
|
||||||
#define INPUT_2V 2
|
#define INPUT_2V 2
|
||||||
#define INPUT_3V 3
|
#define INPUT_3V 3
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
/* $Id: nvprogram.c,v 1.11 2003/04/05 00:38:09 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 5.1
|
* Version: 5.1
|
||||||
@@ -1060,7 +1058,6 @@ _mesa_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
|
|||||||
|
|
||||||
fragProg = (struct fragment_program *) prog;
|
fragProg = (struct fragment_program *) prog;
|
||||||
for (i = 0; i < fragProg->NumParameters; i++) {
|
for (i = 0; i < fragProg->NumParameters; i++) {
|
||||||
printf("test %d %s\n", i, fragProg->Parameters[i].Name);
|
|
||||||
if (!_mesa_strcmp(fragProg->Parameters[i].Name, (const char *) name)) {
|
if (!_mesa_strcmp(fragProg->Parameters[i].Name, (const char *) name)) {
|
||||||
ASSERT(!fragProg->Parameters[i].Constant);
|
ASSERT(!fragProg->Parameters[i].Constant);
|
||||||
fragProg->Parameters[i].Values[0] = x;
|
fragProg->Parameters[i].Values[0] = x;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: state.c,v 1.102 2003/03/29 17:01:01 brianp Exp $ */
|
/* $Id: state.c,v 1.103 2003/04/08 02:27:16 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -72,6 +72,9 @@
|
|||||||
#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
|
#if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
|
||||||
#include "nvprogram.h"
|
#include "nvprogram.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if FEATURE_NV_fragment_program
|
||||||
|
#include "nvfragprog.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "math/m_matrix.h"
|
#include "math/m_matrix.h"
|
||||||
#include "math/m_xform.h"
|
#include "math/m_xform.h"
|
||||||
@@ -943,9 +946,30 @@ update_texture_state( GLcontext *ctx )
|
|||||||
if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) {
|
if (ctx->Texture._GenFlags & TEXGEN_NEED_EYE_COORD) {
|
||||||
ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN;
|
ctx->_NeedEyeCoords |= NEED_EYE_TEXGEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx->Texture._EnabledCoordUnits = ctx->Texture._EnabledUnits;
|
||||||
|
/* Fragment programs may need texture coordinates but not the
|
||||||
|
* corresponding texture images.
|
||||||
|
*/
|
||||||
|
if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) {
|
||||||
|
ctx->Texture._EnabledCoordUnits |=
|
||||||
|
(ctx->FragmentProgram.Current->InputsRead >> FRAG_ATTRIB_TEX0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update items which depend on vertex/fragment programs.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
update_program( GLcontext *ctx )
|
||||||
|
{
|
||||||
|
if (ctx->FragmentProgram.Enabled && ctx->FragmentProgram.Current) {
|
||||||
|
if (ctx->FragmentProgram.Current->InputsRead & (1 << FRAG_ATTRIB_COL1))
|
||||||
|
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If ctx->NewState is non-zero then this function MUST be called before
|
* If ctx->NewState is non-zero then this function MUST be called before
|
||||||
@@ -1015,6 +1039,8 @@ void _mesa_update_state( GLcontext *ctx )
|
|||||||
ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW;
|
ctx->_NeedEyeCoords |= NEED_EYE_LIGHT_MODELVIEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (new_state & _NEW_PROGRAM)
|
||||||
|
update_program( ctx );
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* XXX this is a bit of a hack. We should be checking elsewhere if
|
/* XXX this is a bit of a hack. We should be checking elsewhere if
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
/* $Id: s_aaline.c,v 1.21 2003/03/14 15:38:04 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 5.0.1
|
* Version: 5.0.3
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
@@ -519,8 +517,8 @@ _swrast_choose_aa_line_function(GLcontext *ctx)
|
|||||||
|
|
||||||
if (ctx->Visual.rgbMode) {
|
if (ctx->Visual.rgbMode) {
|
||||||
/* RGBA */
|
/* RGBA */
|
||||||
if (ctx->Texture._EnabledUnits != 0) {
|
if (ctx->Texture._EnabledCoordUnits != 0) {
|
||||||
if (ctx->Texture._EnabledUnits > 1) {
|
if (ctx->Texture._EnabledCoordUnits > 1) {
|
||||||
/* Multitextured! */
|
/* Multitextured! */
|
||||||
if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR ||
|
if (ctx->Light.Model.ColorControl==GL_SEPARATE_SPECULAR_COLOR ||
|
||||||
ctx->Fog.ColorSumEnabled)
|
ctx->Fog.ColorSumEnabled)
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
/* $Id: s_aatriangle.c,v 1.31 2003/03/25 02:23:44 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 5.1
|
* Version: 5.1
|
||||||
@@ -465,9 +463,9 @@ _swrast_set_aa_triangle_function(GLcontext *ctx)
|
|||||||
{
|
{
|
||||||
ASSERT(ctx->Polygon.SmoothFlag);
|
ASSERT(ctx->Polygon.SmoothFlag);
|
||||||
|
|
||||||
if (ctx->Texture._EnabledUnits != 0) {
|
if (ctx->Texture._EnabledCoordUnits != 0) {
|
||||||
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
|
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
|
||||||
if (ctx->Texture._EnabledUnits > 1) {
|
if (ctx->Texture._EnabledCoordUnits > 1) {
|
||||||
SWRAST_CONTEXT(ctx)->Triangle = spec_multitex_aa_tri;
|
SWRAST_CONTEXT(ctx)->Triangle = spec_multitex_aa_tri;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -475,7 +473,7 @@ _swrast_set_aa_triangle_function(GLcontext *ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (ctx->Texture._EnabledUnits > 1) {
|
if (ctx->Texture._EnabledCoordUnits > 1) {
|
||||||
SWRAST_CONTEXT(ctx)->Triangle = multitex_aa_tri;
|
SWRAST_CONTEXT(ctx)->Triangle = multitex_aa_tri;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -1,10 +1,8 @@
|
|||||||
/* $Id: s_bitmap.c,v 1.22 2003/03/25 02:23:45 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 5.0
|
* Version: 5.1
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -82,7 +80,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
|
|||||||
_swrast_span_default_z(ctx, &span);
|
_swrast_span_default_z(ctx, &span);
|
||||||
if (ctx->Fog.Enabled)
|
if (ctx->Fog.Enabled)
|
||||||
_swrast_span_default_fog(ctx, &span);
|
_swrast_span_default_fog(ctx, &span);
|
||||||
if (ctx->Texture._EnabledUnits)
|
if (ctx->Texture._EnabledCoordUnits)
|
||||||
_swrast_span_default_texcoords(ctx, &span);
|
_swrast_span_default_texcoords(ctx, &span);
|
||||||
|
|
||||||
for (row = 0; row < height; row++, span.y++) {
|
for (row = 0; row < height; row++, span.y++) {
|
||||||
@@ -198,7 +196,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
|
|||||||
_swrast_span_default_z(ctx, &span);
|
_swrast_span_default_z(ctx, &span);
|
||||||
if (ctx->Fog.Enabled)
|
if (ctx->Fog.Enabled)
|
||||||
_swrast_span_default_fog(ctx, &span);
|
_swrast_span_default_fog(ctx, &span);
|
||||||
if (ctx->Texture._EnabledUnits)
|
if (ctx->Texture._EnabledCoordUnits)
|
||||||
_swrast_span_default_texcoords(ctx, &span);
|
_swrast_span_default_texcoords(ctx, &span);
|
||||||
|
|
||||||
for (row=0; row<height; row++, span.y++) {
|
for (row=0; row<height; row++, span.y++) {
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
/* $Id: s_context.c,v 1.48 2003/03/25 02:23:45 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 5.1
|
* Version: 5.1
|
||||||
@@ -600,7 +598,7 @@ _swrast_flush( GLcontext *ctx )
|
|||||||
/* flush any pending fragments from rendering points */
|
/* flush any pending fragments from rendering points */
|
||||||
if (swrast->PointSpan.end > 0) {
|
if (swrast->PointSpan.end > 0) {
|
||||||
if (ctx->Visual.rgbMode) {
|
if (ctx->Visual.rgbMode) {
|
||||||
if (ctx->Texture._EnabledUnits)
|
if (ctx->Texture._EnabledCoordUnits)
|
||||||
_swrast_write_texture_span(ctx, &(swrast->PointSpan));
|
_swrast_write_texture_span(ctx, &(swrast->PointSpan));
|
||||||
else
|
else
|
||||||
_swrast_write_rgba_span(ctx, &(swrast->PointSpan));
|
_swrast_write_rgba_span(ctx, &(swrast->PointSpan));
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
/* $Id: s_copypix.c,v 1.44 2003/03/25 02:23:45 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 5.1
|
* Version: 5.1
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
/* $Id: s_drawpix.c,v 1.47 2003/03/25 02:23:45 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 5.1
|
* Version: 5.1
|
||||||
@@ -111,11 +109,11 @@ fast_draw_pixels(GLcontext *ctx, GLint x, GLint y,
|
|||||||
_swrast_span_default_z(ctx, &span);
|
_swrast_span_default_z(ctx, &span);
|
||||||
if (ctx->Fog.Enabled)
|
if (ctx->Fog.Enabled)
|
||||||
_swrast_span_default_fog(ctx, &span);
|
_swrast_span_default_fog(ctx, &span);
|
||||||
if (ctx->Texture._EnabledUnits)
|
if (ctx->Texture._EnabledCoordUnits)
|
||||||
_swrast_span_default_texcoords(ctx, &span);
|
_swrast_span_default_texcoords(ctx, &span);
|
||||||
|
|
||||||
if ((SWRAST_CONTEXT(ctx)->_RasterMask & ~CLIP_BIT) == 0
|
if ((SWRAST_CONTEXT(ctx)->_RasterMask & ~CLIP_BIT) == 0
|
||||||
&& ctx->Texture._EnabledUnits == 0
|
&& ctx->Texture._EnabledCoordUnits == 0
|
||||||
&& unpack->Alignment == 1
|
&& unpack->Alignment == 1
|
||||||
&& !unpack->SwapBytes
|
&& !unpack->SwapBytes
|
||||||
&& !unpack->LsbFirst) {
|
&& !unpack->LsbFirst) {
|
||||||
@@ -650,7 +648,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||||||
|
|
||||||
if (ctx->Fog.Enabled)
|
if (ctx->Fog.Enabled)
|
||||||
_swrast_span_default_fog(ctx, &span);
|
_swrast_span_default_fog(ctx, &span);
|
||||||
if (ctx->Texture._EnabledUnits)
|
if (ctx->Texture._EnabledCoordUnits)
|
||||||
_swrast_span_default_texcoords(ctx, &span);
|
_swrast_span_default_texcoords(ctx, &span);
|
||||||
|
|
||||||
if (type == GL_UNSIGNED_SHORT && ctx->Visual.depthBits == 16
|
if (type == GL_UNSIGNED_SHORT && ctx->Visual.depthBits == 16
|
||||||
@@ -777,7 +775,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||||||
_swrast_span_default_z(ctx, &span);
|
_swrast_span_default_z(ctx, &span);
|
||||||
if (ctx->Fog.Enabled)
|
if (ctx->Fog.Enabled)
|
||||||
_swrast_span_default_fog(ctx, &span);
|
_swrast_span_default_fog(ctx, &span);
|
||||||
if (ctx->Texture._EnabledUnits)
|
if (ctx->Texture._EnabledCoordUnits)
|
||||||
_swrast_span_default_texcoords(ctx, &span);
|
_swrast_span_default_texcoords(ctx, &span);
|
||||||
|
|
||||||
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0
|
if (SWRAST_CONTEXT(ctx)->_RasterMask == 0 && !zoom && x >= 0 && y >= 0
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
/* $Id: s_lines.c,v 1.36 2003/03/25 02:23:46 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 5.1
|
* Version: 5.1
|
||||||
@@ -305,9 +303,10 @@ _swrast_choose_line( GLcontext *ctx )
|
|||||||
_swrast_choose_aa_line_function(ctx);
|
_swrast_choose_aa_line_function(ctx);
|
||||||
ASSERT(swrast->Line);
|
ASSERT(swrast->Line);
|
||||||
}
|
}
|
||||||
else if (ctx->Texture._EnabledUnits) {
|
else if (ctx->Texture._EnabledCoordUnits) {
|
||||||
/* textured lines */
|
/* textured lines */
|
||||||
if (ctx->Texture._EnabledUnits > 0x1 || (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)) {
|
if (ctx->Texture._EnabledCoordUnits > 0x1
|
||||||
|
|| (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)) {
|
||||||
/* multi-texture and/or separate specular color */
|
/* multi-texture and/or separate specular color */
|
||||||
USE(multitextured_line);
|
USE(multitextured_line);
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: s_nvfragprog.c,v 1.13 2003/04/05 00:38:10 brianp Exp $ */
|
/* $Id: s_nvfragprog.c,v 1.14 2003/04/08 02:27:18 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -25,7 +25,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "glheader.h"
|
#include "glheader.h"
|
||||||
#include "colormac.h"
|
#include "colormac.h"
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
@@ -37,20 +36,23 @@
|
|||||||
#include "s_texture.h"
|
#include "s_texture.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* if 1, print some debugging info */
|
||||||
|
#define DEBUG_FRAG 0
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch a texel.
|
* Fetch a texel.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
fetch_texel( GLcontext *ctx, const GLfloat texcoord[4], GLuint unit,
|
fetch_texel( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
|
||||||
GLfloat color[4] )
|
GLuint unit, GLfloat color[4] )
|
||||||
{
|
{
|
||||||
const GLfloat *lambda = NULL;
|
|
||||||
GLchan rgba[4];
|
GLchan rgba[4];
|
||||||
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
SWcontext *swrast = SWRAST_CONTEXT(ctx);
|
||||||
|
|
||||||
swrast->TextureSample[unit](ctx, unit, ctx->Texture.Unit[unit]._Current,
|
swrast->TextureSample[unit](ctx, unit, ctx->Texture.Unit[unit]._Current,
|
||||||
1, (const GLfloat (*)[4]) texcoord,
|
1, (const GLfloat (*)[4]) texcoord,
|
||||||
lambda, &rgba);
|
&lambda, &rgba);
|
||||||
color[0] = CHAN_TO_FLOAT(rgba[0]);
|
color[0] = CHAN_TO_FLOAT(rgba[0]);
|
||||||
color[1] = CHAN_TO_FLOAT(rgba[1]);
|
color[1] = CHAN_TO_FLOAT(rgba[1]);
|
||||||
color[2] = CHAN_TO_FLOAT(rgba[2]);
|
color[2] = CHAN_TO_FLOAT(rgba[2]);
|
||||||
@@ -347,6 +349,15 @@ store_vector4( const struct fp_instruction *inst,
|
|||||||
const GLboolean *writeMask = dest->WriteMask;
|
const GLboolean *writeMask = dest->WriteMask;
|
||||||
GLboolean condWriteMask[4];
|
GLboolean condWriteMask[4];
|
||||||
|
|
||||||
|
#if DEBUG_FRAG
|
||||||
|
if (value[0] > 1.0e10 ||
|
||||||
|
IS_INF_OR_NAN(value[0]) ||
|
||||||
|
IS_INF_OR_NAN(value[1]) ||
|
||||||
|
IS_INF_OR_NAN(value[2]) ||
|
||||||
|
IS_INF_OR_NAN(value[3]) )
|
||||||
|
printf("store %g %g %g %g\n", value[0], value[1], value[2], value[3]);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (clamp) {
|
if (clamp) {
|
||||||
clampedValue[0] = CLAMP(value[0], 0.0F, 1.0F);
|
clampedValue[0] = CLAMP(value[0], 0.0F, 1.0F);
|
||||||
clampedValue[1] = CLAMP(value[1], 0.0F, 1.0F);
|
clampedValue[1] = CLAMP(value[1], 0.0F, 1.0F);
|
||||||
@@ -501,9 +512,14 @@ init_machine_deriv( GLcontext *ctx,
|
|||||||
static GLboolean
|
static GLboolean
|
||||||
execute_program( GLcontext *ctx,
|
execute_program( GLcontext *ctx,
|
||||||
const struct fragment_program *program, GLuint maxInst,
|
const struct fragment_program *program, GLuint maxInst,
|
||||||
struct fp_machine *machine, const struct sw_span *span )
|
struct fp_machine *machine, const struct sw_span *span,
|
||||||
|
GLuint column )
|
||||||
{
|
{
|
||||||
GLuint pc = 0;
|
GLuint pc;
|
||||||
|
|
||||||
|
#if DEBUG_FRAG
|
||||||
|
printf("execute fragment program --------------------\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
for (pc = 0; pc < maxInst; pc++) {
|
for (pc = 0; pc < maxInst; pc++) {
|
||||||
const struct fp_instruction *inst = program->Instructions + pc;
|
const struct fp_instruction *inst = program->Instructions + pc;
|
||||||
@@ -542,7 +558,7 @@ execute_program( GLcontext *ctx,
|
|||||||
*/
|
*/
|
||||||
init_machine_deriv(ctx, machine, program, span,
|
init_machine_deriv(ctx, machine, program, span,
|
||||||
'X', &dMachine);
|
'X', &dMachine);
|
||||||
execute_program(ctx, program, pc, &dMachine, span);
|
execute_program(ctx, program, pc, &dMachine, span, column);
|
||||||
fetch_vector4( &inst->SrcReg[0], &dMachine, program, aNext );
|
fetch_vector4( &inst->SrcReg[0], &dMachine, program, aNext );
|
||||||
result[0] = aNext[0] - a[0];
|
result[0] = aNext[0] - a[0];
|
||||||
result[1] = aNext[1] - a[1];
|
result[1] = aNext[1] - a[1];
|
||||||
@@ -559,7 +575,7 @@ execute_program( GLcontext *ctx,
|
|||||||
if (!fetch_vector4_deriv(&inst->SrcReg[0], span, 'Y', result)) {
|
if (!fetch_vector4_deriv(&inst->SrcReg[0], span, 'Y', result)) {
|
||||||
init_machine_deriv(ctx, machine, program, span,
|
init_machine_deriv(ctx, machine, program, span,
|
||||||
'Y', &dMachine);
|
'Y', &dMachine);
|
||||||
execute_program(ctx, program, pc, &dMachine, span);
|
execute_program(ctx, program, pc, &dMachine, span, column);
|
||||||
fetch_vector4( &inst->SrcReg[0], &dMachine, program, aNext );
|
fetch_vector4( &inst->SrcReg[0], &dMachine, program, aNext );
|
||||||
result[0] = aNext[0] - a[0];
|
result[0] = aNext[0] - a[0];
|
||||||
result[1] = aNext[1] - a[1];
|
result[1] = aNext[1] - a[1];
|
||||||
@@ -575,8 +591,12 @@ execute_program( GLcontext *ctx,
|
|||||||
fetch_vector4( &inst->SrcReg[0], machine, program, a );
|
fetch_vector4( &inst->SrcReg[0], machine, program, a );
|
||||||
fetch_vector4( &inst->SrcReg[1], machine, program, b );
|
fetch_vector4( &inst->SrcReg[1], machine, program, b );
|
||||||
result[0] = result[1] = result[2] = result[3] =
|
result[0] = result[1] = result[2] = result[3] =
|
||||||
a[0] + b[0] + a[1] * b[1] + a[2] * b[2];
|
a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
||||||
store_vector4( inst, machine, result );
|
store_vector4( inst, machine, result );
|
||||||
|
#if DEBUG_FRAG
|
||||||
|
printf("DP3 %g = (%g %g %g) . (%g %g %g)\n",
|
||||||
|
result[0], a[0], a[1], a[2], b[0], b[1], b[2]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FP_OPCODE_DP4:
|
case FP_OPCODE_DP4:
|
||||||
@@ -585,7 +605,7 @@ execute_program( GLcontext *ctx,
|
|||||||
fetch_vector4( &inst->SrcReg[0], machine, program, a );
|
fetch_vector4( &inst->SrcReg[0], machine, program, a );
|
||||||
fetch_vector4( &inst->SrcReg[1], machine, program, b );
|
fetch_vector4( &inst->SrcReg[1], machine, program, b );
|
||||||
result[0] = result[1] = result[2] = result[3] =
|
result[0] = result[1] = result[2] = result[3] =
|
||||||
a[0] + b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
|
a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
|
||||||
store_vector4( inst, machine, result );
|
store_vector4( inst, machine, result );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -734,6 +754,12 @@ execute_program( GLcontext *ctx,
|
|||||||
result[2] = a[2] * b[2];
|
result[2] = a[2] * b[2];
|
||||||
result[3] = a[3] * b[3];
|
result[3] = a[3] * b[3];
|
||||||
store_vector4( inst, machine, result );
|
store_vector4( inst, machine, result );
|
||||||
|
#if DEBUG_FRAG
|
||||||
|
printf("MUL (%g %g %g %g) = (%g %g %g %g) * (%g %g %g %g)\n",
|
||||||
|
result[0], result[1], result[2], result[3],
|
||||||
|
a[0], a[1], a[2], a[3],
|
||||||
|
b[0], b[1], b[2], b[3]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FP_OPCODE_PK2H: /* pack two 16-bit floats */
|
case FP_OPCODE_PK2H: /* pack two 16-bit floats */
|
||||||
@@ -812,6 +838,12 @@ execute_program( GLcontext *ctx,
|
|||||||
{
|
{
|
||||||
GLfloat a[4], result[4];
|
GLfloat a[4], result[4];
|
||||||
fetch_vector1( &inst->SrcReg[0], machine, program, a );
|
fetch_vector1( &inst->SrcReg[0], machine, program, a );
|
||||||
|
#if DEBUG_FRAG
|
||||||
|
if (a[0] == 0)
|
||||||
|
printf("RCP(0)\n");
|
||||||
|
else if (IS_INF_OR_NAN(a[0]))
|
||||||
|
printf("RCP(inf)\n");
|
||||||
|
#endif
|
||||||
result[0] = result[1] = result[2] = result[3]
|
result[0] = result[1] = result[2] = result[3]
|
||||||
= 1.0F / a[0];
|
= 1.0F / a[0];
|
||||||
store_vector4( inst, machine, result );
|
store_vector4( inst, machine, result );
|
||||||
@@ -841,6 +873,9 @@ execute_program( GLcontext *ctx,
|
|||||||
fetch_vector1( &inst->SrcReg[0], machine, program, a );
|
fetch_vector1( &inst->SrcReg[0], machine, program, a );
|
||||||
result[0] = result[1] = result[2] = result[3] = INV_SQRTF(a[0]);
|
result[0] = result[1] = result[2] = result[3] = INV_SQRTF(a[0]);
|
||||||
store_vector4( inst, machine, result );
|
store_vector4( inst, machine, result );
|
||||||
|
#if DEBUG_FRAG
|
||||||
|
printf("RSQ %g = 1/sqrt(%g)\n", result[0], a[0]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FP_OPCODE_SEQ: /* set on equal */
|
case FP_OPCODE_SEQ: /* set on equal */
|
||||||
@@ -953,7 +988,9 @@ execute_program( GLcontext *ctx,
|
|||||||
GLfloat texcoord[4], color[4];
|
GLfloat texcoord[4], color[4];
|
||||||
fetch_vector4( &inst->SrcReg[0], machine, program, texcoord );
|
fetch_vector4( &inst->SrcReg[0], machine, program, texcoord );
|
||||||
/* XXX: Undo perspective divide from interpolate_texcoords() */
|
/* XXX: Undo perspective divide from interpolate_texcoords() */
|
||||||
fetch_texel( ctx, texcoord, inst->TexSrcUnit, color );
|
fetch_texel( ctx, texcoord,
|
||||||
|
span->array->lambda[inst->TexSrcUnit][column],
|
||||||
|
inst->TexSrcUnit, color );
|
||||||
store_vector4( inst, machine, color );
|
store_vector4( inst, machine, color );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -975,7 +1012,9 @@ execute_program( GLcontext *ctx,
|
|||||||
GLfloat texcoord[4], color[4];
|
GLfloat texcoord[4], color[4];
|
||||||
fetch_vector4( &inst->SrcReg[0], machine, program, texcoord );
|
fetch_vector4( &inst->SrcReg[0], machine, program, texcoord );
|
||||||
/* Already did perspective divide in interpolate_texcoords() */
|
/* Already did perspective divide in interpolate_texcoords() */
|
||||||
fetch_texel( ctx, texcoord, inst->TexSrcUnit, color );
|
fetch_texel( ctx, texcoord,
|
||||||
|
span->array->lambda[inst->TexSrcUnit][column],
|
||||||
|
inst->TexSrcUnit, color );
|
||||||
store_vector4( inst, machine, color );
|
store_vector4( inst, machine, color );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1103,12 +1142,9 @@ init_machine( GLcontext *ctx, struct fp_machine *machine,
|
|||||||
for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
|
for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
|
||||||
if (program->InputsRead & (1 << (FRAG_ATTRIB_TEX0 + u))) {
|
if (program->InputsRead & (1 << (FRAG_ATTRIB_TEX0 + u))) {
|
||||||
GLfloat *tex = machine->Registers[FP_INPUT_REG_START+FRAG_ATTRIB_TEX0+u];
|
GLfloat *tex = machine->Registers[FP_INPUT_REG_START+FRAG_ATTRIB_TEX0+u];
|
||||||
if (ctx->Texture.Unit[u]._ReallyEnabled) {
|
ASSERT(ctx->Texture._EnabledCoordUnits & (1 << u));
|
||||||
COPY_4V(tex, span->array->texcoords[u][col]);
|
COPY_4V(tex, span->array->texcoords[u][col]);
|
||||||
}
|
ASSERT(tex[0] != 0 || tex[1] != 0 || tex[2] != 0);
|
||||||
else {
|
|
||||||
COPY_4V(tex, ctx->Current.Attrib[VERT_ATTRIB_TEX0 + u]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1126,7 +1162,7 @@ _swrast_exec_nv_fragment_program( GLcontext *ctx, struct sw_span *span )
|
|||||||
ctx->FragmentProgram.Current, span, i);
|
ctx->FragmentProgram.Current, span, i);
|
||||||
|
|
||||||
if (!execute_program(ctx, program, ~0,
|
if (!execute_program(ctx, program, ~0,
|
||||||
&ctx->FragmentProgram.Machine, span))
|
&ctx->FragmentProgram.Machine, span, i))
|
||||||
span->array->mask[i] = GL_FALSE; /* killed fragment */
|
span->array->mask[i] = GL_FALSE; /* killed fragment */
|
||||||
|
|
||||||
/* Store output registers */
|
/* Store output registers */
|
||||||
|
@@ -1,10 +1,8 @@
|
|||||||
/* $Id: s_points.c,v 1.21 2003/03/25 02:23:47 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 4.1
|
* Version: 5.1
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -214,7 +212,7 @@ _swrast_choose_point( GLcontext *ctx )
|
|||||||
if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) {
|
if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) {
|
||||||
USE(atten_antialiased_rgba_point);
|
USE(atten_antialiased_rgba_point);
|
||||||
}
|
}
|
||||||
else if (ctx->Texture._EnabledUnits) {
|
else if (ctx->Texture._EnabledCoordUnits) {
|
||||||
USE(antialiased_tex_rgba_point);
|
USE(antialiased_tex_rgba_point);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -227,7 +225,7 @@ _swrast_choose_point( GLcontext *ctx )
|
|||||||
}
|
}
|
||||||
else if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) {
|
else if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) {
|
||||||
if (rgbMode) {
|
if (rgbMode) {
|
||||||
if (ctx->Texture._EnabledUnits) {
|
if (ctx->Texture._EnabledCoordUnits) {
|
||||||
if (ctx->Point.SmoothFlag) {
|
if (ctx->Point.SmoothFlag) {
|
||||||
USE(atten_antialiased_rgba_point);
|
USE(atten_antialiased_rgba_point);
|
||||||
}
|
}
|
||||||
@@ -244,7 +242,7 @@ _swrast_choose_point( GLcontext *ctx )
|
|||||||
USE(atten_general_ci_point);
|
USE(atten_general_ci_point);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ctx->Texture._EnabledUnits && rgbMode) {
|
else if (ctx->Texture._EnabledCoordUnits && rgbMode) {
|
||||||
/* textured */
|
/* textured */
|
||||||
USE(textured_rgba_point);
|
USE(textured_rgba_point);
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
/* $Id: s_span.c,v 1.60 2003/03/25 02:23:47 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 5.1
|
* Version: 5.1
|
||||||
@@ -353,21 +351,30 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
|
|||||||
ASSERT(span->interpMask & SPAN_TEXTURE);
|
ASSERT(span->interpMask & SPAN_TEXTURE);
|
||||||
ASSERT(!(span->arrayMask & SPAN_TEXTURE));
|
ASSERT(!(span->arrayMask & SPAN_TEXTURE));
|
||||||
|
|
||||||
if (ctx->Texture._EnabledUnits > 1) {
|
if (ctx->Texture._EnabledCoordUnits > 1) {
|
||||||
/* multitexture */
|
/* multitexture */
|
||||||
GLuint u;
|
GLuint u;
|
||||||
span->arrayMask |= SPAN_TEXTURE;
|
span->arrayMask |= SPAN_TEXTURE;
|
||||||
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
|
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
|
||||||
if (ctx->Texture.Unit[u]._ReallyEnabled) {
|
if (ctx->Texture._EnabledCoordUnits & (1 << u)) {
|
||||||
const struct gl_texture_object *obj =ctx->Texture.Unit[u]._Current;
|
const struct gl_texture_object *obj =ctx->Texture.Unit[u]._Current;
|
||||||
|
GLfloat texW, texH;
|
||||||
|
GLboolean needLambda;
|
||||||
|
if (obj) {
|
||||||
const struct gl_texture_image *img = obj->Image[obj->BaseLevel];
|
const struct gl_texture_image *img = obj->Image[obj->BaseLevel];
|
||||||
const GLboolean needLambda = (obj->MinFilter != obj->MagFilter)
|
needLambda = (obj->MinFilter != obj->MagFilter)
|
||||||
|| ctx->FragmentProgram.Enabled;
|
|| ctx->FragmentProgram.Enabled;
|
||||||
|
texW = img->WidthScale;
|
||||||
|
texH = img->HeightScale;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
texW = 1.0;
|
||||||
|
texH = 1.0;
|
||||||
|
needLambda = GL_FALSE;
|
||||||
|
}
|
||||||
if (needLambda) {
|
if (needLambda) {
|
||||||
GLfloat (*texcoord)[4] = span->array->texcoords[u];
|
GLfloat (*texcoord)[4] = span->array->texcoords[u];
|
||||||
GLfloat *lambda = span->array->lambda[u];
|
GLfloat *lambda = span->array->lambda[u];
|
||||||
const GLfloat texW = (GLfloat) img->WidthScale;
|
|
||||||
const GLfloat texH = (GLfloat) img->HeightScale;
|
|
||||||
const GLfloat dsdx = span->texStepX[u][0];
|
const GLfloat dsdx = span->texStepX[u][0];
|
||||||
const GLfloat dsdy = span->texStepY[u][0];
|
const GLfloat dsdy = span->texStepY[u][0];
|
||||||
const GLfloat dtdx = span->texStepX[u][1];
|
const GLfloat dtdx = span->texStepX[u][1];
|
||||||
@@ -415,6 +422,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
|
|||||||
texcoord[i][0] = s * invQ;
|
texcoord[i][0] = s * invQ;
|
||||||
texcoord[i][1] = t * invQ;
|
texcoord[i][1] = t * invQ;
|
||||||
texcoord[i][2] = r * invQ;
|
texcoord[i][2] = r * invQ;
|
||||||
|
texcoord[i][3] = q;
|
||||||
lambda[i] = 0.0;
|
lambda[i] = 0.0;
|
||||||
s += dsdx;
|
s += dsdx;
|
||||||
t += dtdx;
|
t += dtdx;
|
||||||
@@ -427,6 +435,7 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
|
|||||||
texcoord[i][0] = s * invQ;
|
texcoord[i][0] = s * invQ;
|
||||||
texcoord[i][1] = t * invQ;
|
texcoord[i][1] = t * invQ;
|
||||||
texcoord[i][2] = r * invQ;
|
texcoord[i][2] = r * invQ;
|
||||||
|
texcoord[i][3] = q;
|
||||||
lambda[i] = 0.0;
|
lambda[i] = 0.0;
|
||||||
s += dsdx;
|
s += dsdx;
|
||||||
t += dtdx;
|
t += dtdx;
|
||||||
@@ -441,16 +450,24 @@ interpolate_texcoords(GLcontext *ctx, struct sw_span *span)
|
|||||||
else {
|
else {
|
||||||
/* single texture */
|
/* single texture */
|
||||||
const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current;
|
const struct gl_texture_object *obj = ctx->Texture.Unit[0]._Current;
|
||||||
|
GLfloat texW, texH;
|
||||||
|
GLboolean needLambda;
|
||||||
|
if (obj) {
|
||||||
const struct gl_texture_image *img = obj->Image[obj->BaseLevel];
|
const struct gl_texture_image *img = obj->Image[obj->BaseLevel];
|
||||||
const GLboolean needLambda = (obj->MinFilter != obj->MagFilter)
|
needLambda = (obj->MinFilter != obj->MagFilter)
|
||||||
|| ctx->FragmentProgram.Enabled;
|
|| ctx->FragmentProgram.Enabled;
|
||||||
|
texW = (GLfloat) img->WidthScale;
|
||||||
|
texH = (GLfloat) img->HeightScale;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
needLambda = GL_FALSE;
|
||||||
|
texW = texH = 1.0;
|
||||||
|
}
|
||||||
span->arrayMask |= SPAN_TEXTURE;
|
span->arrayMask |= SPAN_TEXTURE;
|
||||||
if (needLambda) {
|
if (needLambda) {
|
||||||
/* just texture unit 0, with lambda */
|
/* just texture unit 0, with lambda */
|
||||||
GLfloat (*texcoord)[4] = span->array->texcoords[0];
|
GLfloat (*texcoord)[4] = span->array->texcoords[0];
|
||||||
GLfloat *lambda = span->array->lambda[0];
|
GLfloat *lambda = span->array->lambda[0];
|
||||||
const GLfloat texW = (GLfloat) img->WidthScale;
|
|
||||||
const GLfloat texH = (GLfloat) img->HeightScale;
|
|
||||||
const GLfloat dsdx = span->texStepX[0][0];
|
const GLfloat dsdx = span->texStepX[0][0];
|
||||||
const GLfloat dsdy = span->texStepY[0][0];
|
const GLfloat dsdy = span->texStepY[0][0];
|
||||||
const GLfloat dtdx = span->texStepX[0][1];
|
const GLfloat dtdx = span->texStepX[0][1];
|
||||||
@@ -972,6 +989,9 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span)
|
|||||||
interpolate_colors(ctx, span);
|
interpolate_colors(ctx, span);
|
||||||
span->interpMask &= ~SPAN_RGBA;
|
span->interpMask &= ~SPAN_RGBA;
|
||||||
}
|
}
|
||||||
|
if (span->interpMask & SPAN_SPEC) {
|
||||||
|
interpolate_specular(ctx, span);
|
||||||
|
}
|
||||||
_swrast_exec_nv_fragment_program(ctx, span);
|
_swrast_exec_nv_fragment_program(ctx, span);
|
||||||
monoColor = GL_FALSE;
|
monoColor = GL_FALSE;
|
||||||
}
|
}
|
||||||
@@ -1154,7 +1174,7 @@ _swrast_write_texture_span( GLcontext *ctx, struct sw_span *span)
|
|||||||
span->primitive == GL_POLYGON || span->primitive == GL_BITMAP);
|
span->primitive == GL_POLYGON || span->primitive == GL_BITMAP);
|
||||||
ASSERT(span->end <= MAX_WIDTH);
|
ASSERT(span->end <= MAX_WIDTH);
|
||||||
ASSERT((span->interpMask & span->arrayMask) == 0);
|
ASSERT((span->interpMask & span->arrayMask) == 0);
|
||||||
ASSERT(ctx->Texture._EnabledUnits);
|
ASSERT(ctx->Texture._EnabledCoordUnits);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
printf("%s() interp 0x%x array 0x%x\n", __FUNCTION__, span->interpMask, span->arrayMask);
|
printf("%s() interp 0x%x array 0x%x\n", __FUNCTION__, span->interpMask, span->arrayMask);
|
||||||
@@ -1207,6 +1227,10 @@ _swrast_write_texture_span( GLcontext *ctx, struct sw_span *span)
|
|||||||
if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0)
|
if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0)
|
||||||
interpolate_colors(ctx, span);
|
interpolate_colors(ctx, span);
|
||||||
|
|
||||||
|
if (span->interpMask & SPAN_SPEC) {
|
||||||
|
interpolate_specular(ctx, span);
|
||||||
|
}
|
||||||
|
|
||||||
/* Texturing without alpha is done after depth-testing which
|
/* Texturing without alpha is done after depth-testing which
|
||||||
* gives a potential speed-up.
|
* gives a potential speed-up.
|
||||||
*/
|
*/
|
||||||
@@ -1262,6 +1286,10 @@ _swrast_write_texture_span( GLcontext *ctx, struct sw_span *span)
|
|||||||
if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0)
|
if ((span->interpMask & SPAN_RGBA) && (span->arrayMask & SPAN_RGBA) == 0)
|
||||||
interpolate_colors(ctx, span);
|
interpolate_colors(ctx, span);
|
||||||
|
|
||||||
|
if (span->interpMask & SPAN_SPEC) {
|
||||||
|
interpolate_specular(ctx, span);
|
||||||
|
}
|
||||||
|
|
||||||
if (ctx->FragmentProgram.Enabled)
|
if (ctx->FragmentProgram.Enabled)
|
||||||
_swrast_exec_nv_fragment_program( ctx, span );
|
_swrast_exec_nv_fragment_program( ctx, span );
|
||||||
else
|
else
|
||||||
|
@@ -1,10 +1,8 @@
|
|||||||
/* $Id: s_triangle.c,v 1.70 2003/03/25 02:23:48 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 5.1
|
* Version: 5.1
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -105,7 +103,7 @@ GLboolean _swrast_culltriangle( GLcontext *ctx,
|
|||||||
#define INTERP_FOG 1
|
#define INTERP_FOG 1
|
||||||
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
|
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
|
||||||
#define SETUP_CODE \
|
#define SETUP_CODE \
|
||||||
ASSERT(ctx->Texture._EnabledUnits == 0); \
|
ASSERT(ctx->Texture._EnabledCoordUnits == 0);\
|
||||||
ASSERT(ctx->Light.ShadeModel==GL_FLAT); \
|
ASSERT(ctx->Light.ShadeModel==GL_FLAT); \
|
||||||
span.interpMask |= SPAN_RGBA; \
|
span.interpMask |= SPAN_RGBA; \
|
||||||
span.red = ChanToFixed(v2->color[0]); \
|
span.red = ChanToFixed(v2->color[0]); \
|
||||||
@@ -133,7 +131,7 @@ GLboolean _swrast_culltriangle( GLcontext *ctx,
|
|||||||
#define SETUP_CODE \
|
#define SETUP_CODE \
|
||||||
{ \
|
{ \
|
||||||
/* texturing must be off */ \
|
/* texturing must be off */ \
|
||||||
ASSERT(ctx->Texture._EnabledUnits == 0); \
|
ASSERT(ctx->Texture._EnabledCoordUnits == 0); \
|
||||||
ASSERT(ctx->Light.ShadeModel==GL_SMOOTH); \
|
ASSERT(ctx->Light.ShadeModel==GL_SMOOTH); \
|
||||||
}
|
}
|
||||||
#define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span);
|
#define RENDER_SPAN( span ) _swrast_write_rgba_span(ctx, &span);
|
||||||
@@ -1053,7 +1051,7 @@ _swrast_choose_triangle( GLcontext *ctx )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->Texture._EnabledUnits) {
|
if (ctx->Texture._EnabledCoordUnits || ctx->FragmentProgram.Enabled) {
|
||||||
/* Ugh, we do a _lot_ of tests to pick the best textured tri func */
|
/* Ugh, we do a _lot_ of tests to pick the best textured tri func */
|
||||||
const struct gl_texture_object *texObj2D;
|
const struct gl_texture_object *texObj2D;
|
||||||
const struct gl_texture_image *texImg;
|
const struct gl_texture_image *texImg;
|
||||||
@@ -1067,7 +1065,7 @@ _swrast_choose_triangle( GLcontext *ctx )
|
|||||||
envMode = ctx->Texture.Unit[0].EnvMode;
|
envMode = ctx->Texture.Unit[0].EnvMode;
|
||||||
|
|
||||||
/* First see if we can use an optimized 2-D texture function */
|
/* First see if we can use an optimized 2-D texture function */
|
||||||
if (ctx->Texture._EnabledUnits == 1
|
if (ctx->Texture._EnabledCoordUnits == 1
|
||||||
&& !ctx->FragmentProgram.Enabled
|
&& !ctx->FragmentProgram.Enabled
|
||||||
&& ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT
|
&& ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT
|
||||||
&& texObj2D->WrapS==GL_REPEAT
|
&& texObj2D->WrapS==GL_REPEAT
|
||||||
@@ -1112,7 +1110,7 @@ _swrast_choose_triangle( GLcontext *ctx )
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* general case textured triangles */
|
/* general case textured triangles */
|
||||||
if (ctx->Texture._EnabledUnits > 1) {
|
if (ctx->Texture._EnabledCoordUnits > 1) {
|
||||||
USE(multitextured_triangle);
|
USE(multitextured_triangle);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1121,7 +1119,7 @@ _swrast_choose_triangle( GLcontext *ctx )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ASSERT(!ctx->Texture._EnabledUnits);
|
ASSERT(!ctx->Texture._EnabledCoordUnits);
|
||||||
if (ctx->Light.ShadeModel==GL_SMOOTH) {
|
if (ctx->Light.ShadeModel==GL_SMOOTH) {
|
||||||
/* smooth shaded, no texturing, stippled or some raster ops */
|
/* smooth shaded, no texturing, stippled or some raster ops */
|
||||||
if (rgbmode) {
|
if (rgbmode) {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: s_tritemp.h,v 1.48 2003/03/25 02:23:48 brianp Exp $ */
|
/* $Id: s_tritemp.h,v 1.49 2003/04/08 02:27:18 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
{ \
|
{ \
|
||||||
GLuint u; \
|
GLuint u; \
|
||||||
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
|
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { \
|
||||||
if (ctx->Texture.Unit[u]._ReallyEnabled) { \
|
if (ctx->Texture._EnabledCoordUnits & (1 << u)) { \
|
||||||
CODE \
|
CODE \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
@@ -1,10 +1,8 @@
|
|||||||
/* $Id: ss_vb.c,v 1.22 2002/10/29 20:29:00 brianp Exp $ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 4.1
|
* Version: 5.1
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -389,9 +387,9 @@ _swsetup_choose_rastersetup_func(GLcontext *ctx)
|
|||||||
if (ctx->Visual.rgbMode) {
|
if (ctx->Visual.rgbMode) {
|
||||||
funcindex = COLOR;
|
funcindex = COLOR;
|
||||||
|
|
||||||
if (ctx->Texture._EnabledUnits > 1)
|
if (ctx->Texture._EnabledCoordUnits > 1)
|
||||||
funcindex |= MULTITEX; /* a unit above unit[0] is enabled */
|
funcindex |= MULTITEX; /* a unit above unit[0] is enabled */
|
||||||
else if (ctx->Texture._EnabledUnits == 1)
|
else if (ctx->Texture._EnabledCoordUnits == 1)
|
||||||
funcindex |= TEX0; /* only unit 0 is enabled */
|
funcindex |= TEX0; /* only unit 0 is enabled */
|
||||||
|
|
||||||
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
|
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: t_array_import.c,v 1.28 2003/03/01 01:50:26 brianp Exp $ */
|
/* $Id: t_array_import.c,v 1.29 2003/04/08 02:27:19 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -363,6 +363,22 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
|
|||||||
|
|
||||||
_ac_import_range( ctx, start, count );
|
_ac_import_range( ctx, start, count );
|
||||||
|
|
||||||
|
/* When vertex program mode is enabled, the generic vertex program
|
||||||
|
* attribute arrays have priority over the conventional attributes.
|
||||||
|
* Try to use them now.
|
||||||
|
*/
|
||||||
|
if (ctx->VertexProgram.Enabled) {
|
||||||
|
GLuint index;
|
||||||
|
for (index = 0; index < VERT_ATTRIB_MAX; index++) {
|
||||||
|
/* XXX check program->InputsRead to reduce work here */
|
||||||
|
_tnl_import_attrib( ctx, index, GL_FALSE, GL_TRUE );
|
||||||
|
VB->AttribPtr[index] = &tmp->Attribs[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Conventional attributes
|
||||||
|
*/
|
||||||
if (inputs & VERT_BIT_POS) {
|
if (inputs & VERT_BIT_POS) {
|
||||||
_tnl_import_vertex( ctx, 0, 0 );
|
_tnl_import_vertex( ctx, 0, 0 );
|
||||||
tmp->Obj.count = VB->Count;
|
tmp->Obj.count = VB->Count;
|
||||||
@@ -418,14 +434,4 @@ void _tnl_vb_bind_arrays( GLcontext *ctx, GLint start, GLsizei count )
|
|||||||
VB->SecondaryColorPtr[1] = 0;
|
VB->SecondaryColorPtr[1] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX not 100% sure this is finished. Keith should probably inspect. */
|
|
||||||
if (ctx->VertexProgram.Enabled) {
|
|
||||||
GLuint index;
|
|
||||||
for (index = 0; index < VERT_ATTRIB_MAX; index++) {
|
|
||||||
/* XXX check program->InputsRead to reduce work here */
|
|
||||||
_tnl_import_attrib( ctx, index, GL_FALSE, GL_TRUE );
|
|
||||||
VB->AttribPtr[index] = &tmp->Attribs[index];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: t_context.c,v 1.31 2003/02/04 14:40:56 brianp Exp $ */
|
/* $Id: t_context.c,v 1.32 2003/04/08 02:27:20 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -162,7 +162,9 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state )
|
|||||||
IM->ArrayEltFlags = ~ctx->Array._Enabled;
|
IM->ArrayEltFlags = ~ctx->Array._Enabled;
|
||||||
IM->ArrayEltFlush = (ctx->Array.LockCount
|
IM->ArrayEltFlush = (ctx->Array.LockCount
|
||||||
? FLUSH_ELT_LAZY : FLUSH_ELT_EAGER);
|
? FLUSH_ELT_LAZY : FLUSH_ELT_EAGER);
|
||||||
IM->ArrayEltIncr = ctx->Array.Vertex.Enabled ? 1 : 0;
|
IM->ArrayEltIncr = (ctx->Array.Vertex.Enabled ||
|
||||||
|
(ctx->VertexProgram.Enabled &&
|
||||||
|
ctx->Array.VertexAttrib[0].Enabled)) ? 1 : 0;
|
||||||
tnl->pipeline.run_input_changes |= ctx->Array.NewState; /* overkill */
|
tnl->pipeline.run_input_changes |= ctx->Array.NewState; /* overkill */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -753,7 +753,8 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM,
|
|||||||
GLuint *flags = IM->Flag;
|
GLuint *flags = IM->Flag;
|
||||||
const GLuint *elts = IM->Elt;
|
const GLuint *elts = IM->Elt;
|
||||||
GLuint translate = ctx->Array._Enabled;
|
GLuint translate = ctx->Array._Enabled;
|
||||||
GLuint i, attr;
|
GLuint translateConventional;
|
||||||
|
GLuint attr;
|
||||||
|
|
||||||
if (MESA_VERBOSE & VERBOSE_IMMEDIATE)
|
if (MESA_VERBOSE & VERBOSE_IMMEDIATE)
|
||||||
_mesa_debug(ctx, "exec_array_elements %d .. %d\n", start, count);
|
_mesa_debug(ctx, "exec_array_elements %d .. %d\n", start, count);
|
||||||
@@ -774,8 +775,45 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
translateConventional = translate;
|
||||||
|
|
||||||
if (translate & VERT_BIT_POS) {
|
/*
|
||||||
|
* When vertex program mode is enabled, the generic vertex attribute arrays
|
||||||
|
* have priority over the conventional arrays. Process those arrays now.
|
||||||
|
* When we're done here, translateConventional will indicate which
|
||||||
|
* conventional arrays still have to be translated when we're done.
|
||||||
|
*/
|
||||||
|
if (ctx->VertexProgram.Enabled) {
|
||||||
|
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
|
||||||
|
const GLuint attrBit = 1 << attr;
|
||||||
|
if ((translate & attrBit) && ctx->Array.VertexAttrib[attr].Enabled) {
|
||||||
|
_tnl_trans_elt_4f( IM->Attrib[attr],
|
||||||
|
&ctx->Array.VertexAttrib[attr],
|
||||||
|
flags, elts, (VERT_BIT_ELT | attrBit),
|
||||||
|
start, count);
|
||||||
|
/* special case stuff */
|
||||||
|
if (attr == VERT_ATTRIB_POS) {
|
||||||
|
if (ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Size == 4)
|
||||||
|
translate |= VERT_BITS_OBJ_234;
|
||||||
|
else if (ctx->Array.VertexAttrib[VERT_ATTRIB_POS].Size == 3)
|
||||||
|
translate |= VERT_BITS_OBJ_23;
|
||||||
|
}
|
||||||
|
else if (attr >= VERT_ATTRIB_TEX0 && attr <= VERT_ATTRIB_TEX7) {
|
||||||
|
if (ctx->Array.VertexAttrib[attr].Size == 4)
|
||||||
|
IM->TexSize |= TEX_SIZE_4(attr - VERT_ATTRIB_TEX0);
|
||||||
|
else if (ctx->Array.VertexAttrib[attr].Size == 3)
|
||||||
|
IM->TexSize |= TEX_SIZE_3(attr - VERT_ATTRIB_TEX0);
|
||||||
|
}
|
||||||
|
/* override the conventional array */
|
||||||
|
translateConventional &= ~attrBit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check which conventional arrays are needed.
|
||||||
|
*/
|
||||||
|
if (translateConventional & VERT_BIT_POS) {
|
||||||
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_POS],
|
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_POS],
|
||||||
&ctx->Array.Vertex,
|
&ctx->Array.Vertex,
|
||||||
flags, elts, (VERT_BIT_ELT|VERT_BIT_POS),
|
flags, elts, (VERT_BIT_ELT|VERT_BIT_POS),
|
||||||
@@ -787,35 +825,38 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM,
|
|||||||
translate |= VERT_BITS_OBJ_23;
|
translate |= VERT_BITS_OBJ_23;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (translate & VERT_BIT_NORMAL)
|
if (translateConventional & VERT_BIT_NORMAL) {
|
||||||
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_NORMAL],
|
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_NORMAL],
|
||||||
&ctx->Array.Normal,
|
&ctx->Array.Normal,
|
||||||
flags, elts, (VERT_BIT_ELT|VERT_BIT_NORMAL),
|
flags, elts, (VERT_BIT_ELT|VERT_BIT_NORMAL),
|
||||||
start, count);
|
start, count);
|
||||||
|
}
|
||||||
|
|
||||||
if (translate & VERT_BIT_COLOR0) {
|
if (translateConventional & VERT_BIT_COLOR0) {
|
||||||
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR0],
|
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR0],
|
||||||
&ctx->Array.Color,
|
&ctx->Array.Color,
|
||||||
flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR0),
|
flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR0),
|
||||||
start, count);
|
start, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (translate & VERT_BIT_COLOR1) {
|
if (translateConventional & VERT_BIT_COLOR1) {
|
||||||
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR1],
|
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_COLOR1],
|
||||||
&ctx->Array.SecondaryColor,
|
&ctx->Array.SecondaryColor,
|
||||||
flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR1),
|
flags, elts, (VERT_BIT_ELT|VERT_BIT_COLOR1),
|
||||||
start, count);
|
start, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (translate & VERT_BIT_FOG)
|
if (translateConventional & VERT_BIT_FOG) {
|
||||||
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_FOG],
|
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_FOG],
|
||||||
&ctx->Array.FogCoord,
|
&ctx->Array.FogCoord,
|
||||||
flags, elts, (VERT_BIT_ELT|VERT_BIT_FOG),
|
flags, elts, (VERT_BIT_ELT|VERT_BIT_FOG),
|
||||||
start, count);
|
start, count);
|
||||||
|
}
|
||||||
|
|
||||||
if (translate & VERT_BITS_TEX_ANY) {
|
if (translateConventional & VERT_BITS_TEX_ANY) {
|
||||||
|
GLuint i;
|
||||||
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
|
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++)
|
||||||
if (translate & VERT_BIT_TEX(i)) {
|
if (translateConventional & VERT_BIT_TEX(i)) {
|
||||||
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i],
|
_tnl_trans_elt_4f( IM->Attrib[VERT_ATTRIB_TEX0 + i],
|
||||||
&ctx->Array.TexCoord[i],
|
&ctx->Array.TexCoord[i],
|
||||||
flags, elts, (VERT_BIT_ELT|VERT_BIT_TEX(i)),
|
flags, elts, (VERT_BIT_ELT|VERT_BIT_TEX(i)),
|
||||||
@@ -840,9 +881,12 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM,
|
|||||||
flags, elts, (VERT_BIT_ELT|VERT_BIT_EDGEFLAG),
|
flags, elts, (VERT_BIT_ELT|VERT_BIT_EDGEFLAG),
|
||||||
start, count);
|
start, count);
|
||||||
|
|
||||||
|
{
|
||||||
|
GLuint i;
|
||||||
for (i = start ; i < count ; i++)
|
for (i = start ; i < count ; i++)
|
||||||
if (flags[i] & VERT_BIT_ELT)
|
if (flags[i] & VERT_BIT_ELT)
|
||||||
flags[i] |= translate;
|
flags[i] |= translate;
|
||||||
|
}
|
||||||
|
|
||||||
IM->FlushElt = 0;
|
IM->FlushElt = 0;
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: t_imm_exec.c,v 1.45 2003/04/07 14:53:28 keithw Exp $ */
|
/* $Id: t_imm_exec.c,v 1.46 2003/04/08 02:27:20 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -85,7 +85,9 @@ static void reset_input( GLcontext *ctx,
|
|||||||
IM->MaterialMask[IM->Start] = 0;
|
IM->MaterialMask[IM->Start] = 0;
|
||||||
|
|
||||||
IM->ArrayEltFlags = ~ctx->Array._Enabled;
|
IM->ArrayEltFlags = ~ctx->Array._Enabled;
|
||||||
IM->ArrayEltIncr = ctx->Array.Vertex.Enabled ? 1 : 0;
|
IM->ArrayEltIncr = (ctx->Array.Vertex.Enabled ||
|
||||||
|
(ctx->VertexProgram.Enabled &&
|
||||||
|
ctx->Array.VertexAttrib[0].Enabled)) ? 1 : 0;
|
||||||
IM->ArrayEltFlush = ctx->Array.LockCount ? FLUSH_ELT_LAZY : FLUSH_ELT_EAGER;
|
IM->ArrayEltFlush = ctx->Array.LockCount ? FLUSH_ELT_LAZY : FLUSH_ELT_EAGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,7 +488,9 @@ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM )
|
|||||||
}
|
}
|
||||||
else if ((IM->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT &&
|
else if ((IM->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT &&
|
||||||
ctx->Array.LockCount &&
|
ctx->Array.LockCount &&
|
||||||
ctx->Array.Vertex.Enabled) {
|
(ctx->Array.Vertex.Enabled ||
|
||||||
|
(ctx->VertexProgram.Enabled &&
|
||||||
|
ctx->Array.VertexAttrib[0].Enabled))) {
|
||||||
exec_elt_cassette( ctx, IM );
|
exec_elt_cassette( ctx, IM );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -367,7 +367,8 @@ _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
|
|||||||
|
|
||||||
if ((prev->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT &&
|
if ((prev->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT &&
|
||||||
ctx->Array.LockCount &&
|
ctx->Array.LockCount &&
|
||||||
ctx->Array.Vertex.Enabled)
|
(ctx->Array.Vertex.Enabled ||
|
||||||
|
(ctx->VertexProgram.Enabled && ctx->Array.VertexAttrib[0].Enabled)))
|
||||||
{
|
{
|
||||||
/* Copy Elt values only
|
/* Copy Elt values only
|
||||||
*/
|
*/
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: t_vb_render.c,v 1.34 2003/03/01 01:50:27 brianp Exp $ */
|
/* $Id: t_vb_render.c,v 1.35 2003/04/08 02:27:20 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -352,9 +352,9 @@ static void check_render( GLcontext *ctx, struct gl_pipeline_stage *stage )
|
|||||||
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
|
if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)
|
||||||
inputs |= VERT_BIT_COLOR1;
|
inputs |= VERT_BIT_COLOR1;
|
||||||
|
|
||||||
if (ctx->Texture._EnabledUnits) {
|
if (ctx->Texture._EnabledCoordUnits) {
|
||||||
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
|
for (i = 0 ; i < ctx->Const.MaxTextureUnits ; i++) {
|
||||||
if (ctx->Texture.Unit[i]._ReallyEnabled)
|
if (ctx->Texture._EnabledCoordUnits & (1 << i))
|
||||||
inputs |= VERT_BIT_TEX(i);
|
inputs |= VERT_BIT_TEX(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user