blob: ce038a34f23d51438340a803f0b20114a2398578 [file] [log] [blame]
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +00001//
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
12#define GL_APICALL
13#include <GLES3/gl3.h>
14#include <GLES2/gl2.h>
15#include <GLES2/gl2ext.h>
16
Geoff Langfe28ca02013-06-04 10:10:48 -040017#include "libGLESv2/angletypes.h"
18
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000019typedef void (*MipGenerationFunction)(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
20 const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
21 unsigned char *destData, int destRowPitch, int destDepthPitch);
22
23typedef void (*LoadImageFunction)(int width, int height, int depth,
24 const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
25 void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
26
Geoff Langfe28ca02013-06-04 10:10:48 -040027typedef void (*ColorReadFunction)(const void *source, void *dest);
28typedef void (*ColorWriteFunction)(const void *source, void *dest);
29typedef void (*ColorCopyFunction)(const void *source, void *dest);
30
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000031namespace rx
32{
33
34class Renderer;
35
36}
37
38namespace gl
39{
40
41class Context;
42
43bool IsValidInternalFormat(GLint internalFormat, const Context *context);
44bool IsValidFormat(GLenum format, GLuint clientVersion);
45bool IsValidType(GLenum type, GLuint clientVersion);
46
47bool IsValidFormatCombination(GLint internalFormat, GLenum format, GLenum type, GLuint clientVersion);
shannonwoods@chromium.orgffab47d2013-05-30 00:16:22 +000048bool IsValidCopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint clientVersion);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000049
50bool IsSizedInternalFormat(GLint internalFormat, GLuint clientVersion);
51GLint GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion);
52
53GLuint GetPixelBytes(GLint internalFormat, GLuint clientVersion);
54GLuint GetAlphaBits(GLint internalFormat, GLuint clientVersion);
55GLuint GetRedBits(GLint internalFormat, GLuint clientVersion);
56GLuint GetGreenBits(GLint internalFormat, GLuint clientVersion);
57GLuint GetBlueBits(GLint internalFormat, GLuint clientVersion);
58GLuint GetLuminanceBits(GLint internalFormat, GLuint clientVersion);
59GLuint GetDepthBits(GLint internalFormat, GLuint clientVersion);
60GLuint GetStencilBits(GLint internalFormat, GLuint clientVersion);
61
Geoff Langf23eb282013-07-22 10:52:19 -040062GLuint GetTypeBytes(GLenum type);
63bool IsSpecialInterpretationType(GLenum type);
64
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000065GLenum GetFormat(GLint internalFormat, GLuint clientVersion);
66GLenum GetType(GLint internalFormat, GLuint clientVersion);
67
shannonwoods@chromium.orge19409b2013-05-30 00:16:15 +000068bool IsNormalizedFixedPointFormat(GLint internalFormat, GLuint clientVersion);
69bool IsIntegerFormat(GLint internalFormat, GLuint clientVersion);
70bool IsSignedIntegerFormat(GLint internalFormat, GLuint clientVersion);
71bool IsUnsignedIntegerFormat(GLint internalFormat, GLuint clientVersion);
72bool IsFloatingPointFormat(GLint internalFormat, GLuint clientVersion);
73
shannonwoods@chromium.orge81ea502013-05-30 00:16:53 +000074bool IsSRGBFormat(GLint internalFormat, GLuint clientVersion);
75
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000076bool IsColorRenderingSupported(GLint internalFormat, const rx::Renderer *renderer);
77bool IsColorRenderingSupported(GLint internalFormat, const Context *context);
78bool IsTextureFilteringSupported(GLint internalFormat, const rx::Renderer *renderer);
79bool IsTextureFilteringSupported(GLint internalFormat, const Context *context);
80bool IsDepthRenderingSupported(GLint internalFormat, const rx::Renderer *renderer);
81bool IsDepthRenderingSupported(GLint internalFormat, const Context *context);
82bool IsStencilRenderingSupported(GLint internalFormat, const rx::Renderer *renderer);
83bool IsStencilRenderingSupported(GLint internalFormat, const Context *context);
84
85GLuint GetRowPitch(GLint internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLint alignment);
86GLuint GetDepthPitch(GLint internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height, GLint alignment);
87GLuint GetBlockSize(GLint internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height);
88
89bool IsFormatCompressed(GLint internalFormat, GLuint clientVersion);
90GLuint GetCompressedBlockWidth(GLint internalFormat, GLuint clientVersion);
91GLuint GetCompressedBlockHeight(GLint internalFormat, GLuint clientVersion);
92
Geoff Langfe28ca02013-06-04 10:10:48 -040093ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type, GLuint clientVersion);
94
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000095}
96
97#endif LIBGLESV2_FORMATUTILS_H_