Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Unified Diff: gpu/command_buffer/common/gles2_cmd_utils.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/common/gles2_cmd_utils.cc
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc
index 6b34f3926164bc760acda7ccfbf0d83a7bfcd36b..0c2f493c6e63592321dd41f5167d6ca7834282f5 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -9,7 +9,9 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <GLES2/gl2extchromium.h>
+#include <GLES3/gl3.h>
+#include "base/numerics/safe_math.h"
#include "gpu/command_buffer/common/gles2_cmd_format.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
@@ -360,6 +362,7 @@ int ElementsPerGroup(int format, int type) {
case GL_SRGB_EXT:
return 3;
case GL_LUMINANCE_ALPHA:
+ case GL_RG_EXT:
return 2;
case GL_RGBA:
case GL_BGRA_EXT:
@@ -373,6 +376,7 @@ int ElementsPerGroup(int format, int type) {
case GL_DEPTH_COMPONENT16:
case GL_DEPTH24_STENCIL8_OES:
case GL_DEPTH_STENCIL_OES:
+ case GL_RED_EXT:
return 1;
default:
return 0;
@@ -704,6 +708,10 @@ uint32 GLES2Util::GetChannelsForFormat(int format) {
case GL_DEPTH_STENCIL_OES:
case GL_DEPTH24_STENCIL8_OES:
return kDepth | kStencil;
+ case GL_RED_EXT:
+ return kRed;
+ case GL_RG_EXT:
+ return kRed | kGreen;
default:
return 0x0000;
}
@@ -770,7 +778,7 @@ bool GLES2Util::ParseUniformName(
bool* getting_array) {
bool getting_array_location = false;
size_t open_pos = std::string::npos;
- int index = 0;
+ base::CheckedNumeric<int> index = 0;
if (name[name.size() - 1] == ']') {
if (name.size() < 3) {
return false;
@@ -788,10 +796,13 @@ bool GLES2Util::ParseUniformName(
}
index = index * 10 + digit;
}
+ if (!index.IsValid()) {
+ return false;
+ }
getting_array_location = true;
}
*getting_array = getting_array_location;
- *element_index = index;
+ *element_index = index.ValueOrDie();
*array_pos = open_pos;
return true;
}
« no previous file with comments | « gpu/command_buffer/common/gles2_cmd_ids_autogen.h ('k') | gpu/command_buffer/common/gles2_cmd_utils_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698