blob: 48f107128cd3cc9c5c67e7830da7d5b21cd9fcfb [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 Lang0c99b1b2013-09-30 15:07:43 -040027typedef void (*InitializeTextureDataFunction)(int width, int height, int depth,
28 void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
29
Geoff Langfe28ca02013-06-04 10:10:48 -040030typedef void (*ColorReadFunction)(const void *source, void *dest);
31typedef void (*ColorWriteFunction)(const void *source, void *dest);
32typedef void (*ColorCopyFunction)(const void *source, void *dest);
33
Jamie Madill7ab02fa2014-02-04 16:04:08 -050034typedef void (*VertexCopyFunction)(const void *input, size_t stride, size_t count, void *output);
35
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000036namespace rx
37{
38
39class Renderer;
40
41}
42
43namespace gl
44{
45
46class Context;
47
Geoff Lang005df412013-10-16 14:12:50 -040048bool IsValidInternalFormat(GLenum internalFormat, const Context *context);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000049bool IsValidFormat(GLenum format, GLuint clientVersion);
50bool IsValidType(GLenum type, GLuint clientVersion);
51
Geoff Lang005df412013-10-16 14:12:50 -040052bool IsValidFormatCombination(GLenum internalFormat, GLenum format, GLenum type, GLuint clientVersion);
shannonwoods@chromium.orgffab47d2013-05-30 00:16:22 +000053bool IsValidCopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint clientVersion);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000054
Geoff Lang005df412013-10-16 14:12:50 -040055bool IsSizedInternalFormat(GLenum internalFormat, GLuint clientVersion);
56GLenum GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000057
Geoff Lang005df412013-10-16 14:12:50 -040058GLuint GetPixelBytes(GLenum internalFormat, GLuint clientVersion);
59GLuint GetAlphaBits(GLenum internalFormat, GLuint clientVersion);
60GLuint GetRedBits(GLenum internalFormat, GLuint clientVersion);
61GLuint GetGreenBits(GLenum internalFormat, GLuint clientVersion);
62GLuint GetBlueBits(GLenum internalFormat, GLuint clientVersion);
63GLuint GetLuminanceBits(GLenum internalFormat, GLuint clientVersion);
64GLuint GetDepthBits(GLenum internalFormat, GLuint clientVersion);
65GLuint GetStencilBits(GLenum internalFormat, GLuint clientVersion);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000066
Geoff Langf23eb282013-07-22 10:52:19 -040067GLuint GetTypeBytes(GLenum type);
68bool IsSpecialInterpretationType(GLenum type);
69
Geoff Lang005df412013-10-16 14:12:50 -040070GLenum GetFormat(GLenum internalFormat, GLuint clientVersion);
71GLenum GetType(GLenum internalFormat, GLuint clientVersion);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000072
Geoff Lang005df412013-10-16 14:12:50 -040073GLenum GetComponentType(GLenum internalFormat, GLuint clientVersion);
74GLuint GetComponentCount(GLenum internalFormat, GLuint clientVersion);
75GLenum GetColorEncoding(GLenum internalFormat, GLuint clientVersion);
shannonwoods@chromium.orge81ea502013-05-30 00:16:53 +000076
Geoff Lang005df412013-10-16 14:12:50 -040077bool IsColorRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
78bool IsColorRenderingSupported(GLenum internalFormat, const Context *context);
79bool IsTextureFilteringSupported(GLenum internalFormat, const rx::Renderer *renderer);
80bool IsTextureFilteringSupported(GLenum internalFormat, const Context *context);
81bool IsDepthRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
82bool IsDepthRenderingSupported(GLenum internalFormat, const Context *context);
83bool IsStencilRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
84bool IsStencilRenderingSupported(GLenum internalFormat, const Context *context);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000085
Geoff Lang005df412013-10-16 14:12:50 -040086GLuint GetRowPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLint alignment);
87GLuint GetDepthPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height, GLint alignment);
88GLuint GetBlockSize(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000089
Geoff Lang005df412013-10-16 14:12:50 -040090bool IsFormatCompressed(GLenum internalFormat, GLuint clientVersion);
91GLuint GetCompressedBlockWidth(GLenum internalFormat, GLuint clientVersion);
92GLuint GetCompressedBlockHeight(GLenum internalFormat, GLuint clientVersion);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000093
Geoff Langfe28ca02013-06-04 10:10:48 -040094ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type, GLuint clientVersion);
95
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000096}
97
98#endif LIBGLESV2_FORMATUTILS_H_