summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2017-06-30 14:11:01 -0700
committerBrian Paul <[email protected]>2017-07-03 10:10:14 -0600
commit6158c0b5d8b6367a46acbe2fe20357210422c96f (patch)
treed42d43e845c2224c83d5c0975e6fc86c5dfbe351 /src/gallium
parente6d1cc31fa7a7252c07933a7e311fb0d8b331e12 (diff)
svga: don't call svga_texture_device_format_has_alpha() for PIPE_BUFFER
svga_texture_device_format_has_alpha() is only intended to work for texture resources, not buffer resources. This fixes a failed assertion in the svga_texture() cast function when running texture buffer tests. Also, add an assertion in svga_texture_device_format_has_alpha() to catch the issue sooner. Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/svga/svga_resource_texture.c3
-rw-r--r--src/gallium/drivers/svga/svga_shader.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c
index 84441d116dd..5a684b7933b 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -1539,6 +1539,9 @@ svga_texture_transfer_unmap_upload(struct svga_context *svga,
boolean
svga_texture_device_format_has_alpha(struct pipe_resource *texture)
{
+ /* the svga_texture() call below is invalid for PIPE_BUFFER resources */
+ assert(texture->target != PIPE_BUFFER);
+
enum svga3d_block_desc block_desc =
svga3dsurface_get_desc(svga_texture(texture)->key.format)->block_desc;
diff --git a/src/gallium/drivers/svga/svga_shader.c b/src/gallium/drivers/svga/svga_shader.c
index ef3b021d404..5ff6f034cf8 100644
--- a/src/gallium/drivers/svga/svga_shader.c
+++ b/src/gallium/drivers/svga/svga_shader.c
@@ -224,7 +224,8 @@ svga_init_shader_key_common(const struct svga_context *svga,
}
}
- swizzle_tab = (!util_format_has_alpha(view->format) &&
+ swizzle_tab = (view->texture->target != PIPE_BUFFER &&
+ !util_format_has_alpha(view->format) &&
svga_texture_device_format_has_alpha(view->texture)) ?
set_alpha : copy_alpha;