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

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

Issue 439253002: Micro-optimization in HandleVertexAttribPointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 6 years, 4 months 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
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/common/gles2_cmd_utils.h
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.h b/gpu/command_buffer/common/gles2_cmd_utils.h
index c590b159594e9fbf3e595dc09877afaed4612d30..15f3b57e0a5516cef7ddf1882b95c00c53efa832 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.h
+++ b/gpu/command_buffer/common/gles2_cmd_utils.h
@@ -156,8 +156,14 @@ class GLES2_UTILS_EXPORT GLES2Util {
static uint32_t GetChannelsNeededForAttachmentType(
int type, uint32_t max_color_attachments);
+ // Return true if value is neither a power of two nor zero.
static bool IsNPOT(uint32_t value) {
- return value > 0 && (value & (value - 1)) != 0;
+ return (value & (value - 1)) != 0;
+ }
+
+ // Return true if value is a power of two or zero.
+ static bool IsPOT(uint32_t value) {
+ return (value & (value - 1)) == 0;
}
static std::string GetStringEnum(uint32_t value);
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698