b8ebe237c3
This reverts commit b7e836cee9
.
Change-Id: I3c39a928ba4a9a2863b616f2a500975294b03860
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355980
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
38 lines
661 B
Plaintext
38 lines
661 B
Plaintext
uniform float4 u1;
|
|
float index_by_literal() {
|
|
return u1[0];
|
|
}
|
|
|
|
uniform float4 u2;
|
|
float index_by_loop() {
|
|
float sum = 0;
|
|
for (int i = 0; i < 4; ++i) {
|
|
sum += u2[i];
|
|
}
|
|
return sum;
|
|
}
|
|
|
|
uniform float4 u3;
|
|
float index_by_complex_loop() {
|
|
float prod = 1;
|
|
for (int i = 0; i < 4; ++i) {
|
|
prod *= u3[i < 2 ? 0 : i];
|
|
}
|
|
return prod;
|
|
}
|
|
|
|
uniform float4 u4;
|
|
float index_clamped_out_of_bounds() {
|
|
for (int i = 7; i < 8; i++) {
|
|
return u4[i];
|
|
}
|
|
}
|
|
|
|
float4 main() {
|
|
return float4(
|
|
index_by_literal(),
|
|
index_by_loop(),
|
|
index_by_complex_loop(),
|
|
index_clamped_out_of_bounds());
|
|
}
|