blob: 004c8eda83bb154c90fd48ef180d2efbc538e1c4 [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
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000012#include <GLES3/gl3.h>
13#include <GLES2/gl2.h>
14#include <GLES2/gl2ext.h>
15
Geoff Langfe28ca02013-06-04 10:10:48 -040016#include "libGLESv2/angletypes.h"
17
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000018typedef void (*MipGenerationFunction)(unsigned int sourceWidth, unsigned int sourceHeight, unsigned int sourceDepth,
19 const unsigned char *sourceData, int sourceRowPitch, int sourceDepthPitch,
20 unsigned char *destData, int destRowPitch, int destDepthPitch);
21
22typedef void (*LoadImageFunction)(int width, int height, int depth,
23 const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
24 void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
25
Geoff Lang0c99b1b2013-09-30 15:07:43 -040026typedef void (*InitializeTextureDataFunction)(int width, int height, int depth,
27 void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
28
Geoff Langfe28ca02013-06-04 10:10:48 -040029typedef void (*ColorReadFunction)(const void *source, void *dest);
30typedef void (*ColorWriteFunction)(const void *source, void *dest);
31typedef void (*ColorCopyFunction)(const void *source, void *dest);
32
Jamie Madill7ab02fa2014-02-04 16:04:08 -050033typedef void (*VertexCopyFunction)(const void *input, size_t stride, size_t count, void *output);
34
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000035namespace rx
36{
37
38class Renderer;
39
40}
41
42namespace gl
43{
44
45class Context;
46
Geoff Lang005df412013-10-16 14:12:50 -040047bool IsValidInternalFormat(GLenum internalFormat, const Context *context);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000048bool IsValidFormat(GLenum format, GLuint clientVersion);
49bool IsValidType(GLenum type, GLuint clientVersion);
50
Geoff Lang005df412013-10-16 14:12:50 -040051bool IsValidFormatCombination(GLenum internalFormat, GLenum format, GLenum type, GLuint clientVersion);
Shannon Woods4d161ba2014-03-17 18:13:30 -040052bool IsValidCopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint readBufferHandle, GLuint clientVersion);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000053
Geoff Lang005df412013-10-16 14:12:50 -040054bool IsSizedInternalFormat(GLenum internalFormat, GLuint clientVersion);
55GLenum GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000056
Geoff Lang005df412013-10-16 14:12:50 -040057GLuint GetPixelBytes(GLenum internalFormat, GLuint clientVersion);
58GLuint GetAlphaBits(GLenum internalFormat, GLuint clientVersion);
59GLuint GetRedBits(GLenum internalFormat, GLuint clientVersion);
60GLuint GetGreenBits(GLenum internalFormat, GLuint clientVersion);
61GLuint GetBlueBits(GLenum internalFormat, GLuint clientVersion);
62GLuint GetLuminanceBits(GLenum internalFormat, GLuint clientVersion);
63GLuint GetDepthBits(GLenum internalFormat, GLuint clientVersion);
64GLuint GetStencilBits(GLenum internalFormat, GLuint clientVersion);
shannonwoods@chromium.orgb8490f32013-05-30 00:08:00 +000065
Geoff Langf23eb282013-07-22 10:52:19 -040066GLuint GetTypeBytes(GLenum type);
67bool IsSpecialInterpretationType(GLenum type);
Shannon Woods4d161ba2014-03-17 18:13:30 -040068bool IsFloatOrFixedComponentType(GLenum type);
Geoff Langf23eb282013-07-22 10:52:19 -040069
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_