Index: gpu/command_buffer/service/context_state.h |
diff --git a/gpu/command_buffer/service/context_state.h b/gpu/command_buffer/service/context_state.h |
index 32bef4cea3ec3f9099eb087b40090f22f2ec41bb..e4bd1318f6bd80bd382cd3eb74eae08d146abc66 100644 |
--- a/gpu/command_buffer/service/context_state.h |
+++ b/gpu/command_buffer/service/context_state.h |
@@ -101,14 +101,43 @@ struct GPU_EXPORT TextureUnit { |
} |
}; |
-struct Vec4 { |
+class GPU_EXPORT Vec4 { |
+ public: |
+ enum DataType { |
+ kFloat, |
+ kInt, |
+ kUInt, |
+ }; |
+ |
Vec4() { |
- v[0] = 0.0f; |
- v[1] = 0.0f; |
- v[2] = 0.0f; |
- v[3] = 1.0f; |
+ v_[0].float_value = 0.0f; |
+ v_[1].float_value = 0.0f; |
+ v_[2].float_value = 0.0f; |
+ v_[3].float_value = 1.0f; |
+ type_ = kFloat; |
+ } |
+ |
+ template <typename T> |
+ void GetValues(T* values) const; |
+ |
+ template <typename T> |
+ void SetValues(const T* values); |
+ |
+ DataType type() const { |
+ return type_; |
} |
- float v[4]; |
+ |
+ bool Equal(const Vec4& other) const; |
+ |
+ private: |
+ union ValueUnion { |
+ GLfloat float_value; |
+ GLint int_value; |
+ GLuint uint_value; |
+ }; |
+ |
+ ValueUnion v_[4]; |
+ DataType type_; |
}; |
struct GPU_EXPORT ContextState { |