#include "texstore.h"
#include "macros.h"
#include "format_unpack.h"
+#include "util/format_srgb.h"
struct etc2_block {
_mesa_texstore_etc1_rgb8(TEXSTORE_PARAMS)
{
/* GL_ETC1_RGB8_OES is only valid in glCompressedTexImage2D */
- ASSERT(0);
+ assert(0);
return GL_FALSE;
}
/* Use same modifier tables as for etc1 textures if opaque bit is set
* or if non punchthrough texture format
*/
- block->modifier_tables[0] = (block->opaque || !punchthrough_alpha) ?
+ block->modifier_tables[0] = (!punchthrough_alpha || block->opaque) ?
etc1_modifier_tables[table1_idx] :
etc2_modifier_tables_non_opaque[table1_idx];
- block->modifier_tables[1] = (block->opaque || !punchthrough_alpha) ?
+ block->modifier_tables[1] = (!punchthrough_alpha || block->opaque) ?
etc1_modifier_tables[table2_idx] :
etc2_modifier_tables_non_opaque[table2_idx];
const unsigned h = MIN2(bh, height - y);
for (x = 0; x < width; x+= bw) {
- etc2_rgb8_parse_block(&block, src,
- false /* punchthrough_alpha */);
-
/*
* Destination texture may not be a multiple of four texels in
* width. Compute a safe width to avoid writing outside the texture.
*/
const unsigned w = MIN2(bw, width - x);
+ etc2_rgb8_parse_block(&block, src,
+ false /* punchthrough_alpha */);
+
for (j = 0; j < h; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
for (i = 0; i < w; i++) {
GLboolean
_mesa_texstore_etc2_rgb8(TEXSTORE_PARAMS)
{
- ASSERT(0);
+ assert(0);
return GL_FALSE;
}
GLboolean
_mesa_texstore_etc2_srgb8(TEXSTORE_PARAMS)
{
- ASSERT(0);
+ assert(0);
return GL_FALSE;
}
GLboolean
_mesa_texstore_etc2_rgba8_eac(TEXSTORE_PARAMS)
{
- ASSERT(0);
+ assert(0);
return GL_FALSE;
}
GLboolean
_mesa_texstore_etc2_srgb8_alpha8_eac(TEXSTORE_PARAMS)
{
- ASSERT(0);
+ assert(0);
return GL_FALSE;
}
GLboolean
_mesa_texstore_etc2_r11_eac(TEXSTORE_PARAMS)
{
- ASSERT(0);
+ assert(0);
return GL_FALSE;
}
GLboolean
_mesa_texstore_etc2_signed_r11_eac(TEXSTORE_PARAMS)
{
- ASSERT(0);
+ assert(0);
return GL_FALSE;
}
GLboolean
_mesa_texstore_etc2_rg11_eac(TEXSTORE_PARAMS)
{
- ASSERT(0);
+ assert(0);
return GL_FALSE;
}
GLboolean
_mesa_texstore_etc2_signed_rg11_eac(TEXSTORE_PARAMS)
{
- ASSERT(0);
+ assert(0);
return GL_FALSE;
}
GLboolean
_mesa_texstore_etc2_rgb8_punchthrough_alpha1(TEXSTORE_PARAMS)
{
- ASSERT(0);
+ assert(0);
return GL_FALSE;
}
GLboolean
_mesa_texstore_etc2_srgb8_punchthrough_alpha1(TEXSTORE_PARAMS)
{
- ASSERT(0);
+ assert(0);
return GL_FALSE;
}
etc2_rgb8_fetch_texel(&block, i % 4, j % 4, dst,
false /* punchthrough_alpha */);
- texel[RCOMP] = _mesa_nonlinear_to_linear(dst[0]);
- texel[GCOMP] = _mesa_nonlinear_to_linear(dst[1]);
- texel[BCOMP] = _mesa_nonlinear_to_linear(dst[2]);
+ texel[RCOMP] = util_format_srgb_8unorm_to_linear_float(dst[0]);
+ texel[GCOMP] = util_format_srgb_8unorm_to_linear_float(dst[1]);
+ texel[BCOMP] = util_format_srgb_8unorm_to_linear_float(dst[2]);
texel[ACOMP] = 1.0f;
}
etc2_rgba8_parse_block(&block, src);
etc2_rgba8_fetch_texel(&block, i % 4, j % 4, dst);
- texel[RCOMP] = _mesa_nonlinear_to_linear(dst[0]);
- texel[GCOMP] = _mesa_nonlinear_to_linear(dst[1]);
- texel[BCOMP] = _mesa_nonlinear_to_linear(dst[2]);
+ texel[RCOMP] = util_format_srgb_8unorm_to_linear_float(dst[0]);
+ texel[GCOMP] = util_format_srgb_8unorm_to_linear_float(dst[1]);
+ texel[BCOMP] = util_format_srgb_8unorm_to_linear_float(dst[2]);
texel[ACOMP] = UBYTE_TO_FLOAT(dst[3]);
}
true /* punchthrough alpha */);
etc2_rgb8_fetch_texel(&block, i % 4, j % 4, dst,
true /* punchthrough alpha */);
- texel[RCOMP] = _mesa_nonlinear_to_linear(dst[0]);
- texel[GCOMP] = _mesa_nonlinear_to_linear(dst[1]);
- texel[BCOMP] = _mesa_nonlinear_to_linear(dst[2]);
+ texel[RCOMP] = util_format_srgb_8unorm_to_linear_float(dst[0]);
+ texel[GCOMP] = util_format_srgb_8unorm_to_linear_float(dst[1]);
+ texel[BCOMP] = util_format_srgb_8unorm_to_linear_float(dst[2]);
texel[ACOMP] = UBYTE_TO_FLOAT(dst[3]);
}