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 | |
| 9 | #ifndef LIBGLESV2_FORMATUTILS_H_ |
| 10 | #define LIBGLESV2_FORMATUTILS_H_ |
| 11 | |
Jamie Madill | f51639a | 2014-06-25 16:04:57 -0400 | [diff] [blame] | 12 | #include "angle_gl.h" |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 13 | |
Geoff Lang | cec3590 | 2014-04-16 10:52:36 -0400 | [diff] [blame] | 14 | #include "libGLESv2/Caps.h" |
Geoff Lang | fe28ca0 | 2013-06-04 10:10:48 -0400 | [diff] [blame] | 15 | #include "libGLESv2/angletypes.h" |
| 16 | |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 17 | typedef void (*MipGenerationFunction)(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth, |
| 18 | const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch, |
| 19 | unsigned char *destData, int destRowPitch, int destDepthPitch); |
| 20 | |
| 21 | typedef void (*LoadImageFunction)(int width, int height, int depth, |
| 22 | const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch, |
| 23 | void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch); |
| 24 | |
Geoff Lang | 0c99b1b | 2013-09-30 15:07:43 -0400 | [diff] [blame] | 25 | typedef void (*InitializeTextureDataFunction)(int width, int height, int depth, |
| 26 | void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch); |
| 27 | |
Geoff Lang | fe28ca0 | 2013-06-04 10:10:48 -0400 | [diff] [blame] | 28 | typedef void (*ColorReadFunction)(const void *source, void *dest); |
| 29 | typedef void (*ColorWriteFunction)(const void *source, void *dest); |
| 30 | typedef void (*ColorCopyFunction)(const void *source, void *dest); |
| 31 | |
Jamie Madill | 7ab02fa | 2014-02-04 16:04:08 -0500 | [diff] [blame] | 32 | typedef void (*VertexCopyFunction)(const void *input, size_t stride, size_t count, void *output); |
| 33 | |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 34 | namespace gl |
| 35 | { |
| 36 | |
Geoff Lang | cec3590 | 2014-04-16 10:52:36 -0400 | [diff] [blame] | 37 | typedef std::set<GLenum> FormatSet; |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 38 | |
Geoff Lang | cec3590 | 2014-04-16 10:52:36 -0400 | [diff] [blame] | 39 | bool IsValidInternalFormat(GLenum internalFormat, const Extensions &extensions, GLuint clientVersion); |
Geoff Lang | e4a492b | 2014-06-19 14:14:41 -0400 | [diff] [blame^] | 40 | bool IsValidFormat(GLenum format, const Extensions &extensions, GLuint clientVersion); |
| 41 | bool IsValidType(GLenum type, const Extensions &extensions, GLuint clientVersion); |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 42 | |
Geoff Lang | e4a492b | 2014-06-19 14:14:41 -0400 | [diff] [blame^] | 43 | bool IsValidFormatCombination(GLenum internalFormat, GLenum format, GLenum type, const Extensions &extensions, GLuint clientVersion); |
Shannon Woods | 4d161ba | 2014-03-17 18:13:30 -0400 | [diff] [blame] | 44 | bool IsValidCopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint readBufferHandle, GLuint clientVersion); |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 45 | |
Geoff Lang | e4a492b | 2014-06-19 14:14:41 -0400 | [diff] [blame^] | 46 | bool IsSizedInternalFormat(GLenum internalFormat); |
| 47 | GLenum GetSizedInternalFormat(GLenum format, GLenum type); |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 48 | |
Geoff Lang | e4a492b | 2014-06-19 14:14:41 -0400 | [diff] [blame^] | 49 | GLuint GetPixelBytes(GLenum internalFormat); |
| 50 | GLuint GetAlphaBits(GLenum internalFormat); |
| 51 | GLuint GetRedBits(GLenum internalFormat); |
| 52 | GLuint GetGreenBits(GLenum internalFormat); |
| 53 | GLuint GetBlueBits(GLenum internalFormat); |
| 54 | GLuint GetLuminanceBits(GLenum internalFormat); |
| 55 | GLuint GetDepthBits(GLenum internalFormat); |
| 56 | GLuint GetStencilBits(GLenum internalFormat); |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 57 | |
Geoff Lang | f23eb28 | 2013-07-22 10:52:19 -0400 | [diff] [blame] | 58 | GLuint GetTypeBytes(GLenum type); |
| 59 | bool IsSpecialInterpretationType(GLenum type); |
Shannon Woods | 4d161ba | 2014-03-17 18:13:30 -0400 | [diff] [blame] | 60 | bool IsFloatOrFixedComponentType(GLenum type); |
Geoff Lang | f23eb28 | 2013-07-22 10:52:19 -0400 | [diff] [blame] | 61 | |
Geoff Lang | e4a492b | 2014-06-19 14:14:41 -0400 | [diff] [blame^] | 62 | GLenum GetFormat(GLenum internalFormat); |
| 63 | GLenum GetType(GLenum internalFormat); |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 64 | |
Geoff Lang | e4a492b | 2014-06-19 14:14:41 -0400 | [diff] [blame^] | 65 | GLenum GetComponentType(GLenum internalFormat); |
| 66 | GLuint GetComponentCount(GLenum internalFormat); |
| 67 | GLenum GetColorEncoding(GLenum internalFormat); |
shannonwoods@chromium.org | e81ea50 | 2013-05-30 00:16:53 +0000 | [diff] [blame] | 68 | |
Geoff Lang | e4a492b | 2014-06-19 14:14:41 -0400 | [diff] [blame^] | 69 | GLuint GetRowPitch(GLenum internalFormat, GLenum type, GLsizei width, GLint alignment); |
| 70 | GLuint GetDepthPitch(GLenum internalFormat, GLenum type, GLsizei width, GLsizei height, GLint alignment); |
| 71 | GLuint GetBlockSize(GLenum internalFormat, GLenum type, GLsizei width, GLsizei height); |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 72 | |
Geoff Lang | e4a492b | 2014-06-19 14:14:41 -0400 | [diff] [blame^] | 73 | bool IsFormatCompressed(GLenum internalFormat); |
| 74 | GLuint GetCompressedBlockWidth(GLenum internalFormat); |
| 75 | GLuint GetCompressedBlockHeight(GLenum internalFormat); |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 76 | |
Geoff Lang | e4a492b | 2014-06-19 14:14:41 -0400 | [diff] [blame^] | 77 | const FormatSet &GetAllSizedInternalFormats(); |
Geoff Lang | cec3590 | 2014-04-16 10:52:36 -0400 | [diff] [blame] | 78 | |
Geoff Lang | e4a492b | 2014-06-19 14:14:41 -0400 | [diff] [blame^] | 79 | ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type); |
Geoff Lang | fe28ca0 | 2013-06-04 10:10:48 -0400 | [diff] [blame] | 80 | |
shannonwoods@chromium.org | b8490f3 | 2013-05-30 00:08:00 +0000 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | #endif LIBGLESV2_FORMATUTILS_H_ |