Hash :
e9603921
Author :
Date :
2019-10-31T14:33:26
Capture/Replay: Correct a few GLenum replay issues. This change refactors the GLenum utils into a non-autogenerated and an autogenerated portion. That makes it easier to modify the non-auto- generated bits to properly output GLenums even when the gl.xml data isn't totally correct. For instance, the "GetPName" group was missing a bunch of queries. Instead of trying to fix the GL we can simply fall back to querying the "Default" group when we return invalid enum. Also corrects a missing "0x" on hex output. Also allows the capture/replay sample to specify the correct binary data directory when testing a replay. Bug: angleproject:3611 Change-Id: I8e4c690b2850bb157a8cde8b057b20603e4b177d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1891008 Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: 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
//
// Copyright 2019 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.
//
// gl_enum_utils.cpp:
// Utility functions for converting GLenums to string.
#include "libANGLE/gl_enum_utils.h"
#include <iomanip>
namespace gl
{
const char kUnknownGLenumString[] = "EnumUnknown";
void OutputGLenumString(std::ostream &out, GLenumGroup enumGroup, unsigned int value)
{
const char *enumStr = GLenumToString(enumGroup, value);
if (enumStr != kUnknownGLenumString)
{
out << enumStr;
return;
}
if (enumGroup != GLenumGroup::DefaultGroup)
{
// Retry with the "Default" group
enumStr = GLenumToString(GLenumGroup::DefaultGroup, value);
if (enumStr != kUnknownGLenumString)
{
out << enumStr;
return;
}
}
out << std::hex << "0x" << std::setfill('0') << std::setw(4) << value << std::dec;
}
void OutputGLbitfieldString(std::ostream &out, GLenumGroup enumGroup, unsigned int value)
{
out << GLbitfieldToString(enumGroup, value);
}
const char *GLbooleanToString(unsigned int value)
{
switch (value)
{
case 0x0:
return "GL_FALSE";
case 0x1:
return "GL_TRUE";
default:
return kUnknownGLenumString;
}
}
} // namespace gl