1// 2// Copyright 2015 The ANGLE Project Authors. All rights reserved. 3// Use of this source code is governed by a BSD-style license that can be 4// found in the LICENSE file. 5// 6// VertexAttribute.inc: Inline vertex attribute methods 7// 8 9namespace gl 10{ 11 12inline VertexAttribCurrentValueData::VertexAttribCurrentValueData() 13 : Type(gl::VertexAttribType::Float) 14{ 15 Values.FloatValues[0] = 0.0f; 16 Values.FloatValues[1] = 0.0f; 17 Values.FloatValues[2] = 0.0f; 18 Values.FloatValues[3] = 1.0f; 19} 20 21inline void VertexAttribCurrentValueData::setFloatValues(const GLfloat floatValues[4]) 22{ 23 for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++) 24 { 25 Values.FloatValues[valueIndex] = floatValues[valueIndex]; 26 } 27 Type = gl::VertexAttribType::Float; 28} 29 30inline void VertexAttribCurrentValueData::setIntValues(const GLint intValues[4]) 31{ 32 for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++) 33 { 34 Values.IntValues[valueIndex] = intValues[valueIndex]; 35 } 36 Type = gl::VertexAttribType::Int; 37} 38 39inline void VertexAttribCurrentValueData::setUnsignedIntValues(const GLuint unsignedIntValues[4]) 40{ 41 for (unsigned int valueIndex = 0; valueIndex < 4; valueIndex++) 42 { 43 Values.UnsignedIntValues[valueIndex] = unsignedIntValues[valueIndex]; 44 } 45 Type = gl::VertexAttribType::UnsignedInt; 46} 47 48inline bool operator==(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b) 49{ 50 return (a.Type == b.Type && memcmp(&a.Values, &b.Values, sizeof(VertexAttribCurrentValueData::Values)) == 0); 51} 52 53inline bool operator!=(const VertexAttribCurrentValueData &a, const VertexAttribCurrentValueData &b) 54{ 55 return !(a == b); 56} 57 58} // namespace gl 59