Commit 64b0f988 by gman@chromium.org

Add comments to ArrayBoundsClamper about why 'clamp'

was not used to do the bounds clamping. BUG=397 git-svn-id: https://angleproject.googlecode.com/svn/trunk@1720 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 688712c1
......@@ -25,6 +25,15 @@
#include "third_party/compiler/ArrayBoundsClamper.h"
// The built-in 'clamp' instruction only accepts floats and returns a float. I
// iterated a few times with our driver team who examined the output from our
// compiler - they said the multiple casts generates more code than a single
// function call. An inline ternary operator might have been better, but since
// the index value might be an expression itself, we'd have to make temporary
// variables to avoid evaluating the expression multiple times. And making
// temporary variables was difficult because ANGLE would then need to make more
// brutal changes to the expression tree.
const char* kIntClampBegin = "// BEGIN: Generated code for array bounds clamping\n\n";
const char* kIntClampEnd = "// END: Generated code for array bounds clamping\n\n";
const char* kIntClampDefinition = "int webgl_int_clamp(int value, int minValue, int maxValue) { return ((value < minValue) ? minValue : ((value > maxValue) ? maxValue : value)); }\n\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment