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>
This commit is contained in:
Brian Paul
2017-11-14 09:34:29 -07:00
parent 45517f492b
commit 767c1eb436

View File

@@ -209,18 +209,17 @@ svga_init_shader_key_common(const struct svga_context *svga,
assert(view->texture->target < (1 << 4)); /* texture_target:4 */ assert(view->texture->target < (1 << 4)); /* texture_target:4 */
/* 1D/2D array textures with one slice are treated as non-arrays /* 1D/2D array textures with one slice are treated as non-arrays
* by the SVGA3D device. Convert the texture type here so that * by the SVGA3D device. Set the is_array flag only if we know that
* we emit the right TEX/SAMPLE instruction in the shader. * 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 || switch (view->texture->target) {
view->texture->target == PIPE_TEXTURE_2D_ARRAY) { case PIPE_TEXTURE_1D_ARRAY:
if (view->texture->array_size == 1) { case PIPE_TEXTURE_2D_ARRAY:
key->tex[i].is_array = 0; key->tex[i].is_array = view->texture->array_size > 1;
} break;
else { default:
assert(view->texture->array_size > 1); ; /* nothing / silence compiler warning */
key->tex[i].is_array = 1;
}
} }
assert(view->texture->nr_samples < (1 << 5)); /* 5-bit field */ assert(view->texture->nr_samples < (1 << 5)); /* 5-bit field */