summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/common
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 05:04:28 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 05:04:28 +0000
commita6eb5232d2608cd0773bbe559757bd52c7f53670 (patch)
treea2ab7e129ab4a9105d70f067983bcd1c24bfa839 /gpu/command_buffer/common
parentc620060371fe1832017570351139046ff8205fb4 (diff)
downloadchromium_src-a6eb5232d2608cd0773bbe559757bd52c7f53670.zip
chromium_src-a6eb5232d2608cd0773bbe559757bd52c7f53670.tar.gz
chromium_src-a6eb5232d2608cd0773bbe559757bd52c7f53670.tar.bz2
Implements index validation for DrawElements.
(note: I also forgot to check in the changes to build_gles2_cmd_buffer.py from my last CL so that's in here as well) TEST=various unit tests BUG=26101 Review URL: http://codereview.chromium.org/668131 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40713 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/common')
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.h b/gpu/command_buffer/common/gles2_cmd_utils.h
index c5cd792..318d2d8 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.h
+++ b/gpu/command_buffer/common/gles2_cmd_utils.h
@@ -18,12 +18,13 @@ namespace gles2 {
// returns true.
template <typename T>
inline bool SafeMultiply(T a, T b, T* dst) {
- *dst = 0;
if (b == 0) {
+ *dst = 0;
return true;
}
T v = a * b;
if (v / b != a) {
+ *dst = 0;
return false;
}
*dst = v;
@@ -38,8 +39,8 @@ inline bool SafeMultiplyUint32(uint32 a, uint32 b, uint32* dst) {
// Does an add checking for overflow. If there was no overflow returns true.
template <typename T>
inline bool SafeAdd(T a, T b, T* dst) {
- *dst = 0;
if (a + b < a) {
+ *dst = 0;
return false;
}
*dst = a + b;