Hash :
7e0699a2
Author :
Date :
2020-02-05T17:04:06
Create the ProgramExecutable Class The ProgramExecutable class is being created to collect data structures that are common to both Programs and ProgramPipelines, as well as any shared functions. This allows callers to request the current ProgramExecutable from the State and make Program-/ProgramPipeline-specific queries without needing to know exactly which responded. This will also allow the necessary data structures to only be populated and stored within the ProgramExecutable when necessary and reused as often as necessary. Bug: angleproject:3570 Change-Id: I101f08ab03421894667b4a426a04d2147489f0e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2040512 Commit-Queue: Tim Van Patten <timvp@google.com> 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
//
// Copyright 2020 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.
//
// InfoLog.h: Defines the gl::InfoLog class to handle the logs generated when
// compiling/linking shaders so useful error messages can be returned to the caller.
#ifndef LIBANGLE_INFOLOG_H_
#define LIBANGLE_INFOLOG_H_
namespace gl
{
class InfoLog : angle::NonCopyable
{
public:
InfoLog();
~InfoLog();
size_t getLength() const;
void getLog(GLsizei bufSize, GLsizei *length, char *infoLog) const;
void appendSanitized(const char *message);
void reset();
// This helper class ensures we append a newline after writing a line.
class StreamHelper : angle::NonCopyable
{
public:
StreamHelper(StreamHelper &&rhs) : mStream(rhs.mStream) { rhs.mStream = nullptr; }
StreamHelper &operator=(StreamHelper &&rhs)
{
std::swap(mStream, rhs.mStream);
return *this;
}
~StreamHelper()
{
// Write newline when destroyed on the stack
if (mStream)
{
(*mStream) << std::endl;
}
}
template <typename T>
StreamHelper &operator<<(const T &value)
{
(*mStream) << value;
return *this;
}
private:
friend class InfoLog;
StreamHelper(std::stringstream *stream) : mStream(stream) { ASSERT(stream); }
std::stringstream *mStream;
};
template <typename T>
StreamHelper operator<<(const T &value)
{
ensureInitialized();
StreamHelper helper(mLazyStream.get());
helper << value;
return helper;
}
std::string str() const { return mLazyStream ? mLazyStream->str() : ""; }
bool empty() const;
private:
void ensureInitialized()
{
if (!mLazyStream)
{
mLazyStream.reset(new std::stringstream());
}
}
std::unique_ptr<std::stringstream> mLazyStream;
};
} // namespace gl
#endif // LIBANGLE_INFOLOG_H_