summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2017-11-14 09:34:29 -0700
committerBrian Paul <brianp@vmware.com>2018-09-10 13:07:30 -0600
commit767c1eb43686ef6bebf7ebc99c4cef9c6f58d4af (patch)
tree2aec83725670a395d888d446e6823effdb2c188c /src/gallium
parent45517f492b461df1e536c254c5f7e0fbb9295c53 (diff)
svga: simplify array test in svga_init_shader_key_common()
And squash commit a patch to silence a compiler warning (add default case to the switch statement). Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/svga/svga_shader.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/gallium/drivers/svga/svga_shader.c b/src/gallium/drivers/svga/svga_shader.c
index e16842f2358..ebf1131d51d 100644
--- a/src/gallium/drivers/svga/svga_shader.c
+++ b/src/gallium/drivers/svga/svga_shader.c
@@ -209,18 +209,17 @@ svga_init_shader_key_common(const struct svga_context *svga,
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. Convert the texture type here so that
- * we emit the right TEX/SAMPLE instruction in the shader.
+ * 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.
*/
- if (view->texture->target == PIPE_TEXTURE_1D_ARRAY ||
- view->texture->target == PIPE_TEXTURE_2D_ARRAY) {
- if (view->texture->array_size == 1) {
- key->tex[i].is_array = 0;
- }
- else {
- assert(view->texture->array_size > 1);
- key->tex[i].is_array = 1;
- }
+ 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;
+ default:
+ ; /* nothing / silence compiler warning */
}
assert(view->texture->nr_samples < (1 << 5)); /* 5-bit field */