Edit

kc3-lang/angle/src/libANGLE/renderer/Format.cpp

Branch :

  • Show log

    Commit

  • Author : Jamie Madill
    Date : 2016-10-06 15:55:35
    Hash : e0548ad2
    Message : D3D11: Split off DXGI component type query. This query is currently a part of a std::map. Split it off to its own switch using auto-generation based on the format string. Also introduce a DXGI-to-angle format map. This map is not totally complete because some more esoteric formats don't have corresponding ANGLE formats yet. We should add these other formats (EG NV12) if we need them. BUG=angleproject:1389 BUG=angleproject:1459 Change-Id: I49e045bdc04a52166299c9e22a4c4d3f24069dbc Reviewed-on: https://chromium-review.googlesource.com/392209 Reviewed-by: Geoff Lang <geofflang@chromium.org>

  • src/libANGLE/renderer/Format.cpp
  • //
    // Copyright 2016 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    // Format:
    //   A universal description of texture storage. Across multiple
    //   renderer back-ends, there are common formats and some distinct
    //   permutations, this enum encapsulates them all.
    
    #include "libANGLE/renderer/Format.h"
    
    #include "image_util/copyimage.h"
    
    using namespace rx;
    
    namespace angle
    {
    
    namespace
    {
    
    const FastCopyFunctionMap &GetFastCopyFunctionsMap(Format::ID formatID)
    {
        switch (formatID)
        {
            case Format::ID::B8G8R8A8_UNORM:
            {
                static FastCopyFunctionMap fastCopyMap;
                if (fastCopyMap.empty())
                {
                    fastCopyMap[gl::FormatType(GL_RGBA, GL_UNSIGNED_BYTE)] = CopyBGRA8ToRGBA8;
                }
                return fastCopyMap;
            }
            default:
            {
                static FastCopyFunctionMap emptyMap;
                return emptyMap;
            }
        }
    }
    
    }  // anonymous namespace
    
    Format::Format(ID id,
                   GLenum glFormat,
                   GLenum fboFormat,
                   MipGenerationFunction mipGen,
                   ColorReadFunction colorRead,
                   GLenum componentType,
                   GLuint redBits,
                   GLuint greenBits,
                   GLuint blueBits,
                   GLuint alphaBits,
                   GLuint depthBits,
                   GLuint stencilBits)
        : id(id),
          glInternalFormat(glFormat),
          fboImplementationInternalFormat(fboFormat),
          mipGenerationFunction(mipGen),
          colorReadFunction(colorRead),
          fastCopyFunctions(GetFastCopyFunctionsMap(id)),
          componentType(componentType),
          redBits(redBits),
          greenBits(greenBits),
          blueBits(blueBits),
          alphaBits(alphaBits),
          depthBits(depthBits),
          stencilBits(stencilBits)
    {
    }
    
    }  // namespace angle