diff options
author | Thomas Hellstrom <[email protected]> | 2017-05-30 15:51:06 +0200 |
---|---|---|
committer | Thomas Hellstrom <[email protected]> | 2017-06-07 19:43:54 +0200 |
commit | df4d6003dc75395f8ded57fdf59046f0d008eea3 (patch) | |
tree | 51a33d450ef26838b0352defdce6bf1938a4dc08 /src/gallium/drivers/svga/svga_resource_texture.c | |
parent | c2138a066cf75491e45df53cd799feb23027dae0 (diff) |
svga: Fix imported surface view creation
When deciding to create a view with or without an alpha channel we need to
look at the SVGA3D format and not the PIPE format.
This fixes the glx-tfp piglit test for dri3/xa.
Signed-off-by: Thomas Hellstrom <[email protected]>
Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_resource_texture.c')
-rw-r--r-- | src/gallium/drivers/svga/svga_resource_texture.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index 356e7c54d9d..39e11d3a616 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -1488,3 +1488,25 @@ svga_texture_transfer_unmap_upload(struct svga_context *svga, pipe_resource_reference(&st->upload.buf, NULL); } + +/** + * Does the device format backing this surface have an + * alpha channel? + * + * \param texture[in] The texture whose format we're querying + * \return TRUE if the format has an alpha channel, FALSE otherwise + * + * For locally created textures, the device (svga) format is typically + * identical to svga_format(texture->format), and we can use the gallium + * format tests to determine whether the device format has an alpha channel + * or not. However, for textures backed by imported svga surfaces that is + * not always true, and we have to look at the SVGA3D utilities. + */ +boolean +svga_texture_device_format_has_alpha(struct pipe_resource *texture) +{ + enum svga3d_block_desc block_desc = + svga3dsurface_get_desc(svga_texture(texture)->key.format)->block_desc; + + return !!(block_desc & SVGA3DBLOCKDESC_ALPHA); +} |