blob: ca05642155f120a59263a2967129d4d9f717f4cb [file] [log] [blame]
Nicolas Capens68a82382018-10-02 13:16:55 -04001// 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
Nicolas Capens1d8c8db2018-11-05 16:30:42 -050018#include "Device/Config.hpp"
Ben Claytonfccfc562019-12-17 20:37:31 +000019#include "System/Types.hpp"
Nicolas Capens68a82382018-10-02 13:16:55 -040020
Nicolas Capens157ba262019-12-10 17:49:14 -050021namespace sw {
22
Nicolas Capens9e6cce22019-12-12 16:52:43 -050023struct alignas(16) Vertex
Nicolas Capens68a82382018-10-02 13:16:55 -040024{
Nicolas Capens157ba262019-12-10 17:49:14 -050025 union
Nicolas Capens68a82382018-10-02 13:16:55 -040026 {
Nicolas Capens157ba262019-12-10 17:49:14 -050027 struct
Nicolas Capens18c9ac42019-08-27 09:28:27 -040028 {
Nicolas Capens157ba262019-12-10 17:49:14 -050029 float x;
30 float y;
Chris Forbes26f1a862019-02-02 15:23:01 -080031 float z;
32 float w;
Nicolas Capens157ba262019-12-10 17:49:14 -050033 };
Nicolas Capens68a82382018-10-02 13:16:55 -040034
Nicolas Capens157ba262019-12-10 17:49:14 -050035 float4 position;
36 };
Nicolas Capens68a82382018-10-02 13:16:55 -040037
Nicolas Capens157ba262019-12-10 17:49:14 -050038 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];
Nicolas Capens9e6cce22019-12-12 16:52:43 -050054};
Nicolas Capens157ba262019-12-10 17:49:14 -050055
56static_assert((sizeof(Vertex) & 0x0000000F) == 0, "Vertex size not a multiple of 16 bytes (alignment requirement)");
57
58} // namespace sw
Nicolas Capens68a82382018-10-02 13:16:55 -040059
Ben Claytonfccfc562019-12-17 20:37:31 +000060#endif // Vertex_hpp