• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "Device/Config.hpp"
19 #include "System/Types.hpp"
20 
21 namespace sw {
22 
23 struct alignas(16) Vertex
24 {
25 	union
26 	{
27 		struct
28 		{
29 			float x;
30 			float y;
31 			float z;
32 			float w;
33 		};
34 
35 		float4 position;
36 	};
37 
38 	float pointSize;
39 
40 	int clipFlags;
41 	int cullMask;
42 	float clipDistance[MAX_CLIP_DISTANCES];
43 	float cullDistance[MAX_CLIP_DISTANCES];
44 
45 	alignas(16) struct
46 	{
47 		int x;
48 		int y;
49 		float z;
50 		float w;
51 	} projected;
52 
53 	alignas(16) float v[MAX_INTERFACE_COMPONENTS];
54 };
55 
56 static_assert((sizeof(Vertex) & 0x0000000F) == 0, "Vertex size not a multiple of 16 bytes (alignment requirement)");
57 
58 }  // namespace sw
59 
60 #endif  // Vertex_hpp
61