shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright (c) 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 | // formatutils.h: Queries for GL image formats. |
| 8 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 9 | #ifndef LIBANGLE_FORMATUTILS_H_ |
| 10 | #define LIBANGLE_FORMATUTILS_H_ |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 11 | |
Geoff Lang | 2b5420c | 2014-11-19 14:20:15 -0500 | [diff] [blame] | 12 | #include "libANGLE/Caps.h" |
| 13 | #include "libANGLE/angletypes.h" |
Geoff Lang | fe28ca0 | 2013-06-04 10:10:48 -0400 | [diff] [blame] | 14 | |
Geoff Lang | 0b7eef7 | 2014-06-12 14:10:47 -0400 | [diff] [blame] | 15 | #include "angle_gl.h" |
| 16 | |
Geoff Lang | 86846e2 | 2014-06-03 15:48:54 -0400 | [diff] [blame] | 17 | #include <cstddef> |
Jamie Madill | 47e156c | 2015-01-05 13:15:13 -0500 | [diff] [blame] | 18 | #include <stdint.h> |
Geoff Lang | 86846e2 | 2014-06-03 15:48:54 -0400 | [diff] [blame] | 19 | |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 20 | namespace gl |
| 21 | { |
| 22 | |
Geoff Lang | 9d9132d | 2014-12-03 14:46:48 -0500 | [diff] [blame] | 23 | struct Type |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 24 | { |
| 25 | Type(); |
| 26 | |
| 27 | GLuint bytes; |
| 28 | bool specialInterpretation; |
| 29 | }; |
Geoff Lang | 9d9132d | 2014-12-03 14:46:48 -0500 | [diff] [blame] | 30 | const Type &GetTypeInfo(GLenum type); |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 31 | |
Geoff Lang | 9d9132d | 2014-12-03 14:46:48 -0500 | [diff] [blame] | 32 | struct InternalFormat |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 33 | { |
| 34 | InternalFormat(); |
| 35 | |
| 36 | GLuint redBits; |
| 37 | GLuint greenBits; |
| 38 | GLuint blueBits; |
| 39 | |
| 40 | GLuint luminanceBits; |
| 41 | |
| 42 | GLuint alphaBits; |
| 43 | GLuint sharedBits; |
| 44 | |
| 45 | GLuint depthBits; |
| 46 | GLuint stencilBits; |
| 47 | |
| 48 | GLuint pixelBytes; |
| 49 | |
| 50 | GLuint componentCount; |
| 51 | |
| 52 | bool compressed; |
| 53 | GLuint compressedBlockWidth; |
| 54 | GLuint compressedBlockHeight; |
| 55 | |
| 56 | GLenum format; |
| 57 | GLenum type; |
| 58 | |
| 59 | GLenum componentType; |
| 60 | GLenum colorEncoding; |
| 61 | |
| 62 | typedef bool (*SupportCheckFunction)(GLuint, const Extensions &); |
| 63 | SupportCheckFunction textureSupport; |
| 64 | SupportCheckFunction renderSupport; |
| 65 | SupportCheckFunction filterSupport; |
| 66 | |
Austin Kinross | c67e6e9 | 2015-01-21 16:01:07 -0800 | [diff] [blame^] | 67 | GLuint computeRowPitch(GLenum formatType, GLsizei width, GLint alignment) const; |
| 68 | GLuint computeDepthPitch(GLenum formatType, GLsizei width, GLsizei height, GLint alignment) const; |
| 69 | GLuint computeBlockSize(GLenum formatType, GLsizei width, GLsizei height) const; |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 70 | }; |
Geoff Lang | 9d9132d | 2014-12-03 14:46:48 -0500 | [diff] [blame] | 71 | const InternalFormat &GetInternalFormatInfo(GLenum internalFormat); |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 72 | |
Geoff Lang | 9d9132d | 2014-12-03 14:46:48 -0500 | [diff] [blame] | 73 | GLenum GetSizedInternalFormat(GLenum internalFormat, GLenum type); |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 74 | |
Geoff Lang | cec3590 | 2014-04-16 10:52:36 -0400 | [diff] [blame] | 75 | typedef std::set<GLenum> FormatSet; |
Geoff Lang | e4a492b | 2014-06-19 14:14:41 -0400 | [diff] [blame] | 76 | const FormatSet &GetAllSizedInternalFormats(); |
Geoff Lang | cec3590 | 2014-04-16 10:52:36 -0400 | [diff] [blame] | 77 | |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 78 | } |
| 79 | |
Geoff Lang | 0a73dd8 | 2014-11-19 16:18:08 -0500 | [diff] [blame] | 80 | #endif // LIBANGLE_FORMATUTILS_H_ |