I don't know of any hardware which supports it.
With this, GL_OES_compressed_ETC1_RGB8_texture is supported if RGBA8
is supported.
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
<li>GL_ARB_fragment_layer_viewport on nv50, nvc0, llvmpipe, r600</li>
<li>GL_AMD_vertex_shader_viewport_index on i965/gen7+, r600</li>
<li>GL_ARB_clear_texture on i965</li>
+<li>GL_OES_compressed_ETC1_RGB8_texture on nv30, nv50, nvc0, r300, r600, radeonsi, softpipe, llvmpipe</li>
<li>A new software rasterizer driver (kms_swrast_dri.so) that works with
DRM drivers that don't have a full-fledged GEM (such as qxl or simpledrm)</li>
</ul>
map = st_texture_image_map(st, stImage, pipeMode, x, y, slice, w, h, 1,
&transfer);
if (map) {
- if (_mesa_is_format_etc2(texImage->TexFormat)) {
+ if (_mesa_is_format_etc2(texImage->TexFormat) ||
+ (texImage->TexFormat == MESA_FORMAT_ETC1_RGB8 && !st->has_etc1)) {
/* ETC isn't supported by gallium and it's represented
* by uncompressed formats. Only write transfers with precompressed
* data are supported by ES3, which makes this really simple.
struct st_context *st = st_context(ctx);
struct st_texture_image *stImage = st_texture_image(texImage);
- if (_mesa_is_format_etc2(texImage->TexFormat)) {
+ if (_mesa_is_format_etc2(texImage->TexFormat) ||
+ (texImage->TexFormat == MESA_FORMAT_ETC1_RGB8 && !st->has_etc1)) {
/* Decompress the ETC texture to the mapped one. */
unsigned z = slice + stImage->base.Face;
struct st_texture_image_transfer *itransfer = &stImage->transfer[z];
assert(z == transfer->box.z);
- _mesa_unpack_etc2_format(itransfer->map, transfer->stride,
- itransfer->temp_data, itransfer->temp_stride,
- transfer->box.width, transfer->box.height,
- texImage->TexFormat);
+ if (texImage->TexFormat == MESA_FORMAT_ETC1_RGB8) {
+ _mesa_etc1_unpack_rgba8888(itransfer->map, transfer->stride,
+ itransfer->temp_data,
+ itransfer->temp_stride,
+ transfer->box.width, transfer->box.height);
+ }
+ else {
+ _mesa_unpack_etc2_format(itransfer->map, transfer->stride,
+ itransfer->temp_data, itransfer->temp_stride,
+ transfer->box.width, transfer->box.height,
+ texImage->TexFormat);
+ }
free(itransfer->temp_data);
itransfer->temp_data = NULL;
unsigned bind;
GLubyte *map;
- assert(!_mesa_is_format_etc2(texImage->TexFormat));
+ assert(!_mesa_is_format_etc2(texImage->TexFormat) &&
+ texImage->TexFormat != MESA_FORMAT_ETC1_RGB8);
if (!st->prefer_blit_based_texture_transfer) {
goto fallback;
ubyte *map = NULL;
boolean done = FALSE;
- assert(!_mesa_is_format_etc2(texImage->TexFormat));
+ assert(!_mesa_is_format_etc2(texImage->TexFormat) &&
+ texImage->TexFormat != MESA_FORMAT_ETC1_RGB8);
if (!st->prefer_blit_based_texture_transfer &&
!_mesa_is_format_compressed(texImage->TexFormat)) {
unsigned bind;
GLint srcY0, srcY1;
- assert(!_mesa_is_format_etc2(texImage->TexFormat));
+ assert(!_mesa_is_format_etc2(texImage->TexFormat) &&
+ texImage->TexFormat != MESA_FORMAT_ETC1_RGB8);
if (!strb || !strb->surface || !stImage->pt) {
debug_printf("%s: null strb or stImage\n", __FUNCTION__);
st->has_stencil_export =
screen->get_param(screen, PIPE_CAP_SHADER_STENCIL_EXPORT);
st->has_shader_model3 = screen->get_param(screen, PIPE_CAP_SM3);
+ st->has_etc1 = screen->is_format_supported(screen, PIPE_FORMAT_ETC1_RGB8,
+ PIPE_TEXTURE_2D, 0,
+ PIPE_BIND_SAMPLER_VIEW);
st->prefer_blit_based_texture_transfer = screen->get_param(screen,
PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER);
boolean has_stencil_export; /**< can do shader stencil export? */
boolean has_time_elapsed;
boolean has_shader_model3;
+ boolean has_etc1;
boolean prefer_blit_based_texture_transfer;
boolean needs_texcoord_semantic;
GL_TRUE }, /* at least one format must be supported */
{ { o(OES_compressed_ETC1_RGB8_texture) },
- { PIPE_FORMAT_ETC1_RGB8 } },
+ { PIPE_FORMAT_ETC1_RGB8,
+ PIPE_FORMAT_R8G8B8A8_UNORM },
+ GL_TRUE }, /* at least one format must be supported */
{ { o(ARB_stencil_texturing) },
{ PIPE_FORMAT_X24S8_UINT,
case MESA_FORMAT_LA_LATC2_SNORM:
return PIPE_FORMAT_LATC2_SNORM;
+ /* The destination RGBA format mustn't be changed, because it's also
+ * a destination format of the unpack/decompression function. */
case MESA_FORMAT_ETC1_RGB8:
- return PIPE_FORMAT_ETC1_RGB8;
+ return st->has_etc1 ? PIPE_FORMAT_ETC1_RGB8 : PIPE_FORMAT_R8G8B8A8_UNORM;
/* signed normalized formats */
case MESA_FORMAT_R_SNORM8:
/* test all Mesa formats */
for (i = 1; i < MESA_FORMAT_COUNT; i++) {
- /* ETC2 formats are translated differently, skip them. */
+ /* ETC formats are translated differently, skip them. */
if (_mesa_is_format_etc2(i))
continue;
+ if (i == MESA_FORMAT_ETC1_RGB8 && !st->has_etc1)
+ continue;
enum pipe_format pf = st_mesa_format_to_pipe_format(st, i);
if (pf != PIPE_FORMAT_NONE) {
/* Test all Gallium formats */
for (i = 1; i < PIPE_FORMAT_COUNT; i++) {
mesa_format mf = st_pipe_format_to_mesa_format(i);
+
+ /* ETC formats are translated differently, skip them. */
+ if (i == PIPE_FORMAT_ETC1_RGB8 && !st->has_etc1)
+ continue;
+
if (mf != MESA_FORMAT_NONE) {
enum pipe_format pf = st_mesa_format_to_pipe_format(st, mf);
assert(pf == i);