vrend: do not proble for compressed formats

Not all compressed formats can be uploaded using glTexImage2D, that
only works if the extension provides an online texture-compressor. For
instance, EXT_texture_compression_s3tc only requires an online
compressor in the desktop version.

This test isn't really a test for the presence of an online-compressor,
this code is meant to test if we can render from it. But calling
glCompressedTexImage2D requires us to provide a valid compressed
payload, which is really awkward to maintain.

So let's instead just check for extensions to decide if these formats
are renderable or not.

Also, none of these compressed formats can be rendered to, so there's
no point in even testing for that.

Combined with a commit in mesa that enables EXT_texture_compression_s3tc
on GLES 2.0, this makes these dEQP-tests go from NotSupported to Pass
on i965:

- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_invalid_target
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_neg_level_cube
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_level_max_tex2d
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_level_max_cube
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_neg_offset
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_offset_allowed
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_neg_wdt_hgt
- dEQP-GLES2.functional.negative_api.texture.compressedtexsubimage2d_invalid_size

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Erik Faye-Lund 6 years ago committed by Dave Airlie
parent 298059b97e
commit e44ef7de64
  1. 31
      src/vrend_formats.c

@ -308,6 +308,37 @@ static void vrend_add_formats(struct vrend_format_table *table, int num_entries)
glBindTexture(GL_TEXTURE_2D, tex_id);
glBindFramebuffer(GL_FRAMEBUFFER, fb_id);
/* we can't probe compressed formats, as we'd need valid payloads to
* glCompressedTexImage2D. Let's just check for extensions instead.
*/
const struct util_format_description *desc = util_format_description(table[i].format);
switch (desc->layout) {
case UTIL_FORMAT_LAYOUT_S3TC:
if (epoxy_has_gl_extension("GL_EXT_texture_compression_s3tc"))
vrend_insert_format(&table[i], VIRGL_BIND_SAMPLER_VIEW);
continue;
case UTIL_FORMAT_LAYOUT_RGTC:
if (epoxy_has_gl_extension("GL_ARB_texture_compression_rgtc") ||
epoxy_has_gl_extension("GL_EXT_texture_compression_rgtc") )
vrend_insert_format(&table[i], VIRGL_BIND_SAMPLER_VIEW);
continue;
case UTIL_FORMAT_LAYOUT_ETC:
if (epoxy_has_gl_extension("GL_OES_compressed_ETC1_RGB8_texture"))
vrend_insert_format(&table[i], VIRGL_BIND_SAMPLER_VIEW);
continue;
case UTIL_FORMAT_LAYOUT_BPTC:
if (epoxy_has_gl_extension("GL_ARB_texture_compression_bptc") ||
epoxy_has_gl_extension("GL_EXT_texture_compression_bptc"))
vrend_insert_format(&table[i], VIRGL_BIND_SAMPLER_VIEW);
continue;
default:
;/* do logic below */
}
glTexImage2D(GL_TEXTURE_2D, 0, table[i].internalformat, 32, 32, 0, table[i].glformat, table[i].gltype, NULL);
status = glGetError();
if (status == GL_INVALID_VALUE || status == GL_INVALID_ENUM || status == GL_INVALID_OPERATION) {

Loading…
Cancel
Save