#include "libANGLE/Shader.h"
#include <functional>
#include <sstream>
#include "GLSLANG/ShaderLang.h"
#include "common/angle_version_info.h"
#include "common/string_utils.h"
#include "common/system_utils.h"
#include "common/utilities.h"
#include "libANGLE/Caps.h"
#include "libANGLE/Compiler.h"
#include "libANGLE/Constants.h"
#include "libANGLE/Context.h"
#include "libANGLE/Display.h"
#include "libANGLE/MemoryShaderCache.h"
#include "libANGLE/Program.h"
#include "libANGLE/ResourceManager.h"
#include "libANGLE/renderer/GLImplFactory.h"
#include "libANGLE/renderer/ShaderImpl.h"
#include "libANGLE/trace.h"
#include "platform/autogen/FrontendFeatures_autogen.h"
namespace gl
{
namespace
{
constexpr uint32_t kShaderCacheIdentifier = …;
constexpr char kShaderDumpPathVarName[] = …;
constexpr char kEShaderDumpPathPropertyName[] = …;
size_t ComputeShaderHash(const std::string &mergedSource)
{ … }
std::string GetShaderDumpFilePath(size_t shaderHash, const char *suffix)
{ … }
class CompileTask final : public angle::Closure
{ … };
class CompileEvent final
{ … };
angle::Result CompileTask::compileImpl()
{ … }
angle::Result CompileTask::postTranslate()
{ … }
template <typename T>
void AppendHashValue(angle::base::SecureHashAlgorithm &hasher, T value)
{ … }
angle::JobThreadSafety GetTranslateTaskThreadSafety(const Context *context)
{ … }
}
const char *GetShaderTypeString(ShaderType type)
{ … }
std::string GetShaderDumpFileDirectory()
{ … }
std::string GetShaderDumpFileName(size_t shaderHash)
{ … }
struct CompileJob
{ … };
struct CompileJobDone final : public CompileJob
{ … };
ShaderState::ShaderState(ShaderType shaderType)
: … { … }
ShaderState::~ShaderState() { … }
Shader::Shader(ShaderProgramManager *manager,
rx::GLImplFactory *implFactory,
const gl::Limitations &rendererLimitations,
ShaderType type,
ShaderProgramID handle)
: … { … }
void Shader::onDestroy(const gl::Context *context)
{ … }
Shader::~Shader()
{ … }
angle::Result Shader::setLabel(const Context *context, const std::string &label)
{ … }
const std::string &Shader::getLabel() const
{ … }
ShaderProgramID Shader::getHandle() const
{ … }
std::string Shader::joinShaderSources(GLsizei count, const char *const *string, const GLint *length)
{ … }
void Shader::setSource(const Context *context,
GLsizei count,
const char *const *string,
const GLint *length)
{ … }
int Shader::getInfoLogLength(const Context *context)
{ … }
void Shader::getInfoLog(const Context *context, GLsizei bufSize, GLsizei *length, char *infoLog)
{ … }
int Shader::getSourceLength() const
{ … }
int Shader::getTranslatedSourceLength(const Context *context)
{ … }
int Shader::getTranslatedSourceWithDebugInfoLength(const Context *context)
{ … }
void Shader::GetSourceImpl(const std::string &source,
GLsizei bufSize,
GLsizei *length,
char *buffer)
{ … }
void Shader::getSource(GLsizei bufSize, GLsizei *length, char *buffer) const
{ … }
void Shader::getTranslatedSource(const Context *context,
GLsizei bufSize,
GLsizei *length,
char *buffer)
{ … }
const std::string &Shader::getTranslatedSource(const Context *context)
{ … }
size_t Shader::getSourceHash() const
{ … }
void Shader::getTranslatedSourceWithDebugInfo(const Context *context,
GLsizei bufSize,
GLsizei *length,
char *buffer)
{ … }
void Shader::compile(const Context *context, angle::JobResultExpectancy resultExpectancy)
{ … }
void Shader::resolveCompile(const Context *context)
{ … }
void Shader::addRef()
{ … }
void Shader::release(const Context *context)
{ … }
unsigned int Shader::getRefCount() const
{ … }
bool Shader::isFlaggedForDeletion() const
{ … }
void Shader::flagForDeletion()
{ … }
bool Shader::isCompiled(const Context *context)
{ … }
bool Shader::isCompleted()
{ … }
SharedCompileJob Shader::getCompileJob(SharedCompiledShaderState *compiledStateOut)
{ … }
angle::Result Shader::serialize(const Context *context, angle::MemoryBuffer *binaryOut) const
{ … }
bool Shader::deserialize(BinaryInputStream &stream)
{ … }
bool Shader::loadBinary(const Context *context,
const void *binary,
GLsizei length,
angle::JobResultExpectancy resultExpectancy)
{ … }
bool Shader::loadShaderBinary(const Context *context,
const void *binary,
GLsizei length,
angle::JobResultExpectancy resultExpectancy)
{ … }
bool Shader::loadBinaryImpl(const Context *context,
const void *binary,
GLsizei length,
angle::JobResultExpectancy resultExpectancy,
bool generatedWithOfflineCompiler)
{ … }
void Shader::setShaderKey(const Context *context,
const ShCompileOptions &compileOptions,
const ShShaderOutput &outputType,
const ShBuiltInResources &resources)
{ … }
bool WaitCompileJobUnlocked(const SharedCompileJob &compileJob)
{ … }
}