Path: blob/main_old/src/common/PackedEGLEnums_autogen.cpp
1693 views
// GENERATED FILE - DO NOT EDIT.1// Generated by gen_packed_gl_enums.py using data from packed_egl_enums.json.2//3// Copyright 2017 The ANGLE Project Authors. All rights reserved.4// Use of this source code is governed by a BSD-style license that can be5// found in the LICENSE file.6//7// PackedEGLEnums_autogen.cpp:8// Implements ANGLE-specific enums classes for EGLenums and functions operating9// on them.1011#include "common/PackedEGLEnums_autogen.h"12#include "common/debug.h"1314namespace egl15{1617template <>18ColorSpace FromEGLenum<ColorSpace>(EGLenum from)19{20switch (from)21{22case EGL_COLORSPACE_sRGB:23return ColorSpace::sRGB;24case EGL_COLORSPACE_LINEAR:25return ColorSpace::Linear;26default:27return ColorSpace::InvalidEnum;28}29}3031EGLenum ToEGLenum(ColorSpace from)32{33switch (from)34{35case ColorSpace::sRGB:36return EGL_COLORSPACE_sRGB;37case ColorSpace::Linear:38return EGL_COLORSPACE_LINEAR;39default:40UNREACHABLE();41return 0;42}43}4445std::ostream &operator<<(std::ostream &os, ColorSpace value)46{47switch (value)48{49case ColorSpace::sRGB:50os << "EGL_COLORSPACE_sRGB";51break;52case ColorSpace::Linear:53os << "EGL_COLORSPACE_LINEAR";54break;55default:56os << "GL_INVALID_ENUM";57break;58}59return os;60}6162template <>63CompositorTiming FromEGLenum<CompositorTiming>(EGLenum from)64{65switch (from)66{67case EGL_COMPOSITE_DEADLINE_ANDROID:68return CompositorTiming::CompositeDeadline;69case EGL_COMPOSITE_INTERVAL_ANDROID:70return CompositorTiming::CompositInterval;71case EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID:72return CompositorTiming::CompositToPresentLatency;73default:74return CompositorTiming::InvalidEnum;75}76}7778EGLenum ToEGLenum(CompositorTiming from)79{80switch (from)81{82case CompositorTiming::CompositeDeadline:83return EGL_COMPOSITE_DEADLINE_ANDROID;84case CompositorTiming::CompositInterval:85return EGL_COMPOSITE_INTERVAL_ANDROID;86case CompositorTiming::CompositToPresentLatency:87return EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID;88default:89UNREACHABLE();90return 0;91}92}9394std::ostream &operator<<(std::ostream &os, CompositorTiming value)95{96switch (value)97{98case CompositorTiming::CompositeDeadline:99os << "EGL_COMPOSITE_DEADLINE_ANDROID";100break;101case CompositorTiming::CompositInterval:102os << "EGL_COMPOSITE_INTERVAL_ANDROID";103break;104case CompositorTiming::CompositToPresentLatency:105os << "EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID";106break;107default:108os << "GL_INVALID_ENUM";109break;110}111return os;112}113114template <>115ContextPriority FromEGLenum<ContextPriority>(EGLenum from)116{117switch (from)118{119case EGL_CONTEXT_PRIORITY_LOW_IMG:120return ContextPriority::Low;121case EGL_CONTEXT_PRIORITY_MEDIUM_IMG:122return ContextPriority::Medium;123case EGL_CONTEXT_PRIORITY_HIGH_IMG:124return ContextPriority::High;125default:126return ContextPriority::InvalidEnum;127}128}129130EGLenum ToEGLenum(ContextPriority from)131{132switch (from)133{134case ContextPriority::Low:135return EGL_CONTEXT_PRIORITY_LOW_IMG;136case ContextPriority::Medium:137return EGL_CONTEXT_PRIORITY_MEDIUM_IMG;138case ContextPriority::High:139return EGL_CONTEXT_PRIORITY_HIGH_IMG;140default:141UNREACHABLE();142return 0;143}144}145146std::ostream &operator<<(std::ostream &os, ContextPriority value)147{148switch (value)149{150case ContextPriority::Low:151os << "EGL_CONTEXT_PRIORITY_LOW_IMG";152break;153case ContextPriority::Medium:154os << "EGL_CONTEXT_PRIORITY_MEDIUM_IMG";155break;156case ContextPriority::High:157os << "EGL_CONTEXT_PRIORITY_HIGH_IMG";158break;159default:160os << "GL_INVALID_ENUM";161break;162}163return os;164}165166template <>167MessageType FromEGLenum<MessageType>(EGLenum from)168{169switch (from)170{171case EGL_DEBUG_MSG_CRITICAL_KHR:172return MessageType::Critical;173case EGL_DEBUG_MSG_ERROR_KHR:174return MessageType::Error;175case EGL_DEBUG_MSG_WARN_KHR:176return MessageType::Warn;177case EGL_DEBUG_MSG_INFO_KHR:178return MessageType::Info;179default:180return MessageType::InvalidEnum;181}182}183184EGLenum ToEGLenum(MessageType from)185{186switch (from)187{188case MessageType::Critical:189return EGL_DEBUG_MSG_CRITICAL_KHR;190case MessageType::Error:191return EGL_DEBUG_MSG_ERROR_KHR;192case MessageType::Warn:193return EGL_DEBUG_MSG_WARN_KHR;194case MessageType::Info:195return EGL_DEBUG_MSG_INFO_KHR;196default:197UNREACHABLE();198return 0;199}200}201202std::ostream &operator<<(std::ostream &os, MessageType value)203{204switch (value)205{206case MessageType::Critical:207os << "EGL_DEBUG_MSG_CRITICAL_KHR";208break;209case MessageType::Error:210os << "EGL_DEBUG_MSG_ERROR_KHR";211break;212case MessageType::Warn:213os << "EGL_DEBUG_MSG_WARN_KHR";214break;215case MessageType::Info:216os << "EGL_DEBUG_MSG_INFO_KHR";217break;218default:219os << "GL_INVALID_ENUM";220break;221}222return os;223}224225template <>226ObjectType FromEGLenum<ObjectType>(EGLenum from)227{228switch (from)229{230case EGL_OBJECT_THREAD_KHR:231return ObjectType::Thread;232case EGL_OBJECT_DISPLAY_KHR:233return ObjectType::Display;234case EGL_OBJECT_CONTEXT_KHR:235return ObjectType::Context;236case EGL_OBJECT_SURFACE_KHR:237return ObjectType::Surface;238case EGL_OBJECT_IMAGE_KHR:239return ObjectType::Image;240case EGL_OBJECT_SYNC_KHR:241return ObjectType::Sync;242case EGL_OBJECT_STREAM_KHR:243return ObjectType::Stream;244default:245return ObjectType::InvalidEnum;246}247}248249EGLenum ToEGLenum(ObjectType from)250{251switch (from)252{253case ObjectType::Thread:254return EGL_OBJECT_THREAD_KHR;255case ObjectType::Display:256return EGL_OBJECT_DISPLAY_KHR;257case ObjectType::Context:258return EGL_OBJECT_CONTEXT_KHR;259case ObjectType::Surface:260return EGL_OBJECT_SURFACE_KHR;261case ObjectType::Image:262return EGL_OBJECT_IMAGE_KHR;263case ObjectType::Sync:264return EGL_OBJECT_SYNC_KHR;265case ObjectType::Stream:266return EGL_OBJECT_STREAM_KHR;267default:268UNREACHABLE();269return 0;270}271}272273std::ostream &operator<<(std::ostream &os, ObjectType value)274{275switch (value)276{277case ObjectType::Thread:278os << "EGL_OBJECT_THREAD_KHR";279break;280case ObjectType::Display:281os << "EGL_OBJECT_DISPLAY_KHR";282break;283case ObjectType::Context:284os << "EGL_OBJECT_CONTEXT_KHR";285break;286case ObjectType::Surface:287os << "EGL_OBJECT_SURFACE_KHR";288break;289case ObjectType::Image:290os << "EGL_OBJECT_IMAGE_KHR";291break;292case ObjectType::Sync:293os << "EGL_OBJECT_SYNC_KHR";294break;295case ObjectType::Stream:296os << "EGL_OBJECT_STREAM_KHR";297break;298default:299os << "GL_INVALID_ENUM";300break;301}302return os;303}304305template <>306TextureFormat FromEGLenum<TextureFormat>(EGLenum from)307{308switch (from)309{310case EGL_NO_TEXTURE:311return TextureFormat::NoTexture;312case EGL_TEXTURE_RGB:313return TextureFormat::RGB;314case EGL_TEXTURE_RGBA:315return TextureFormat::RGBA;316default:317return TextureFormat::InvalidEnum;318}319}320321EGLenum ToEGLenum(TextureFormat from)322{323switch (from)324{325case TextureFormat::NoTexture:326return EGL_NO_TEXTURE;327case TextureFormat::RGB:328return EGL_TEXTURE_RGB;329case TextureFormat::RGBA:330return EGL_TEXTURE_RGBA;331default:332UNREACHABLE();333return 0;334}335}336337std::ostream &operator<<(std::ostream &os, TextureFormat value)338{339switch (value)340{341case TextureFormat::NoTexture:342os << "EGL_NO_TEXTURE";343break;344case TextureFormat::RGB:345os << "EGL_TEXTURE_RGB";346break;347case TextureFormat::RGBA:348os << "EGL_TEXTURE_RGBA";349break;350default:351os << "GL_INVALID_ENUM";352break;353}354return os;355}356357template <>358Timestamp FromEGLenum<Timestamp>(EGLenum from)359{360switch (from)361{362case EGL_REQUESTED_PRESENT_TIME_ANDROID:363return Timestamp::RequestedPresentTime;364case EGL_RENDERING_COMPLETE_TIME_ANDROID:365return Timestamp::RenderingCompleteTime;366case EGL_COMPOSITION_LATCH_TIME_ANDROID:367return Timestamp::CompositionLatchTime;368case EGL_FIRST_COMPOSITION_START_TIME_ANDROID:369return Timestamp::FirstCompositionStartTime;370case EGL_LAST_COMPOSITION_START_TIME_ANDROID:371return Timestamp::LastCompositionStartTime;372case EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID:373return Timestamp::FirstCompositionGPUFinishedTime;374case EGL_DISPLAY_PRESENT_TIME_ANDROID:375return Timestamp::DisplayPresentTime;376case EGL_DEQUEUE_READY_TIME_ANDROID:377return Timestamp::DequeueReadyTime;378case EGL_READS_DONE_TIME_ANDROID:379return Timestamp::ReadsDoneTime;380default:381return Timestamp::InvalidEnum;382}383}384385EGLenum ToEGLenum(Timestamp from)386{387switch (from)388{389case Timestamp::RequestedPresentTime:390return EGL_REQUESTED_PRESENT_TIME_ANDROID;391case Timestamp::RenderingCompleteTime:392return EGL_RENDERING_COMPLETE_TIME_ANDROID;393case Timestamp::CompositionLatchTime:394return EGL_COMPOSITION_LATCH_TIME_ANDROID;395case Timestamp::FirstCompositionStartTime:396return EGL_FIRST_COMPOSITION_START_TIME_ANDROID;397case Timestamp::LastCompositionStartTime:398return EGL_LAST_COMPOSITION_START_TIME_ANDROID;399case Timestamp::FirstCompositionGPUFinishedTime:400return EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID;401case Timestamp::DisplayPresentTime:402return EGL_DISPLAY_PRESENT_TIME_ANDROID;403case Timestamp::DequeueReadyTime:404return EGL_DEQUEUE_READY_TIME_ANDROID;405case Timestamp::ReadsDoneTime:406return EGL_READS_DONE_TIME_ANDROID;407default:408UNREACHABLE();409return 0;410}411}412413std::ostream &operator<<(std::ostream &os, Timestamp value)414{415switch (value)416{417case Timestamp::RequestedPresentTime:418os << "EGL_REQUESTED_PRESENT_TIME_ANDROID";419break;420case Timestamp::RenderingCompleteTime:421os << "EGL_RENDERING_COMPLETE_TIME_ANDROID";422break;423case Timestamp::CompositionLatchTime:424os << "EGL_COMPOSITION_LATCH_TIME_ANDROID";425break;426case Timestamp::FirstCompositionStartTime:427os << "EGL_FIRST_COMPOSITION_START_TIME_ANDROID";428break;429case Timestamp::LastCompositionStartTime:430os << "EGL_LAST_COMPOSITION_START_TIME_ANDROID";431break;432case Timestamp::FirstCompositionGPUFinishedTime:433os << "EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID";434break;435case Timestamp::DisplayPresentTime:436os << "EGL_DISPLAY_PRESENT_TIME_ANDROID";437break;438case Timestamp::DequeueReadyTime:439os << "EGL_DEQUEUE_READY_TIME_ANDROID";440break;441case Timestamp::ReadsDoneTime:442os << "EGL_READS_DONE_TIME_ANDROID";443break;444default:445os << "GL_INVALID_ENUM";446break;447}448return os;449}450451} // namespace egl452453454