michael@0: // michael@0: // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: // utilities.h: Conversion functions and other utility routines. michael@0: michael@0: #ifndef LIBGLESV2_UTILITIES_H michael@0: #define LIBGLESV2_UTILITIES_H michael@0: michael@0: #define GL_APICALL michael@0: #include michael@0: #include michael@0: michael@0: #include michael@0: michael@0: namespace gl michael@0: { michael@0: michael@0: struct Color; michael@0: michael@0: int UniformComponentCount(GLenum type); michael@0: GLenum UniformComponentType(GLenum type); michael@0: size_t UniformInternalSize(GLenum type); michael@0: size_t UniformExternalSize(GLenum type); michael@0: int VariableRowCount(GLenum type); michael@0: int VariableColumnCount(GLenum type); michael@0: michael@0: int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize); michael@0: michael@0: void MakeValidSize(bool isImage, bool isCompressed, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset); michael@0: int ComputePixelSize(GLint internalformat); michael@0: GLsizei ComputePitch(GLsizei width, GLint internalformat, GLint alignment); michael@0: GLsizei ComputeCompressedPitch(GLsizei width, GLenum format); michael@0: GLsizei ComputeCompressedSize(GLsizei width, GLsizei height, GLenum format); michael@0: GLsizei ComputeTypeSize(GLenum type); michael@0: bool IsCompressed(GLenum format); michael@0: bool IsDepthTexture(GLenum format); michael@0: bool IsStencilTexture(GLenum format); michael@0: bool IsCubemapTextureTarget(GLenum target); michael@0: bool IsInternalTextureTarget(GLenum target); michael@0: GLint ConvertSizedInternalFormat(GLenum format, GLenum type); michael@0: GLenum ExtractFormat(GLenum internalformat); michael@0: GLenum ExtractType(GLenum internalformat); michael@0: michael@0: bool IsColorRenderable(GLenum internalformat); michael@0: bool IsDepthRenderable(GLenum internalformat); michael@0: bool IsStencilRenderable(GLenum internalformat); michael@0: michael@0: bool IsFloat32Format(GLint internalformat); michael@0: bool IsFloat16Format(GLint internalformat); michael@0: michael@0: GLuint GetAlphaSize(GLenum colorFormat); michael@0: GLuint GetRedSize(GLenum colorFormat); michael@0: GLuint GetGreenSize(GLenum colorFormat); michael@0: GLuint GetBlueSize(GLenum colorFormat); michael@0: GLuint GetDepthSize(GLenum depthFormat); michael@0: GLuint GetStencilSize(GLenum stencilFormat); michael@0: bool IsTriangleMode(GLenum drawMode); michael@0: michael@0: } michael@0: michael@0: std::string getTempPath(); michael@0: void writeFile(const char* path, const void* data, size_t size); michael@0: michael@0: #endif // LIBGLESV2_UTILITIES_H