summaryrefslogtreecommitdiffstats
path: root/src/glsl/ast_expr.cpp
diff options
context:
space:
mode:
authorMartin Peres <[email protected]>2015-05-26 15:32:21 +0300
committerMartin Peres <[email protected]>2015-06-11 14:04:29 +0300
commit5b61cb12366f65a5d7e21b47fa3501a03fd884ee (patch)
treef6249f21f24706cae4170c9919e02a02d7e6ce4e /src/glsl/ast_expr.cpp
parent83624c141d3568217190933945c3243913e7ba2c (diff)
glsl: fix constructing a vector from a matrix
Without this patch, the following constructs (not an extensive list) would crash mesa: - mat2 foo = mat2(1); vec4 bar = vec4(foo); - mat3 foo = mat3(1); vec4 bar = vec4(foo); - mat3 foo = mat3(1); ivec4 bar = ivec4(foo); The first case is explicitely allowed by the GLSL spec, as seen on page 101 of the GLSL 4.40 spec: "vec4(mat2) // the vec4 is column 0 followed by column 1" The other cases are implicitely allowed also. The actual changes are quite minimal. We first split each column of the matrix to a list of vectors and then use them to initialize the vector. An additional check to make sure that we are not trying to copy 0 elements of a vector fix the (i)vec4(mat3) case as the last vector (3rd column) is not needed at all. Reviewed-by: Tapani Pälli <[email protected]> Signed-off-by: Martin Peres <[email protected]>
Diffstat (limited to 'src/glsl/ast_expr.cpp')
0 files changed, 0 insertions, 0 deletions