summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-01-20 08:51:07 -0700
committerBrian Paul <[email protected]>2011-01-20 08:56:36 -0700
commit7330f8b2bc88458f3ad1704248c8e35c5f1d1ea4 (patch)
treeca4934a771476813b1016a221c9a9ad48da18110 /src
parent751fe9058bc15f4f8608f0fdc02209542991ff23 (diff)
st/mesa: clean up the sampler view format code
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index eb8bbeb853f..fd03669e660 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -218,22 +218,29 @@ update_textures(struct st_context *st)
continue;
}
+ /* Determine the format of the texture sampler view */
st_view_format = stObj->pt->format;
{
- struct st_texture_image *firstImage;
- enum pipe_format firstImageFormat;
- firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]);
+ const struct st_texture_image *firstImage =
+ st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]);
+ const gl_format texFormat = firstImage->base.TexFormat;
+ enum pipe_format firstImageFormat =
+ st_mesa_format_to_pipe_format(texFormat);
- firstImageFormat = st_mesa_format_to_pipe_format(firstImage->base.TexFormat);
if ((stObj->base.sRGBDecode == GL_SKIP_DECODE_EXT) &&
- (_mesa_get_format_color_encoding(firstImage->base.TexFormat) == GL_SRGB)) {
- firstImageFormat = st_mesa_format_to_pipe_format(_mesa_get_srgb_format_linear(firstImage->base.TexFormat));
+ (_mesa_get_format_color_encoding(texFormat) == GL_SRGB)) {
+ /* don't do sRGB->RGB conversion. Interpret the texture
+ * texture data as linear values.
+ */
+ const gl_format linearFormat =
+ _mesa_get_srgb_format_linear(texFormat);
+ firstImageFormat = st_mesa_format_to_pipe_format(linearFormat);
}
if (firstImageFormat != stObj->pt->format)
st_view_format = firstImageFormat;
-
}
+
st->state.num_textures = su + 1;
/* if sampler view has changed dereference it */