|
1 // |
|
2 // Copyright (c) 2002-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 // utilities.h: Conversion functions and other utility routines. |
|
8 |
|
9 #ifndef LIBGLESV2_UTILITIES_H |
|
10 #define LIBGLESV2_UTILITIES_H |
|
11 |
|
12 #define GL_APICALL |
|
13 #include <GLES2/gl2.h> |
|
14 #include <GLES2/gl2ext.h> |
|
15 |
|
16 #include <string> |
|
17 |
|
18 namespace gl |
|
19 { |
|
20 |
|
21 struct Color; |
|
22 |
|
23 int UniformComponentCount(GLenum type); |
|
24 GLenum UniformComponentType(GLenum type); |
|
25 size_t UniformInternalSize(GLenum type); |
|
26 size_t UniformExternalSize(GLenum type); |
|
27 int VariableRowCount(GLenum type); |
|
28 int VariableColumnCount(GLenum type); |
|
29 |
|
30 int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize); |
|
31 |
|
32 void MakeValidSize(bool isImage, bool isCompressed, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset); |
|
33 int ComputePixelSize(GLint internalformat); |
|
34 GLsizei ComputePitch(GLsizei width, GLint internalformat, GLint alignment); |
|
35 GLsizei ComputeCompressedPitch(GLsizei width, GLenum format); |
|
36 GLsizei ComputeCompressedSize(GLsizei width, GLsizei height, GLenum format); |
|
37 GLsizei ComputeTypeSize(GLenum type); |
|
38 bool IsCompressed(GLenum format); |
|
39 bool IsDepthTexture(GLenum format); |
|
40 bool IsStencilTexture(GLenum format); |
|
41 bool IsCubemapTextureTarget(GLenum target); |
|
42 bool IsInternalTextureTarget(GLenum target); |
|
43 GLint ConvertSizedInternalFormat(GLenum format, GLenum type); |
|
44 GLenum ExtractFormat(GLenum internalformat); |
|
45 GLenum ExtractType(GLenum internalformat); |
|
46 |
|
47 bool IsColorRenderable(GLenum internalformat); |
|
48 bool IsDepthRenderable(GLenum internalformat); |
|
49 bool IsStencilRenderable(GLenum internalformat); |
|
50 |
|
51 bool IsFloat32Format(GLint internalformat); |
|
52 bool IsFloat16Format(GLint internalformat); |
|
53 |
|
54 GLuint GetAlphaSize(GLenum colorFormat); |
|
55 GLuint GetRedSize(GLenum colorFormat); |
|
56 GLuint GetGreenSize(GLenum colorFormat); |
|
57 GLuint GetBlueSize(GLenum colorFormat); |
|
58 GLuint GetDepthSize(GLenum depthFormat); |
|
59 GLuint GetStencilSize(GLenum stencilFormat); |
|
60 bool IsTriangleMode(GLenum drawMode); |
|
61 |
|
62 } |
|
63 |
|
64 std::string getTempPath(); |
|
65 void writeFile(const char* path, const void* data, size_t size); |
|
66 |
|
67 #endif // LIBGLESV2_UTILITIES_H |