зеркало из https://github.com/AvaloniaUI/angle.git
Remove gl::LinkResult.
Instead of returning a small struct from LinkProgram calls we use angle::Result. Linking can have 3 cases: - the link was successful -> angle::Result::Continue - the link failed -> angle::Result::Incomplete - there was an internal error -> angle::Result::Stop Note that any unexpected Incomplete is still an error. Each function that accepts Incomplete must check explicitly. This is the last user of ErrorOrResult. Bug: angleproject:2491 Change-Id: Idba23be27efe4b561720a4bdd8fe486b40779497 Reviewed-on: https://chromium-review.googlesource.com/c/1255645 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@google.com>
This commit is contained in:
Родитель
0ca0975339
Коммит
785e8a0b7d
|
@ -5771,7 +5771,7 @@ void Context::linkProgram(GLuint program)
|
|||
// ProgramD3D.
|
||||
if (programObject->isInUse())
|
||||
{
|
||||
programObject->resolveLink();
|
||||
programObject->resolveLink(this);
|
||||
if (programObject->isLinked())
|
||||
{
|
||||
ANGLE_CONTEXT_TRY(mGLState.onProgramExecutableChange(this, programObject));
|
||||
|
@ -7781,7 +7781,7 @@ Program *Context::getProgramResolveLink(GLuint handle) const
|
|||
Program *program = mState.mShaderPrograms->getProgram(handle);
|
||||
if (program)
|
||||
{
|
||||
program->resolveLink();
|
||||
program->resolveLink(this);
|
||||
}
|
||||
return program;
|
||||
}
|
||||
|
@ -7924,6 +7924,7 @@ void ErrorSet::handleError(const Error &error) const
|
|||
{
|
||||
GLenum code = error.getCode();
|
||||
mErrors.insert(code);
|
||||
|
||||
if (code == GL_OUT_OF_MEMORY && mContext->getWorkarounds().loseContextOnOutOfMemory)
|
||||
{
|
||||
mContext->markContextLost();
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace angle
|
|||
{
|
||||
Result::operator gl::Error() const
|
||||
{
|
||||
if (mResult == ResultValue::kContinue)
|
||||
if (mValue == Value::Continue)
|
||||
{
|
||||
return gl::NoError();
|
||||
}
|
||||
|
|
|
@ -144,8 +144,6 @@ inline Error NoError()
|
|||
{
|
||||
return Error::NoError();
|
||||
}
|
||||
|
||||
using LinkResult = ErrorOrResult<bool>;
|
||||
} // namespace gl
|
||||
|
||||
namespace egl
|
||||
|
@ -287,13 +285,11 @@ class ANGLE_NO_DISCARD Result
|
|||
{
|
||||
public:
|
||||
// TODO(jmadill): Rename when refactor is complete. http://anglebug.com/2491
|
||||
bool isError() const { return mResult == ResultValue::kStop; }
|
||||
Result getError() { return *this; }
|
||||
Result getResult() { return *this; }
|
||||
bool isError() const { return mValue == Value::Stop; }
|
||||
|
||||
static Result Continue() { return Result(ResultValue::kContinue); }
|
||||
static Result Stop() { return Result(ResultValue::kStop); }
|
||||
static Result Incomplete() { return Result(ResultValue::kIncomplete); }
|
||||
static Result Stop() { return Result(Value::Stop); }
|
||||
static Result Continue() { return Result(Value::Continue); }
|
||||
static Result Incomplete() { return Result(Value::Incomplete); }
|
||||
|
||||
// TODO(jmadill): Remove when refactor is complete. http://anglebug.com/2491
|
||||
operator gl::Error() const;
|
||||
|
@ -305,20 +301,20 @@ class ANGLE_NO_DISCARD Result
|
|||
return operator gl::Error();
|
||||
}
|
||||
|
||||
bool operator==(Result other) const { return mResult == other.mResult; }
|
||||
bool operator==(Result other) const { return mValue == other.mValue; }
|
||||
|
||||
bool operator!=(Result other) const { return mResult != other.mResult; }
|
||||
bool operator!=(Result other) const { return mValue != other.mValue; }
|
||||
|
||||
private:
|
||||
enum class ResultValue
|
||||
enum class Value
|
||||
{
|
||||
kContinue = 0,
|
||||
kStop,
|
||||
kIncomplete,
|
||||
Continue,
|
||||
Stop,
|
||||
Incomplete,
|
||||
};
|
||||
|
||||
Result(ResultValue stop) : mResult(stop) {}
|
||||
ResultValue mResult;
|
||||
Result(Value value) : mValue(value) {}
|
||||
Value mValue;
|
||||
};
|
||||
} // namespace angle
|
||||
|
||||
|
|
|
@ -1859,7 +1859,7 @@ FramebufferAttachment *Framebuffer::getAttachmentFromSubjectIndex(angle::Subject
|
|||
|
||||
bool Framebuffer::formsRenderingFeedbackLoopWith(const State &state) const
|
||||
{
|
||||
const Program *program = state.getLinkedProgram();
|
||||
const Program *program = state.getProgram();
|
||||
|
||||
// TODO(jmadill): Default framebuffer feedback loops.
|
||||
if (mState.mId == 0)
|
||||
|
|
|
@ -538,7 +538,7 @@ Error GLES1Renderer::linkProgram(Context *context,
|
|||
}
|
||||
|
||||
ANGLE_TRY(programObject->link(context));
|
||||
programObject->resolveLink();
|
||||
programObject->resolveLink(context);
|
||||
|
||||
ANGLE_TRY(glState->onProgramExecutableChange(context, programObject));
|
||||
|
||||
|
|
|
@ -209,12 +209,12 @@ MemoryProgramCache::~MemoryProgramCache()
|
|||
}
|
||||
|
||||
// static
|
||||
LinkResult MemoryProgramCache::Deserialize(const Context *context,
|
||||
const Program *program,
|
||||
ProgramState *state,
|
||||
const uint8_t *binary,
|
||||
size_t length,
|
||||
InfoLog &infoLog)
|
||||
angle::Result MemoryProgramCache::Deserialize(const Context *context,
|
||||
const Program *program,
|
||||
ProgramState *state,
|
||||
const uint8_t *binary,
|
||||
size_t length,
|
||||
InfoLog &infoLog)
|
||||
{
|
||||
BinaryInputStream stream(binary, length);
|
||||
|
||||
|
@ -224,7 +224,7 @@ LinkResult MemoryProgramCache::Deserialize(const Context *context,
|
|||
0)
|
||||
{
|
||||
infoLog << "Invalid program binary version.";
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
int majorVersion = stream.readInt<int>();
|
||||
|
@ -233,7 +233,7 @@ LinkResult MemoryProgramCache::Deserialize(const Context *context,
|
|||
minorVersion != context->getClientMinorVersion())
|
||||
{
|
||||
infoLog << "Cannot load program binaries across different ES context versions.";
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
state->mComputeShaderLocalSize[0] = stream.readInt<int>();
|
||||
|
@ -345,7 +345,7 @@ LinkResult MemoryProgramCache::Deserialize(const Context *context,
|
|||
context->getWorkarounds().disableProgramCachingForTransformFeedback)
|
||||
{
|
||||
infoLog << "Current driver does not support transform feedback in binary programs.";
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
ASSERT(state->mLinkedTransformFeedbackVaryings.empty());
|
||||
|
@ -673,38 +673,39 @@ void MemoryProgramCache::ComputeHash(const Context *context,
|
|||
programKey.length(), hashOut->data());
|
||||
}
|
||||
|
||||
LinkResult MemoryProgramCache::getProgram(const Context *context,
|
||||
const Program *program,
|
||||
ProgramState *state,
|
||||
egl::BlobCache::Key *hashOut)
|
||||
angle::Result MemoryProgramCache::getProgram(const Context *context,
|
||||
const Program *program,
|
||||
ProgramState *state,
|
||||
egl::BlobCache::Key *hashOut)
|
||||
{
|
||||
ComputeHash(context, program, hashOut);
|
||||
egl::BlobCache::Value binaryProgram;
|
||||
LinkResult result(false);
|
||||
if (get(context, *hashOut, &binaryProgram))
|
||||
{
|
||||
InfoLog infoLog;
|
||||
ANGLE_TRY_RESULT(Deserialize(context, program, state, binaryProgram.data(),
|
||||
binaryProgram.size(), infoLog),
|
||||
result);
|
||||
ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.ProgramCache.LoadBinarySuccess", result.getResult());
|
||||
if (!result.getResult())
|
||||
{
|
||||
// Cache load failed, evict.
|
||||
if (mIssuedWarnings++ < kWarningLimit)
|
||||
{
|
||||
WARN() << "Failed to load binary from cache: " << infoLog.str();
|
||||
angle::Result result = Deserialize(context, program, state, binaryProgram.data(),
|
||||
binaryProgram.size(), infoLog);
|
||||
ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.ProgramCache.LoadBinarySuccess",
|
||||
result == angle::Result::Continue());
|
||||
ANGLE_TRY(result);
|
||||
|
||||
if (mIssuedWarnings == kWarningLimit)
|
||||
{
|
||||
WARN() << "Reaching warning limit for cache load failures, silencing "
|
||||
"subsequent warnings.";
|
||||
}
|
||||
if (result == angle::Result::Continue())
|
||||
return angle::Result::Continue();
|
||||
|
||||
// Cache load failed, evict.
|
||||
if (mIssuedWarnings++ < kWarningLimit)
|
||||
{
|
||||
WARN() << "Failed to load binary from cache: " << infoLog.str();
|
||||
|
||||
if (mIssuedWarnings == kWarningLimit)
|
||||
{
|
||||
WARN() << "Reaching warning limit for cache load failures, silencing "
|
||||
"subsequent warnings.";
|
||||
}
|
||||
remove(*hashOut);
|
||||
}
|
||||
remove(*hashOut);
|
||||
}
|
||||
return result;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
bool MemoryProgramCache::get(const Context *context,
|
||||
|
|
|
@ -35,12 +35,12 @@ class MemoryProgramCache final : angle::NonCopyable
|
|||
angle::MemoryBuffer *binaryOut);
|
||||
|
||||
// Loads program state according to the specified binary blob.
|
||||
static LinkResult Deserialize(const Context *context,
|
||||
const Program *program,
|
||||
ProgramState *state,
|
||||
const uint8_t *binary,
|
||||
size_t length,
|
||||
InfoLog &infoLog);
|
||||
static angle::Result Deserialize(const Context *context,
|
||||
const Program *program,
|
||||
ProgramState *state,
|
||||
const uint8_t *binary,
|
||||
size_t length,
|
||||
InfoLog &infoLog);
|
||||
|
||||
static void ComputeHash(const Context *context,
|
||||
const Program *program,
|
||||
|
@ -73,10 +73,10 @@ class MemoryProgramCache final : angle::NonCopyable
|
|||
|
||||
// Check the cache, and deserialize and load the program if found. Evict existing hash if load
|
||||
// fails.
|
||||
LinkResult getProgram(const Context *context,
|
||||
const Program *program,
|
||||
ProgramState *state,
|
||||
egl::BlobCache::Key *hashOut);
|
||||
angle::Result getProgram(const Context *context,
|
||||
const Program *program,
|
||||
ProgramState *state,
|
||||
egl::BlobCache::Key *hashOut);
|
||||
|
||||
// Empty the cache.
|
||||
void clear();
|
||||
|
|
|
@ -1129,8 +1129,9 @@ Error Program::link(const gl::Context *context)
|
|||
|
||||
if (cache)
|
||||
{
|
||||
ANGLE_TRY_RESULT(cache->getProgram(context, this, &mState, &programHash), mLinked);
|
||||
ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.ProgramCache.LoadBinarySuccess", mLinked);
|
||||
angle::Result result = cache->getProgram(context, this, &mState, &programHash);
|
||||
mLinked = (result == angle::Result::Continue());
|
||||
ANGLE_TRY(result);
|
||||
}
|
||||
|
||||
if (mLinked)
|
||||
|
@ -1288,11 +1289,13 @@ bool Program::isLinking() const
|
|||
return (mLinkingState.get() && mLinkingState->linkEvent->isLinking());
|
||||
}
|
||||
|
||||
void Program::resolveLinkImpl()
|
||||
void Program::resolveLinkImpl(const Context *context)
|
||||
{
|
||||
ASSERT(mLinkingState.get());
|
||||
|
||||
mLinked = mLinkingState->linkEvent->wait();
|
||||
angle::Result result = mLinkingState->linkEvent->wait(context);
|
||||
|
||||
mLinked = result == angle::Result::Continue();
|
||||
mLinkResolved = true;
|
||||
auto linkingState = std::move(mLinkingState);
|
||||
if (!mLinked)
|
||||
|
@ -1448,11 +1451,13 @@ Error Program::loadBinary(const Context *context,
|
|||
}
|
||||
|
||||
const uint8_t *bytes = reinterpret_cast<const uint8_t *>(binary);
|
||||
ANGLE_TRY_RESULT(
|
||||
MemoryProgramCache::Deserialize(context, this, &mState, bytes, length, mInfoLog), mLinked);
|
||||
angle::Result result =
|
||||
MemoryProgramCache::Deserialize(context, this, &mState, bytes, length, mInfoLog);
|
||||
mLinked = result == angle::Result::Continue();
|
||||
ANGLE_TRY(result);
|
||||
|
||||
// Currently we require the full shader text to compute the program hash.
|
||||
// TODO(jmadill): Store the binary in the internal program cache.
|
||||
// We could also store the binary in the internal program cache.
|
||||
|
||||
for (size_t uniformBlockIndex = 0; uniformBlockIndex < mState.mUniformBlocks.size();
|
||||
++uniformBlockIndex)
|
||||
|
|
|
@ -812,11 +812,11 @@ class Program final : angle::NonCopyable, public LabeledObject
|
|||
Error syncState(const Context *context);
|
||||
|
||||
// Try to resolve linking. Inlined to make sure its overhead is as low as possible.
|
||||
void resolveLink()
|
||||
void resolveLink(const Context *context)
|
||||
{
|
||||
if (!mLinkResolved)
|
||||
{
|
||||
resolveLinkImpl();
|
||||
resolveLinkImpl(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -918,7 +918,7 @@ class Program final : angle::NonCopyable, public LabeledObject
|
|||
bool validateSamplersImpl(InfoLog *infoLog, const Caps &caps);
|
||||
|
||||
// Block until linking is finished and resolve it.
|
||||
void resolveLinkImpl();
|
||||
void resolveLinkImpl(const gl::Context *context);
|
||||
|
||||
ProgramState mState;
|
||||
rx::ProgramImpl *mProgram;
|
||||
|
|
|
@ -234,11 +234,11 @@ class State : angle::NonCopyable
|
|||
return mProgram;
|
||||
}
|
||||
|
||||
Program *getLinkedProgram() const
|
||||
Program *getLinkedProgram(const Context *context) const
|
||||
{
|
||||
if (mProgram)
|
||||
{
|
||||
mProgram->resolveLink();
|
||||
mProgram->resolveLink(context);
|
||||
}
|
||||
return mProgram;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class LinkEvent : angle::NonCopyable
|
|||
//
|
||||
// Waits until the linking is actually done. Returns true if the linking
|
||||
// succeeded, false otherwise.
|
||||
virtual bool wait() = 0;
|
||||
virtual angle::Result wait(const gl::Context *context) = 0;
|
||||
// Peeks whether the linking is still ongoing.
|
||||
virtual bool isLinking() = 0;
|
||||
};
|
||||
|
@ -51,12 +51,12 @@ class LinkEvent : angle::NonCopyable
|
|||
class LinkEventDone final : public LinkEvent
|
||||
{
|
||||
public:
|
||||
LinkEventDone(const gl::LinkResult &result) : mResult(result) {}
|
||||
bool wait() override { return (!mResult.isError() && mResult.getResult()); }
|
||||
LinkEventDone(angle::Result result) : mResult(result) {}
|
||||
angle::Result wait(const gl::Context *context) override { return mResult; }
|
||||
bool isLinking() override { return false; }
|
||||
|
||||
private:
|
||||
gl::LinkResult mResult;
|
||||
angle::Result mResult;
|
||||
};
|
||||
|
||||
class ProgramImpl : angle::NonCopyable
|
||||
|
@ -66,9 +66,9 @@ class ProgramImpl : angle::NonCopyable
|
|||
virtual ~ProgramImpl() {}
|
||||
virtual gl::Error destroy(const gl::Context *context) { return gl::NoError(); }
|
||||
|
||||
virtual gl::LinkResult load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream) = 0;
|
||||
virtual angle::Result load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream) = 0;
|
||||
virtual void save(const gl::Context *context, gl::BinaryOutputStream *stream) = 0;
|
||||
virtual void setBinaryRetrievableHint(bool retrievable) = 0;
|
||||
virtual void setSeparable(bool separable) = 0;
|
||||
|
|
|
@ -24,15 +24,15 @@ class MockProgramImpl : public rx::ProgramImpl
|
|||
MockProgramImpl() : ProgramImpl(gl::ProgramState()) {}
|
||||
virtual ~MockProgramImpl() { destructor(); }
|
||||
|
||||
MOCK_METHOD3(load, gl::LinkResult(const gl::Context *, gl::InfoLog &, gl::BinaryInputStream *));
|
||||
MOCK_METHOD3(load, angle::Result(const gl::Context *, gl::InfoLog &, gl::BinaryInputStream *));
|
||||
MOCK_METHOD2(save, void(const gl::Context *, gl::BinaryOutputStream *));
|
||||
MOCK_METHOD1(setBinaryRetrievableHint, void(bool));
|
||||
MOCK_METHOD1(setSeparable, void(bool));
|
||||
|
||||
MOCK_METHOD3(link,
|
||||
gl::LinkResult(const gl::Context *,
|
||||
const gl::ProgramLinkedResources &,
|
||||
gl::InfoLog &));
|
||||
std::unique_ptr<LinkEvent>(const gl::Context *,
|
||||
const gl::ProgramLinkedResources &,
|
||||
gl::InfoLog &));
|
||||
MOCK_METHOD2(validate, GLboolean(const gl::Caps &, gl::InfoLog *));
|
||||
|
||||
MOCK_METHOD3(setUniform1fv, void(GLint, GLsizei, const GLfloat *));
|
||||
|
|
|
@ -110,7 +110,7 @@ HLSLCompiler::~HLSLCompiler()
|
|||
release();
|
||||
}
|
||||
|
||||
angle::Result HLSLCompiler::ensureInitialized(const gl::Context *context)
|
||||
angle::Result HLSLCompiler::ensureInitialized(d3d::Context *context)
|
||||
{
|
||||
if (mInitialized)
|
||||
{
|
||||
|
@ -138,12 +138,10 @@ angle::Result HLSLCompiler::ensureInitialized(const gl::Context *context)
|
|||
mD3DCompilerModule = LoadLibrary(D3DCOMPILER_DLL);
|
||||
}
|
||||
|
||||
ContextD3D *contextD3D = GetImplAs<ContextD3D>(context);
|
||||
|
||||
if (!mD3DCompilerModule)
|
||||
{
|
||||
ERR() << "D3D compiler module not found.";
|
||||
ANGLE_TRY_HR(contextD3D, E_OUTOFMEMORY, "D3D compiler module not found.");
|
||||
ANGLE_TRY_HR(context, E_OUTOFMEMORY, "D3D compiler module not found.");
|
||||
}
|
||||
|
||||
mD3DCompileFunc = reinterpret_cast<pD3DCompile>(GetProcAddress(mD3DCompilerModule, "D3DCompile"));
|
||||
|
@ -160,7 +158,7 @@ angle::Result HLSLCompiler::ensureInitialized(const gl::Context *context)
|
|||
mD3DDisassembleFunc = reinterpret_cast<pD3DDisassemble>(D3DDisassemble);
|
||||
#endif
|
||||
|
||||
ANGLE_CHECK_HR(contextD3D, mD3DCompileFunc, "Error finding D3DCompile entry point.",
|
||||
ANGLE_CHECK_HR(context, mD3DCompileFunc, "Error finding D3DCompile entry point.",
|
||||
E_OUTOFMEMORY);
|
||||
|
||||
mInitialized = true;
|
||||
|
@ -179,7 +177,7 @@ void HLSLCompiler::release()
|
|||
}
|
||||
}
|
||||
|
||||
angle::Result HLSLCompiler::compileToBinary(const gl::Context *context,
|
||||
angle::Result HLSLCompiler::compileToBinary(d3d::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
const std::string &hlsl,
|
||||
const std::string &profile,
|
||||
|
@ -289,8 +287,7 @@ angle::Result HLSLCompiler::compileToBinary(const gl::Context *context,
|
|||
if (result == E_OUTOFMEMORY)
|
||||
{
|
||||
*outCompiledBlob = nullptr;
|
||||
ANGLE_TRY_HR(GetImplAs<ContextD3D>(context), result,
|
||||
"HLSL compiler had an unexpected failure");
|
||||
ANGLE_TRY_HR(context, result, "HLSL compiler had an unexpected failure");
|
||||
}
|
||||
|
||||
infoLog << "Warning: D3D shader compilation failed with " << configs[i].name << " flags. ("
|
||||
|
@ -307,7 +304,7 @@ angle::Result HLSLCompiler::compileToBinary(const gl::Context *context,
|
|||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
angle::Result HLSLCompiler::disassembleBinary(const gl::Context *context,
|
||||
angle::Result HLSLCompiler::disassembleBinary(d3d::Context *context,
|
||||
ID3DBlob *shaderBinary,
|
||||
std::string *disassemblyOut)
|
||||
{
|
||||
|
|
|
@ -19,12 +19,15 @@
|
|||
|
||||
namespace gl
|
||||
{
|
||||
class Context;
|
||||
class InfoLog;
|
||||
}
|
||||
} // namespace gl
|
||||
|
||||
namespace rx
|
||||
{
|
||||
namespace d3d
|
||||
{
|
||||
class Context;
|
||||
} // namespace d3d
|
||||
|
||||
struct CompileConfig
|
||||
{
|
||||
|
@ -45,7 +48,7 @@ class HLSLCompiler : angle::NonCopyable
|
|||
|
||||
// Attempt to compile a HLSL shader using the supplied configurations, may output a NULL compiled blob
|
||||
// even if no GL errors are returned.
|
||||
angle::Result compileToBinary(const gl::Context *context,
|
||||
angle::Result compileToBinary(d3d::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
const std::string &hlsl,
|
||||
const std::string &profile,
|
||||
|
@ -54,10 +57,10 @@ class HLSLCompiler : angle::NonCopyable
|
|||
ID3DBlob **outCompiledBlob,
|
||||
std::string *outDebugInfo);
|
||||
|
||||
angle::Result disassembleBinary(const gl::Context *context,
|
||||
angle::Result disassembleBinary(d3d::Context *context,
|
||||
ID3DBlob *shaderBinary,
|
||||
std::string *disassemblyOut);
|
||||
angle::Result ensureInitialized(const gl::Context *context);
|
||||
angle::Result ensureInitialized(d3d::Context *context);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "libANGLE/features.h"
|
||||
#include "libANGLE/queryconversions.h"
|
||||
#include "libANGLE/renderer/ContextImpl.h"
|
||||
#include "libANGLE/renderer/d3d/ContextD3D.h"
|
||||
#include "libANGLE/renderer/d3d/DynamicHLSL.h"
|
||||
#include "libANGLE/renderer/d3d/FramebufferD3D.h"
|
||||
#include "libANGLE/renderer/d3d/ShaderD3D.h"
|
||||
|
@ -738,9 +739,9 @@ gl::RangeUI ProgramD3D::getUsedImageRange(gl::ShaderType type, bool readonly) co
|
|||
}
|
||||
}
|
||||
|
||||
gl::LinkResult ProgramD3D::load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream)
|
||||
angle::Result ProgramD3D::load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream)
|
||||
{
|
||||
// TODO(jmadill): Use Renderer from contextImpl.
|
||||
|
||||
|
@ -754,14 +755,14 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context,
|
|||
if (memcmp(&identifier, &binaryDeviceIdentifier, sizeof(DeviceIdentifier)) != 0)
|
||||
{
|
||||
infoLog << "Invalid program binary, device configuration has changed.";
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
int compileFlags = stream->readInt<int>();
|
||||
if (compileFlags != ANGLE_COMPILE_OPTIMIZATION_LEVEL)
|
||||
{
|
||||
infoLog << "Mismatched compilation flags.";
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
for (int &index : mAttribLocationToD3DSemantic)
|
||||
|
@ -819,7 +820,7 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context,
|
|||
if (stream->error())
|
||||
{
|
||||
infoLog << "Invalid program binary.";
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
ASSERT(mD3DShaderStorageBlocks.empty());
|
||||
|
@ -837,7 +838,7 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context,
|
|||
if (stream->error())
|
||||
{
|
||||
infoLog << "Invalid program binary.";
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
const auto &linkedUniforms = mState.getUniforms();
|
||||
|
@ -864,7 +865,7 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context,
|
|||
if (stream->error())
|
||||
{
|
||||
infoLog << "Invalid program binary.";
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
ASSERT(mD3DUniformBlocks.empty());
|
||||
|
@ -920,6 +921,8 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context,
|
|||
|
||||
bool separateAttribs = (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS);
|
||||
|
||||
d3d::Context *contextD3D = GetImplAs<ContextD3D>(context);
|
||||
|
||||
const unsigned int vertexShaderCount = stream->readInt<unsigned int>();
|
||||
for (unsigned int vertexShaderIndex = 0; vertexShaderIndex < vertexShaderCount;
|
||||
vertexShaderIndex++)
|
||||
|
@ -937,14 +940,14 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context,
|
|||
|
||||
ShaderExecutableD3D *shaderExecutable = nullptr;
|
||||
|
||||
ANGLE_TRY(mRenderer->loadExecutable(context, vertexShaderFunction, vertexShaderSize,
|
||||
ANGLE_TRY(mRenderer->loadExecutable(contextD3D, vertexShaderFunction, vertexShaderSize,
|
||||
gl::ShaderType::Vertex, mStreamOutVaryings,
|
||||
separateAttribs, &shaderExecutable));
|
||||
|
||||
if (!shaderExecutable)
|
||||
{
|
||||
infoLog << "Could not create vertex shader.";
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
// generated converted input layout
|
||||
|
@ -972,14 +975,14 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context,
|
|||
const unsigned char *pixelShaderFunction = binary + stream->offset();
|
||||
ShaderExecutableD3D *shaderExecutable = nullptr;
|
||||
|
||||
ANGLE_TRY(mRenderer->loadExecutable(context, pixelShaderFunction, pixelShaderSize,
|
||||
ANGLE_TRY(mRenderer->loadExecutable(contextD3D, pixelShaderFunction, pixelShaderSize,
|
||||
gl::ShaderType::Fragment, mStreamOutVaryings,
|
||||
separateAttribs, &shaderExecutable));
|
||||
|
||||
if (!shaderExecutable)
|
||||
{
|
||||
infoLog << "Could not create pixel shader.";
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
// add new binary
|
||||
|
@ -1000,14 +1003,14 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context,
|
|||
const unsigned char *geometryShaderFunction = binary + stream->offset();
|
||||
|
||||
ShaderExecutableD3D *geometryExecutable = nullptr;
|
||||
ANGLE_TRY(mRenderer->loadExecutable(context, geometryShaderFunction, geometryShaderSize,
|
||||
ANGLE_TRY(mRenderer->loadExecutable(contextD3D, geometryShaderFunction, geometryShaderSize,
|
||||
gl::ShaderType::Geometry, mStreamOutVaryings,
|
||||
separateAttribs, &geometryExecutable));
|
||||
|
||||
if (!geometryExecutable)
|
||||
{
|
||||
infoLog << "Could not create geometry shader.";
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
geometryExe.reset(geometryExecutable);
|
||||
|
@ -1021,14 +1024,14 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context,
|
|||
const unsigned char *computeShaderFunction = binary + stream->offset();
|
||||
|
||||
ShaderExecutableD3D *computeExecutable = nullptr;
|
||||
ANGLE_TRY(mRenderer->loadExecutable(context, computeShaderFunction, computeShaderSize,
|
||||
ANGLE_TRY(mRenderer->loadExecutable(contextD3D, computeShaderFunction, computeShaderSize,
|
||||
gl::ShaderType::Compute, std::vector<D3DVarying>(),
|
||||
false, &computeExecutable));
|
||||
|
||||
if (!computeExecutable)
|
||||
{
|
||||
infoLog << "Could not create compute shader.";
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
mComputeExecutable.reset(computeExecutable);
|
||||
|
@ -1038,7 +1041,7 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context,
|
|||
|
||||
dirtyAllUniforms();
|
||||
|
||||
return true;
|
||||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
void ProgramD3D::save(const gl::Context *context, gl::BinaryOutputStream *stream)
|
||||
|
@ -1232,7 +1235,7 @@ void ProgramD3D::setSeparable(bool /* separable */)
|
|||
}
|
||||
|
||||
angle::Result ProgramD3D::getPixelExecutableForCachedOutputLayout(
|
||||
const gl::Context *context,
|
||||
d3d::Context *context,
|
||||
ShaderExecutableD3D **outExecutable,
|
||||
gl::InfoLog *infoLog)
|
||||
{
|
||||
|
@ -1274,7 +1277,7 @@ angle::Result ProgramD3D::getPixelExecutableForCachedOutputLayout(
|
|||
}
|
||||
|
||||
angle::Result ProgramD3D::getVertexExecutableForCachedInputLayout(
|
||||
const gl::Context *context,
|
||||
d3d::Context *context,
|
||||
ShaderExecutableD3D **outExectuable,
|
||||
gl::InfoLog *infoLog)
|
||||
{
|
||||
|
@ -1316,7 +1319,8 @@ angle::Result ProgramD3D::getVertexExecutableForCachedInputLayout(
|
|||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
angle::Result ProgramD3D::getGeometryExecutableForPrimitiveType(const gl::Context *context,
|
||||
angle::Result ProgramD3D::getGeometryExecutableForPrimitiveType(d3d::Context *context,
|
||||
const gl::Caps &caps,
|
||||
gl::PrimitiveMode drawMode,
|
||||
ShaderExecutableD3D **outExecutable,
|
||||
gl::InfoLog *infoLog)
|
||||
|
@ -1344,7 +1348,7 @@ angle::Result ProgramD3D::getGeometryExecutableForPrimitiveType(const gl::Contex
|
|||
}
|
||||
|
||||
std::string geometryHLSL = mDynamicHLSL->generateGeometryShaderHLSL(
|
||||
context->getCaps(), geometryShaderType, mState, mRenderer->presentPathFastEnabled(),
|
||||
caps, geometryShaderType, mState, mRenderer->presentPathFastEnabled(),
|
||||
mHasANGLEMultiviewEnabled, mRenderer->canSelectViewInVertexShader(),
|
||||
usesGeometryShaderForPointSpriteEmulation(), mGeometryShaderPreamble);
|
||||
|
||||
|
@ -1375,17 +1379,10 @@ angle::Result ProgramD3D::getGeometryExecutableForPrimitiveType(const gl::Contex
|
|||
return result;
|
||||
}
|
||||
|
||||
class ProgramD3D::GetExecutableTask : public Closure
|
||||
class ProgramD3D::GetExecutableTask : public Closure, public d3d::Context
|
||||
{
|
||||
public:
|
||||
GetExecutableTask(ProgramD3D *program, const gl::Context *context)
|
||||
: mProgram(program),
|
||||
mResult(angle::Result::Continue()),
|
||||
mInfoLog(),
|
||||
mExecutable(nullptr),
|
||||
mContext(context)
|
||||
{
|
||||
}
|
||||
GetExecutableTask(ProgramD3D *program) : mProgram(program) {}
|
||||
|
||||
virtual angle::Result run() = 0;
|
||||
|
||||
|
@ -1395,27 +1392,45 @@ class ProgramD3D::GetExecutableTask : public Closure
|
|||
const gl::InfoLog &getInfoLog() const { return mInfoLog; }
|
||||
ShaderExecutableD3D *getExecutable() { return mExecutable; }
|
||||
|
||||
void handleError(HRESULT hr,
|
||||
const char *message,
|
||||
const char *file,
|
||||
const char *function,
|
||||
unsigned int line) override
|
||||
{
|
||||
mStoredHR = hr;
|
||||
mStoredMessage = message;
|
||||
mStoredFile = file;
|
||||
mStoredFunction = function;
|
||||
mStoredLine = line;
|
||||
}
|
||||
|
||||
void popError(d3d::Context *context)
|
||||
{
|
||||
context->handleError(mStoredHR, mStoredMessage, mStoredFile, mStoredFunction, mStoredLine);
|
||||
}
|
||||
|
||||
protected:
|
||||
ProgramD3D *mProgram;
|
||||
angle::Result mResult;
|
||||
ProgramD3D *mProgram = nullptr;
|
||||
angle::Result mResult = angle::Result::Continue();
|
||||
gl::InfoLog mInfoLog;
|
||||
ShaderExecutableD3D *mExecutable;
|
||||
const gl::Context *mContext;
|
||||
ShaderExecutableD3D *mExecutable = nullptr;
|
||||
HRESULT mStoredHR = S_OK;
|
||||
const char *mStoredMessage = nullptr;
|
||||
const char *mStoredFile = nullptr;
|
||||
const char *mStoredFunction = nullptr;
|
||||
unsigned int mStoredLine = 0;
|
||||
};
|
||||
|
||||
class ProgramD3D::GetVertexExecutableTask : public ProgramD3D::GetExecutableTask
|
||||
{
|
||||
public:
|
||||
GetVertexExecutableTask(ProgramD3D *program, const gl::Context *context)
|
||||
: GetExecutableTask(program, context)
|
||||
{
|
||||
}
|
||||
GetVertexExecutableTask(ProgramD3D *program) : GetExecutableTask(program) {}
|
||||
angle::Result run() override
|
||||
{
|
||||
mProgram->updateCachedInputLayoutFromShader();
|
||||
|
||||
ANGLE_TRY(
|
||||
mProgram->getVertexExecutableForCachedInputLayout(mContext, &mExecutable, &mInfoLog));
|
||||
ANGLE_TRY(mProgram->getVertexExecutableForCachedInputLayout(this, &mExecutable, &mInfoLog));
|
||||
|
||||
return angle::Result::Continue();
|
||||
}
|
||||
|
@ -1432,16 +1447,12 @@ void ProgramD3D::updateCachedInputLayoutFromShader()
|
|||
class ProgramD3D::GetPixelExecutableTask : public ProgramD3D::GetExecutableTask
|
||||
{
|
||||
public:
|
||||
GetPixelExecutableTask(ProgramD3D *program, const gl::Context *context)
|
||||
: GetExecutableTask(program, context)
|
||||
{
|
||||
}
|
||||
GetPixelExecutableTask(ProgramD3D *program) : GetExecutableTask(program) {}
|
||||
angle::Result run() override
|
||||
{
|
||||
mProgram->updateCachedOutputLayoutFromShader();
|
||||
|
||||
ANGLE_TRY(
|
||||
mProgram->getPixelExecutableForCachedOutputLayout(mContext, &mExecutable, &mInfoLog));
|
||||
ANGLE_TRY(mProgram->getPixelExecutableForCachedOutputLayout(this, &mExecutable, &mInfoLog));
|
||||
|
||||
return angle::Result::Continue();
|
||||
}
|
||||
|
@ -1456,8 +1467,8 @@ void ProgramD3D::updateCachedOutputLayoutFromShader()
|
|||
class ProgramD3D::GetGeometryExecutableTask : public ProgramD3D::GetExecutableTask
|
||||
{
|
||||
public:
|
||||
GetGeometryExecutableTask(ProgramD3D *program, const gl::Context *context)
|
||||
: GetExecutableTask(program, context)
|
||||
GetGeometryExecutableTask(ProgramD3D *program, const gl::Caps &caps)
|
||||
: GetExecutableTask(program), mCaps(caps)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1468,11 +1479,14 @@ class ProgramD3D::GetGeometryExecutableTask : public ProgramD3D::GetExecutableTa
|
|||
if (mProgram->usesGeometryShader(gl::PrimitiveMode::Points))
|
||||
{
|
||||
ANGLE_TRY(mProgram->getGeometryExecutableForPrimitiveType(
|
||||
mContext, gl::PrimitiveMode::Points, &mExecutable, &mInfoLog));
|
||||
this, mCaps, gl::PrimitiveMode::Points, &mExecutable, &mInfoLog));
|
||||
}
|
||||
|
||||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
private:
|
||||
const gl::Caps &mCaps;
|
||||
};
|
||||
|
||||
angle::Result ProgramD3D::getComputeExecutable(ShaderExecutableD3D **outExecutable)
|
||||
|
@ -1512,14 +1526,19 @@ class ProgramD3D::GraphicsProgramLinkEvent final : public LinkEvent
|
|||
{
|
||||
}
|
||||
|
||||
bool wait() override
|
||||
angle::Result wait(const gl::Context *context) override
|
||||
{
|
||||
WaitableEvent::WaitMany(&mWaitEvents);
|
||||
|
||||
if (!checkTask(mVertexTask.get()) || !checkTask(mPixelTask.get()) ||
|
||||
!checkTask(mGeometryTask.get()))
|
||||
ANGLE_TRY(checkTask(context, mVertexTask.get()));
|
||||
ANGLE_TRY(checkTask(context, mPixelTask.get()));
|
||||
ANGLE_TRY(checkTask(context, mGeometryTask.get()));
|
||||
|
||||
if (mVertexTask.get()->getResult() == angle::Result::Incomplete() ||
|
||||
mPixelTask.get()->getResult() == angle::Result::Incomplete() ||
|
||||
mGeometryTask.get()->getResult() == angle::Result::Incomplete())
|
||||
{
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
ShaderExecutableD3D *defaultVertexExecutable = mVertexTask->getExecutable();
|
||||
|
@ -1551,7 +1570,7 @@ class ProgramD3D::GraphicsProgramLinkEvent final : public LinkEvent
|
|||
{
|
||||
mInfoLog << "Failed to create D3D Shaders";
|
||||
}
|
||||
return isLinked;
|
||||
return isLinked ? angle::Result::Continue() : angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
bool isLinking() override
|
||||
|
@ -1567,18 +1586,22 @@ class ProgramD3D::GraphicsProgramLinkEvent final : public LinkEvent
|
|||
}
|
||||
|
||||
private:
|
||||
bool checkTask(ProgramD3D::GetExecutableTask *task)
|
||||
angle::Result checkTask(const gl::Context *context, ProgramD3D::GetExecutableTask *task)
|
||||
{
|
||||
if (!task->getInfoLog().empty())
|
||||
{
|
||||
mInfoLog << task->getInfoLog().str();
|
||||
}
|
||||
auto result = task->getResult();
|
||||
if (result.isError())
|
||||
|
||||
// Continue and Incomplete are not errors. For Stop, pass the error to the ContextD3D.
|
||||
if (task->getResult() != angle::Result::Stop())
|
||||
{
|
||||
return false;
|
||||
return angle::Result::Continue();
|
||||
}
|
||||
return true;
|
||||
|
||||
ContextD3D *contextD3D = GetImplAs<ContextD3D>(context);
|
||||
task->popError(contextD3D);
|
||||
return angle::Result::Stop();
|
||||
}
|
||||
|
||||
gl::InfoLog &mInfoLog;
|
||||
|
@ -1596,15 +1619,15 @@ std::unique_ptr<LinkEvent> ProgramD3D::compileProgramExecutables(const gl::Conte
|
|||
gl::InfoLog &infoLog)
|
||||
{
|
||||
// Ensure the compiler is initialized to avoid race conditions.
|
||||
gl::Error result = mRenderer->ensureHLSLCompilerInitialized(context);
|
||||
angle::Result result = mRenderer->ensureHLSLCompilerInitialized(GetImplAs<ContextD3D>(context));
|
||||
if (result.isError())
|
||||
{
|
||||
return std::make_unique<LinkEventDone>(result);
|
||||
}
|
||||
|
||||
auto vertexTask = std::make_shared<GetVertexExecutableTask>(this, context);
|
||||
auto pixelTask = std::make_shared<GetPixelExecutableTask>(this, context);
|
||||
auto geometryTask = std::make_shared<GetGeometryExecutableTask>(this, context);
|
||||
auto vertexTask = std::make_shared<GetVertexExecutableTask>(this);
|
||||
auto pixelTask = std::make_shared<GetPixelExecutableTask>(this);
|
||||
auto geometryTask = std::make_shared<GetGeometryExecutableTask>(this, context->getCaps());
|
||||
bool useGS = usesGeometryShader(gl::PrimitiveMode::Points);
|
||||
const ShaderD3D *vertexShaderD3D =
|
||||
GetImplAs<ShaderD3D>(mState.getAttachedShader(gl::ShaderType::Vertex));
|
||||
|
@ -1616,8 +1639,7 @@ std::unique_ptr<LinkEvent> ProgramD3D::compileProgramExecutables(const gl::Conte
|
|||
vertexShaderD3D, fragmentShaderD3D);
|
||||
}
|
||||
|
||||
gl::LinkResult ProgramD3D::compileComputeExecutable(const gl::Context *context,
|
||||
gl::InfoLog &infoLog)
|
||||
angle::Result ProgramD3D::compileComputeExecutable(d3d::Context *context, gl::InfoLog &infoLog)
|
||||
{
|
||||
// Ensure the compiler is initialized to avoid race conditions.
|
||||
ANGLE_TRY(mRenderer->ensureHLSLCompilerInitialized(context));
|
||||
|
@ -1644,7 +1666,7 @@ gl::LinkResult ProgramD3D::compileComputeExecutable(const gl::Context *context,
|
|||
mComputeExecutable.reset(computeExecutable);
|
||||
}
|
||||
|
||||
return mComputeExecutable.get() != nullptr;
|
||||
return mComputeExecutable.get() ? angle::Result::Continue() : angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
std::unique_ptr<LinkEvent> ProgramD3D::link(const gl::Context *context,
|
||||
|
@ -1668,12 +1690,8 @@ std::unique_ptr<LinkEvent> ProgramD3D::link(const gl::Context *context,
|
|||
|
||||
linkResources(resources);
|
||||
|
||||
gl::LinkResult result = compileComputeExecutable(context, infoLog);
|
||||
if (result.isError())
|
||||
{
|
||||
infoLog << result.getError().getMessage();
|
||||
}
|
||||
else if (!result.getResult())
|
||||
angle::Result result = compileComputeExecutable(GetImplAs<ContextD3D>(context), infoLog);
|
||||
if (result != angle::Result::Continue())
|
||||
{
|
||||
infoLog << "Failed to create D3D compute shader.";
|
||||
}
|
||||
|
@ -1702,7 +1720,7 @@ std::unique_ptr<LinkEvent> ProgramD3D::link(const gl::Context *context,
|
|||
if (shadersD3D[gl::ShaderType::Fragment]->usesFrontFacing())
|
||||
{
|
||||
infoLog << "The current renderer doesn't support gl_FrontFacing";
|
||||
return std::make_unique<LinkEventDone>(false);
|
||||
return std::make_unique<LinkEventDone>(angle::Result::Incomplete());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -178,21 +178,22 @@ class ProgramD3D : public ProgramImpl
|
|||
bool usesGeometryShaderForPointSpriteEmulation() const;
|
||||
bool usesInstancedPointSpriteEmulation() const;
|
||||
|
||||
gl::LinkResult load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream) override;
|
||||
angle::Result load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream) override;
|
||||
void save(const gl::Context *context, gl::BinaryOutputStream *stream) override;
|
||||
void setBinaryRetrievableHint(bool retrievable) override;
|
||||
void setSeparable(bool separable) override;
|
||||
|
||||
angle::Result getVertexExecutableForCachedInputLayout(const gl::Context *context,
|
||||
angle::Result getVertexExecutableForCachedInputLayout(d3d::Context *context,
|
||||
ShaderExecutableD3D **outExectuable,
|
||||
gl::InfoLog *infoLog);
|
||||
angle::Result getGeometryExecutableForPrimitiveType(const gl::Context *context,
|
||||
angle::Result getGeometryExecutableForPrimitiveType(d3d::Context *context,
|
||||
const gl::Caps &caps,
|
||||
gl::PrimitiveMode drawMode,
|
||||
ShaderExecutableD3D **outExecutable,
|
||||
gl::InfoLog *infoLog);
|
||||
angle::Result getPixelExecutableForCachedOutputLayout(const gl::Context *context,
|
||||
angle::Result getPixelExecutableForCachedOutputLayout(d3d::Context *context,
|
||||
ShaderExecutableD3D **outExectuable,
|
||||
gl::InfoLog *infoLog);
|
||||
angle::Result getComputeExecutable(ShaderExecutableD3D **outExecutable);
|
||||
|
@ -455,7 +456,7 @@ class ProgramD3D : public ProgramImpl
|
|||
|
||||
std::unique_ptr<LinkEvent> compileProgramExecutables(const gl::Context *context,
|
||||
gl::InfoLog &infoLog);
|
||||
gl::LinkResult compileComputeExecutable(const gl::Context *context, gl::InfoLog &infoLog);
|
||||
angle::Result compileComputeExecutable(d3d::Context *context, gl::InfoLog &infoLog);
|
||||
|
||||
void gatherTransformFeedbackVaryings(const gl::VaryingPacking &varyings,
|
||||
const BuiltinInfo &builtins);
|
||||
|
|
|
@ -31,6 +31,7 @@ class ConfigSet;
|
|||
|
||||
namespace gl
|
||||
{
|
||||
class ErrorSet;
|
||||
class FramebufferState;
|
||||
class InfoLog;
|
||||
class Texture;
|
||||
|
@ -261,22 +262,22 @@ class RendererD3D : public BufferFactoryD3D
|
|||
RenderTargetD3D **outRT) = 0;
|
||||
|
||||
// Shader operations
|
||||
virtual angle::Result loadExecutable(const gl::Context *context,
|
||||
virtual angle::Result loadExecutable(d3d::Context *context,
|
||||
const uint8_t *function,
|
||||
size_t length,
|
||||
gl::ShaderType type,
|
||||
const std::vector<D3DVarying> &streamOutVaryings,
|
||||
bool separatedOutputBuffers,
|
||||
ShaderExecutableD3D **outExecutable) = 0;
|
||||
virtual angle::Result compileToExecutable(const gl::Context *context,
|
||||
ShaderExecutableD3D **outExecutable) = 0;
|
||||
virtual angle::Result compileToExecutable(d3d::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
const std::string &shaderHLSL,
|
||||
gl::ShaderType type,
|
||||
const std::vector<D3DVarying> &streamOutVaryings,
|
||||
bool separatedOutputBuffers,
|
||||
const angle::CompilerWorkaroundsD3D &workarounds,
|
||||
ShaderExecutableD3D **outExectuable) = 0;
|
||||
virtual angle::Result ensureHLSLCompilerInitialized(const gl::Context *context) = 0;
|
||||
ShaderExecutableD3D **outExectuable) = 0;
|
||||
virtual angle::Result ensureHLSLCompilerInitialized(d3d::Context *context) = 0;
|
||||
|
||||
virtual UniformStorageD3D *createUniformStorage(size_t storageSize) = 0;
|
||||
|
||||
|
|
|
@ -507,15 +507,14 @@ angle::Result Context11::triggerDrawCallProgramRecompilation(const gl::Context *
|
|||
}
|
||||
|
||||
// Load the compiler if necessary and recompile the programs.
|
||||
ANGLE_TRY(mRenderer->ensureHLSLCompilerInitialized(context));
|
||||
ANGLE_TRY(mRenderer->ensureHLSLCompilerInitialized(this));
|
||||
|
||||
gl::InfoLog infoLog;
|
||||
|
||||
if (recompileVS)
|
||||
{
|
||||
ShaderExecutableD3D *vertexExe = nullptr;
|
||||
ANGLE_TRY(
|
||||
programD3D->getVertexExecutableForCachedInputLayout(context, &vertexExe, &infoLog));
|
||||
ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(this, &vertexExe, &infoLog));
|
||||
if (!programD3D->hasVertexExecutableForCachedInputLayout())
|
||||
{
|
||||
ASSERT(infoLog.getLength() > 0);
|
||||
|
@ -527,8 +526,8 @@ angle::Result Context11::triggerDrawCallProgramRecompilation(const gl::Context *
|
|||
if (recompileGS)
|
||||
{
|
||||
ShaderExecutableD3D *geometryExe = nullptr;
|
||||
ANGLE_TRY(programD3D->getGeometryExecutableForPrimitiveType(context, drawMode, &geometryExe,
|
||||
&infoLog));
|
||||
ANGLE_TRY(programD3D->getGeometryExecutableForPrimitiveType(
|
||||
this, mState.getCaps(), drawMode, &geometryExe, &infoLog));
|
||||
if (!programD3D->hasGeometryExecutableForPrimitiveType(drawMode))
|
||||
{
|
||||
ASSERT(infoLog.getLength() > 0);
|
||||
|
@ -540,8 +539,7 @@ angle::Result Context11::triggerDrawCallProgramRecompilation(const gl::Context *
|
|||
if (recompilePS)
|
||||
{
|
||||
ShaderExecutableD3D *pixelExe = nullptr;
|
||||
ANGLE_TRY(
|
||||
programD3D->getPixelExecutableForCachedOutputLayout(context, &pixelExe, &infoLog));
|
||||
ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(this, &pixelExe, &infoLog));
|
||||
if (!programD3D->hasPixelExecutableForCachedOutputLayout())
|
||||
{
|
||||
ASSERT(infoLog.getLength() > 0);
|
||||
|
|
|
@ -116,8 +116,7 @@ void InputLayoutCache::clear()
|
|||
}
|
||||
|
||||
angle::Result InputLayoutCache::getInputLayout(
|
||||
const gl::Context *context,
|
||||
Renderer11 *renderer,
|
||||
Context11 *context11,
|
||||
const gl::State &state,
|
||||
const std::vector<const TranslatedAttribute *> ¤tAttributes,
|
||||
const AttribIndexArray &sortedSemanticIndices,
|
||||
|
@ -184,7 +183,7 @@ angle::Result InputLayoutCache::getInputLayout(
|
|||
angle::TrimCache(mLayoutCache.max_size() / 2, kGCLimit, "input layout", &mLayoutCache);
|
||||
|
||||
d3d11::InputLayout newInputLayout;
|
||||
ANGLE_TRY(createInputLayout(context, renderer, sortedSemanticIndices, currentAttributes,
|
||||
ANGLE_TRY(createInputLayout(context11, sortedSemanticIndices, currentAttributes,
|
||||
program, drawCallParams, &newInputLayout));
|
||||
|
||||
auto insertIt = mLayoutCache.Put(layout, std::move(newInputLayout));
|
||||
|
@ -196,8 +195,7 @@ angle::Result InputLayoutCache::getInputLayout(
|
|||
}
|
||||
|
||||
angle::Result InputLayoutCache::createInputLayout(
|
||||
const gl::Context *context,
|
||||
Renderer11 *renderer,
|
||||
Context11 *context11,
|
||||
const AttribIndexArray &sortedSemanticIndices,
|
||||
const std::vector<const TranslatedAttribute *> ¤tAttributes,
|
||||
gl::Program *program,
|
||||
|
@ -205,6 +203,7 @@ angle::Result InputLayoutCache::createInputLayout(
|
|||
d3d11::InputLayout *inputLayoutOut)
|
||||
{
|
||||
ProgramD3D *programD3D = GetImplAs<ProgramD3D>(program);
|
||||
Renderer11 *renderer = context11->getRenderer();
|
||||
auto featureLevel = renderer->getRenderer11DeviceCaps().featureLevel;
|
||||
|
||||
bool programUsesInstancedPointSprites =
|
||||
|
@ -295,15 +294,15 @@ angle::Result InputLayoutCache::createInputLayout(
|
|||
}
|
||||
|
||||
ShaderExecutableD3D *shader = nullptr;
|
||||
ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(context, &shader, nullptr));
|
||||
ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(context11, &shader, nullptr));
|
||||
|
||||
ShaderExecutableD3D *shader11 = GetAs<ShaderExecutable11>(shader);
|
||||
|
||||
InputElementArray inputElementArray(inputElements.data(), inputElementCount);
|
||||
ShaderData vertexShaderData(shader11->getFunction(), shader11->getLength());
|
||||
|
||||
ANGLE_TRY(renderer->allocateResource(GetImplAs<Context11>(context), inputElementArray,
|
||||
&vertexShaderData, inputLayoutOut));
|
||||
ANGLE_TRY(renderer->allocateResource(context11, inputElementArray, &vertexShaderData,
|
||||
inputLayoutOut));
|
||||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ class Program;
|
|||
|
||||
namespace rx
|
||||
{
|
||||
class Context11;
|
||||
struct TranslatedAttribute;
|
||||
struct TranslatedIndexData;
|
||||
struct SourceIndexData;
|
||||
|
@ -88,8 +89,7 @@ class InputLayoutCache : angle::NonCopyable
|
|||
// Useful for testing
|
||||
void setCacheSize(size_t newCacheSize);
|
||||
|
||||
angle::Result getInputLayout(const gl::Context *context,
|
||||
Renderer11 *renderer,
|
||||
angle::Result getInputLayout(Context11 *context,
|
||||
const gl::State &state,
|
||||
const std::vector<const TranslatedAttribute *> ¤tAttributes,
|
||||
const AttribIndexArray &sortedSemanticIndices,
|
||||
|
@ -98,8 +98,7 @@ class InputLayoutCache : angle::NonCopyable
|
|||
|
||||
private:
|
||||
angle::Result createInputLayout(
|
||||
const gl::Context *context,
|
||||
Renderer11 *renderer,
|
||||
Context11 *context11,
|
||||
const AttribIndexArray &sortedSemanticIndices,
|
||||
const std::vector<const TranslatedAttribute *> ¤tAttributes,
|
||||
gl::Program *program,
|
||||
|
|
|
@ -1394,12 +1394,12 @@ void *Renderer11::getD3DDevice()
|
|||
return mDevice;
|
||||
}
|
||||
|
||||
angle::Result Renderer11::drawWithGeometryShaderAndTransformFeedback(const gl::Context *context,
|
||||
angle::Result Renderer11::drawWithGeometryShaderAndTransformFeedback(Context11 *context11,
|
||||
gl::PrimitiveMode mode,
|
||||
UINT instanceCount,
|
||||
UINT vertexCount)
|
||||
{
|
||||
const gl::State &glState = context->getGLState();
|
||||
const gl::State &glState = context11->getGLState();
|
||||
ProgramD3D *programD3D = mStateManager.getProgramD3D();
|
||||
|
||||
// Since we use a geometry if-and-only-if we rewrite vertex streams, transform feedback
|
||||
|
@ -1418,7 +1418,7 @@ angle::Result Renderer11::drawWithGeometryShaderAndTransformFeedback(const gl::C
|
|||
}
|
||||
|
||||
rx::ShaderExecutableD3D *pixelExe = nullptr;
|
||||
ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(context, &pixelExe, nullptr));
|
||||
ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(context11, &pixelExe, nullptr));
|
||||
|
||||
// Skip the draw call if rasterizer discard is enabled (or no fragment shader).
|
||||
if (!pixelExe || glState.getRasterizerState().rasterizerDiscard)
|
||||
|
@ -1430,8 +1430,8 @@ angle::Result Renderer11::drawWithGeometryShaderAndTransformFeedback(const gl::C
|
|||
|
||||
// Retrieve the geometry shader.
|
||||
rx::ShaderExecutableD3D *geometryExe = nullptr;
|
||||
ANGLE_TRY(
|
||||
programD3D->getGeometryExecutableForPrimitiveType(context, mode, &geometryExe, nullptr));
|
||||
ANGLE_TRY(programD3D->getGeometryExecutableForPrimitiveType(context11, context11->getCaps(),
|
||||
mode, &geometryExe, nullptr));
|
||||
|
||||
mStateManager.setGeometryShader(&GetAs<ShaderExecutable11>(geometryExe)->getGeometryShader());
|
||||
|
||||
|
@ -1467,8 +1467,9 @@ angle::Result Renderer11::drawArrays(const gl::Context *context, const gl::DrawC
|
|||
|
||||
if (programD3D->usesGeometryShader(params.mode()))
|
||||
{
|
||||
return drawWithGeometryShaderAndTransformFeedback(
|
||||
context, params.mode(), adjustedInstanceCount, clampedVertexCount);
|
||||
return drawWithGeometryShaderAndTransformFeedback(GetImplAs<Context11>(context),
|
||||
params.mode(), adjustedInstanceCount,
|
||||
clampedVertexCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2673,7 +2674,7 @@ angle::Result Renderer11::createRenderTargetCopy(const gl::Context *context,
|
|||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
angle::Result Renderer11::loadExecutable(const gl::Context *context,
|
||||
angle::Result Renderer11::loadExecutable(d3d::Context *context,
|
||||
const uint8_t *function,
|
||||
size_t length,
|
||||
gl::ShaderType type,
|
||||
|
@ -2683,7 +2684,7 @@ angle::Result Renderer11::loadExecutable(const gl::Context *context,
|
|||
{
|
||||
ShaderData shaderData(function, length);
|
||||
|
||||
Context11 *context11 = GetImplAs<Context11>(context);
|
||||
Context11 *context11 = static_cast<Context11 *>(context);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -2747,7 +2748,7 @@ angle::Result Renderer11::loadExecutable(const gl::Context *context,
|
|||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
angle::Result Renderer11::compileToExecutable(const gl::Context *context,
|
||||
angle::Result Renderer11::compileToExecutable(d3d::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
const std::string &shaderHLSL,
|
||||
gl::ShaderType type,
|
||||
|
@ -2773,7 +2774,7 @@ angle::Result Renderer11::compileToExecutable(const gl::Context *context,
|
|||
profileStream << "cs";
|
||||
break;
|
||||
default:
|
||||
ANGLE_HR_UNREACHABLE(GetImplAs<Context11>(context));
|
||||
ANGLE_HR_UNREACHABLE(context);
|
||||
}
|
||||
|
||||
profileStream << "_" << getMajorShaderModel() << "_" << getMinorShaderModel()
|
||||
|
@ -2846,7 +2847,7 @@ angle::Result Renderer11::compileToExecutable(const gl::Context *context,
|
|||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
angle::Result Renderer11::ensureHLSLCompilerInitialized(const gl::Context *context)
|
||||
angle::Result Renderer11::ensureHLSLCompilerInitialized(d3d::Context *context)
|
||||
{
|
||||
return mCompiler.ensureInitialized(context);
|
||||
}
|
||||
|
|
|
@ -228,14 +228,14 @@ class Renderer11 : public RendererD3D
|
|||
RenderTargetD3D **outRT) override;
|
||||
|
||||
// Shader operations
|
||||
angle::Result loadExecutable(const gl::Context *context,
|
||||
angle::Result loadExecutable(d3d::Context *context,
|
||||
const uint8_t *function,
|
||||
size_t length,
|
||||
gl::ShaderType type,
|
||||
const std::vector<D3DVarying> &streamOutVaryings,
|
||||
bool separatedOutputBuffers,
|
||||
ShaderExecutableD3D **outExecutable) override;
|
||||
angle::Result compileToExecutable(const gl::Context *context,
|
||||
angle::Result compileToExecutable(d3d::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
const std::string &shaderHLSL,
|
||||
gl::ShaderType type,
|
||||
|
@ -243,7 +243,7 @@ class Renderer11 : public RendererD3D
|
|||
bool separatedOutputBuffers,
|
||||
const angle::CompilerWorkaroundsD3D &workarounds,
|
||||
ShaderExecutableD3D **outExectuable) override;
|
||||
angle::Result ensureHLSLCompilerInitialized(const gl::Context *context) override;
|
||||
angle::Result ensureHLSLCompilerInitialized(d3d::Context *context) override;
|
||||
|
||||
UniformStorageD3D *createUniformStorage(size_t storageSize) override;
|
||||
|
||||
|
@ -542,7 +542,7 @@ class Renderer11 : public RendererD3D
|
|||
d3d11::ANGLED3D11DeviceType getDeviceType() const;
|
||||
|
||||
angle::Result markTransformFeedbackUsage(const gl::Context *context);
|
||||
angle::Result drawWithGeometryShaderAndTransformFeedback(const gl::Context *context,
|
||||
angle::Result drawWithGeometryShaderAndTransformFeedback(Context11 *context11,
|
||||
gl::PrimitiveMode mode,
|
||||
UINT instanceCount,
|
||||
UINT vertexCount);
|
||||
|
|
|
@ -2728,14 +2728,14 @@ angle::Result StateManager11::syncProgram(const gl::Context *context, gl::Primit
|
|||
ASSERT(mProgramD3D->hasPixelExecutableForCachedOutputLayout());
|
||||
|
||||
ShaderExecutableD3D *vertexExe = nullptr;
|
||||
ANGLE_TRY(mProgramD3D->getVertexExecutableForCachedInputLayout(context, &vertexExe, nullptr));
|
||||
ANGLE_TRY(mProgramD3D->getVertexExecutableForCachedInputLayout(context11, &vertexExe, nullptr));
|
||||
|
||||
ShaderExecutableD3D *pixelExe = nullptr;
|
||||
ANGLE_TRY(mProgramD3D->getPixelExecutableForCachedOutputLayout(context, &pixelExe, nullptr));
|
||||
ANGLE_TRY(mProgramD3D->getPixelExecutableForCachedOutputLayout(context11, &pixelExe, nullptr));
|
||||
|
||||
ShaderExecutableD3D *geometryExe = nullptr;
|
||||
ANGLE_TRY(mProgramD3D->getGeometryExecutableForPrimitiveType(context, drawMode, &geometryExe,
|
||||
nullptr));
|
||||
ANGLE_TRY(mProgramD3D->getGeometryExecutableForPrimitiveType(context11, context11->getCaps(),
|
||||
drawMode, &geometryExe, nullptr));
|
||||
|
||||
const d3d11::VertexShader *vertexShader =
|
||||
(vertexExe ? &GetAs<ShaderExecutable11>(vertexExe)->getVertexShader() : nullptr);
|
||||
|
@ -2810,9 +2810,9 @@ angle::Result StateManager11::syncVertexBuffersAndInputLayout(
|
|||
// Update the applied input layout by querying the cache.
|
||||
const gl::State &state = context->getGLState();
|
||||
const d3d11::InputLayout *inputLayout = nullptr;
|
||||
ANGLE_TRY(mInputLayoutCache.getInputLayout(context, mRenderer, state, mCurrentAttributes,
|
||||
sortedSemanticIndices, drawCallParams,
|
||||
&inputLayout));
|
||||
ANGLE_TRY(mInputLayoutCache.getInputLayout(GetImplAs<Context11>(context), state,
|
||||
mCurrentAttributes, sortedSemanticIndices,
|
||||
drawCallParams, &inputLayout));
|
||||
setInputLayoutInternal(inputLayout);
|
||||
|
||||
// Update the applied vertex buffers.
|
||||
|
|
|
@ -1674,21 +1674,23 @@ angle::Result Renderer9::getCountingIB(const gl::Context *context,
|
|||
angle::Result Renderer9::applyShaders(const gl::Context *context, gl::PrimitiveMode drawMode)
|
||||
{
|
||||
const gl::State &state = context->getContextState().getState();
|
||||
d3d::Context *contextD3D = GetImplAs<ContextD3D>(context);
|
||||
|
||||
// This method is called single-threaded.
|
||||
ANGLE_TRY(ensureHLSLCompilerInitialized(context));
|
||||
ANGLE_TRY(ensureHLSLCompilerInitialized(contextD3D));
|
||||
|
||||
ProgramD3D *programD3D = GetImplAs<ProgramD3D>(state.getProgram());
|
||||
VertexArray9 *vao = GetImplAs<VertexArray9>(state.getVertexArray());
|
||||
programD3D->updateCachedInputLayout(vao->getCurrentStateSerial(), state);
|
||||
|
||||
ShaderExecutableD3D *vertexExe = nullptr;
|
||||
ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(context, &vertexExe, nullptr));
|
||||
ANGLE_TRY(programD3D->getVertexExecutableForCachedInputLayout(contextD3D, &vertexExe, nullptr));
|
||||
|
||||
const gl::Framebuffer *drawFramebuffer = state.getDrawFramebuffer();
|
||||
programD3D->updateCachedOutputLayout(context, drawFramebuffer);
|
||||
|
||||
ShaderExecutableD3D *pixelExe = nullptr;
|
||||
ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(context, &pixelExe, nullptr));
|
||||
ANGLE_TRY(programD3D->getPixelExecutableForCachedOutputLayout(contextD3D, &pixelExe, nullptr));
|
||||
|
||||
IDirect3DVertexShader9 *vertexShader =
|
||||
(vertexExe ? GetAs<ShaderExecutable9>(vertexExe)->getVertexShader() : nullptr);
|
||||
|
@ -2549,7 +2551,7 @@ angle::Result Renderer9::createRenderTargetCopy(const gl::Context *context,
|
|||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
angle::Result Renderer9::loadExecutable(const gl::Context *context,
|
||||
angle::Result Renderer9::loadExecutable(d3d::Context *context,
|
||||
const uint8_t *function,
|
||||
size_t length,
|
||||
gl::ShaderType type,
|
||||
|
@ -2560,7 +2562,7 @@ angle::Result Renderer9::loadExecutable(const gl::Context *context,
|
|||
// Transform feedback is not supported in ES2 or D3D9
|
||||
ASSERT(streamOutVaryings.empty());
|
||||
|
||||
Context9 *context9 = GetImplAs<Context9>(context);
|
||||
Context9 *context9 = static_cast<Context9 *>(context);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -2579,13 +2581,13 @@ angle::Result Renderer9::loadExecutable(const gl::Context *context,
|
|||
}
|
||||
break;
|
||||
default:
|
||||
ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
|
||||
ANGLE_HR_UNREACHABLE(context);
|
||||
}
|
||||
|
||||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
angle::Result Renderer9::compileToExecutable(const gl::Context *context,
|
||||
angle::Result Renderer9::compileToExecutable(d3d::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
const std::string &shaderHLSL,
|
||||
gl::ShaderType type,
|
||||
|
@ -2608,7 +2610,7 @@ angle::Result Renderer9::compileToExecutable(const gl::Context *context,
|
|||
profileStream << "ps";
|
||||
break;
|
||||
default:
|
||||
ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
|
||||
ANGLE_HR_UNREACHABLE(context);
|
||||
}
|
||||
|
||||
profileStream << "_" << ((getMajorShaderModel() >= 3) ? 3 : 2);
|
||||
|
@ -2675,7 +2677,7 @@ angle::Result Renderer9::compileToExecutable(const gl::Context *context,
|
|||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
angle::Result Renderer9::ensureHLSLCompilerInitialized(const gl::Context *context)
|
||||
angle::Result Renderer9::ensureHLSLCompilerInitialized(d3d::Context *context)
|
||||
{
|
||||
return mCompiler.ensureInitialized(context);
|
||||
}
|
||||
|
|
|
@ -253,14 +253,14 @@ class Renderer9 : public RendererD3D
|
|||
RenderTargetD3D **outRT) override;
|
||||
|
||||
// Shader operations
|
||||
angle::Result loadExecutable(const gl::Context *context,
|
||||
angle::Result loadExecutable(d3d::Context *context,
|
||||
const uint8_t *function,
|
||||
size_t length,
|
||||
gl::ShaderType type,
|
||||
const std::vector<D3DVarying> &streamOutVaryings,
|
||||
bool separatedOutputBuffers,
|
||||
ShaderExecutableD3D **outExecutable) override;
|
||||
angle::Result compileToExecutable(const gl::Context *context,
|
||||
angle::Result compileToExecutable(d3d::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
const std::string &shaderHLSL,
|
||||
gl::ShaderType type,
|
||||
|
@ -268,7 +268,7 @@ class Renderer9 : public RendererD3D
|
|||
bool separatedOutputBuffers,
|
||||
const angle::CompilerWorkaroundsD3D &workarounds,
|
||||
ShaderExecutableD3D **outExectuable) override;
|
||||
angle::Result ensureHLSLCompilerInitialized(const gl::Context *context) override;
|
||||
angle::Result ensureHLSLCompilerInitialized(d3d::Context *context) override;
|
||||
|
||||
UniformStorageD3D *createUniformStorage(size_t storageSize) override;
|
||||
|
||||
|
|
|
@ -52,9 +52,9 @@ ProgramGL::~ProgramGL()
|
|||
mProgramID = 0;
|
||||
}
|
||||
|
||||
gl::LinkResult ProgramGL::load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream)
|
||||
angle::Result ProgramGL::load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream)
|
||||
{
|
||||
preLink();
|
||||
|
||||
|
@ -70,13 +70,13 @@ gl::LinkResult ProgramGL::load(const gl::Context *context,
|
|||
// Verify that the program linked
|
||||
if (!checkLinkStatus(infoLog))
|
||||
{
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
postLink();
|
||||
reapplyUBOBindingsIfNeeded(context);
|
||||
|
||||
return true;
|
||||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
void ProgramGL::save(const gl::Context *context, gl::BinaryOutputStream *stream)
|
||||
|
@ -133,9 +133,9 @@ std::unique_ptr<LinkEvent> ProgramGL::link(const gl::Context *context,
|
|||
return std::make_unique<LinkEventDone>(linkImpl(context, resources, infoLog));
|
||||
}
|
||||
|
||||
gl::LinkResult ProgramGL::linkImpl(const gl::Context *context,
|
||||
const gl::ProgramLinkedResources &resources,
|
||||
gl::InfoLog &infoLog)
|
||||
angle::Result ProgramGL::linkImpl(const gl::Context *context,
|
||||
const gl::ProgramLinkedResources &resources,
|
||||
gl::InfoLog &infoLog)
|
||||
{
|
||||
preLink();
|
||||
|
||||
|
@ -337,7 +337,7 @@ gl::LinkResult ProgramGL::linkImpl(const gl::Context *context,
|
|||
// Verify the link
|
||||
if (!checkLinkStatus(infoLog))
|
||||
{
|
||||
return false;
|
||||
return angle::Result::Incomplete();
|
||||
}
|
||||
|
||||
if (mWorkarounds.alwaysCallUseProgramAfterLink)
|
||||
|
@ -348,7 +348,7 @@ gl::LinkResult ProgramGL::linkImpl(const gl::Context *context,
|
|||
linkResources(resources);
|
||||
postLink();
|
||||
|
||||
return true;
|
||||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
GLboolean ProgramGL::validate(const gl::Caps & /*caps*/, gl::InfoLog * /*infoLog*/)
|
||||
|
|
|
@ -31,9 +31,9 @@ class ProgramGL : public ProgramImpl
|
|||
bool enablePathRendering);
|
||||
~ProgramGL() override;
|
||||
|
||||
gl::LinkResult load(const gl::Context *contextImpl,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream) override;
|
||||
angle::Result load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream) override;
|
||||
void save(const gl::Context *context, gl::BinaryOutputStream *stream) override;
|
||||
void setBinaryRetrievableHint(bool retrievable) override;
|
||||
void setSeparable(bool separable) override;
|
||||
|
@ -90,9 +90,9 @@ class ProgramGL : public ProgramImpl
|
|||
void preLink();
|
||||
bool checkLinkStatus(gl::InfoLog &infoLog);
|
||||
void postLink();
|
||||
gl::LinkResult linkImpl(const gl::Context *contextImpl,
|
||||
const gl::ProgramLinkedResources &resources,
|
||||
gl::InfoLog &infoLog);
|
||||
angle::Result linkImpl(const gl::Context *contextImpl,
|
||||
const gl::ProgramLinkedResources &resources,
|
||||
gl::InfoLog &infoLog);
|
||||
|
||||
void reapplyUBOBindingsIfNeeded(const gl::Context *context);
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@ ProgramNULL::~ProgramNULL()
|
|||
{
|
||||
}
|
||||
|
||||
gl::LinkResult ProgramNULL::load(const gl::Context *contextImpl,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream)
|
||||
angle::Result ProgramNULL::load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream)
|
||||
{
|
||||
return true;
|
||||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
void ProgramNULL::save(const gl::Context *context, gl::BinaryOutputStream *stream)
|
||||
|
@ -45,7 +45,7 @@ std::unique_ptr<LinkEvent> ProgramNULL::link(const gl::Context *contextImpl,
|
|||
const gl::ProgramLinkedResources &resources,
|
||||
gl::InfoLog &infoLog)
|
||||
{
|
||||
return std::make_unique<LinkEventDone>(true);
|
||||
return std::make_unique<LinkEventDone>(angle::Result::Continue());
|
||||
}
|
||||
|
||||
GLboolean ProgramNULL::validate(const gl::Caps &caps, gl::InfoLog *infoLog)
|
||||
|
|
|
@ -21,9 +21,9 @@ class ProgramNULL : public ProgramImpl
|
|||
ProgramNULL(const gl::ProgramState &state);
|
||||
~ProgramNULL() override;
|
||||
|
||||
gl::LinkResult load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream) override;
|
||||
angle::Result load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream) override;
|
||||
void save(const gl::Context *context, gl::BinaryOutputStream *stream) override;
|
||||
void setBinaryRetrievableHint(bool retrievable) override;
|
||||
void setSeparable(bool separable) override;
|
||||
|
|
|
@ -234,12 +234,12 @@ angle::Result ProgramVk::reset(ContextVk *contextVk)
|
|||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
gl::LinkResult ProgramVk::load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream)
|
||||
angle::Result ProgramVk::load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return gl::InternalError();
|
||||
return angle::Result::Stop();
|
||||
}
|
||||
|
||||
void ProgramVk::save(const gl::Context *context, gl::BinaryOutputStream *stream)
|
||||
|
@ -257,18 +257,18 @@ void ProgramVk::setSeparable(bool separable)
|
|||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
std::unique_ptr<LinkEvent> ProgramVk::link(const gl::Context *glContext,
|
||||
std::unique_ptr<LinkEvent> ProgramVk::link(const gl::Context *context,
|
||||
const gl::ProgramLinkedResources &resources,
|
||||
gl::InfoLog &infoLog)
|
||||
{
|
||||
// TODO(jie.a.chen@intel.com): Parallelize linking.
|
||||
// http://crbug.com/849576
|
||||
return std::make_unique<LinkEventDone>(linkImpl(glContext, resources, infoLog));
|
||||
return std::make_unique<LinkEventDone>(linkImpl(context, resources, infoLog));
|
||||
}
|
||||
|
||||
gl::LinkResult ProgramVk::linkImpl(const gl::Context *glContext,
|
||||
const gl::ProgramLinkedResources &resources,
|
||||
gl::InfoLog &infoLog)
|
||||
angle::Result ProgramVk::linkImpl(const gl::Context *glContext,
|
||||
const gl::ProgramLinkedResources &resources,
|
||||
gl::InfoLog &infoLog)
|
||||
{
|
||||
ContextVk *contextVk = vk::GetImpl(glContext);
|
||||
RendererVk *renderer = contextVk->getRenderer();
|
||||
|
@ -343,7 +343,7 @@ gl::LinkResult ProgramVk::linkImpl(const gl::Context *glContext,
|
|||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return angle::Result::Continue();
|
||||
}
|
||||
|
||||
angle::Result ProgramVk::initDefaultUniformBlocks(const gl::Context *glContext)
|
||||
|
|
|
@ -25,9 +25,9 @@ class ProgramVk : public ProgramImpl
|
|||
~ProgramVk() override;
|
||||
gl::Error destroy(const gl::Context *context) override;
|
||||
|
||||
gl::LinkResult load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream) override;
|
||||
angle::Result load(const gl::Context *context,
|
||||
gl::InfoLog &infoLog,
|
||||
gl::BinaryInputStream *stream) override;
|
||||
void save(const gl::Context *context, gl::BinaryOutputStream *stream) override;
|
||||
void setBinaryRetrievableHint(bool retrievable) override;
|
||||
void setSeparable(bool separable) override;
|
||||
|
@ -136,9 +136,9 @@ class ProgramVk : public ProgramImpl
|
|||
|
||||
template <typename T>
|
||||
void setUniformImpl(GLint location, GLsizei count, const T *v, GLenum entryPointType);
|
||||
gl::LinkResult linkImpl(const gl::Context *context,
|
||||
const gl::ProgramLinkedResources &resources,
|
||||
gl::InfoLog &infoLog);
|
||||
angle::Result linkImpl(const gl::Context *glContext,
|
||||
const gl::ProgramLinkedResources &resources,
|
||||
gl::InfoLog &infoLog);
|
||||
|
||||
// State for the default uniform blocks.
|
||||
struct DefaultUniformBlock final : private angle::NonCopyable
|
||||
|
|
|
@ -385,7 +385,7 @@ bool ValidateTextureMaxAnisotropyValue(Context *context, GLfloat paramValue)
|
|||
|
||||
bool ValidateFragmentShaderColorBufferTypeMatch(Context *context)
|
||||
{
|
||||
const Program *program = context->getGLState().getLinkedProgram();
|
||||
const Program *program = context->getGLState().getLinkedProgram(context);
|
||||
const Framebuffer *framebuffer = context->getGLState().getDrawFramebuffer();
|
||||
|
||||
return ComponentTypeMask::Validate(program->getDrawBufferTypeMask().to_ulong(),
|
||||
|
@ -397,7 +397,7 @@ bool ValidateFragmentShaderColorBufferTypeMatch(Context *context)
|
|||
bool ValidateVertexShaderAttributeTypeMatch(Context *context)
|
||||
{
|
||||
const auto &glState = context->getGLState();
|
||||
const Program *program = context->getGLState().getLinkedProgram();
|
||||
const Program *program = context->getGLState().getLinkedProgram(context);
|
||||
const VertexArray *vao = context->getGLState().getVertexArray();
|
||||
|
||||
unsigned long stateCurrentValuesTypeBits = glState.getCurrentValuesTypeMask().to_ulong();
|
||||
|
@ -655,7 +655,7 @@ bool ValidateDrawInstancedANGLE(Context *context)
|
|||
// Verify there is at least one active attribute with a divisor of zero
|
||||
const State &state = context->getGLState();
|
||||
|
||||
Program *program = state.getLinkedProgram();
|
||||
Program *program = state.getLinkedProgram(context);
|
||||
|
||||
const auto &attribs = state.getVertexArray()->getVertexAttributes();
|
||||
const auto &bindings = state.getVertexArray()->getVertexBindings();
|
||||
|
@ -1040,7 +1040,7 @@ Program *GetValidProgram(Context *context, GLuint id)
|
|||
Program *program = GetValidProgramNoResolve(context, id);
|
||||
if (program)
|
||||
{
|
||||
program->resolveLink();
|
||||
program->resolveLink(context);
|
||||
}
|
||||
return program;
|
||||
}
|
||||
|
@ -2150,7 +2150,7 @@ bool ValidateUniformMatrixValue(Context *context, GLenum valueType, GLenum unifo
|
|||
bool ValidateUniform(Context *context, GLenum valueType, GLint location, GLsizei count)
|
||||
{
|
||||
const LinkedUniform *uniform = nullptr;
|
||||
Program *programObject = context->getGLState().getLinkedProgram();
|
||||
Program *programObject = context->getGLState().getLinkedProgram(context);
|
||||
return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
|
||||
ValidateUniformValue(context, valueType, uniform->type);
|
||||
}
|
||||
|
@ -2158,7 +2158,7 @@ bool ValidateUniform(Context *context, GLenum valueType, GLint location, GLsizei
|
|||
bool ValidateUniform1iv(Context *context, GLint location, GLsizei count, const GLint *value)
|
||||
{
|
||||
const LinkedUniform *uniform = nullptr;
|
||||
Program *programObject = context->getGLState().getLinkedProgram();
|
||||
Program *programObject = context->getGLState().getLinkedProgram(context);
|
||||
return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
|
||||
ValidateUniform1ivValue(context, uniform->type, count, value);
|
||||
}
|
||||
|
@ -2176,7 +2176,7 @@ bool ValidateUniformMatrix(Context *context,
|
|||
}
|
||||
|
||||
const LinkedUniform *uniform = nullptr;
|
||||
Program *programObject = context->getGLState().getLinkedProgram();
|
||||
Program *programObject = context->getGLState().getLinkedProgram(context);
|
||||
return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
|
||||
ValidateUniformMatrixValue(context, valueType, uniform->type);
|
||||
}
|
||||
|
@ -2657,7 +2657,7 @@ const char *ValidateDrawStates(Context *context)
|
|||
// If we are running GLES1, there is no current program.
|
||||
if (context->getClientVersion() >= Version(2, 0))
|
||||
{
|
||||
Program *program = state.getLinkedProgram();
|
||||
Program *program = state.getLinkedProgram(context);
|
||||
if (!program)
|
||||
{
|
||||
return kErrorProgramNotBound;
|
||||
|
@ -2804,7 +2804,7 @@ bool ValidateDrawMode(Context *context, PrimitiveMode mode)
|
|||
{
|
||||
const State &state = context->getGLState();
|
||||
|
||||
Program *program = state.getLinkedProgram();
|
||||
Program *program = state.getLinkedProgram(context);
|
||||
ASSERT(program);
|
||||
|
||||
// Do geometry shader specific validations
|
||||
|
|
|
@ -2464,7 +2464,7 @@ bool ValidateBeginTransformFeedback(Context *context, PrimitiveMode primitiveMod
|
|||
}
|
||||
}
|
||||
|
||||
Program *program = context->getGLState().getLinkedProgram();
|
||||
Program *program = context->getGLState().getLinkedProgram(context);
|
||||
|
||||
if (!program)
|
||||
{
|
||||
|
|
|
@ -1428,7 +1428,7 @@ bool ValidateDispatchCompute(Context *context,
|
|||
}
|
||||
|
||||
const State &state = context->getGLState();
|
||||
Program *program = state.getLinkedProgram();
|
||||
Program *program = state.getLinkedProgram(context);
|
||||
|
||||
if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute))
|
||||
{
|
||||
|
@ -1471,7 +1471,7 @@ bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect)
|
|||
}
|
||||
|
||||
const State &state = context->getGLState();
|
||||
Program *program = state.getLinkedProgram();
|
||||
Program *program = state.getLinkedProgram(context);
|
||||
|
||||
if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute))
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче