st_texture_release_all_sampler_views(st, stObj);
}
+bool
+st_astc_format_fallback(const struct st_context *st, mesa_format format)
+{
+ if (!_mesa_is_format_astc_2d(format))
+ return false;
+
+ if (format == MESA_FORMAT_RGBA_ASTC_5x5 ||
+ format == MESA_FORMAT_SRGB8_ALPHA8_ASTC_5x5)
+ return !st->has_astc_5x5_ldr;
+
+ return !st->has_astc_2d_ldr;
+}
bool
st_compressed_format_fallback(struct st_context *st, mesa_format format)
if (_mesa_is_format_etc2(format))
return !st->has_etc2;
- if (_mesa_is_format_astc_2d(format))
- return !st->has_astc_2d_ldr;
+ if (st_astc_format_fallback(st, format))
+ return true;
return false;
}
st->has_astc_2d_ldr =
screen->is_format_supported(screen, PIPE_FORMAT_ASTC_4x4_SRGB,
PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW);
+ st->has_astc_5x5_ldr =
+ screen->is_format_supported(screen, PIPE_FORMAT_ASTC_5x5_SRGB,
+ PIPE_TEXTURE_2D, 0, 0, PIPE_BIND_SAMPLER_VIEW);
st->prefer_blit_based_texture_transfer = screen->get_param(screen,
PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER);
st->force_persample_in_shader =
boolean has_etc1;
boolean has_etc2;
boolean has_astc_2d_ldr;
+ boolean has_astc_5x5_ldr;
boolean prefer_blit_based_texture_transfer;
boolean force_persample_in_shader;
boolean has_shareable_shaders;
}
}
- if (_mesa_is_format_astc_2d(mesaFormat) && !st->has_astc_2d_ldr) {
+ if (st_astc_format_fallback(st, mesaFormat)) {
if (_mesa_is_format_srgb(mesaFormat))
return PIPE_FORMAT_R8G8B8A8_SRGB;
else
void
st_destroy_bound_image_handles(struct st_context *st);
+bool
+st_astc_format_fallback(const struct st_context *st, mesa_format format);
+
bool
st_compressed_format_fallback(struct st_context *st, mesa_format format);
.has_etc1 = true,
.has_etc2 = true,
.has_astc_2d_ldr = true,
+ .has_astc_5x5_ldr = true,
};
struct st_context *st = &local_st;