* \return integer texture index
*/
static void
-wrap_nearest_repeat(const float s[4], unsigned size,
- int icoord[4])
+wrap_nearest_repeat(const float s[4], unsigned size, int icoord[4])
{
uint ch;
-
/* s limited to [0,1) */
/* i limited to [0,size-1] */
for (ch = 0; ch < 4; ch++) {
static void
-wrap_nearest_clamp(const float s[4], unsigned size,
- int icoord[4])
+wrap_nearest_clamp(const float s[4], unsigned size, int icoord[4])
{
uint ch;
/* s limited to [0,1] */
static void
-wrap_nearest_clamp_to_edge(const float s[4], unsigned size,
- int icoord[4])
+wrap_nearest_clamp_to_edge(const float s[4], unsigned size, int icoord[4])
{
uint ch;
/* s limited to [min,max] */
static void
-wrap_nearest_clamp_to_border(const float s[4], unsigned size,
- int icoord[4])
+wrap_nearest_clamp_to_border(const float s[4], unsigned size, int icoord[4])
{
uint ch;
/* s limited to [min,max] */
}
}
+
static void
-wrap_nearest_mirror_repeat(const float s[4], unsigned size,
- int icoord[4])
+wrap_nearest_mirror_repeat(const float s[4], unsigned size, int icoord[4])
{
uint ch;
const float min = 1.0F / (2.0F * size);
}
}
+
static void
-wrap_nearest_mirror_clamp(const float s[4], unsigned size,
- int icoord[4])
+wrap_nearest_mirror_clamp(const float s[4], unsigned size, int icoord[4])
{
uint ch;
for (ch = 0; ch < 4; ch++) {
}
}
+
static void
wrap_nearest_mirror_clamp_to_edge(const float s[4], unsigned size,
- int icoord[4])
+ int icoord[4])
{
uint ch;
/* s limited to [min,max] */
int icoord0[4], int icoord1[4], float w[4])
{
uint ch;
-
for (ch = 0; ch < 4; ch++) {
float u = s[ch] * size - 0.5F;
icoord0[ch] = REMAINDER(util_ifloor(u), size);
}
}
+
static void
wrap_linear_clamp(const float s[4], unsigned size,
int icoord0[4], int icoord1[4], float w[4])
}
}
+
static void
wrap_linear_clamp_to_edge(const float s[4], unsigned size,
int icoord0[4], int icoord1[4], float w[4])
}
}
+
static void
wrap_linear_clamp_to_border(const float s[4], unsigned size,
int icoord0[4], int icoord1[4], float w[4])
}
}
+
static void
wrap_linear_mirror_clamp(const float s[4], unsigned size,
int icoord0[4], int icoord1[4], float w[4])
}
}
+
static void
wrap_linear_mirror_clamp_to_edge(const float s[4], unsigned size,
int icoord0[4], int icoord1[4], float w[4])
}
}
+
static void
wrap_linear_mirror_clamp_to_border(const float s[4], unsigned size,
int icoord0[4], int icoord1[4], float w[4])
* Only a subset of wrap modes supported.
*/
static void
-wrap_nearest_unorm_clamp(const float s[4], unsigned size,
- int icoord[4])
+wrap_nearest_unorm_clamp(const float s[4], unsigned size, int icoord[4])
{
uint ch;
for (ch = 0; ch < 4; ch++) {
}
}
-/* Handles clamp_to_edge and clamp_to_border:
+
+/**
+ * Handles clamp_to_edge and clamp_to_border:
*/
static void
wrap_nearest_unorm_clamp_to_border(const float s[4], unsigned size,
- int icoord[4])
+ int icoord[4])
{
uint ch;
for (ch = 0; ch < 4; ch++) {
*/
static void
wrap_linear_unorm_clamp(const float s[4], unsigned size,
- int icoord0[4], int icoord1[4], float w[4])
+ int icoord0[4], int icoord1[4], float w[4])
{
uint ch;
for (ch = 0; ch < 4; ch++) {
}
}
+
static void
-wrap_linear_unorm_clamp_to_border( const float s[4], unsigned size,
- int icoord0[4], int icoord1[4], float w[4])
+wrap_linear_unorm_clamp_to_border(const float s[4], unsigned size,
+ int icoord0[4], int icoord1[4], float w[4])
{
uint ch;
for (ch = 0; ch < 4; ch++) {
-
-
/**
* Examine the quad's texture coordinates to compute the partial
* derivatives w.r.t X and Y, then compute lambda (level of detail).
return lambda;
}
+
static float
compute_lambda_2d(const struct sp_sampler_varient *samp,
const float s[QUAD_SIZE],
}
-
+/**
+ * Compute lambda for a vertex texture sampler.
+ * Since there aren't derivatives to use, just return the LOD bias.
+ */
static float
compute_lambda_vert(const struct sp_sampler_varient *samp,
const float s[QUAD_SIZE],
*/
static INLINE const float *
get_texel_3d_no_border(const struct sp_sampler_varient *samp,
- union tex_tile_address addr, int x, int y, int z)
+ union tex_tile_address addr, int x, int y, int z)
{
const struct softpipe_tex_cached_tile *tile;
static INLINE const float *
get_texel_3d(const struct sp_sampler_varient *samp,
- union tex_tile_address addr, int x, int y, int z )
+ union tex_tile_address addr, int x, int y, int z)
{
const struct pipe_texture *texture = samp->texture;
unsigned level = addr.bits.level;
*/
static INLINE void
img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler,
- const float s[QUAD_SIZE],
- const float t[QUAD_SIZE],
- const float p[QUAD_SIZE],
- float lodbias,
- float rgba[NUM_CHANNELS][QUAD_SIZE])
+ const float s[QUAD_SIZE],
+ const float t[QUAD_SIZE],
+ const float p[QUAD_SIZE],
+ float lodbias,
+ float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
unsigned j;
addr.value = 0;
addr.bits.level = samp->level;
-
for (j = 0; j < QUAD_SIZE; j++) {
int c;
/* Can we fetch all four at once:
*/
- if (x0 < xmax && y0 < ymax)
- {
+ if (x0 < xmax && y0 < ymax) {
get_texel_quad_2d_no_border_single_tile(samp, addr, x0, y0, tx);
}
- else
- {
+ else {
unsigned x1 = (x0 + 1) & (xpot - 1);
unsigned y1 = (y0 + 1) & (ypot - 1);
get_texel_quad_2d_no_border(samp, addr, x0, y0, x1, y1, tx);
}
-
/* interpolate R, G, B, A */
for (c = 0; c < 4; c++) {
rgba[c][j] = lerp_2d(xw, yw,
}
}
+
static void
img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler,
const float s[QUAD_SIZE],
}
}
-static inline union tex_tile_address face( union tex_tile_address addr,
- unsigned face )
+
+static inline union tex_tile_address
+face(union tex_tile_address addr, unsigned face )
{
addr.bits.face = face;
return addr;
}
+
static void
img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler,
- const float s[QUAD_SIZE],
- const float t[QUAD_SIZE],
- const float p[QUAD_SIZE],
- float lodbias,
- float rgba[NUM_CHANNELS][QUAD_SIZE])
+ const float s[QUAD_SIZE],
+ const float t[QUAD_SIZE],
+ const float p[QUAD_SIZE],
+ float lodbias,
+ float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
int x[4], y[4];
union tex_tile_address addr;
-
level0 = samp->level;
width = texture->width[level0];
height = texture->height[level0];
float xw[4]; /* weights */
union tex_tile_address addr;
-
level0 = samp->level;
width = texture->width[level0];
samp->linear_texcoord_s(s, width, x0, x1, xw);
-
for (j = 0; j < QUAD_SIZE; j++) {
const float *tx0 = get_texel_2d(samp, addr, x0[j], 0);
const float *tx1 = get_texel_2d(samp, addr, x1[j], 0);
float xw[4], yw[4]; /* weights */
union tex_tile_address addr;
-
level0 = samp->level;
width = texture->width[level0];
height = texture->height[level0];
static void
img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler,
- const float s[QUAD_SIZE],
- const float t[QUAD_SIZE],
- const float p[QUAD_SIZE],
- float lodbias,
- float rgba[NUM_CHANNELS][QUAD_SIZE])
+ const float s[QUAD_SIZE],
+ const float t[QUAD_SIZE],
+ const float p[QUAD_SIZE],
+ float lodbias,
+ float rgba[NUM_CHANNELS][QUAD_SIZE])
{
const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
float xw[4], yw[4]; /* weights */
union tex_tile_address addr;
-
level0 = samp->level;
width = texture->width[level0];
height = texture->height[level0];
}
-
-
-
-
-
static void
mip_filter_linear(struct tgsi_sampler *tgsi_sampler,
- const float s[QUAD_SIZE],
- const float t[QUAD_SIZE],
- const float p[QUAD_SIZE],
- float lodbias,
- float rgba[NUM_CHANNELS][QUAD_SIZE])
+ const float s[QUAD_SIZE],
+ const float t[QUAD_SIZE],
+ const float p[QUAD_SIZE],
+ float lodbias,
+ float rgba[NUM_CHANNELS][QUAD_SIZE])
{
struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler);
const struct pipe_texture *texture = samp->texture;
}
-
static void
mip_filter_nearest(struct tgsi_sampler *tgsi_sampler,
const float s[QUAD_SIZE],
-/* Specialized version of mip_filter_linear with hard-wired calls to
+/**
+ * Specialized version of mip_filter_linear with hard-wired calls to
* 2d lambda calculation and 2d_linear_repeat_POT img filters.
*/
static void
-/* Compare stage in the little sampling pipeline.
+/**
+ * Do shadow/depth comparisons.
*/
static void
sample_compare(struct tgsi_sampler *tgsi_sampler,
samp->mip_filter( tgsi_sampler, s, t, p, lodbias, rgba );
-
/**
* Compare texcoord 'p' (aka R) against texture value 'rgba[0]'
* When we sampled the depth texture, the depth value was put into all
}
}
-/* Calculate cube faces.
+
+/**
+ * Compute which cube face is referenced by each texcoord and put that
+ * info into the sampler faces[] array. Then sample the cube faces
*/
static void
sample_cube(struct tgsi_sampler *tgsi_sampler,
-
-static wrap_nearest_func get_nearest_unorm_wrap( unsigned mode )
+static wrap_nearest_func
+get_nearest_unorm_wrap(unsigned mode)
{
switch (mode) {
case PIPE_TEX_WRAP_CLAMP:
}
-static wrap_nearest_func get_nearest_wrap( unsigned mode )
+static wrap_nearest_func
+get_nearest_wrap(unsigned mode)
{
switch (mode) {
case PIPE_TEX_WRAP_REPEAT:
}
}
-static wrap_linear_func get_linear_unorm_wrap( unsigned mode )
+
+static wrap_linear_func
+get_linear_unorm_wrap(unsigned mode)
{
switch (mode) {
case PIPE_TEX_WRAP_CLAMP:
}
}
-static wrap_linear_func get_linear_wrap( unsigned mode )
+
+static wrap_linear_func
+get_linear_wrap(unsigned mode)
{
switch (mode) {
case PIPE_TEX_WRAP_REPEAT:
}
}
-static compute_lambda_func get_lambda_func( const union sp_sampler_key key )
+
+static compute_lambda_func
+get_lambda_func(const union sp_sampler_key key)
{
if (key.bits.processor == TGSI_PROCESSOR_VERTEX)
return compute_lambda_vert;
}
}
-static filter_func get_img_filter( const union sp_sampler_key key,
- unsigned filter,
- const struct pipe_sampler_state *sampler )
+
+static filter_func
+get_img_filter(const union sp_sampler_key key,
+ unsigned filter,
+ const struct pipe_sampler_state *sampler)
{
switch (key.bits.target) {
case PIPE_TEXTURE_1D:
}
-/* Create a sampler varient for a given set of non-orthogonal state. Currently the
+/**
+ * Create a sampler varient for a given set of non-orthogonal state.
*/
struct sp_sampler_varient *
sp_create_sampler_varient( const struct pipe_sampler_state *sampler,
return samp;
}
-
-
-
-
-
-