1 // 2 // Copyright 2013 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 7 // copyvertex.h: Defines vertex buffer copying and conversion functions 8 9 #ifndef LIBANGLE_RENDERER_COPYVERTEX_H_ 10 #define LIBANGLE_RENDERER_COPYVERTEX_H_ 11 12 #include "common/mathutil.h" 13 14 namespace rx 15 { 16 17 using VertexCopyFunction = void (*)(const uint8_t *input, 18 size_t stride, 19 size_t count, 20 uint8_t *output); 21 22 // 'alphaDefaultValueBits' gives the default value for the alpha channel (4th component) 23 template <typename T, 24 size_t inputComponentCount, 25 size_t outputComponentCount, 26 uint32_t alphaDefaultValueBits> 27 void CopyNativeVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output); 28 29 template <size_t inputComponentCount, size_t outputComponentCount> 30 void Copy8SintTo16SintVertexData(const uint8_t *input, 31 size_t stride, 32 size_t count, 33 uint8_t *output); 34 35 template <size_t componentCount> 36 void Copy8SnormTo16SnormVertexData(const uint8_t *input, 37 size_t stride, 38 size_t count, 39 uint8_t *output); 40 41 template <size_t inputComponentCount, size_t outputComponentCount> 42 void Copy32FixedTo32FVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output); 43 44 template <typename T, 45 size_t inputComponentCount, 46 size_t outputComponentCount, 47 bool normalized, 48 bool toHalf> 49 void CopyToFloatVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output); 50 51 template <size_t inputComponentCount, size_t outputComponentCount> 52 void Copy32FTo16FVertexData(const uint8_t *input, size_t stride, size_t count, uint8_t *output); 53 54 void CopyXYZ32FToXYZ9E5(const uint8_t *input, size_t stride, size_t count, uint8_t *output); 55 56 void CopyXYZ32FToX11Y11B10F(const uint8_t *input, size_t stride, size_t count, uint8_t *output); 57 58 template <bool isSigned, bool normalized, bool toFloat, bool toHalf> 59 void CopyXYZ10W2ToXYZWFloatVertexData(const uint8_t *input, 60 size_t stride, 61 size_t count, 62 uint8_t *output); 63 64 template <bool isSigned, bool normalized, bool toHalf> 65 void CopyXYZ10ToXYZWFloatVertexData(const uint8_t *input, 66 size_t stride, 67 size_t count, 68 uint8_t *output); 69 70 template <bool isSigned, bool normalized, bool toHalf> 71 void CopyW2XYZ10ToXYZWFloatVertexData(const uint8_t *input, 72 size_t stride, 73 size_t count, 74 uint8_t *output); 75 76 } // namespace rx 77 78 #include "copyvertex.inc.h" 79 80 #endif // LIBANGLE_RENDERER_COPYVERTEX_H_ 81