The pipe_sampler_view::format field should be prefered over the resource/
texture format. The former is used to override the texture format for
sRGB decode enable/disable, etc.
Also, use new util_format_is_srgb() helper to catch all sRGB formats.
This fixes the piglit tex-srgb test for GL_EXT_texture_sRGB_decode.
#include "util/u_inlines.h"
#include "pipe/p_defines.h"
+#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "tgsi/tgsi_parse.h"
if (!views[i])
continue;
- if (views[i]->texture->format == PIPE_FORMAT_B8G8R8A8_SRGB)
+ if (util_format_is_srgb(views[i]->format))
flag_srgb |= 1 << i;
if (views[i]->texture->target == PIPE_TEXTURE_1D)