mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-25 05:01:24 +00:00
[qfcc] Construct matrices by vectors
SPIR-V requires that matrices are constructed from vectors rather than individual components. While not optimal, iqm.vert's output now passes spirv-val. Also probably still lots wrong with fine details.
This commit is contained in:
parent
f014d3f580
commit
14e39627cc
1 changed files with 15 additions and 1 deletions
|
@ -130,7 +130,21 @@ construct_by_components (const type_t *type, const expr_t *params,
|
|||
auto vec = new_expr ();
|
||||
vec->type = ex_vector;
|
||||
vec->vector.type = type;
|
||||
list_gather (&vec->vector.list, components, num_comp);
|
||||
if (is_matrix (type)) {
|
||||
const expr_t *columns[type_cols (type)];
|
||||
const expr_t **col = components;
|
||||
for (int i = 0; i < type_cols (type); i++) {
|
||||
auto c = new_expr ();
|
||||
c->type = ex_vector;
|
||||
c->vector.type = column_type (type);
|
||||
list_gather (&c->vector.list, col, type_rows (type));
|
||||
columns[i] = c;
|
||||
col += type_rows (type);
|
||||
}
|
||||
list_gather (&vec->vector.list, columns, type_cols (type));
|
||||
} else {
|
||||
list_gather (&vec->vector.list, components, num_comp);
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue