From f386f73f9e4054a750d453fa2f5449c2f1d2e242 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 14 Mar 2003 15:40:59 +0000 Subject: Clean-up of parser error handling/reporting. Basic fragment program texture instructions are limping along. --- src/mesa/swrast/s_context.c | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'src/mesa/swrast/s_context.c') diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 2c3ffbedd7..6ed0c42e4d 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -1,4 +1,4 @@ -/* $Id: s_context.c,v 1.45 2003/02/23 04:10:54 brianp Exp $ */ +/* $Id: s_context.c,v 1.46 2003/03/14 15:41:00 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -25,12 +25,13 @@ * * Authors: * Keith Whitwell + * Brian Paul */ -#include "glheader.h" +#include "imports.h" #include "context.h" #include "mtypes.h" -#include "imports.h" +#include "texobj.h" #include "swrast.h" #include "s_blend.h" @@ -305,11 +306,40 @@ _swrast_validate_texture_sample( GLcontext *ctx, GLuint texUnit, } } + if (ctx->FragmentProgram.Enabled) { + ASSERT(ctx->FragmentProgram.Current); + /* only one target can be referenced per unit per fragment program */ + switch (ctx->FragmentProgram.Current->TexturesUsed[texUnit]) { + case TEXTURE_1D_BIT: + tObj = ctx->Texture.Unit[texUnit].Current1D; + break; + case TEXTURE_2D_BIT: + tObj = ctx->Texture.Unit[texUnit].Current2D; + break; + case TEXTURE_3D_BIT: + tObj = ctx->Texture.Unit[texUnit].Current3D; + break; + case TEXTURE_CUBE_BIT: + tObj = ctx->Texture.Unit[texUnit].CurrentCubeMap; + break; + case TEXTURE_RECT_BIT: + tObj = ctx->Texture.Unit[texUnit].CurrentRect; + break; + default: + _mesa_problem(ctx, "Bad texture in _swrast_validate_texture_sample"); + return; + } + if (!tObj->Complete) { + _mesa_test_texobj_completeness(ctx, + (struct gl_texture_object *) tObj ); + } + } + swrast->TextureSample[texUnit] = _swrast_choose_texture_sample_func( ctx, tObj ); swrast->TextureSample[texUnit]( ctx, texUnit, tObj, n, texcoords, - lambda, rgba ); + lambda, rgba ); /* GL_SGI_texture_color_table */ if (ctx->Texture.Unit[texUnit].ColorTableEnabled) { -- cgit v1.2.3