Home | History | Annotate | Download | only in libGLESv2
      1 //
      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 #include <GLES3/gl3.h>
     13 #include <GLES2/gl2.h>
     14 #include <GLES2/gl2ext.h>
     15 
     16 #include "libGLESv2/angletypes.h"
     17 
     18 typedef 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 
     22 typedef 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 
     26 typedef void (*InitializeTextureDataFunction)(int width, int height, int depth,
     27                                               void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
     28 
     29 typedef void (*ColorReadFunction)(const void *source, void *dest);
     30 typedef void (*ColorWriteFunction)(const void *source, void *dest);
     31 typedef void (*ColorCopyFunction)(const void *source, void *dest);
     32 
     33 typedef void (*VertexCopyFunction)(const void *input, size_t stride, size_t count, void *output);
     34 
     35 namespace rx
     36 {
     37 
     38 class Renderer;
     39 
     40 }
     41 
     42 namespace gl
     43 {
     44 
     45 class Context;
     46 
     47 bool IsValidInternalFormat(GLenum internalFormat, const Context *context);
     48 bool IsValidFormat(GLenum format, GLuint clientVersion);
     49 bool IsValidType(GLenum type, GLuint clientVersion);
     50 
     51 bool IsValidFormatCombination(GLenum internalFormat, GLenum format, GLenum type, GLuint clientVersion);
     52 bool IsValidCopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint readBufferHandle, GLuint clientVersion);
     53 
     54 bool IsSizedInternalFormat(GLenum internalFormat, GLuint clientVersion);
     55 GLenum GetSizedInternalFormat(GLenum format, GLenum type, GLuint clientVersion);
     56 
     57 GLuint GetPixelBytes(GLenum internalFormat, GLuint clientVersion);
     58 GLuint GetAlphaBits(GLenum internalFormat, GLuint clientVersion);
     59 GLuint GetRedBits(GLenum internalFormat, GLuint clientVersion);
     60 GLuint GetGreenBits(GLenum internalFormat, GLuint clientVersion);
     61 GLuint GetBlueBits(GLenum internalFormat, GLuint clientVersion);
     62 GLuint GetLuminanceBits(GLenum internalFormat, GLuint clientVersion);
     63 GLuint GetDepthBits(GLenum internalFormat, GLuint clientVersion);
     64 GLuint GetStencilBits(GLenum internalFormat, GLuint clientVersion);
     65 
     66 GLuint GetTypeBytes(GLenum type);
     67 bool IsSpecialInterpretationType(GLenum type);
     68 bool IsFloatOrFixedComponentType(GLenum type);
     69 
     70 GLenum GetFormat(GLenum internalFormat, GLuint clientVersion);
     71 GLenum GetType(GLenum internalFormat, GLuint clientVersion);
     72 
     73 GLenum GetComponentType(GLenum internalFormat, GLuint clientVersion);
     74 GLuint GetComponentCount(GLenum internalFormat, GLuint clientVersion);
     75 GLenum GetColorEncoding(GLenum internalFormat, GLuint clientVersion);
     76 
     77 bool IsColorRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
     78 bool IsColorRenderingSupported(GLenum internalFormat, const Context *context);
     79 bool IsTextureFilteringSupported(GLenum internalFormat, const rx::Renderer *renderer);
     80 bool IsTextureFilteringSupported(GLenum internalFormat, const Context *context);
     81 bool IsDepthRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
     82 bool IsDepthRenderingSupported(GLenum internalFormat, const Context *context);
     83 bool IsStencilRenderingSupported(GLenum internalFormat, const rx::Renderer *renderer);
     84 bool IsStencilRenderingSupported(GLenum internalFormat, const Context *context);
     85 
     86 GLuint GetRowPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLint alignment);
     87 GLuint GetDepthPitch(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height, GLint alignment);
     88 GLuint GetBlockSize(GLenum internalFormat, GLenum type, GLuint clientVersion, GLsizei width, GLsizei height);
     89 
     90 bool IsFormatCompressed(GLenum internalFormat, GLuint clientVersion);
     91 GLuint GetCompressedBlockWidth(GLenum internalFormat, GLuint clientVersion);
     92 GLuint GetCompressedBlockHeight(GLenum internalFormat, GLuint clientVersion);
     93 
     94 ColorWriteFunction GetColorWriteFunction(GLenum format, GLenum type, GLuint clientVersion);
     95 
     96 }
     97 
     98 #endif LIBGLESV2_FORMATUTILS_H_
     99