Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / gpu / command_buffer / common / gles2_cmd_utils.h
index f6432a7..163ffc0 100644 (file)
@@ -141,6 +141,8 @@ class GLES2_UTILS_EXPORT GLES2Util {
 
   static uint32_t IndexToGLFaceTarget(int index);
 
+  static size_t GLTargetToFaceIndex(uint32_t target);
+
   static uint32_t GetPreferredGLReadPixelsFormat(uint32_t internal_format);
 
   static uint32_t GetPreferredGLReadPixelsType(
@@ -154,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);
@@ -188,27 +196,25 @@ class GLES2_UTILS_EXPORT GLES2Util {
   int num_shader_binary_formats_;
 };
 
-class GLES2_UTILS_EXPORT ContextCreationAttribHelper {
- public:
+struct GLES2_UTILS_EXPORT ContextCreationAttribHelper {
   ContextCreationAttribHelper();
 
-  void Serialize(std::vector<int32_t>* attribs);
+  void Serialize(std::vector<int32_t>* attribs) const;
   bool Parse(const std::vector<int32_t>& attribs);
 
   // -1 if invalid or unspecified.
-  int32_t alpha_size_;
-  int32_t blue_size_;
-  int32_t green_size_;
-  int32_t red_size_;
-  int32_t depth_size_;
-  int32_t stencil_size_;
-  int32_t samples_;
-  int32_t sample_buffers_;
-  bool buffer_preserved_;
-  bool share_resources_;
-  bool bind_generates_resource_;
-  bool fail_if_major_perf_caveat_;
-  bool lose_context_when_out_of_memory_;
+  int32_t alpha_size;
+  int32_t blue_size;
+  int32_t green_size;
+  int32_t red_size;
+  int32_t depth_size;
+  int32_t stencil_size;
+  int32_t samples;
+  int32_t sample_buffers;
+  bool buffer_preserved;
+  bool bind_generates_resource;
+  bool fail_if_major_perf_caveat;
+  bool lose_context_when_out_of_memory;
 };
 
 }  // namespace gles2