gfx/angle/src/libANGLE/renderer/Format.h
author Morris Tseng <mtseng@mozilla.com>
Thu, 08 Sep 2016 16:28:30 +0800
changeset 354509 53735145cfbeede7164416318becd8e33dca53c9
child 356890 7e4b771905373aba5a8b0733389ba5d1855c4158
permissions -rwxr-xr-x
Bug 1297924 - Update ANGLE to chromium/2845. r=jgilbert MozReview-Commit-ID: 2H0PBFFgmDp

//
// 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 typed GPU storage. Across multiple
//   renderer back-ends, there are common formats and some distinct
//   permutations, this enum encapsulates them all. Formats apply to
//   textures, but could also apply to any typed data.

#ifndef LIBANGLE_RENDERER_FORMAT_H_
#define LIBANGLE_RENDERER_FORMAT_H_

#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/renderer_utils.h"

namespace angle
{

struct Format final : angle::NonCopyable
{
    enum class ID;

    Format(ID id,
           GLenum glFormat,
           GLenum fboFormat,
           rx::MipGenerationFunction mipGen,
           rx::ColorReadFunction colorRead);

    static const Format &Get(ID id);

    ID id;

    // The closest matching GL internal format for the storage this format uses. Note that this
    // may be a different internal format than the one this ANGLE format is used for.
    GLenum glInternalFormat;

    // The format we should report to the GL layer when querying implementation formats from a FBO.
    // This might not be the same as the glInternalFormat, since some DXGI formats don't have
    // matching GL format enums, like BGRA4, BGR5A1 and B5G6R6.
    GLenum fboImplementationInternalFormat;

    rx::MipGenerationFunction mipGenerationFunction;
    rx::ColorReadFunction colorReadFunction;

    // A map from a gl::FormatType to a fast pixel copy function for this format.
    rx::FastCopyFunctionMap fastCopyFunctions;
};

}  // namespace angle

#include "libANGLE/renderer/Format_ID_autogen.inl"

#endif  // LIBANGLE_RENDERER_FORMAT_H_