skia2/resources/sksl/errors/MatrixInlinedIndexOutOfRange.sksl
John Stiles d92f9c2f8d Add tests for matrix constant-expressions.
We should support constant-expressions involving matrices (GLSL ES2
does, WebGL does). We currently don't. We do properly report out-of-
range indexing, but we don't optimize away valid matrix index
expressions or allow matrices to be indexed in a constant-expression
context.

Change-Id: If58aa4c5f15abef421a412957072f3617b4176df
Bug: skia:12472
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469818
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-11-10 20:59:36 +00:00

14 lines
319 B
Plaintext

uniform half4 colorGreen, colorRed;
const float3x3 values = float3x3(1);
inline float3 indexMatrix(int index) {
return values[index];
}
half4 main(float2 coords) {
float3 ok = indexMatrix(0) + indexMatrix(1) + indexMatrix(2);
float3 undefined = indexMatrix(-1) + indexMatrix(3);
return colorGreen;
}