zink: generically handle matrix types

there's a bunch of glsl 1.10 tests for this

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6268>
This commit is contained in:
Mike Blumenkrantz 2020-06-23 14:50:37 -04:00 committed by Marge Bot
parent 2c5c55e72a
commit 9005c9cae4
3 changed files with 19 additions and 0 deletions

View File

@ -285,6 +285,12 @@ get_glsl_type(struct ntv_context *ctx, const struct glsl_type *type)
return ret;
}
if (glsl_type_is_matrix(type))
return spirv_builder_type_matrix(&ctx->builder,
spirv_builder_type_vector(&ctx->builder,
get_glsl_basetype(ctx, glsl_get_base_type(type)),
glsl_get_vector_elements(type)),
glsl_get_matrix_columns(type));
unreachable("we shouldn't get here, I think...");
}

View File

@ -915,6 +915,15 @@ spirv_builder_type_vector(struct spirv_builder *b, SpvId component_type,
return get_type_def(b, SpvOpTypeVector, args, ARRAY_SIZE(args));
}
SpvId
spirv_builder_type_matrix(struct spirv_builder *b, SpvId component_type,
unsigned component_count)
{
assert(component_count > 1);
uint32_t args[] = { component_type, component_count };
return get_type_def(b, SpvOpTypeMatrix, args, ARRAY_SIZE(args));
}
SpvId
spirv_builder_type_array(struct spirv_builder *b, SpvId component_type,
SpvId length)

View File

@ -301,6 +301,10 @@ SpvId
spirv_builder_type_vector(struct spirv_builder *b, SpvId component_type,
unsigned component_count);
SpvId
spirv_builder_type_matrix(struct spirv_builder *b, SpvId component_type,
unsigned component_count);
SpvId
spirv_builder_type_array(struct spirv_builder *b, SpvId component_type,
SpvId length);