chromium/third_party/angle/src/libANGLE/Program.cpp

//
// Copyright 2002 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.
//

// Program.cpp: Implements the gl::Program class. Implements GL program objects
// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.

#include "libANGLE/Program.h"

#include <algorithm>
#include <utility>

#include "common/angle_version_info.h"
#include "common/bitset_utils.h"
#include "common/debug.h"
#include "common/platform.h"
#include "common/platform_helpers.h"
#include "common/string_utils.h"
#include "common/utilities.h"
#include "compiler/translator/blocklayout.h"
#include "libANGLE/Context.h"
#include "libANGLE/ErrorStrings.h"
#include "libANGLE/MemoryProgramCache.h"
#include "libANGLE/ProgramLinkedResources.h"
#include "libANGLE/ResourceManager.h"
#include "libANGLE/Uniform.h"
#include "libANGLE/VaryingPacking.h"
#include "libANGLE/Version.h"
#include "libANGLE/capture/FrameCapture.h"
#include "libANGLE/features.h"
#include "libANGLE/histogram_macros.h"
#include "libANGLE/queryconversions.h"
#include "libANGLE/renderer/ContextImpl.h"
#include "libANGLE/renderer/GLImplFactory.h"
#include "libANGLE/renderer/ProgramImpl.h"
#include "libANGLE/trace.h"
#include "platform/PlatformMethods.h"
#include "platform/autogen/FrontendFeatures_autogen.h"

namespace gl
{

namespace
{
void InitUniformBlockLinker(const ProgramState &state, UniformBlockLinker *blockLinker)
{}

void InitShaderStorageBlockLinker(const ProgramState &state, ShaderStorageBlockLinker *blockLinker)
{}

// Provides a mechanism to access the result of asynchronous linking.
class LinkEvent : angle::NonCopyable
{};

// Wraps an already done linking.
class LinkEventDone final : public LinkEvent
{};

void ScheduleSubTasks(const std::shared_ptr<angle::WorkerThreadPool> &workerThreadPool,
                      std::vector<std::shared_ptr<rx::LinkSubTask>> &tasks,
                      std::vector<std::shared_ptr<angle::WaitableEvent>> *eventsOut)
{}
}  // anonymous namespace

const char *GetLinkMismatchErrorString(LinkMismatchError linkError)
{}

template <typename T>
void UpdateInterfaceVariable(std::vector<T> *block, const sh::ShaderVariable &var)
{}

// Saves the linking context for later use in resolveLink().
struct Program::LinkingState
{};

const char *const g_fakepath =;

// InfoLog implementation.
InfoLog::InfoLog() :{}

InfoLog::~InfoLog() {}

size_t InfoLog::getLength() const
{}

void InfoLog::getLog(GLsizei bufSize, GLsizei *length, char *infoLog) const
{}

// append a sanitized message to the program info log.
// The D3D compiler includes a fake file path in some of the warning or error
// messages, so lets remove all occurrences of this fake file path from the log.
void InfoLog::appendSanitized(const char *message)
{}

void InfoLog::reset()
{}

bool InfoLog::empty() const
{}

void LogLinkMismatch(InfoLog &infoLog,
                     const std::string &variableName,
                     const char *variableType,
                     LinkMismatchError linkError,
                     const std::string &mismatchedStructOrBlockFieldName,
                     ShaderType shaderType1,
                     ShaderType shaderType2)
{}

bool IsActiveInterfaceBlock(const sh::InterfaceBlock &interfaceBlock)
{}

// VariableLocation implementation.
VariableLocation::VariableLocation() :{}

VariableLocation::VariableLocation(unsigned int arrayIndexIn, unsigned int index)
    :{}

// ProgramBindings implementation.
ProgramBindings::ProgramBindings() {}

ProgramBindings::~ProgramBindings() {}

void ProgramBindings::bindLocation(GLuint index, const std::string &name)
{}

int ProgramBindings::getBindingByName(const std::string &name) const
{}

template <typename T>
int ProgramBindings::getBinding(const T &variable) const
{}

ProgramBindings::const_iterator ProgramBindings::begin() const
{}

ProgramBindings::const_iterator ProgramBindings::end() const
{}

std::map<std::string, GLuint> ProgramBindings::getStableIterationMap() const
{}

// ProgramAliasedBindings implementation.
ProgramAliasedBindings::ProgramAliasedBindings() {}

ProgramAliasedBindings::~ProgramAliasedBindings() {}

void ProgramAliasedBindings::bindLocation(GLuint index, const std::string &name)
{}

int ProgramAliasedBindings::getBindingByName(const std::string &name) const
{}

int ProgramAliasedBindings::getBindingByLocation(GLuint location) const
{}

template <typename T>
int ProgramAliasedBindings::getBinding(const T &variable) const
{}
template int ProgramAliasedBindings::getBinding<UsedUniform>(const UsedUniform &variable) const;
template int ProgramAliasedBindings::getBinding<ProgramOutput>(const ProgramOutput &variable) const;
template int ProgramAliasedBindings::getBinding<sh::ShaderVariable>(
    const sh::ShaderVariable &variable) const;

ProgramAliasedBindings::const_iterator ProgramAliasedBindings::begin() const
{}

ProgramAliasedBindings::const_iterator ProgramAliasedBindings::end() const
{}

std::map<std::string, ProgramBinding> ProgramAliasedBindings::getStableIterationMap() const
{}

// ProgramState implementation.
ProgramState::ProgramState(rx::GLImplFactory *factory)
    :{}

ProgramState::~ProgramState()
{}

const std::string &ProgramState::getLabel()
{}

SharedCompiledShaderState ProgramState::getAttachedShader(ShaderType shaderType) const
{}

bool ProgramState::hasAnyAttachedShader() const
{}

ShaderType ProgramState::getAttachedTransformFeedbackStage() const
{}

// The common portion of parallel link and load jobs
class Program::MainLinkLoadTask : public angle::Closure
{};

class Program::MainLinkTask final : public Program::MainLinkLoadTask
{};

class Program::MainLoadTask final : public Program::MainLinkLoadTask
{};

class Program::MainLinkLoadEvent final : public LinkEvent
{};

angle::Result Program::MainLinkTask::linkImpl()
{}

angle::Result Program::MainLoadTask::loadImpl()
{}

Program::Program(rx::GLImplFactory *factory, ShaderProgramManager *manager, ShaderProgramID handle)
    :{}

Program::~Program()
{}

void Program::onDestroy(const Context *context)
{}

ShaderProgramID Program::id() const
{}

angle::Result Program::setLabel(const Context *context, const std::string &label)
{}

const std::string &Program::getLabel() const
{}

void Program::attachShader(const Context *context, Shader *shader)
{}

void Program::detachShader(const Context *context, Shader *shader)
{}

int Program::getAttachedShadersCount() const
{}

Shader *Program::getAttachedShader(ShaderType shaderType) const
{}

void Program::bindAttributeLocation(const Context *context, GLuint index, const char *name)
{}

void Program::bindUniformLocation(const Context *context,
                                  UniformLocation location,
                                  const char *name)
{}

void Program::bindFragmentOutputLocation(const Context *context, GLuint index, const char *name)
{}

void Program::bindFragmentOutputIndex(const Context *context, GLuint index, const char *name)
{}

void Program::makeNewExecutable(const Context *context)
{}

void Program::setupExecutableForLink(const Context *context)
{}

angle::Result Program::link(const Context *context, angle::JobResultExpectancy resultExpectancy)
{}

angle::Result Program::linkJobImpl(const Caps &caps,
                                   const Limitations &limitations,
                                   const Version &clientVersion,
                                   bool isWebGL,
                                   LinkingVariables *linkingVariables,
                                   ProgramLinkedResources *resources,
                                   ProgramMergedVaryings *mergedVaryingsOut)
{}

bool Program::isLinking() const
{}

bool Program::isBinaryReady(const Context *context)
{}

void Program::resolveLinkImpl(const Context *context)
{}

void Program::waitForPostLinkTasks(const Context *context)
{}

void Program::updateLinkedShaderStages()
{}

void ProgramState::updateActiveSamplers()
{}

void ProgramState::updateProgramInterfaceInputs()
{}

void ProgramState::updateProgramInterfaceOutputs()
{}

// Returns the program object to an unlinked state, before re-linking, or at destruction
void Program::unlink()
{}

angle::Result Program::setBinary(const Context *context,
                                 GLenum binaryFormat,
                                 const void *binary,
                                 GLsizei length)
{}

angle::Result Program::loadBinary(const Context *context,
                                  const void *binary,
                                  GLsizei length,
                                  egl::CacheGetResult *resultOut)
{}

angle::Result Program::getBinary(Context *context,
                                 GLenum *binaryFormat,
                                 void *binary,
                                 GLsizei bufSize,
                                 GLsizei *length)
{}

GLint Program::getBinaryLength(Context *context)
{}

void Program::setBinaryRetrievableHint(bool retrievable)
{}

bool Program::getBinaryRetrievableHint() const
{}

int Program::getInfoLogLength() const
{}

void Program::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog) const
{}

void Program::setSeparable(const Context *context, bool separable)
{}

void Program::deleteSelf(const Context *context)
{}

unsigned int Program::getRefCount() const
{}

void Program::getAttachedShaders(GLsizei maxCount, GLsizei *count, ShaderProgramID *shaders) const
{}

void Program::flagForDeletion()
{}

bool Program::isFlaggedForDeletion() const
{}

void Program::validate(const Caps &caps)
{}

bool Program::isValidated() const
{}

void Program::bindUniformBlock(UniformBlockIndex uniformBlockIndex, GLuint uniformBlockBinding)
{}

void Program::setTransformFeedbackVaryings(const Context *context,
                                           GLsizei count,
                                           const GLchar *const *varyings,
                                           GLenum bufferMode)
{}

bool Program::linkValidateShaders()
{}

// Assumes linkValidateShaders() has validated the shaders and caches some values from the shaders.
void Program::linkShaders()
{}

bool Program::linkVaryings()
{}

bool Program::linkUniforms(const Caps &caps,
                           const Version &clientVersion,
                           std::vector<UnusedUniform> *unusedUniformsOutOrNull,
                           GLuint *combinedImageUniformsOut)
{}

// Assigns locations to all attributes (except built-ins) from the bindings and program locations.
bool Program::linkAttributes(const Caps &caps,
                             const Limitations &limitations,
                             bool webglCompatibility)
{}

angle::Result Program::serialize(const Context *context)
{}

bool Program::deserialize(const Context *context, BinaryInputStream &stream)
{}

void Program::postResolveLink(const Context *context)
{}

void Program::cacheProgramBinaryIfNotAlready(const Context *context)
{}

void Program::dumpProgramInfo(const Context *context) const
{}
}  // namespace gl