etnaviv: add ext_texture_srgb support

Following piglits are passing:
 - glean@texture_srgb
 - spec@ext_texture_srgb@fbo-srgb
 - spec@ext_texture_srgb@tex-srgb
 - spec@ext_texture_srgb@texwrap formats
 - spec@ext_texture_srgb@texwrap formats-s3tc

Btw. this enables GL 2.1 :-)

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
This commit is contained in:
Christian Gmeiner 2017-10-28 17:24:58 +02:00
parent 97e01adfd5
commit 0a23841a98
3 changed files with 10 additions and 1 deletions

View File

@ -165,6 +165,8 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
_T(B8G8R8A8_UNORM, A8R8G8B8, SWIZ(X, Y, Z, W), A8R8G8B8),
_T(B8G8R8X8_UNORM, X8R8G8B8, SWIZ(X, Y, Z, W), X8R8G8B8),
_T(B8G8R8A8_SRGB, A8R8G8B8, SWIZ(X, Y, Z, W), A8R8G8B8),
_T(B8G8R8X8_SRGB, X8R8G8B8, SWIZ(X, Y, Z, W), X8R8G8B8),
V_(R10G10B10A2_UNORM, UNSIGNED_INT_10_10_10_2, NONE),
V_(R10G10B10A2_SNORM, INT_10_10_10_2, NONE),
@ -225,8 +227,11 @@ static struct etna_format formats[PIPE_FORMAT_COUNT] = {
_T(ETC1_RGB8, ETC1, SWIZ(X, Y, Z, W), NONE),
_T(DXT1_RGB, DXT1, SWIZ(X, Y, Z, W), NONE),
_T(DXT1_SRGBA,DXT1, SWIZ(X, Y, Z, W), NONE),
_T(DXT1_RGBA, DXT1, SWIZ(X, Y, Z, W), NONE),
_T(DXT3_SRGBA,DXT2_DXT3, SWIZ(X, Y, Z, W), NONE),
_T(DXT3_RGBA, DXT2_DXT3, SWIZ(X, Y, Z, W), NONE),
_T(DXT5_SRGBA,DXT4_DXT5, SWIZ(X, Y, Z, W), NONE),
_T(DXT5_RGBA, DXT4_DXT5, SWIZ(X, Y, Z, W), NONE),
_T(ETC2_RGB8, EXT_NONE | EXT_FORMAT, SWIZ(X, Y, Z, W), NONE), /* Extd. format NONE doubles as ETC2_RGB8 */

View File

@ -482,6 +482,9 @@ gpu_supports_texure_format(struct etna_screen *screen, uint32_t fmt,
if (fmt >= TEXTURE_FORMAT_DXT1 && fmt <= TEXTURE_FORMAT_DXT4_DXT5)
supported = VIV_FEATURE(screen, chipFeatures, DXT_TEXTURE_COMPRESSION);
if (util_format_is_srgb(format))
supported = VIV_FEATURE(screen, chipMinorFeatures1, HALTI0);
if (fmt & EXT_FORMAT) {
supported = VIV_FEATURE(screen, chipMinorFeatures1, HALTI0);

View File

@ -236,7 +236,8 @@ etna_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
VIVS_TE_SAMPLER_SIZE_HEIGHT(res->base.height0);
sv->TE_SAMPLER_LOG_SIZE =
VIVS_TE_SAMPLER_LOG_SIZE_WIDTH(etna_log2_fixp55(res->base.width0)) |
VIVS_TE_SAMPLER_LOG_SIZE_HEIGHT(etna_log2_fixp55(res->base.height0));
VIVS_TE_SAMPLER_LOG_SIZE_HEIGHT(etna_log2_fixp55(res->base.height0)) |
COND(util_format_is_srgb(so->format), VIVS_TE_SAMPLER_LOG_SIZE_SRGB);
/* Set up levels-of-detail */
for (int lod = 0; lod <= res->base.last_level; ++lod) {