diff options
author | Brian <[email protected]> | 2007-10-13 11:11:11 -0600 |
---|---|---|
committer | Brian <[email protected]> | 2007-10-13 11:11:11 -0600 |
commit | d75acc8ffa47dbd85d864b2f6ab028652e45044d (patch) | |
tree | 4c3af84199b9af42e748d9547f15d0290736e135 /src/mesa/pipe/softpipe | |
parent | eb389aaf720a08045bc2492dd6cf50f1a2e44e87 (diff) |
Check texture format in get_texel() to handle depth textures.
Diffstat (limited to 'src/mesa/pipe/softpipe')
-rw-r--r-- | src/mesa/pipe/softpipe/sp_tex_sample.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/mesa/pipe/softpipe/sp_tex_sample.c b/src/mesa/pipe/softpipe/sp_tex_sample.c index b89adf84805..aab26f0b0e8 100644 --- a/src/mesa/pipe/softpipe/sp_tex_sample.c +++ b/src/mesa/pipe/softpipe/sp_tex_sample.c @@ -606,10 +606,23 @@ get_texel(struct tgsi_sampler *sampler, /* get the texel from cache entry */ tx = x % TEX_CACHE_TILE_SIZE; ty = y % TEX_CACHE_TILE_SIZE; - rgba[0][j] = sampler->cache[entry].data[ty][tx][0]; - rgba[1][j] = sampler->cache[entry].data[ty][tx][1]; - rgba[2][j] = sampler->cache[entry].data[ty][tx][2]; - rgba[3][j] = sampler->cache[entry].data[ty][tx][3]; + if (sampler->texture->format == PIPE_FORMAT_U_Z16 || + sampler->texture->format == PIPE_FORMAT_U_Z32 || + sampler->texture->format == PIPE_FORMAT_S8_Z24) { + /* get_tile() returned one float per texel */ + float *src = (float *) sampler->cache[entry].data; + rgba[0][j] = + rgba[1][j] = + rgba[2][j] = + rgba[3][j] = src[ty * TEX_CACHE_TILE_SIZE + tx]; + } + else { + /* get_tile() returned four floats per texel */ + rgba[0][j] = sampler->cache[entry].data[ty][tx][0]; + rgba[1][j] = sampler->cache[entry].data[ty][tx][1]; + rgba[2][j] = sampler->cache[entry].data[ty][tx][2]; + rgba[3][j] = sampler->cache[entry].data[ty][tx][3]; + } } |