sp_tex_sample.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void sp_get_samples (struct tgsi_sampler *sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE], float lodbias, float rgba[NUM_CHANNELS][QUAD_SIZE])
 Called via tgsi_sampler::get_samples() Use the sampler's state setting to get a filtered RGBA value from the sampler's texture.


Function Documentation

void sp_get_samples ( struct tgsi_sampler sampler,
const float  s[QUAD_SIZE],
const float  t[QUAD_SIZE],
const float  p[QUAD_SIZE],
float  lodbias,
float  rgba[NUM_CHANNELS][QUAD_SIZE] 
)

Called via tgsi_sampler::get_samples() Use the sampler's state setting to get a filtered RGBA value from the sampler's texture.

XXX we can implement many versions of this function, each tightly coded for a specific combination of sampler state (nearest + repeat), (bilinear mipmap + clamp), etc.

The update_samplers() function in st_atom_sampler.c could create a new tgsi_sampler object for each state combo it finds....

Definition at line 1039 of file sp_tex_sample.c.

References assert, pipe_sampler_state::normalized_coords, PIPE_TEXTURE_1D, PIPE_TEXTURE_2D, PIPE_TEXTURE_3D, PIPE_TEXTURE_CUBE, sp_get_samples_1d(), sp_get_samples_2d(), sp_get_samples_3d(), sp_get_samples_cube(), sp_get_samples_rect(), tgsi_sampler::state, pipe_texture::target, and tgsi_sampler::texture.

01045 {
01046    if (!sampler->texture)
01047       return;
01048 
01049    switch (sampler->texture->target) {
01050    case PIPE_TEXTURE_1D:
01051       assert(sampler->state->normalized_coords);
01052       sp_get_samples_1d(sampler, s, t, p, lodbias, rgba);
01053       break;
01054    case PIPE_TEXTURE_2D:
01055       if (sampler->state->normalized_coords)
01056          sp_get_samples_2d(sampler, s, t, p, lodbias, rgba);
01057       else
01058          sp_get_samples_rect(sampler, s, t, p, lodbias, rgba);
01059       break;
01060    case PIPE_TEXTURE_3D:
01061       assert(sampler->state->normalized_coords);
01062       sp_get_samples_3d(sampler, s, t, p, lodbias, rgba);
01063       break;
01064    case PIPE_TEXTURE_CUBE:
01065       assert(sampler->state->normalized_coords);
01066       sp_get_samples_cube(sampler, s, t, p, lodbias, rgba);
01067       break;
01068    default:
01069       assert(0);
01070    }
01071 
01072 #if 0 /* DEBUG */
01073    {
01074       int i;
01075       printf("Sampled at %f, %f, %f:\n", s[0], t[0], p[0]);
01076       for (i = 0; i < 4; i++) {
01077          printf("Frag %d: %f %f %f %f\n", i,
01078                 rgba[0][i],
01079                 rgba[1][i],
01080                 rgba[2][i],
01081                 rgba[3][i]);
01082       }
01083    }
01084 #endif
01085 }


Generated on Tue Sep 29 06:25:42 2009 for Gallium3D by  doxygen 1.5.4