예제 #1
0
/**
 * Called via the swrast->TextureSample[i] function pointer.
 * Basically, given a texture object, an array of texture coords
 * and an array of level-of-detail values, return an array of colors.
 * In this case, determine the correct texture sampling routine
 * (depending on filter mode, texture dimensions, etc) then call the
 * sampler routine.
 */
static void
_swrast_validate_texture_sample( GLcontext *ctx, GLuint texUnit,
				 const struct gl_texture_object *tObj,
				 GLuint n, const GLfloat texcoords[][4],
				 const GLfloat lambda[], GLchan rgba[][4] )
{
   SWcontext *swrast = SWRAST_CONTEXT(ctx);

   _swrast_validate_derived( ctx );

   /* Compute min/mag filter threshold */
   if (tObj && tObj->MinFilter != tObj->MagFilter) {
      if (tObj->MagFilter == GL_LINEAR
          && (tObj->MinFilter == GL_NEAREST_MIPMAP_NEAREST ||
              tObj->MinFilter == GL_NEAREST_MIPMAP_LINEAR)) {
         swrast->_MinMagThresh[texUnit] = 0.5F;
      }
      else {
         swrast->_MinMagThresh[texUnit] = 0.0F;
      }
   }

   swrast->TextureSample[texUnit] =
      _swrast_choose_texture_sample_func( ctx, tObj );

   swrast->TextureSample[texUnit]( ctx, texUnit, tObj, n, texcoords,
                                   lambda, rgba );
}
예제 #2
0
void
_swrast_update_texture_samplers(GLcontext *ctx)
{
   SWcontext *swrast = SWRAST_CONTEXT(ctx);
   GLuint u;

   if (!swrast)
      return; /* pipe hack */

   for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) {
      const struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current;
      /* Note: If tObj is NULL, the sample function will be a simple
       * function that just returns opaque black (0,0,0,1).
       */
      swrast->TextureSample[u] = _swrast_choose_texture_sample_func(ctx, tObj);
   }
}
예제 #3
0
파일: s_context.c 프로젝트: etnaviv/mesa
void
_swrast_update_texture_samplers(struct gl_context *ctx)
{
   SWcontext *swrast = SWRAST_CONTEXT(ctx);
   GLuint u;

   if (!swrast)
      return; /* pipe hack */

   for (u = 0; u < ARRAY_SIZE(swrast->TextureSample); u++) {
      struct gl_texture_object *tObj = ctx->Texture.Unit[u]._Current;
      /* Note: If tObj is NULL, the sample function will be a simple
       * function that just returns opaque black (0,0,0,1).
       */
      _mesa_update_fetch_functions(ctx, u);
      swrast->TextureSample[u] =
         _swrast_choose_texture_sample_func(ctx, tObj,
                                            _mesa_get_samplerobj(ctx, u));
   }
}