summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2017-11-14 09:36:23 -0700
committerBrian Paul <brianp@vmware.com>2018-09-10 13:07:30 -0600
commitafacde35531b74ccb250c65d298678b6993a339d (patch)
tree4ca19f029abeaec6537d9c259bf866f60ac11a63 /src/gallium/drivers
parent767c1eb43686ef6bebf7ebc99c4cef9c6f58d4af (diff)
svga: fix 1-element cube map array issue
As with 1D and 2D array textures, if there's only one array element (one cubemap in this case) we have to issue different shader code. This fixes a number of Piglit cubemap array tests. Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/svga/svga_shader.c12
-rw-r--r--src/gallium/drivers/svga/svga_tgsi_vgpu10.c3
2 files changed, 10 insertions, 5 deletions
diff --git a/src/gallium/drivers/svga/svga_shader.c b/src/gallium/drivers/svga/svga_shader.c
index ebf1131d51d..1eb8b229747 100644
--- a/src/gallium/drivers/svga/svga_shader.c
+++ b/src/gallium/drivers/svga/svga_shader.c
@@ -208,16 +208,20 @@ svga_init_shader_key_common(const struct svga_context *svga,
assert(view->texture);
assert(view->texture->target < (1 << 4)); /* texture_target:4 */
- /* 1D/2D array textures with one slice are treated as non-arrays
- * by the SVGA3D device. Set the is_array flag only if we know that
- * we have more than 1 element. This will be used to select shader
- * instruction/resource types during shader translation.
+ /* 1D/2D array textures with one slice and cube map array textures
+ * with one cube are treated as non-arrays by the SVGA3D device.
+ * Set the is_array flag only if we know that we have more than 1
+ * element. This will be used to select shader instruction/resource
+ * types during shader translation.
*/
switch (view->texture->target) {
case PIPE_TEXTURE_1D_ARRAY:
case PIPE_TEXTURE_2D_ARRAY:
key->tex[i].is_array = view->texture->array_size > 1;
break;
+ case PIPE_TEXTURE_CUBE_ARRAY:
+ key->tex[i].is_array = view->texture->array_size > 6;
+ break;
default:
; /* nothing / silence compiler warning */
}
diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
index 03ea67cad65..85074187155 100644
--- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
+++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c
@@ -3197,7 +3197,8 @@ tgsi_texture_to_resource_dimension(enum tgsi_texture_type target,
: VGPU10_RESOURCE_DIMENSION_TEXTURE2DMS;
case TGSI_TEXTURE_CUBE_ARRAY:
case TGSI_TEXTURE_SHADOWCUBE_ARRAY:
- return VGPU10_RESOURCE_DIMENSION_TEXTURECUBEARRAY;
+ return is_array ? VGPU10_RESOURCE_DIMENSION_TEXTURECUBEARRAY
+ : VGPU10_RESOURCE_DIMENSION_TEXTURECUBE;
default:
assert(!"Unexpected resource type");
return VGPU10_RESOURCE_DIMENSION_TEXTURE2D;