blob: a853fdc5a882baf8f73875a82c8113d6aecfeae5 [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
17typedef 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
21typedef 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
25namespace rx
26{
27
28class Renderer;
29
30}
31
32namespace gl
33{
34
35class Context;
36
37bool IsValidInternalFormat(GLint internalFormat, const Context *context);
38bool IsValidFormat(GLenum format, GLuint clientVersion);
39bool IsValidType(GLenum type, GLuint clientVersion);
40
41bool IsValidFormatCombination(GLint internalFormat, GLenum format, GLenum type, GLuint clientVersion);
shannonwoods@chromium.orgffab47d2013-05-30 00:16:22 +000042bool IsValidCopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint clientVersion);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000043
44bool IsSizedInternalFormat(GLint internalFormat, GLuint clientVersion);
45GLint GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion);
46
47GLuint GetPixelBytes(GLint internalFormat, GLuint clientVersion);
48GLuint GetAlphaBits(GLint internalFormat, GLuint clientVersion);
49GLuint GetRedBits(GLint internalFormat, GLuint clientVersion);
50GLuint GetGreenBits(GLint internalFormat, GLuint clientVersion);
51GLuint GetBlueBits(GLint internalFormat, GLuint clientVersion);
52GLuint GetLuminanceBits(GLint internalFormat, GLuint clientVersion);
53GLuint GetDepthBits(GLint internalFormat, GLuint clientVersion);
54GLuint GetStencilBits(GLint internalFormat, GLuint clientVersion);
55
56GLenum GetFormat(GLint internalFormat, GLuint clientVersion);
57GLenum GetType(GLint internalFormat, GLuint clientVersion);
58
shannonwoods@chromium.orge19409b2013-05-30 00:16:15 +000059bool IsNormalizedFixedPointFormat(GLint internalFormat, GLuint clientVersion);
60bool IsIntegerFormat(GLint internalFormat, GLuint clientVersion);
61bool IsSignedIntegerFormat(GLint internalFormat, GLuint clientVersion);
62bool IsUnsignedIntegerFormat(GLint internalFormat, GLuint clientVersion);
63bool IsFloatingPointFormat(GLint internalFormat, GLuint clientVersion);
64
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000065bool IsColorRenderingSupported(GLint internalFormat, const rx::Renderer *renderer);
66bool IsColorRenderingSupported(GLint internalFormat, const Context *context);
67bool IsTextureFilteringSupported(GLint internalFormat, const rx::Renderer *renderer);
68bool IsTextureFilteringSupported(GLint internalFormat, const Context *context);
69bool IsDepthRenderingSupported(GLint internalFormat, const rx::Renderer *renderer);
70bool IsDepthRenderingSupported(GLint internalFormat, const Context *context);
71bool IsStencilRenderingSupported(GLint internalFormat, const rx::Renderer *renderer);
72bool IsStencilRenderingSupported(GLint internalFormat, const Context *context);
73
74GLuint GetRowPitch(GLint internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLint alignment);
75GLuint GetDepthPitch(GLint internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height, GLint alignment);
76GLuint GetBlockSize(GLint internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height);
77
78bool IsFormatCompressed(GLint internalFormat, GLuint clientVersion);
79GLuint GetCompressedBlockWidth(GLint internalFormat, GLuint clientVersion);
80GLuint GetCompressedBlockHeight(GLint internalFormat, GLuint clientVersion);
81
82}
83
84#endif LIBGLESV2_FORMATUTILS_H_