1 // Copyright 2016 The SwiftShader Authors. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef Vertex_hpp 16 #define Vertex_hpp 17 18 #include "Color.hpp" 19 #include "Device/Config.hpp" 20 #include "System/Types.hpp" 21 22 namespace sw { 23 24 struct alignas(16) Vertex 25 { 26 union 27 { 28 struct 29 { 30 float x; 31 float y; 32 float z; 33 float w; 34 }; 35 36 float4 position; 37 }; 38 39 float pointSize; 40 41 int clipFlags; 42 int cullMask; 43 float clipDistance[MAX_CLIP_DISTANCES]; 44 float cullDistance[MAX_CLIP_DISTANCES]; 45 46 alignas(16) struct 47 { 48 int x; 49 int y; 50 float z; 51 float w; 52 } projected; 53 54 alignas(16) float v[MAX_INTERFACE_COMPONENTS]; 55 }; 56 57 static_assert((sizeof(Vertex) & 0x0000000F) == 0, "Vertex size not a multiple of 16 bytes (alignment requirement)"); 58 59 } // namespace sw 60 61 #endif // Vertex_hpp 62