Edit

kc3-lang/angle/src/common/Color.h

Branch :

  • Show log

    Commit

  • Author : Shahbaz Youssefi
    Date : 2019-02-26 15:08:11
    Hash : 4d153383
    Message : Reland "Vulkan: Implement debug markers" This reverts commit 0c01e36783b20a0177c653490cb4f8ea4a896075. Reason for revert: Its dependency that was reverted has now relanded: https://chromium-review.googlesource.com/c/angle/angle/+/1489153 Original change's description: > Revert "Vulkan: Implement debug markers" > > This reverts commit 983e446921946734fe47217c345a8fe2f079319d. > > Reason for revert: Depends on a CL that's reverted: https://chromium-review.googlesource.com/c/angle/angle/+/1470605 > > Original change's description: > > Vulkan: Implement debug markers > > > > Covers both GL_KHR_debug and GL_EXT_debug_marker. > > > > Debug markers are used to specify events or hierarchically categorize a > > set of commands within the command buffer. When debugging, this allows > > for quicker navigation to the draw calls of interest, and otherwise > > provides context to debug output. > > > > Bug: angleproject:2853 > > Change-Id: Id65e11fc877d9e70b6fd0fae7f0bbbcb1164bf10 > > Reviewed-on: https://chromium-review.googlesource.com/c/1403956 > > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> > > Reviewed-by: Jamie Madill <jmadill@chromium.org> > > Reviewed-by: Geoff Lang <geofflang@chromium.org> > > TBR=geofflang@chromium.org,jmadill@chromium.org,syoussefi@chromium.org > > Change-Id: I7fcfc8683195d396aec61848719f52c0fa049ece > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: angleproject:2853 > Reviewed-on: https://chromium-review.googlesource.com/c/1470606 > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> TBR=geofflang@chromium.org,jmadill@google.com,syoussefi@chromium.org Bug: angleproject:2853 Change-Id: Ie19ae103244d54dcf7108d5f61c24e318fc44057 Reviewed-on: https://chromium-review.googlesource.com/c/1489154 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Jamie Madill <jmadill@google.com>

  • src/common/Color.h
  • //
    // Copyright (c) 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.
    //
    
    // Color.h : Defines the Color type used throughout the ANGLE libraries
    
    #ifndef COMMON_COLOR_H_
    #define COMMON_COLOR_H_
    
    #include <cstdint>
    
    namespace angle
    {
    
    template <typename T>
    struct Color
    {
        Color();
        constexpr Color(T r, T g, T b, T a);
    
        const T *data() const { return &red; }
        T *ptr() { return &red; }
    
        static Color fromData(const T *data) { return Color(data[0], data[1], data[2], data[3]); }
        void writeData(T *data) const
        {
            data[0] = red;
            data[1] = green;
            data[2] = blue;
            data[3] = alpha;
        }
    
        T red;
        T green;
        T blue;
        T alpha;
    };
    
    template <typename T>
    bool operator==(const Color<T> &a, const Color<T> &b);
    
    template <typename T>
    bool operator!=(const Color<T> &a, const Color<T> &b);
    
    typedef Color<float> ColorF;
    typedef Color<int> ColorI;
    typedef Color<unsigned int> ColorUI;
    
    struct ColorGeneric
    {
        inline ColorGeneric();
        inline ColorGeneric(const ColorF &color);
        inline ColorGeneric(const ColorI &color);
        inline ColorGeneric(const ColorUI &color);
    
        enum class Type : uint8_t
        {
            Float = 0,
            Int   = 1,
            UInt  = 2
        };
    
        union
        {
            ColorF colorF;
            ColorI colorI;
            ColorUI colorUI;
        };
    
        Type type;
    };
    
    inline bool operator==(const ColorGeneric &a, const ColorGeneric &b);
    
    inline bool operator!=(const ColorGeneric &a, const ColorGeneric &b);
    
    struct DepthStencil
    {
        DepthStencil() : depth(0), stencil(0) {}
    
        // Double is needed to represent the 32-bit integer range of GL_DEPTH_COMPONENT32.
        double depth;
        uint32_t stencil;
    };
    }  // namespace angle
    
    // TODO: Move this fully into the angle namespace
    namespace gl
    {
    
    template <typename T>
    using Color        = angle::Color<T>;
    using ColorF       = angle::ColorF;
    using ColorI       = angle::ColorI;
    using ColorUI      = angle::ColorUI;
    using ColorGeneric = angle::ColorGeneric;
    
    }  // namespace gl
    
    #include "Color.inl"
    
    #endif  // COMMON_COLOR_H_