Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp
void Texture::loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
                            GLint unpackAlignment, const void *input, size_t outputPitch, void *output, D3DSURFACE_DESC *description) const
{
    GLsizei inputPitch = ComputePitch(width, format, type, unpackAlignment);

    switch (type)
    {
      case GL_UNSIGNED_BYTE:
        switch (format)
        {
          case GL_ALPHA:
            loadAlphaImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_LUMINANCE:
            loadLuminanceImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output, description->Format == D3DFMT_L8);
            break;
          case GL_LUMINANCE_ALPHA:
            loadLuminanceAlphaImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output, description->Format == D3DFMT_A8L8);
            break;
          case GL_RGB:
            loadRGBUByteImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_RGBA:
            loadRGBAUByteImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_BGRA_EXT:
            loadBGRAImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          default: UNREACHABLE();
        }
        break;
      case GL_UNSIGNED_SHORT_5_6_5:
        switch (format)
        {
          case GL_RGB:
            loadRGB565ImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          default: UNREACHABLE();
        }
        break;
      case GL_UNSIGNED_SHORT_4_4_4_4:
        switch (format)
        {
          case GL_RGBA:
            loadRGBA4444ImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          default: UNREACHABLE();
        }
        break;
      case GL_UNSIGNED_SHORT_5_5_5_1:
        switch (format)
        {
          case GL_RGBA:
            loadRGBA5551ImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          default: UNREACHABLE();
        }
        break;
      case GL_FLOAT:
        switch (format)
        {
          // float textures are converted to RGBA, not BGRA, as they're stored that way in D3D
          case GL_ALPHA:
            loadAlphaFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_LUMINANCE:
            loadLuminanceFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_LUMINANCE_ALPHA:
            loadLuminanceAlphaFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_RGB:
            loadRGBFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_RGBA:
            loadRGBAFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          default: UNREACHABLE();
        }
        break;
      case GL_HALF_FLOAT_OES:
        switch (format)
        {
          // float textures are converted to RGBA, not BGRA, as they're stored that way in D3D
          case GL_ALPHA:
            loadAlphaHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_LUMINANCE:
            loadLuminanceHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_LUMINANCE_ALPHA:
            loadLuminanceAlphaHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_RGB:
            loadRGBHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_RGBA:
            loadRGBAHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          default: UNREACHABLE();
        }
        break;
      default: UNREACHABLE();
    }
}
// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
// into the target pixel rectangle at output with outputPitch bytes in between each line.
Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
into the target pixel rectangle at output with outputPitch bytes in between each line.
Store the pixel rectangle designated by xoffset yoffset width height with pixels stored as format / type at input into the target pixel rectangle at output with outputPitch bytes in between each line .
void Texture::loadImageData(GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type,
                            GLint unpackAlignment, const void *input, size_t outputPitch, void *output, D3DSURFACE_DESC *description) const
{
    GLsizei inputPitch = ComputePitch(width, format, type, unpackAlignment);
    switch (type)
    {
      case GL_UNSIGNED_BYTE:
        switch (format)
        {
          case GL_ALPHA:
            loadAlphaImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_LUMINANCE:
            loadLuminanceImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output, description->Format == D3DFMT_L8);
            break;
          case GL_LUMINANCE_ALPHA:
            loadLuminanceAlphaImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output, description->Format == D3DFMT_A8L8);
            break;
          case GL_RGB:
            loadRGBUByteImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_RGBA:
            loadRGBAUByteImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_BGRA_EXT:
            loadBGRAImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          default: UNREACHABLE();
        }
        break;
      case GL_UNSIGNED_SHORT_5_6_5:
        switch (format)
        {
          case GL_RGB:
            loadRGB565ImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          default: UNREACHABLE();
        }
        break;
      case GL_UNSIGNED_SHORT_4_4_4_4:
        switch (format)
        {
          case GL_RGBA:
            loadRGBA4444ImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          default: UNREACHABLE();
        }
        break;
      case GL_UNSIGNED_SHORT_5_5_5_1:
        switch (format)
        {
          case GL_RGBA:
            loadRGBA5551ImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          default: UNREACHABLE();
        }
        break;
      case GL_FLOAT:
        switch (format)
        {
          case GL_ALPHA:
            loadAlphaFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_LUMINANCE:
            loadLuminanceFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_LUMINANCE_ALPHA:
            loadLuminanceAlphaFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_RGB:
            loadRGBFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_RGBA:
            loadRGBAFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          default: UNREACHABLE();
        }
        break;
      case GL_HALF_FLOAT_OES:
        switch (format)
        {
          case GL_ALPHA:
            loadAlphaHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_LUMINANCE:
            loadLuminanceHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_LUMINANCE_ALPHA:
            loadLuminanceAlphaHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_RGB:
            loadRGBHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          case GL_RGBA:
            loadRGBAHalfFloatImageData(xoffset, yoffset, width, height, inputPitch, input, outputPitch, output);
            break;
          default: UNREACHABLE();
        }
        break;
      default: UNREACHABLE();
    }
}
void Texture :: loadImageData ( GLint xoffset , GLint yoffset , GLsizei width , GLsizei height , GLenum format , GLenum type , GLint unpackAlignment , const void * input , size_t outputPitch , void * output , D3DSURFACE_DESC * description ) const { GLsizei inputPitch = ComputePitch ( width , format , type , unpackAlignment ) ; switch ( type ) { case GL_UNSIGNED_BYTE : switch ( format ) { case GL_ALPHA : loadAlphaImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; case GL_LUMINANCE : loadLuminanceImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output , description -> Format == D3DFMT_L8 ) ; break ; case GL_LUMINANCE_ALPHA : loadLuminanceAlphaImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output , description -> Format == D3DFMT_A8L8 ) ; break ; case GL_RGB : loadRGBUByteImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; case GL_RGBA : loadRGBAUByteImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; case GL_BGRA_EXT : loadBGRAImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; default : UNREACHABLE ( ) ; } break ; case GL_UNSIGNED_SHORT_5_6_5 : switch ( format ) { case GL_RGB : loadRGB565ImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; default : UNREACHABLE ( ) ; } break ; case GL_UNSIGNED_SHORT_4_4_4_4 : switch ( format ) { case GL_RGBA : loadRGBA4444ImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; default : UNREACHABLE ( ) ; } break ; case GL_UNSIGNED_SHORT_5_5_5_1 : switch ( format ) { case GL_RGBA : loadRGBA5551ImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; default : UNREACHABLE ( ) ; } break ; case GL_FLOAT : switch ( format ) { case GL_ALPHA : loadAlphaFloatImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; case GL_LUMINANCE : loadLuminanceFloatImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; case GL_LUMINANCE_ALPHA : loadLuminanceAlphaFloatImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; case GL_RGB : loadRGBFloatImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; case GL_RGBA : loadRGBAFloatImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; default : UNREACHABLE ( ) ; } break ; case GL_HALF_FLOAT_OES : switch ( format ) { case GL_ALPHA : loadAlphaHalfFloatImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; case GL_LUMINANCE : loadLuminanceHalfFloatImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; case GL_LUMINANCE_ALPHA : loadLuminanceAlphaHalfFloatImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; case GL_RGB : loadRGBHalfFloatImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; case GL_RGBA : loadRGBAHalfFloatImageData ( xoffset , yoffset , width , height , inputPitch , input , outputPitch , output ) ; break ; default : UNREACHABLE ( ) ; } break ; default : UNREACHABLE ( ) ; } }
Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
into the target pixel rectangle at output with outputPitch bytes in between each line.
Store the pixel rectangle designated by xoffset yoffset width height with pixels stored as format / type at input into the target pixel rectangle at output with outputPitch bytes in between each line .
// float textures are converted to RGBA, not BGRA, as they're stored that way in D3D // float textures are converted to RGBA, not BGRA, as they're stored that way in D3D