1 // Copyright 2016 The SwiftShader Authors. All Rights Reserved.
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include "Common/Types.hpp"
24 enum StreamType ENUM_UNDERLYING_TYPE_UNSIGNED_INT
26 STREAMTYPE_COLOR, // 4 normalized unsigned bytes, ZYXW order
27 STREAMTYPE_UDEC3, // 3 unsigned 10-bit fields
28 STREAMTYPE_DEC3N, // 3 normalized signed 10-bit fields
29 STREAMTYPE_INDICES, // 4 unsigned bytes, stored unconverted into X component
30 STREAMTYPE_FLOAT, // Normalization ignored
37 STREAMTYPE_FIXED, // Normalization ignored (16.16 format)
38 STREAMTYPE_HALF, // Normalization ignored
39 STREAMTYPE_2_10_10_10_INT,
40 STREAMTYPE_2_10_10_10_UINT,
42 STREAMTYPE_LAST = STREAMTYPE_HALF
52 struct Stream : public StreamResource
54 Stream(Resource *resource = 0, const void *buffer = 0, unsigned int stride = 0)
56 this->resource = resource;
57 this->buffer = buffer;
58 this->stride = stride;
61 Stream &define(StreamType type, unsigned int count, bool normalized = false)
65 this->normalized = normalized;
70 Stream &define(const void *buffer, StreamType type, unsigned int count, bool normalized = false)
72 this->buffer = buffer;
75 this->normalized = normalized;
82 static const float4 null = {0, 0, 0, 1};
87 type = STREAMTYPE_FLOAT;
94 operator bool() const // Returns true if stream contains data
105 #endif // sw_Stream_hpp