Hash :
2e568cfb
Author :
Date :
2017-09-18T17:05:22
Add generator for packed GL enums. For testing this also converts two unimportant GLenums, gl::BufferUsage and gl::CullModeFace. BUG=angleproject:2169 Change-Id: If1e86a97d0fed3fd567303aca6506ec579503076 Reviewed-on: https://chromium-review.googlesource.com/688000 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
// GENERATED FILE - DO NOT EDIT.
// Generated by src/libANGLE/gen_packed_gl_enums.py using data from packed_gl_enums.json.
//
// Copyright 2017 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.
//
// PackedGLEnums_autogen.cpp:
// Implements ANGLE-specific enums classes for GLEnum and functions operating
// on them.
#include "libANGLE/PackedGLEnums_autogen.h"
#include "common/debug.h"
namespace gl
{
template <>
BufferUsage FromGLenum<BufferUsage>(GLenum from)
{
switch (from)
{
case GL_DYNAMIC_COPY:
return BufferUsage::DynamicCopy;
case GL_DYNAMIC_DRAW:
return BufferUsage::DynamicDraw;
case GL_DYNAMIC_READ:
return BufferUsage::DynamicRead;
case GL_STATIC_COPY:
return BufferUsage::StaticCopy;
case GL_STATIC_DRAW:
return BufferUsage::StaticDraw;
case GL_STATIC_READ:
return BufferUsage::StaticRead;
case GL_STREAM_COPY:
return BufferUsage::StreamCopy;
case GL_STREAM_DRAW:
return BufferUsage::StreamDraw;
case GL_STREAM_READ:
return BufferUsage::StreamRead;
default:
return BufferUsage::InvalidEnum;
}
}
GLenum ToGLenum(BufferUsage from)
{
switch (from)
{
case BufferUsage::DynamicCopy:
return GL_DYNAMIC_COPY;
case BufferUsage::DynamicDraw:
return GL_DYNAMIC_DRAW;
case BufferUsage::DynamicRead:
return GL_DYNAMIC_READ;
case BufferUsage::StaticCopy:
return GL_STATIC_COPY;
case BufferUsage::StaticDraw:
return GL_STATIC_DRAW;
case BufferUsage::StaticRead:
return GL_STATIC_READ;
case BufferUsage::StreamCopy:
return GL_STREAM_COPY;
case BufferUsage::StreamDraw:
return GL_STREAM_DRAW;
case BufferUsage::StreamRead:
return GL_STREAM_READ;
default:
UNREACHABLE();
return GL_NONE;
}
}
template <>
CullFaceMode FromGLenum<CullFaceMode>(GLenum from)
{
switch (from)
{
case GL_BACK:
return CullFaceMode::Back;
case GL_FRONT:
return CullFaceMode::Front;
case GL_FRONT_AND_BACK:
return CullFaceMode::FrontAndBack;
default:
return CullFaceMode::InvalidEnum;
}
}
GLenum ToGLenum(CullFaceMode from)
{
switch (from)
{
case CullFaceMode::Back:
return GL_BACK;
case CullFaceMode::Front:
return GL_FRONT;
case CullFaceMode::FrontAndBack:
return GL_FRONT_AND_BACK;
default:
UNREACHABLE();
return GL_NONE;
}
}
} // namespace gl