summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorLepton Wu <[email protected]>2020-04-11 15:10:45 -0700
committerLepton Wu <[email protected]>2020-04-16 09:21:21 +0000
commit1c4f68b089b26918fff55196122309ac43e78e1b (patch)
treefc195a74ff3c82129c90a7497a3e9f7e665e8b0c /src/gallium
parentdcb1e8fef8ae60877a696a5bca337eba5475085d (diff)
virgl: Use ETC2 formats directly when possible.
Don't emulate them with uncompressed formats if the host support them since uncompressed formats like GL_R16 could be not available on GLES hosts. Signed-off-by: Lepton Wu <[email protected]> Reviewed-by: Gert Wollny <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/virgl/virgl_encode.c10
-rw-r--r--src/gallium/drivers/virgl/virgl_hw.h12
-rw-r--r--src/gallium/drivers/virgl/virgl_screen.c3
3 files changed, 25 insertions, 0 deletions
diff --git a/src/gallium/drivers/virgl/virgl_encode.c b/src/gallium/drivers/virgl/virgl_encode.c
index fa4e4c0d50e..6d71f5d6574 100644
--- a/src/gallium/drivers/virgl/virgl_encode.c
+++ b/src/gallium/drivers/virgl/virgl_encode.c
@@ -248,6 +248,16 @@ static const enum virgl_formats virgl_formats_conv_table[PIPE_FORMAT_COUNT] = {
CONV_FORMAT(R10G10B10X2_UNORM)
CONV_FORMAT(A4B4G4R4_UNORM)
CONV_FORMAT(R8_SRGB)
+ CONV_FORMAT(ETC2_RGB8)
+ CONV_FORMAT(ETC2_SRGB8)
+ CONV_FORMAT(ETC2_RGB8A1)
+ CONV_FORMAT(ETC2_SRGB8A1)
+ CONV_FORMAT(ETC2_RGBA8)
+ CONV_FORMAT(ETC2_SRGBA8)
+ CONV_FORMAT(ETC2_R11_UNORM)
+ CONV_FORMAT(ETC2_R11_SNORM)
+ CONV_FORMAT(ETC2_RG11_UNORM)
+ CONV_FORMAT(ETC2_RG11_SNORM)
};
enum virgl_formats pipe_to_virgl_format(enum pipe_format format)
diff --git a/src/gallium/drivers/virgl/virgl_hw.h b/src/gallium/drivers/virgl/virgl_hw.h
index cfa89e2e2aa..b2bed9165ef 100644
--- a/src/gallium/drivers/virgl/virgl_hw.h
+++ b/src/gallium/drivers/virgl/virgl_hw.h
@@ -280,6 +280,18 @@ enum virgl_formats {
VIRGL_FORMAT_BPTC_RGB_FLOAT = 257,
VIRGL_FORMAT_BPTC_RGB_UFLOAT = 258,
+ /* etc2 compressed */
+ VIRGL_FORMAT_ETC2_RGB8 = 269,
+ VIRGL_FORMAT_ETC2_SRGB8 = 270,
+ VIRGL_FORMAT_ETC2_RGB8A1 = 271,
+ VIRGL_FORMAT_ETC2_SRGB8A1 = 272,
+ VIRGL_FORMAT_ETC2_RGBA8 = 273,
+ VIRGL_FORMAT_ETC2_SRGBA8 = 274,
+ VIRGL_FORMAT_ETC2_R11_UNORM = 275,
+ VIRGL_FORMAT_ETC2_R11_SNORM = 276,
+ VIRGL_FORMAT_ETC2_RG11_UNORM = 277,
+ VIRGL_FORMAT_ETC2_RG11_SNORM = 278,
+
VIRGL_FORMAT_R10G10B10X2_UNORM = 308,
VIRGL_FORMAT_A4B4G4R4_UNORM = 311,
diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
index 869e25cc46c..235d4280104 100644
--- a/src/gallium/drivers/virgl/virgl_screen.c
+++ b/src/gallium/drivers/virgl/virgl_screen.c
@@ -759,6 +759,9 @@ virgl_is_format_supported( struct pipe_screen *screen,
if (format_desc->layout == UTIL_FORMAT_LAYOUT_BPTC) {
goto out_lookup;
}
+ if (format_desc->layout == UTIL_FORMAT_LAYOUT_ETC) {
+ goto out_lookup;
+ }
if (format == PIPE_FORMAT_R11G11B10_FLOAT) {
goto out_lookup;