It only returned one of two values.
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
* defaults it to on for ES contexts, so we can safely check it.
*/
const bool decode =
- ctx->Color.sRGBEnabled &&
- _mesa_get_format_color_encoding(rb->Format) == GL_SRGB;
+ ctx->Color.sRGBEnabled && _mesa_is_format_srgb(rb->Format);
_mesa_set_sampler_srgb_decode(ctx, fb_tex_blit.samp_obj,
decode ? GL_DECODE_EXT
return true;
}
- if (_mesa_get_format_color_encoding(baseImage->TexFormat) == GL_SRGB &&
+ if (_mesa_is_format_srgb(baseImage->TexFormat) &&
!ctx->Extensions.EXT_texture_sRGB_decode) {
/* The texture format is sRGB but we can't turn off sRGB->linear
* texture sample conversion. So we won't be able to generate the
if (ctx->Extensions.EXT_texture_sRGB_decode) {
const struct gl_texture_image *baseImage =
_mesa_select_tex_image(texObj, target, texObj->BaseLevel);
- const bool srgb =
- _mesa_get_format_color_encoding(baseImage->TexFormat) == GL_SRGB;
+ const bool srgb = _mesa_is_format_srgb(baseImage->TexFormat);
_mesa_set_sampler_srgb_decode(ctx, mipmap->samp_obj,
srgb ? GL_DECODE_EXT : GL_SKIP_DECODE_EXT);
green_bits = _mesa_get_format_bits(format, GL_GREEN_BITS);
blue_bits = _mesa_get_format_bits(format, GL_BLUE_BITS);
alpha_bits = _mesa_get_format_bits(format, GL_ALPHA_BITS);
- is_srgb = _mesa_get_format_color_encoding(format) == GL_SRGB;
+ is_srgb = _mesa_is_format_srgb(format);
num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * num_msaa_modes;
configs = calloc(num_modes + 1, sizeof *configs);
}
if (ctx->Color.sRGBEnabled &&
- _mesa_get_format_color_encoding(src_irb->mt->format) !=
- _mesa_get_format_color_encoding(dst_irb->mt->format)) {
+ _mesa_is_format_srgb(src_irb->mt->format) !=
+ _mesa_is_format_srgb(dst_irb->mt->format)) {
perf_debug("glBlitFramebuffer() with sRGB conversion cannot be "
"handled by BLT path.\n");
return mask;
}
else {
if (ctx->Extensions.EXT_sRGB) {
- *params =
- _mesa_get_format_color_encoding(att->Renderbuffer->Format);
+ *params = (_mesa_is_format_srgb(att->Renderbuffer->Format) ?
+ GL_SRGB : GL_LINEAR);
}
else {
/* According to ARB_framebuffer_sRGB, we should return LINEAR
}
}
-
-/**
- * Return color encoding for given format.
- * \return GL_LINEAR or GL_SRGB
- */
-GLenum
-_mesa_get_format_color_encoding(mesa_format format)
+bool
+_mesa_is_format_srgb(mesa_format format)
{
const struct mesa_format_info *info = _mesa_get_format_info(format);
- return info->IsSRGBFormat ? GL_SRGB : GL_LINEAR;
+ return info->IsSRGBFormat;
}
-
/**
* Return TRUE if format is an ETC2 compressed format specified
* by GL_ARB_ES3_compatibility.
bool
_mesa_is_format_color_format(mesa_format format);
-extern GLenum
-_mesa_get_format_color_encoding(mesa_format format);
+bool
+_mesa_is_format_srgb(mesa_format format);
extern uint32_t
_mesa_format_image_size(mesa_format format, int width,
fb->Visual.alphaBits = _mesa_get_format_bits(fmt, GL_ALPHA_BITS);
fb->Visual.rgbBits = fb->Visual.redBits
+ fb->Visual.greenBits + fb->Visual.blueBits;
- if (_mesa_get_format_color_encoding(fmt) == GL_SRGB)
+ if (_mesa_is_format_srgb(fmt))
fb->Visual.sRGBCapable = ctx->Extensions.EXT_sRGB;
break;
}
switch (_mesa_get_format_layout(m_format)) {
case MESA_FORMAT_LAYOUT_S3TC:
- if (_mesa_get_format_color_encoding(m_format) == GL_LINEAR) {
+ if (!_mesa_is_format_srgb(m_format)) {
return _mesa_has_EXT_texture_compression_s3tc(ctx);
} else {
return (_mesa_has_EXT_texture_sRGB(ctx) ||
mesa_format format)
{
assert(_mesa_is_format_astc_2d(format));
- bool srgb = _mesa_get_format_color_encoding(format) == GL_SRGB;
+ bool srgb = _mesa_is_format_srgb(format);
unsigned blk_w, blk_h;
_mesa_get_format_block_size(format, &blk_w, &blk_h);
}
if (_mesa_is_gles3(ctx)) {
- bool rb_is_srgb = false;
+ bool rb_is_srgb = (ctx->Extensions.EXT_sRGB &&
+ _mesa_is_format_srgb(rb->Format));
bool dst_is_srgb = false;
- if (ctx->Extensions.EXT_sRGB &&
- _mesa_get_format_color_encoding(rb->Format) == GL_SRGB) {
- rb_is_srgb = true;
- }
-
if (_mesa_get_linear_internalformat(internalFormat) != internalFormat) {
dst_is_srgb = true;
}
if (strb) {
if (strb->is_rtt || (strb->texture &&
- _mesa_get_format_color_encoding(strb->Base.Format) == GL_SRGB)) {
+ _mesa_is_format_srgb(strb->Base.Format))) {
/* rendering to a GL texture, may have to update surface */
st_update_renderbuffer_surface(st, strb);
}
* to determine if the rb is sRGB-capable.
*/
boolean enable_srgb = st->ctx->Color.sRGBEnabled &&
- _mesa_get_format_color_encoding(strb->Base.Format) == GL_SRGB;
+ _mesa_is_format_srgb(strb->Base.Format);
enum pipe_format format = resource->format;
if (strb->is_rtt) {
/* If the encoding is sRGB and sRGB rendering cannot be enabled,
* check for linear format support instead.
* Later when we create a surface, we change the format to a linear one. */
- if (!ctx->Extensions.EXT_sRGB &&
- _mesa_get_format_color_encoding(texFormat) == GL_SRGB) {
+ if (!ctx->Extensions.EXT_sRGB && _mesa_is_format_srgb(texFormat)) {
const mesa_format linearFormat = _mesa_get_srgb_format_linear(texFormat);
format = st_mesa_format_to_pipe_format(st_context(ctx), linearFormat);
}
mesa_format mesa_format;
for (mesa_format = 1; mesa_format < MESA_FORMAT_COUNT; mesa_format++) {
- if (_mesa_get_format_color_encoding(mesa_format) == GL_SRGB) {
+ if (_mesa_is_format_srgb(mesa_format)) {
continue;
}
if (_mesa_get_format_bits(mesa_format, GL_TEXTURE_INTENSITY_SIZE) > 0) {