blob: c95292e10de262f0a3217f5902387fa8f5c06c36 [file] [log] [blame]
Jamie Madilld2b50a02016-06-09 00:13:35 -07001//
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
19namespace gl
20{
21struct FormatType;
22struct InternalFormat;
23}
24
25namespace rx
26{
27
28typedef void (*ColorReadFunction)(const uint8_t *source, uint8_t *dest);
29typedef void (*ColorWriteFunction)(const uint8_t *source, uint8_t *dest);
30typedef void (*ColorCopyFunction)(const uint8_t *source, uint8_t *dest);
31
32typedef std::map<gl::FormatType, ColorCopyFunction> FastCopyFunctionMap;
33
34struct 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
53void PackPixels(const PackPixelsParams &params,
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
61ColorWriteFunction GetColorWriteFunction(const gl::FormatType &formatType);
62ColorCopyFunction GetFastCopyFunction(const FastCopyFunctionMap &fastCopyFunctions,
63 const gl::FormatType &formatType);
64
65} // namespace rx
66
67#endif // LIBANGLE_RENDERER_RENDERER_UTILS_H_