Jamie Madill | d2b50a0 | 2016-06-09 00:13:35 -0700 | [diff] [blame^] | 1 | // |
| 2 | // Copyright 2016 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 | // renderer_utils: |
| 7 | // Helper methods pertaining to most or all back-ends. |
| 8 | // |
| 9 | |
| 10 | #ifndef LIBANGLE_RENDERER_RENDERER_UTILS_H_ |
| 11 | #define LIBANGLE_RENDERER_RENDERER_UTILS_H_ |
| 12 | |
| 13 | #include <cstdint> |
| 14 | |
| 15 | #include <map> |
| 16 | |
| 17 | #include "libANGLE/angletypes.h" |
| 18 | |
| 19 | namespace gl |
| 20 | { |
| 21 | struct FormatType; |
| 22 | struct InternalFormat; |
| 23 | } |
| 24 | |
| 25 | namespace rx |
| 26 | { |
| 27 | |
| 28 | typedef void (*ColorReadFunction)(const uint8_t *source, uint8_t *dest); |
| 29 | typedef void (*ColorWriteFunction)(const uint8_t *source, uint8_t *dest); |
| 30 | typedef void (*ColorCopyFunction)(const uint8_t *source, uint8_t *dest); |
| 31 | |
| 32 | typedef std::map<gl::FormatType, ColorCopyFunction> FastCopyFunctionMap; |
| 33 | |
| 34 | struct PackPixelsParams |
| 35 | { |
| 36 | PackPixelsParams(); |
| 37 | PackPixelsParams(const gl::Rectangle &area, |
| 38 | GLenum format, |
| 39 | GLenum type, |
| 40 | GLuint outputPitch, |
| 41 | const gl::PixelPackState &pack, |
| 42 | ptrdiff_t offset); |
| 43 | |
| 44 | gl::Rectangle area; |
| 45 | GLenum format; |
| 46 | GLenum type; |
| 47 | GLuint outputPitch; |
| 48 | gl::Buffer *packBuffer; |
| 49 | gl::PixelPackState pack; |
| 50 | ptrdiff_t offset; |
| 51 | }; |
| 52 | |
| 53 | void PackPixels(const PackPixelsParams ¶ms, |
| 54 | const gl::InternalFormat &sourceFormatInfo, |
| 55 | const FastCopyFunctionMap &fastCopyFunctionsMap, |
| 56 | ColorReadFunction colorReadFunction, |
| 57 | int inputPitch, |
| 58 | const uint8_t *source, |
| 59 | uint8_t *destination); |
| 60 | |
| 61 | ColorWriteFunction GetColorWriteFunction(const gl::FormatType &formatType); |
| 62 | ColorCopyFunction GetFastCopyFunction(const FastCopyFunctionMap &fastCopyFunctions, |
| 63 | const gl::FormatType &formatType); |
| 64 | |
| 65 | } // namespace rx |
| 66 | |
| 67 | #endif // LIBANGLE_RENDERER_RENDERER_UTILS_H_ |