Commit f4a789f9 by Jamie Madill Committed by Commit Bot

Use angle::Result in front-end (Part 6)

Refactors the gl::Program, gl::Compiler and gl::Query classes. Bug: angleproject:2491 Change-Id: I96acecdc6af301a89201bd7f5222a180433e5eb2 Reviewed-on: https://chromium-review.googlesource.com/c/1289711Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent ae108bd1
...@@ -261,6 +261,10 @@ std::string ToString(const T &value) ...@@ -261,6 +261,10 @@ std::string ToString(const T &value)
#define ANGLE_CHECK_GL_MATH(context, result) \ #define ANGLE_CHECK_GL_MATH(context, result) \
ANGLE_CHECK(context, result, "Integer overflow.", GL_INVALID_OPERATION) ANGLE_CHECK(context, result, "Integer overflow.", GL_INVALID_OPERATION)
#define ANGLE_GL_UNREACHABLE(context) \
UNREACHABLE(); \
ANGLE_CHECK(context, false, "Unreachable Code.", GL_INVALID_OPERATION)
// The below inlining code lifted from V8. // The below inlining code lifted from V8.
#if defined(__clang__) || (defined(__GNUC__) && defined(__has_attribute)) #if defined(__clang__) || (defined(__GNUC__) && defined(__has_attribute))
#define ANGLE_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline)) #define ANGLE_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
......
...@@ -181,7 +181,6 @@ Compiler::~Compiler() ...@@ -181,7 +181,6 @@ Compiler::~Compiler()
{ {
sh::Finalize(); sh::Finalize();
} }
ANGLE_SWALLOW_ERR(mImplementation->release());
} }
ShCompilerInstance Compiler::getInstance(ShaderType type) ShCompilerInstance Compiler::getInstance(ShaderType type)
......
...@@ -930,8 +930,7 @@ void Program::onDestroy(const Context *context) ...@@ -930,8 +930,7 @@ void Program::onDestroy(const Context *context)
} }
} }
// TODO(jmadill): Handle error in the Context. http://anglebug.com/2491 mProgram->destroy(context);
ANGLE_SWALLOW_ERR(mProgram->destroy(context));
ASSERT(!mState.hasAttachedShader()); ASSERT(!mState.hasAttachedShader());
SafeDelete(mProgram); SafeDelete(mProgram);
...@@ -1103,7 +1102,7 @@ void Program::pathFragmentInputGen(GLint index, ...@@ -1103,7 +1102,7 @@ void Program::pathFragmentInputGen(GLint index,
// The attached shaders are checked for linking errors by matching up their variables. // The attached shaders are checked for linking errors by matching up their variables.
// Uniform, input and output variables get collected. // Uniform, input and output variables get collected.
// The code gets compiled into binaries. // The code gets compiled into binaries.
Error Program::link(const gl::Context *context) angle::Result Program::link(const Context *context)
{ {
const auto &data = context->getContextState(); const auto &data = context->getContextState();
...@@ -1116,7 +1115,7 @@ Error Program::link(const gl::Context *context) ...@@ -1116,7 +1115,7 @@ Error Program::link(const gl::Context *context)
// Validate we have properly attached shaders before checking the cache. // Validate we have properly attached shaders before checking the cache.
if (!linkValidateShaders(mInfoLog)) if (!linkValidateShaders(mInfoLog))
{ {
return NoError(); return angle::Result::Continue();
} }
egl::BlobCache::Key programHash = {0}; egl::BlobCache::Key programHash = {0};
...@@ -1134,7 +1133,7 @@ Error Program::link(const gl::Context *context) ...@@ -1134,7 +1133,7 @@ Error Program::link(const gl::Context *context)
double delta = platform->currentTime(platform) - startTime; double delta = platform->currentTime(platform) - startTime;
int us = static_cast<int>(delta * 1000000.0); int us = static_cast<int>(delta * 1000000.0);
ANGLE_HISTOGRAM_COUNTS("GPU.ANGLE.ProgramCache.ProgramCacheHitTimeUS", us); ANGLE_HISTOGRAM_COUNTS("GPU.ANGLE.ProgramCache.ProgramCacheHitTimeUS", us);
return NoError(); return angle::Result::Continue();
} }
// Cache load failed, fall through to normal linking. // Cache load failed, fall through to normal linking.
...@@ -1157,7 +1156,7 @@ Error Program::link(const gl::Context *context) ...@@ -1157,7 +1156,7 @@ Error Program::link(const gl::Context *context)
if (!linkUniforms(context->getCaps(), mInfoLog, mUniformLocationBindings, if (!linkUniforms(context->getCaps(), mInfoLog, mUniformLocationBindings,
&combinedImageUniforms, &resources->unusedUniforms)) &combinedImageUniforms, &resources->unusedUniforms))
{ {
return NoError(); return angle::Result::Continue();
} }
GLuint combinedShaderStorageBlocks = 0u; GLuint combinedShaderStorageBlocks = 0u;
...@@ -1165,7 +1164,7 @@ Error Program::link(const gl::Context *context) ...@@ -1165,7 +1164,7 @@ Error Program::link(const gl::Context *context)
context->getExtensions().webglCompatibility, mInfoLog, context->getExtensions().webglCompatibility, mInfoLog,
&combinedShaderStorageBlocks)) &combinedShaderStorageBlocks))
{ {
return NoError(); return angle::Result::Continue();
} }
// [OpenGL ES 3.1] Chapter 8.22 Page 203: // [OpenGL ES 3.1] Chapter 8.22 Page 203:
...@@ -1181,7 +1180,7 @@ Error Program::link(const gl::Context *context) ...@@ -1181,7 +1180,7 @@ Error Program::link(const gl::Context *context)
"and active fragment shader outputs exceeds " "and active fragment shader outputs exceeds "
"MAX_COMBINED_SHADER_OUTPUT_RESOURCES (" "MAX_COMBINED_SHADER_OUTPUT_RESOURCES ("
<< context->getCaps().maxCombinedShaderOutputResources << ")"; << context->getCaps().maxCombinedShaderOutputResources << ")";
return NoError(); return angle::Result::Continue();
} }
InitUniformBlockLinker(mState, &resources->uniformBlockLinker); InitUniformBlockLinker(mState, &resources->uniformBlockLinker);
...@@ -1211,19 +1210,19 @@ Error Program::link(const gl::Context *context) ...@@ -1211,19 +1210,19 @@ Error Program::link(const gl::Context *context)
if (!linkAttributes(context->getCaps(), mInfoLog)) if (!linkAttributes(context->getCaps(), mInfoLog))
{ {
return NoError(); return angle::Result::Continue();
} }
if (!linkVaryings(mInfoLog)) if (!linkVaryings(mInfoLog))
{ {
return NoError(); return angle::Result::Continue();
} }
GLuint combinedImageUniforms = 0u; GLuint combinedImageUniforms = 0u;
if (!linkUniforms(context->getCaps(), mInfoLog, mUniformLocationBindings, if (!linkUniforms(context->getCaps(), mInfoLog, mUniformLocationBindings,
&combinedImageUniforms, &resources->unusedUniforms)) &combinedImageUniforms, &resources->unusedUniforms))
{ {
return NoError(); return angle::Result::Continue();
} }
GLuint combinedShaderStorageBlocks = 0u; GLuint combinedShaderStorageBlocks = 0u;
...@@ -1231,19 +1230,19 @@ Error Program::link(const gl::Context *context) ...@@ -1231,19 +1230,19 @@ Error Program::link(const gl::Context *context)
context->getExtensions().webglCompatibility, mInfoLog, context->getExtensions().webglCompatibility, mInfoLog,
&combinedShaderStorageBlocks)) &combinedShaderStorageBlocks))
{ {
return NoError(); return angle::Result::Continue();
} }
if (!linkValidateGlobalNames(mInfoLog)) if (!linkValidateGlobalNames(mInfoLog))
{ {
return NoError(); return angle::Result::Continue();
} }
if (!linkOutputVariables(context->getCaps(), context->getExtensions(), if (!linkOutputVariables(context->getCaps(), context->getExtensions(),
context->getClientVersion(), combinedImageUniforms, context->getClientVersion(), combinedImageUniforms,
combinedShaderStorageBlocks)) combinedShaderStorageBlocks))
{ {
return NoError(); return angle::Result::Continue();
} }
const auto &mergedVaryings = getMergedVaryings(); const auto &mergedVaryings = getMergedVaryings();
...@@ -1257,13 +1256,13 @@ Error Program::link(const gl::Context *context) ...@@ -1257,13 +1256,13 @@ Error Program::link(const gl::Context *context)
if (!linkValidateTransformFeedback(context->getClientVersion(), mInfoLog, mergedVaryings, if (!linkValidateTransformFeedback(context->getClientVersion(), mInfoLog, mergedVaryings,
context->getCaps())) context->getCaps()))
{ {
return NoError(); return angle::Result::Continue();
} }
if (!resources->varyingPacking.collectAndPackUserVaryings( if (!resources->varyingPacking.collectAndPackUserVaryings(
mInfoLog, mergedVaryings, mState.getTransformFeedbackVaryingNames())) mInfoLog, mergedVaryings, mState.getTransformFeedbackVaryingNames()))
{ {
return NoError(); return angle::Result::Continue();
} }
gatherTransformFeedbackVaryings(mergedVaryings); gatherTransformFeedbackVaryings(mergedVaryings);
...@@ -1276,7 +1275,7 @@ Error Program::link(const gl::Context *context) ...@@ -1276,7 +1275,7 @@ Error Program::link(const gl::Context *context)
mLinkingState->resources = std::move(resources); mLinkingState->resources = std::move(resources);
mLinkResolved = false; mLinkResolved = false;
return NoError(); return angle::Result::Continue();
} }
bool Program::isLinking() const bool Program::isLinking() const
...@@ -1427,22 +1426,22 @@ void Program::unlink() ...@@ -1427,22 +1426,22 @@ void Program::unlink()
mInfoLog.reset(); mInfoLog.reset();
} }
Error Program::loadBinary(const Context *context, angle::Result Program::loadBinary(const Context *context,
GLenum binaryFormat, GLenum binaryFormat,
const void *binary, const void *binary,
GLsizei length) GLsizei length)
{ {
ASSERT(mLinkResolved); ASSERT(mLinkResolved);
unlink(); unlink();
#if ANGLE_PROGRAM_BINARY_LOAD != ANGLE_ENABLED #if ANGLE_PROGRAM_BINARY_LOAD != ANGLE_ENABLED
return NoError(); return angle::Result::Continue();
#else #else
ASSERT(binaryFormat == GL_PROGRAM_BINARY_ANGLE); ASSERT(binaryFormat == GL_PROGRAM_BINARY_ANGLE);
if (binaryFormat != GL_PROGRAM_BINARY_ANGLE) if (binaryFormat != GL_PROGRAM_BINARY_ANGLE)
{ {
mInfoLog << "Invalid program binary format."; mInfoLog << "Invalid program binary format.";
return NoError(); return angle::Result::Continue();
} }
const uint8_t *bytes = reinterpret_cast<const uint8_t *>(binary); const uint8_t *bytes = reinterpret_cast<const uint8_t *>(binary);
...@@ -1460,15 +1459,15 @@ Error Program::loadBinary(const Context *context, ...@@ -1460,15 +1459,15 @@ Error Program::loadBinary(const Context *context,
mDirtyBits.set(uniformBlockIndex); mDirtyBits.set(uniformBlockIndex);
} }
return NoError(); return angle::Result::Continue();
#endif // #if ANGLE_PROGRAM_BINARY_LOAD == ANGLE_ENABLED #endif // #if ANGLE_PROGRAM_BINARY_LOAD == ANGLE_ENABLED
} }
Error Program::saveBinary(const Context *context, angle::Result Program::saveBinary(Context *context,
GLenum *binaryFormat, GLenum *binaryFormat,
void *binary, void *binary,
GLsizei bufSize, GLsizei bufSize,
GLsizei *length) const GLsizei *length) const
{ {
ASSERT(mLinkResolved); ASSERT(mLinkResolved);
if (binaryFormat) if (binaryFormat)
...@@ -1492,7 +1491,7 @@ Error Program::saveBinary(const Context *context, ...@@ -1492,7 +1491,7 @@ Error Program::saveBinary(const Context *context,
// TODO: This should be moved to the validation layer but computing the size of the binary // TODO: This should be moved to the validation layer but computing the size of the binary
// before saving it causes the save to happen twice. It may be possible to write the binary // before saving it causes the save to happen twice. It may be possible to write the binary
// to a separate buffer, validate sizes and then copy it. // to a separate buffer, validate sizes and then copy it.
return InternalError(); ANGLE_CHECK(context, false, "Insufficient buffer size", GL_INVALID_OPERATION);
} }
if (binary) if (binary)
...@@ -1510,10 +1509,10 @@ Error Program::saveBinary(const Context *context, ...@@ -1510,10 +1509,10 @@ Error Program::saveBinary(const Context *context,
*length = streamLength; *length = streamLength;
} }
return NoError(); return angle::Result::Continue();
} }
GLint Program::getBinaryLength(const Context *context) const GLint Program::getBinaryLength(Context *context) const
{ {
ASSERT(mLinkResolved); ASSERT(mLinkResolved);
if (!mLinked) if (!mLinked)
...@@ -1522,8 +1521,9 @@ GLint Program::getBinaryLength(const Context *context) const ...@@ -1522,8 +1521,9 @@ GLint Program::getBinaryLength(const Context *context) const
} }
GLint length; GLint length;
Error error = saveBinary(context, nullptr, nullptr, std::numeric_limits<GLint>::max(), &length); angle::Result result =
if (error.isError()) saveBinary(context, nullptr, nullptr, std::numeric_limits<GLint>::max(), &length);
if (result != angle::Result::Continue())
{ {
return 0; return 0;
} }
......
...@@ -524,7 +524,7 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -524,7 +524,7 @@ class Program final : angle::NonCopyable, public LabeledObject
// KHR_parallel_shader_compile // KHR_parallel_shader_compile
// Try to link the program asynchrously. As a result, background threads may be launched to // Try to link the program asynchrously. As a result, background threads may be launched to
// execute the linking tasks concurrently. // execute the linking tasks concurrently.
Error link(const Context *context); angle::Result link(const Context *context);
// Peek whether there is any running linking tasks. // Peek whether there is any running linking tasks.
bool isLinking() const; bool isLinking() const;
...@@ -541,16 +541,16 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -541,16 +541,16 @@ class Program final : angle::NonCopyable, public LabeledObject
return mState.mLinkedShaderStages[shaderType]; return mState.mLinkedShaderStages[shaderType];
} }
Error loadBinary(const Context *context, angle::Result loadBinary(const Context *context,
GLenum binaryFormat, GLenum binaryFormat,
const void *binary, const void *binary,
GLsizei length); GLsizei length);
Error saveBinary(const Context *context, angle::Result saveBinary(Context *context,
GLenum *binaryFormat, GLenum *binaryFormat,
void *binary, void *binary,
GLsizei bufSize, GLsizei bufSize,
GLsizei *length) const; GLsizei *length) const;
GLint getBinaryLength(const Context *context) const; GLint getBinaryLength(Context *context) const;
void setBinaryRetrievableHint(bool retrievable); void setBinaryRetrievableHint(bool retrievable);
bool getBinaryRetrievableHint() const; bool getBinaryRetrievableHint() const;
......
...@@ -23,7 +23,7 @@ Query::~Query() ...@@ -23,7 +23,7 @@ Query::~Query()
void Query::onDestroy(const Context *context) void Query::onDestroy(const Context *context)
{ {
ASSERT(mQuery); ASSERT(mQuery);
ANGLE_SWALLOW_ERR(mQuery->onDestroy(context)); mQuery->onDestroy(context);
} }
void Query::setLabel(const std::string &label) void Query::setLabel(const std::string &label)
...@@ -36,42 +36,42 @@ const std::string &Query::getLabel() const ...@@ -36,42 +36,42 @@ const std::string &Query::getLabel() const
return mLabel; return mLabel;
} }
Error Query::begin(const Context *context) angle::Result Query::begin(const Context *context)
{ {
return mQuery->begin(context); return mQuery->begin(context);
} }
Error Query::end(const Context *context) angle::Result Query::end(const Context *context)
{ {
return mQuery->end(context); return mQuery->end(context);
} }
Error Query::queryCounter(const Context *context) angle::Result Query::queryCounter(const Context *context)
{ {
return mQuery->queryCounter(context); return mQuery->queryCounter(context);
} }
Error Query::getResult(const Context *context, GLint *params) angle::Result Query::getResult(const Context *context, GLint *params)
{ {
return mQuery->getResult(context, params); return mQuery->getResult(context, params);
} }
Error Query::getResult(const Context *context, GLuint *params) angle::Result Query::getResult(const Context *context, GLuint *params)
{ {
return mQuery->getResult(context, params); return mQuery->getResult(context, params);
} }
Error Query::getResult(const Context *context, GLint64 *params) angle::Result Query::getResult(const Context *context, GLint64 *params)
{ {
return mQuery->getResult(context, params); return mQuery->getResult(context, params);
} }
Error Query::getResult(const Context *context, GLuint64 *params) angle::Result Query::getResult(const Context *context, GLuint64 *params)
{ {
return mQuery->getResult(context, params); return mQuery->getResult(context, params);
} }
Error Query::isResultAvailable(const Context *context, bool *available) angle::Result Query::isResultAvailable(const Context *context, bool *available)
{ {
return mQuery->isResultAvailable(context, available); return mQuery->isResultAvailable(context, available);
} }
......
...@@ -36,14 +36,14 @@ class Query final : public RefCountObject, public LabeledObject ...@@ -36,14 +36,14 @@ class Query final : public RefCountObject, public LabeledObject
void setLabel(const std::string &label) override; void setLabel(const std::string &label) override;
const std::string &getLabel() const override; const std::string &getLabel() const override;
Error begin(const Context *context); angle::Result begin(const Context *context);
Error end(const Context *context); angle::Result end(const Context *context);
Error queryCounter(const Context *context); angle::Result queryCounter(const Context *context);
Error getResult(const Context *context, GLint *params); angle::Result getResult(const Context *context, GLint *params);
Error getResult(const Context *context, GLuint *params); angle::Result getResult(const Context *context, GLuint *params);
Error getResult(const Context *context, GLint64 *params); angle::Result getResult(const Context *context, GLint64 *params);
Error getResult(const Context *context, GLuint64 *params); angle::Result getResult(const Context *context, GLuint64 *params);
Error isResultAvailable(const Context *context, bool *available); angle::Result isResultAvailable(const Context *context, bool *available);
QueryType getType() const; QueryType getType() const;
......
...@@ -1025,7 +1025,7 @@ void QueryBufferPointerv(const Buffer *buffer, GLenum pname, void **params) ...@@ -1025,7 +1025,7 @@ void QueryBufferPointerv(const Buffer *buffer, GLenum pname, void **params)
} }
} }
void QueryProgramiv(const Context *context, const Program *program, GLenum pname, GLint *params) void QueryProgramiv(Context *context, const Program *program, GLenum pname, GLint *params)
{ {
ASSERT(program != nullptr); ASSERT(program != nullptr);
......
...@@ -42,7 +42,7 @@ void QueryFramebufferAttachmentParameteriv(const Context *context, ...@@ -42,7 +42,7 @@ void QueryFramebufferAttachmentParameteriv(const Context *context,
void QueryBufferParameteriv(const Buffer *buffer, GLenum pname, GLint *params); void QueryBufferParameteriv(const Buffer *buffer, GLenum pname, GLint *params);
void QueryBufferParameteri64v(const Buffer *buffer, GLenum pname, GLint64 *params); void QueryBufferParameteri64v(const Buffer *buffer, GLenum pname, GLint64 *params);
void QueryBufferPointerv(const Buffer *buffer, GLenum pname, void **params); void QueryBufferPointerv(const Buffer *buffer, GLenum pname, void **params);
void QueryProgramiv(const Context *context, const Program *program, GLenum pname, GLint *params); void QueryProgramiv(Context *context, const Program *program, GLenum pname, GLint *params);
void QueryRenderbufferiv(const Context *context, void QueryRenderbufferiv(const Context *context,
const Renderbuffer *renderbuffer, const Renderbuffer *renderbuffer,
GLenum pname, GLenum pname,
......
...@@ -23,8 +23,6 @@ class CompilerImpl : angle::NonCopyable ...@@ -23,8 +23,6 @@ class CompilerImpl : angle::NonCopyable
CompilerImpl() {} CompilerImpl() {}
virtual ~CompilerImpl() {} virtual ~CompilerImpl() {}
virtual gl::Error release() = 0;
// TODO(jmadill): Expose translator built-in resources init method. // TODO(jmadill): Expose translator built-in resources init method.
virtual ShShaderOutput getTranslatorOutputType() const = 0; virtual ShShaderOutput getTranslatorOutputType() const = 0;
}; };
......
...@@ -64,7 +64,7 @@ class ProgramImpl : angle::NonCopyable ...@@ -64,7 +64,7 @@ class ProgramImpl : angle::NonCopyable
public: public:
ProgramImpl(const gl::ProgramState &state) : mState(state) {} ProgramImpl(const gl::ProgramState &state) : mState(state) {}
virtual ~ProgramImpl() {} virtual ~ProgramImpl() {}
virtual gl::Error destroy(const gl::Context *context) { return gl::NoError(); } virtual void destroy(const gl::Context *context) {}
virtual angle::Result load(const gl::Context *context, virtual angle::Result load(const gl::Context *context,
gl::InfoLog &infoLog, gl::InfoLog &infoLog,
......
...@@ -11,9 +11,8 @@ ...@@ -11,9 +11,8 @@
namespace rx namespace rx
{ {
gl::Error QueryImpl::onDestroy(const gl::Context *context) void QueryImpl::onDestroy(const gl::Context *context)
{ {
return gl::NoError();
} }
} // namespace rx } // namespace rx
...@@ -26,16 +26,16 @@ class QueryImpl : angle::NonCopyable ...@@ -26,16 +26,16 @@ class QueryImpl : angle::NonCopyable
explicit QueryImpl(gl::QueryType type) : mType(type) {} explicit QueryImpl(gl::QueryType type) : mType(type) {}
virtual ~QueryImpl() {} virtual ~QueryImpl() {}
virtual gl::Error onDestroy(const gl::Context *context); virtual void onDestroy(const gl::Context *context);
virtual gl::Error begin(const gl::Context *context) = 0; virtual angle::Result begin(const gl::Context *context) = 0;
virtual gl::Error end(const gl::Context *context) = 0; virtual angle::Result end(const gl::Context *context) = 0;
virtual gl::Error queryCounter(const gl::Context *context) = 0; virtual angle::Result queryCounter(const gl::Context *context) = 0;
virtual gl::Error getResult(const gl::Context *context, GLint *params) = 0; virtual angle::Result getResult(const gl::Context *context, GLint *params) = 0;
virtual gl::Error getResult(const gl::Context *context, GLuint *params) = 0; virtual angle::Result getResult(const gl::Context *context, GLuint *params) = 0;
virtual gl::Error getResult(const gl::Context *context, GLint64 *params) = 0; virtual angle::Result getResult(const gl::Context *context, GLint64 *params) = 0;
virtual gl::Error getResult(const gl::Context *context, GLuint64 *params) = 0; virtual angle::Result getResult(const gl::Context *context, GLuint64 *params) = 0;
virtual gl::Error isResultAvailable(const gl::Context *context, bool *available) = 0; virtual angle::Result isResultAvailable(const gl::Context *context, bool *available) = 0;
gl::QueryType getType() const { return mType; } gl::QueryType getType() const { return mType; }
......
...@@ -17,11 +17,6 @@ CompilerD3D::CompilerD3D(ShShaderOutput translatorOutputType) ...@@ -17,11 +17,6 @@ CompilerD3D::CompilerD3D(ShShaderOutput translatorOutputType)
{ {
} }
gl::Error CompilerD3D::release()
{
return gl::NoError();
}
ShShaderOutput CompilerD3D::getTranslatorOutputType() const ShShaderOutput CompilerD3D::getTranslatorOutputType() const
{ {
return mTranslatorOutputType; return mTranslatorOutputType;
......
...@@ -21,7 +21,6 @@ class CompilerD3D : public CompilerImpl ...@@ -21,7 +21,6 @@ class CompilerD3D : public CompilerImpl
CompilerD3D(ShShaderOutput translatorOutputType); CompilerD3D(ShShaderOutput translatorOutputType);
~CompilerD3D() override {} ~CompilerD3D() override {}
gl::Error release() override;
ShShaderOutput getTranslatorOutputType() const override; ShShaderOutput getTranslatorOutputType() const override;
private: private:
......
...@@ -70,25 +70,25 @@ Query11::~Query11() ...@@ -70,25 +70,25 @@ Query11::~Query11()
mRenderer->getStateManager()->onDeleteQueryObject(this); mRenderer->getStateManager()->onDeleteQueryObject(this);
} }
gl::Error Query11::begin(const gl::Context *context) angle::Result Query11::begin(const gl::Context *context)
{ {
mResultSum = 0; mResultSum = 0;
mRenderer->getStateManager()->onBeginQuery(this); mRenderer->getStateManager()->onBeginQuery(this);
return resume(GetImplAs<Context11>(context)); return resume(GetImplAs<Context11>(context));
} }
gl::Error Query11::end(const gl::Context *context) angle::Result Query11::end(const gl::Context *context)
{ {
return pause(GetImplAs<Context11>(context)); return pause(GetImplAs<Context11>(context));
} }
gl::Error Query11::queryCounter(const gl::Context *context) angle::Result Query11::queryCounter(const gl::Context *context)
{ {
// This doesn't do anything for D3D11 as we don't support timestamps // This doesn't do anything for D3D11 as we don't support timestamps
ASSERT(getType() == gl::QueryType::Timestamp); ASSERT(getType() == gl::QueryType::Timestamp);
mResultSum = 0; mResultSum = 0;
mPendingQueries.push_back(std::unique_ptr<QueryState>(new QueryState())); mPendingQueries.push_back(std::unique_ptr<QueryState>(new QueryState()));
return gl::NoError(); return angle::Result::Continue();
} }
template <typename T> template <typename T>
...@@ -102,32 +102,32 @@ angle::Result Query11::getResultBase(Context11 *context11, T *params) ...@@ -102,32 +102,32 @@ angle::Result Query11::getResultBase(Context11 *context11, T *params)
return angle::Result::Continue(); return angle::Result::Continue();
} }
gl::Error Query11::getResult(const gl::Context *context, GLint *params) angle::Result Query11::getResult(const gl::Context *context, GLint *params)
{ {
return getResultBase(GetImplAs<Context11>(context), params); return getResultBase(GetImplAs<Context11>(context), params);
} }
gl::Error Query11::getResult(const gl::Context *context, GLuint *params) angle::Result Query11::getResult(const gl::Context *context, GLuint *params)
{ {
return getResultBase(GetImplAs<Context11>(context), params); return getResultBase(GetImplAs<Context11>(context), params);
} }
gl::Error Query11::getResult(const gl::Context *context, GLint64 *params) angle::Result Query11::getResult(const gl::Context *context, GLint64 *params)
{ {
return getResultBase(GetImplAs<Context11>(context), params); return getResultBase(GetImplAs<Context11>(context), params);
} }
gl::Error Query11::getResult(const gl::Context *context, GLuint64 *params) angle::Result Query11::getResult(const gl::Context *context, GLuint64 *params)
{ {
return getResultBase(GetImplAs<Context11>(context), params); return getResultBase(GetImplAs<Context11>(context), params);
} }
gl::Error Query11::isResultAvailable(const gl::Context *context, bool *available) angle::Result Query11::isResultAvailable(const gl::Context *context, bool *available)
{ {
ANGLE_TRY(flush(GetImplAs<Context11>(context), false)); ANGLE_TRY(flush(GetImplAs<Context11>(context), false));
*available = mPendingQueries.empty(); *available = mPendingQueries.empty();
return gl::NoError(); return angle::Result::Continue();
} }
angle::Result Query11::pause(Context11 *context11) angle::Result Query11::pause(Context11 *context11)
......
...@@ -25,14 +25,14 @@ class Query11 : public QueryImpl ...@@ -25,14 +25,14 @@ class Query11 : public QueryImpl
Query11(Renderer11 *renderer, gl::QueryType type); Query11(Renderer11 *renderer, gl::QueryType type);
~Query11() override; ~Query11() override;
gl::Error begin(const gl::Context *context) override; angle::Result begin(const gl::Context *context) override;
gl::Error end(const gl::Context *context) override; angle::Result end(const gl::Context *context) override;
gl::Error queryCounter(const gl::Context *context) override; angle::Result queryCounter(const gl::Context *context) override;
gl::Error getResult(const gl::Context *context, GLint *params) override; angle::Result getResult(const gl::Context *context, GLint *params) override;
gl::Error getResult(const gl::Context *context, GLuint *params) override; angle::Result getResult(const gl::Context *context, GLuint *params) override;
gl::Error getResult(const gl::Context *context, GLint64 *params) override; angle::Result getResult(const gl::Context *context, GLint64 *params) override;
gl::Error getResult(const gl::Context *context, GLuint64 *params) override; angle::Result getResult(const gl::Context *context, GLuint64 *params) override;
gl::Error isResultAvailable(const gl::Context *context, bool *available) override; angle::Result isResultAvailable(const gl::Context *context, bool *available) override;
angle::Result pause(Context11 *context11); angle::Result pause(Context11 *context11);
angle::Result resume(Context11 *context11); angle::Result resume(Context11 *context11);
......
...@@ -7,8 +7,11 @@ ...@@ -7,8 +7,11 @@
// Query9.cpp: Defines the rx::Query9 class which implements rx::QueryImpl. // Query9.cpp: Defines the rx::Query9 class which implements rx::QueryImpl.
#include "libANGLE/renderer/d3d/d3d9/Query9.h" #include "libANGLE/renderer/d3d/d3d9/Query9.h"
#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
#include "libANGLE/Context.h"
#include "libANGLE/renderer/d3d/d3d9/Context9.h"
#include "libANGLE/renderer/d3d/d3d9/Renderer9.h" #include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h"
#include <GLES2/gl2ext.h> #include <GLES2/gl2ext.h>
...@@ -29,64 +32,52 @@ Query9::~Query9() ...@@ -29,64 +32,52 @@ Query9::~Query9()
SafeRelease(mQuery); SafeRelease(mQuery);
} }
gl::Error Query9::begin(const gl::Context *context) angle::Result Query9::begin(const gl::Context *context)
{ {
Context9 *context9 = GetImplAs<Context9>(context);
D3DQUERYTYPE d3dQueryType = gl_d3d9::ConvertQueryType(getType()); D3DQUERYTYPE d3dQueryType = gl_d3d9::ConvertQueryType(getType());
if (mQuery == nullptr) if (mQuery == nullptr)
{ {
HRESULT result = mRenderer->getDevice()->CreateQuery(d3dQueryType, &mQuery); HRESULT result = mRenderer->getDevice()->CreateQuery(d3dQueryType, &mQuery);
if (FAILED(result)) ANGLE_TRY_HR(context9, result, "Internal query creation failed");
{
return gl::OutOfMemory() << "Internal query creation failed, " << gl::FmtHR(result);
}
} }
if (d3dQueryType != D3DQUERYTYPE_EVENT) if (d3dQueryType != D3DQUERYTYPE_EVENT)
{ {
HRESULT result = mQuery->Issue(D3DISSUE_BEGIN); HRESULT result = mQuery->Issue(D3DISSUE_BEGIN);
ASSERT(SUCCEEDED(result)); ASSERT(SUCCEEDED(result));
if (FAILED(result)) ANGLE_TRY_HR(context9, result, "Failed to begin internal query");
{
return gl::OutOfMemory() << "Failed to begin internal query, " << gl::FmtHR(result);
}
} }
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error Query9::end(const gl::Context *context) angle::Result Query9::end(const gl::Context *context)
{ {
Context9 *context9 = GetImplAs<Context9>(context);
ASSERT(mQuery); ASSERT(mQuery);
HRESULT result = mQuery->Issue(D3DISSUE_END); HRESULT result = mQuery->Issue(D3DISSUE_END);
ASSERT(SUCCEEDED(result)); ASSERT(SUCCEEDED(result));
if (FAILED(result)) ANGLE_TRY_HR(context9, result, "Failed to end internal query");
{
return gl::OutOfMemory() << "Failed to end internal query, " << gl::FmtHR(result);
}
mQueryFinished = false; mQueryFinished = false;
mResult = GL_FALSE; mResult = GL_FALSE;
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error Query9::queryCounter(const gl::Context *context) angle::Result Query9::queryCounter(const gl::Context *context)
{ {
UNIMPLEMENTED(); ANGLE_HR_UNREACHABLE(GetImplAs<Context9>(context));
return gl::InternalError() << "Unimplemented";
} }
template <typename T> template <typename T>
gl::Error Query9::getResultBase(T *params) angle::Result Query9::getResultBase(Context9 *context9, T *params)
{ {
while (!mQueryFinished) while (!mQueryFinished)
{ {
gl::Error error = testQuery(); ANGLE_TRY(testQuery(context9));
if (error.isError())
{
return error;
}
if (!mQueryFinished) if (!mQueryFinished)
{ {
...@@ -96,43 +87,37 @@ gl::Error Query9::getResultBase(T *params) ...@@ -96,43 +87,37 @@ gl::Error Query9::getResultBase(T *params)
ASSERT(mQueryFinished); ASSERT(mQueryFinished);
*params = static_cast<T>(mResult); *params = static_cast<T>(mResult);
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error Query9::getResult(const gl::Context *context, GLint *params) angle::Result Query9::getResult(const gl::Context *context, GLint *params)
{ {
return getResultBase(params); return getResultBase(GetImplAs<Context9>(context), params);
} }
gl::Error Query9::getResult(const gl::Context *context, GLuint *params) angle::Result Query9::getResult(const gl::Context *context, GLuint *params)
{ {
return getResultBase(params); return getResultBase(GetImplAs<Context9>(context), params);
} }
gl::Error Query9::getResult(const gl::Context *context, GLint64 *params) angle::Result Query9::getResult(const gl::Context *context, GLint64 *params)
{ {
return getResultBase(params); return getResultBase(GetImplAs<Context9>(context), params);
} }
gl::Error Query9::getResult(const gl::Context *context, GLuint64 *params) angle::Result Query9::getResult(const gl::Context *context, GLuint64 *params)
{ {
return getResultBase(params); return getResultBase(GetImplAs<Context9>(context), params);
} }
gl::Error Query9::isResultAvailable(const gl::Context *context, bool *available) angle::Result Query9::isResultAvailable(const gl::Context *context, bool *available)
{ {
gl::Error error = testQuery(); ANGLE_TRY(testQuery(GetImplAs<Context9>(context)));
if (error.isError())
{
return error;
}
*available = mQueryFinished; *available = mQueryFinished;
return angle::Result::Continue();
return gl::NoError();
} }
gl::Error Query9::testQuery() angle::Result Query9::testQuery(Context9 *context9)
{ {
if (!mQueryFinished) if (!mQueryFinished)
{ {
...@@ -173,24 +158,20 @@ gl::Error Query9::testQuery() ...@@ -173,24 +158,20 @@ gl::Error Query9::testQuery()
if (!mQueryFinished) if (!mQueryFinished)
{ {
if (d3d9::isDeviceLostError(result)) ANGLE_TRY_HR(context9, result, "Failed to test get query result");
{
mRenderer->notifyDeviceLost();
return gl::OutOfMemory() << "Failed to test get query result, device is lost.";
}
mGetDataAttemptCount++; mGetDataAttemptCount++;
bool checkDeviceLost = bool checkDeviceLost =
(mGetDataAttemptCount % kPollingD3DDeviceLostCheckFrequency) == 0; (mGetDataAttemptCount % kPollingD3DDeviceLostCheckFrequency) == 0;
if (checkDeviceLost && mRenderer->testDeviceLost()) if (checkDeviceLost && mRenderer->testDeviceLost())
{ {
mRenderer->notifyDeviceLost(); ANGLE_TRY_HR(context9, D3DERR_DEVICELOST,
return gl::OutOfMemory() << "Failed to test get query result, device is lost."; "Failed to test get query result, device is lost");
} }
} }
} }
return gl::NoError(); return angle::Result::Continue();
} }
} }
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
namespace rx namespace rx
{ {
class Context9;
class Renderer9; class Renderer9;
class Query9 : public QueryImpl class Query9 : public QueryImpl
...@@ -21,20 +22,20 @@ class Query9 : public QueryImpl ...@@ -21,20 +22,20 @@ class Query9 : public QueryImpl
Query9(Renderer9 *renderer, gl::QueryType type); Query9(Renderer9 *renderer, gl::QueryType type);
~Query9() override; ~Query9() override;
gl::Error begin(const gl::Context *context) override; angle::Result begin(const gl::Context *context) override;
gl::Error end(const gl::Context *context) override; angle::Result end(const gl::Context *context) override;
gl::Error queryCounter(const gl::Context *context) override; angle::Result queryCounter(const gl::Context *context) override;
gl::Error getResult(const gl::Context *context, GLint *params) override; angle::Result getResult(const gl::Context *context, GLint *params) override;
gl::Error getResult(const gl::Context *context, GLuint *params) override; angle::Result getResult(const gl::Context *context, GLuint *params) override;
gl::Error getResult(const gl::Context *context, GLint64 *params) override; angle::Result getResult(const gl::Context *context, GLint64 *params) override;
gl::Error getResult(const gl::Context *context, GLuint64 *params) override; angle::Result getResult(const gl::Context *context, GLuint64 *params) override;
gl::Error isResultAvailable(const gl::Context *context, bool *available) override; angle::Result isResultAvailable(const gl::Context *context, bool *available) override;
private: private:
gl::Error testQuery(); angle::Result testQuery(Context9 *context9);
template <typename T> template <typename T>
gl::Error getResultBase(T *params); angle::Result getResultBase(Context9 *context9, T *params);
unsigned int mGetDataAttemptCount; unsigned int mGetDataAttemptCount;
GLuint64 mResult; GLuint64 mResult;
......
...@@ -88,11 +88,6 @@ CompilerGL::CompilerGL(const FunctionsGL *functions) ...@@ -88,11 +88,6 @@ CompilerGL::CompilerGL(const FunctionsGL *functions)
{ {
} }
gl::Error CompilerGL::release()
{
return gl::NoError();
}
ShShaderOutput CompilerGL::getTranslatorOutputType() const ShShaderOutput CompilerGL::getTranslatorOutputType() const
{ {
return mTranslatorOutputType; return mTranslatorOutputType;
......
...@@ -21,7 +21,6 @@ class CompilerGL : public CompilerImpl ...@@ -21,7 +21,6 @@ class CompilerGL : public CompilerImpl
CompilerGL(const FunctionsGL *functions); CompilerGL(const FunctionsGL *functions);
~CompilerGL() override {} ~CompilerGL() override {}
gl::Error release() override;
ShShaderOutput getTranslatorOutputType() const override; ShShaderOutput getTranslatorOutputType() const override;
private: private:
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "libANGLE/renderer/gl/QueryGL.h" #include "libANGLE/renderer/gl/QueryGL.h"
#include "common/debug.h" #include "common/debug.h"
#include "libANGLE/Context.h"
#include "libANGLE/renderer/gl/ContextGL.h"
#include "libANGLE/renderer/gl/FunctionsGL.h" #include "libANGLE/renderer/gl/FunctionsGL.h"
#include "libANGLE/renderer/gl/StateManagerGL.h" #include "libANGLE/renderer/gl/StateManagerGL.h"
#include "libANGLE/renderer/gl/renderergl_utils.h" #include "libANGLE/renderer/gl/renderergl_utils.h"
...@@ -85,18 +87,18 @@ StandardQueryGL::~StandardQueryGL() ...@@ -85,18 +87,18 @@ StandardQueryGL::~StandardQueryGL()
} }
} }
gl::Error StandardQueryGL::begin(const gl::Context *context) angle::Result StandardQueryGL::begin(const gl::Context *context)
{ {
mResultSum = 0; mResultSum = 0;
return resume(context); return resume(context);
} }
gl::Error StandardQueryGL::end(const gl::Context *context) angle::Result StandardQueryGL::end(const gl::Context *context)
{ {
return pause(context); return pause(context);
} }
gl::Error StandardQueryGL::queryCounter(const gl::Context *context) angle::Result StandardQueryGL::queryCounter(const gl::Context *context)
{ {
ASSERT(mType == gl::QueryType::Timestamp); ASSERT(mType == gl::QueryType::Timestamp);
...@@ -107,7 +109,7 @@ gl::Error StandardQueryGL::queryCounter(const gl::Context *context) ...@@ -107,7 +109,7 @@ gl::Error StandardQueryGL::queryCounter(const gl::Context *context)
mFunctions->queryCounter(query, GL_TIMESTAMP); mFunctions->queryCounter(query, GL_TIMESTAMP);
mPendingQueries.push_back(query); mPendingQueries.push_back(query);
return gl::NoError(); return angle::Result::Continue();
} }
template <typename T> template <typename T>
...@@ -122,33 +124,33 @@ angle::Result StandardQueryGL::getResultBase(const gl::Context *context, T *para ...@@ -122,33 +124,33 @@ angle::Result StandardQueryGL::getResultBase(const gl::Context *context, T *para
return angle::Result::Continue(); return angle::Result::Continue();
} }
gl::Error StandardQueryGL::getResult(const gl::Context *context, GLint *params) angle::Result StandardQueryGL::getResult(const gl::Context *context, GLint *params)
{ {
return getResultBase(context, params); return getResultBase(context, params);
} }
gl::Error StandardQueryGL::getResult(const gl::Context *context, GLuint *params) angle::Result StandardQueryGL::getResult(const gl::Context *context, GLuint *params)
{ {
return getResultBase(context, params); return getResultBase(context, params);
} }
gl::Error StandardQueryGL::getResult(const gl::Context *context, GLint64 *params) angle::Result StandardQueryGL::getResult(const gl::Context *context, GLint64 *params)
{ {
return getResultBase(context, params); return getResultBase(context, params);
} }
gl::Error StandardQueryGL::getResult(const gl::Context *context, GLuint64 *params) angle::Result StandardQueryGL::getResult(const gl::Context *context, GLuint64 *params)
{ {
return getResultBase(context, params); return getResultBase(context, params);
} }
gl::Error StandardQueryGL::isResultAvailable(const gl::Context *context, bool *available) angle::Result StandardQueryGL::isResultAvailable(const gl::Context *context, bool *available)
{ {
ASSERT(mActiveQuery == 0); ASSERT(mActiveQuery == 0);
ANGLE_TRY(flush(context, false)); ANGLE_TRY(flush(context, false));
*available = mPendingQueries.empty(); *available = mPendingQueries.empty();
return gl::NoError(); return angle::Result::Continue();
} }
angle::Result StandardQueryGL::pause(const gl::Context *context) angle::Result StandardQueryGL::pause(const gl::Context *context)
...@@ -317,12 +319,12 @@ bool SyncQueryGL::IsSupported(const FunctionsGL *functions) ...@@ -317,12 +319,12 @@ bool SyncQueryGL::IsSupported(const FunctionsGL *functions)
return nativegl::SupportsFenceSync(functions) || nativegl::SupportsOcclusionQueries(functions); return nativegl::SupportsFenceSync(functions) || nativegl::SupportsOcclusionQueries(functions);
} }
gl::Error SyncQueryGL::begin(const gl::Context *context) angle::Result SyncQueryGL::begin(const gl::Context *context)
{ {
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error SyncQueryGL::end(const gl::Context *context) angle::Result SyncQueryGL::end(const gl::Context *context)
{ {
if (nativegl::SupportsFenceSync(mFunctions)) if (nativegl::SupportsFenceSync(mFunctions))
{ {
...@@ -335,43 +337,42 @@ gl::Error SyncQueryGL::end(const gl::Context *context) ...@@ -335,43 +337,42 @@ gl::Error SyncQueryGL::end(const gl::Context *context)
} }
else else
{ {
ASSERT(false); ANGLE_GL_UNREACHABLE(GetImplAs<ContextGL>(context));
return gl::InternalError() << "No native support for sync queries.";
} }
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error SyncQueryGL::queryCounter(const gl::Context *context) angle::Result SyncQueryGL::queryCounter(const gl::Context *context)
{ {
UNREACHABLE(); UNREACHABLE();
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error SyncQueryGL::getResult(const gl::Context *context, GLint *params) angle::Result SyncQueryGL::getResult(const gl::Context *context, GLint *params)
{ {
return getResultBase(context, params); return getResultBase(context, params);
} }
gl::Error SyncQueryGL::getResult(const gl::Context *context, GLuint *params) angle::Result SyncQueryGL::getResult(const gl::Context *context, GLuint *params)
{ {
return getResultBase(context, params); return getResultBase(context, params);
} }
gl::Error SyncQueryGL::getResult(const gl::Context *context, GLint64 *params) angle::Result SyncQueryGL::getResult(const gl::Context *context, GLint64 *params)
{ {
return getResultBase(context, params); return getResultBase(context, params);
} }
gl::Error SyncQueryGL::getResult(const gl::Context *context, GLuint64 *params) angle::Result SyncQueryGL::getResult(const gl::Context *context, GLuint64 *params)
{ {
return getResultBase(context, params); return getResultBase(context, params);
} }
gl::Error SyncQueryGL::isResultAvailable(const gl::Context *context, bool *available) angle::Result SyncQueryGL::isResultAvailable(const gl::Context *context, bool *available)
{ {
ANGLE_TRY(flush(context, false)); ANGLE_TRY(flush(context, false));
*available = mFinished; *available = mFinished;
return gl::NoError(); return angle::Result::Continue();
} }
angle::Result SyncQueryGL::pause(const gl::Context *context) angle::Result SyncQueryGL::pause(const gl::Context *context)
......
...@@ -41,14 +41,14 @@ class StandardQueryGL : public QueryGL ...@@ -41,14 +41,14 @@ class StandardQueryGL : public QueryGL
StandardQueryGL(gl::QueryType type, const FunctionsGL *functions, StateManagerGL *stateManager); StandardQueryGL(gl::QueryType type, const FunctionsGL *functions, StateManagerGL *stateManager);
~StandardQueryGL() override; ~StandardQueryGL() override;
gl::Error begin(const gl::Context *context) override; angle::Result begin(const gl::Context *context) override;
gl::Error end(const gl::Context *context) override; angle::Result end(const gl::Context *context) override;
gl::Error queryCounter(const gl::Context *context) override; angle::Result queryCounter(const gl::Context *context) override;
gl::Error getResult(const gl::Context *context, GLint *params) override; angle::Result getResult(const gl::Context *context, GLint *params) override;
gl::Error getResult(const gl::Context *context, GLuint *params) override; angle::Result getResult(const gl::Context *context, GLuint *params) override;
gl::Error getResult(const gl::Context *context, GLint64 *params) override; angle::Result getResult(const gl::Context *context, GLint64 *params) override;
gl::Error getResult(const gl::Context *context, GLuint64 *params) override; angle::Result getResult(const gl::Context *context, GLuint64 *params) override;
gl::Error isResultAvailable(const gl::Context *context, bool *available) override; angle::Result isResultAvailable(const gl::Context *context, bool *available) override;
angle::Result pause(const gl::Context *context) override; angle::Result pause(const gl::Context *context) override;
angle::Result resume(const gl::Context *context) override; angle::Result resume(const gl::Context *context) override;
...@@ -78,14 +78,14 @@ class SyncQueryGL : public QueryGL ...@@ -78,14 +78,14 @@ class SyncQueryGL : public QueryGL
static bool IsSupported(const FunctionsGL *functions); static bool IsSupported(const FunctionsGL *functions);
gl::Error begin(const gl::Context *context) override; angle::Result begin(const gl::Context *context) override;
gl::Error end(const gl::Context *context) override; angle::Result end(const gl::Context *context) override;
gl::Error queryCounter(const gl::Context *context) override; angle::Result queryCounter(const gl::Context *context) override;
gl::Error getResult(const gl::Context *context, GLint *params) override; angle::Result getResult(const gl::Context *context, GLint *params) override;
gl::Error getResult(const gl::Context *context, GLuint *params) override; angle::Result getResult(const gl::Context *context, GLuint *params) override;
gl::Error getResult(const gl::Context *context, GLint64 *params) override; angle::Result getResult(const gl::Context *context, GLint64 *params) override;
gl::Error getResult(const gl::Context *context, GLuint64 *params) override; angle::Result getResult(const gl::Context *context, GLuint64 *params) override;
gl::Error isResultAvailable(const gl::Context *context, bool *available) override; angle::Result isResultAvailable(const gl::Context *context, bool *available) override;
angle::Result pause(const gl::Context *context) override; angle::Result pause(const gl::Context *context) override;
angle::Result resume(const gl::Context *context) override; angle::Result resume(const gl::Context *context) override;
......
...@@ -22,11 +22,6 @@ CompilerNULL::~CompilerNULL() ...@@ -22,11 +22,6 @@ CompilerNULL::~CompilerNULL()
{ {
} }
gl::Error CompilerNULL::release()
{
return gl::NoError();
}
ShShaderOutput CompilerNULL::getTranslatorOutputType() const ShShaderOutput CompilerNULL::getTranslatorOutputType() const
{ {
return SH_ESSL_OUTPUT; return SH_ESSL_OUTPUT;
......
...@@ -21,8 +21,6 @@ class CompilerNULL : public CompilerImpl ...@@ -21,8 +21,6 @@ class CompilerNULL : public CompilerImpl
CompilerNULL(); CompilerNULL();
~CompilerNULL() override; ~CompilerNULL() override;
gl::Error release() override;
// TODO(jmadill): Expose translator built-in resources init method. // TODO(jmadill): Expose translator built-in resources init method.
ShShaderOutput getTranslatorOutputType() const override; ShShaderOutput getTranslatorOutputType() const override;
}; };
......
...@@ -22,49 +22,49 @@ QueryNULL::~QueryNULL() ...@@ -22,49 +22,49 @@ QueryNULL::~QueryNULL()
{ {
} }
gl::Error QueryNULL::begin(const gl::Context *context) angle::Result QueryNULL::begin(const gl::Context *context)
{ {
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error QueryNULL::end(const gl::Context *context) angle::Result QueryNULL::end(const gl::Context *context)
{ {
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error QueryNULL::queryCounter(const gl::Context *context) angle::Result QueryNULL::queryCounter(const gl::Context *context)
{ {
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error QueryNULL::getResult(const gl::Context *context, GLint *params) angle::Result QueryNULL::getResult(const gl::Context *context, GLint *params)
{ {
*params = 0; *params = 0;
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error QueryNULL::getResult(const gl::Context *context, GLuint *params) angle::Result QueryNULL::getResult(const gl::Context *context, GLuint *params)
{ {
*params = 0; *params = 0;
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error QueryNULL::getResult(const gl::Context *context, GLint64 *params) angle::Result QueryNULL::getResult(const gl::Context *context, GLint64 *params)
{ {
*params = 0; *params = 0;
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error QueryNULL::getResult(const gl::Context *context, GLuint64 *params) angle::Result QueryNULL::getResult(const gl::Context *context, GLuint64 *params)
{ {
*params = 0; *params = 0;
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error QueryNULL::isResultAvailable(const gl::Context *context, bool *available) angle::Result QueryNULL::isResultAvailable(const gl::Context *context, bool *available)
{ {
*available = true; *available = true;
return gl::NoError(); return angle::Result::Continue();
} }
} // namespace rx } // namespace rx
...@@ -21,14 +21,14 @@ class QueryNULL : public QueryImpl ...@@ -21,14 +21,14 @@ class QueryNULL : public QueryImpl
QueryNULL(gl::QueryType type); QueryNULL(gl::QueryType type);
~QueryNULL() override; ~QueryNULL() override;
gl::Error begin(const gl::Context *context) override; angle::Result begin(const gl::Context *context) override;
gl::Error end(const gl::Context *context) override; angle::Result end(const gl::Context *context) override;
gl::Error queryCounter(const gl::Context *context) override; angle::Result queryCounter(const gl::Context *context) override;
gl::Error getResult(const gl::Context *context, GLint *params) override; angle::Result getResult(const gl::Context *context, GLint *params) override;
gl::Error getResult(const gl::Context *context, GLuint *params) override; angle::Result getResult(const gl::Context *context, GLuint *params) override;
gl::Error getResult(const gl::Context *context, GLint64 *params) override; angle::Result getResult(const gl::Context *context, GLint64 *params) override;
gl::Error getResult(const gl::Context *context, GLuint64 *params) override; angle::Result getResult(const gl::Context *context, GLuint64 *params) override;
gl::Error isResultAvailable(const gl::Context *context, bool *available) override; angle::Result isResultAvailable(const gl::Context *context, bool *available) override;
}; };
} // namespace rx } // namespace rx
......
...@@ -22,11 +22,6 @@ CompilerVk::~CompilerVk() ...@@ -22,11 +22,6 @@ CompilerVk::~CompilerVk()
{ {
} }
gl::Error CompilerVk::release()
{
return gl::NoError();
}
ShShaderOutput CompilerVk::getTranslatorOutputType() const ShShaderOutput CompilerVk::getTranslatorOutputType() const
{ {
return SH_GLSL_VULKAN_OUTPUT; return SH_GLSL_VULKAN_OUTPUT;
......
...@@ -21,8 +21,6 @@ class CompilerVk : public CompilerImpl ...@@ -21,8 +21,6 @@ class CompilerVk : public CompilerImpl
CompilerVk(); CompilerVk();
~CompilerVk() override; ~CompilerVk() override;
gl::Error release() override;
// TODO(jmadill): Expose translator built-in resources init method. // TODO(jmadill): Expose translator built-in resources init method.
ShShaderOutput getTranslatorOutputType() const override; ShShaderOutput getTranslatorOutputType() const override;
}; };
......
...@@ -199,10 +199,12 @@ ProgramVk::ProgramVk(const gl::ProgramState &state) : ProgramImpl(state), mUnifo ...@@ -199,10 +199,12 @@ ProgramVk::ProgramVk(const gl::ProgramState &state) : ProgramImpl(state), mUnifo
ProgramVk::~ProgramVk() = default; ProgramVk::~ProgramVk() = default;
gl::Error ProgramVk::destroy(const gl::Context *context) void ProgramVk::destroy(const gl::Context *context)
{ {
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
return reset(contextVk);
// We don't interrupt exectution in destructors.
(void)reset(contextVk);
} }
angle::Result ProgramVk::reset(ContextVk *contextVk) angle::Result ProgramVk::reset(ContextVk *contextVk)
......
...@@ -23,7 +23,7 @@ class ProgramVk : public ProgramImpl ...@@ -23,7 +23,7 @@ class ProgramVk : public ProgramImpl
public: public:
ProgramVk(const gl::ProgramState &state); ProgramVk(const gl::ProgramState &state);
~ProgramVk() override; ~ProgramVk() override;
gl::Error destroy(const gl::Context *context) override; void destroy(const gl::Context *context) override;
angle::Result load(const gl::Context *context, angle::Result load(const gl::Context *context,
gl::InfoLog &infoLog, gl::InfoLog &infoLog,
......
...@@ -23,16 +23,15 @@ QueryVk::QueryVk(gl::QueryType type) : QueryImpl(type), mCachedResult(0), mCache ...@@ -23,16 +23,15 @@ QueryVk::QueryVk(gl::QueryType type) : QueryImpl(type), mCachedResult(0), mCache
QueryVk::~QueryVk() = default; QueryVk::~QueryVk() = default;
gl::Error QueryVk::onDestroy(const gl::Context *context) void QueryVk::onDestroy(const gl::Context *context)
{ {
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
contextVk->getQueryPool(getType())->freeQuery(contextVk, &mQueryHelper); vk::DynamicQueryPool *queryPool = contextVk->getQueryPool(getType());
contextVk->getQueryPool(getType())->freeQuery(contextVk, &mQueryHelperTimeElapsedBegin); queryPool->freeQuery(contextVk, &mQueryHelper);
queryPool->freeQuery(contextVk, &mQueryHelperTimeElapsedBegin);
return gl::NoError();
} }
gl::Error QueryVk::begin(const gl::Context *context) angle::Result QueryVk::begin(const gl::Context *context)
{ {
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
...@@ -61,10 +60,10 @@ gl::Error QueryVk::begin(const gl::Context *context) ...@@ -61,10 +60,10 @@ gl::Error QueryVk::begin(const gl::Context *context)
mQueryHelper.beginQuery(contextVk, mQueryHelper.getQueryPool(), mQueryHelper.getQuery()); mQueryHelper.beginQuery(contextVk, mQueryHelper.getQueryPool(), mQueryHelper.getQuery());
} }
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error QueryVk::end(const gl::Context *context) angle::Result QueryVk::end(const gl::Context *context)
{ {
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
...@@ -78,10 +77,10 @@ gl::Error QueryVk::end(const gl::Context *context) ...@@ -78,10 +77,10 @@ gl::Error QueryVk::end(const gl::Context *context)
mQueryHelper.endQuery(contextVk, mQueryHelper.getQueryPool(), mQueryHelper.getQuery()); mQueryHelper.endQuery(contextVk, mQueryHelper.getQueryPool(), mQueryHelper.getQuery());
} }
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error QueryVk::queryCounter(const gl::Context *context) angle::Result QueryVk::queryCounter(const gl::Context *context)
{ {
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
...@@ -96,7 +95,7 @@ gl::Error QueryVk::queryCounter(const gl::Context *context) ...@@ -96,7 +95,7 @@ gl::Error QueryVk::queryCounter(const gl::Context *context)
mQueryHelper.writeTimestamp(contextVk, mQueryHelper.getQueryPool(), mQueryHelper.getQuery()); mQueryHelper.writeTimestamp(contextVk, mQueryHelper.getQueryPool(), mQueryHelper.getQuery());
return gl::NoError(); return angle::Result::Continue();
} }
angle::Result QueryVk::getResult(const gl::Context *context, bool wait) angle::Result QueryVk::getResult(const gl::Context *context, bool wait)
...@@ -183,40 +182,40 @@ angle::Result QueryVk::getResult(const gl::Context *context, bool wait) ...@@ -183,40 +182,40 @@ angle::Result QueryVk::getResult(const gl::Context *context, bool wait)
mCachedResultValid = true; mCachedResultValid = true;
return angle::Result::Continue(); return angle::Result::Continue();
} }
gl::Error QueryVk::getResult(const gl::Context *context, GLint *params) angle::Result QueryVk::getResult(const gl::Context *context, GLint *params)
{ {
ANGLE_TRY(getResult(context, true)); ANGLE_TRY(getResult(context, true));
*params = static_cast<GLint>(mCachedResult); *params = static_cast<GLint>(mCachedResult);
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error QueryVk::getResult(const gl::Context *context, GLuint *params) angle::Result QueryVk::getResult(const gl::Context *context, GLuint *params)
{ {
ANGLE_TRY(getResult(context, true)); ANGLE_TRY(getResult(context, true));
*params = static_cast<GLuint>(mCachedResult); *params = static_cast<GLuint>(mCachedResult);
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error QueryVk::getResult(const gl::Context *context, GLint64 *params) angle::Result QueryVk::getResult(const gl::Context *context, GLint64 *params)
{ {
ANGLE_TRY(getResult(context, true)); ANGLE_TRY(getResult(context, true));
*params = static_cast<GLint64>(mCachedResult); *params = static_cast<GLint64>(mCachedResult);
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error QueryVk::getResult(const gl::Context *context, GLuint64 *params) angle::Result QueryVk::getResult(const gl::Context *context, GLuint64 *params)
{ {
ANGLE_TRY(getResult(context, true)); ANGLE_TRY(getResult(context, true));
*params = mCachedResult; *params = mCachedResult;
return gl::NoError(); return angle::Result::Continue();
} }
gl::Error QueryVk::isResultAvailable(const gl::Context *context, bool *available) angle::Result QueryVk::isResultAvailable(const gl::Context *context, bool *available)
{ {
ANGLE_TRY(getResult(context, false)); ANGLE_TRY(getResult(context, false));
*available = mCachedResultValid; *available = mCachedResultValid;
return gl::NoError(); return angle::Result::Continue();
} }
} // namespace rx } // namespace rx
...@@ -22,16 +22,16 @@ class QueryVk : public QueryImpl ...@@ -22,16 +22,16 @@ class QueryVk : public QueryImpl
QueryVk(gl::QueryType type); QueryVk(gl::QueryType type);
~QueryVk() override; ~QueryVk() override;
gl::Error onDestroy(const gl::Context *context) override; void onDestroy(const gl::Context *context) override;
gl::Error begin(const gl::Context *context) override; angle::Result begin(const gl::Context *context) override;
gl::Error end(const gl::Context *context) override; angle::Result end(const gl::Context *context) override;
gl::Error queryCounter(const gl::Context *context) override; angle::Result queryCounter(const gl::Context *context) override;
gl::Error getResult(const gl::Context *context, GLint *params) override; angle::Result getResult(const gl::Context *context, GLint *params) override;
gl::Error getResult(const gl::Context *context, GLuint *params) override; angle::Result getResult(const gl::Context *context, GLuint *params) override;
gl::Error getResult(const gl::Context *context, GLint64 *params) override; angle::Result getResult(const gl::Context *context, GLint64 *params) override;
gl::Error getResult(const gl::Context *context, GLuint64 *params) override; angle::Result getResult(const gl::Context *context, GLuint64 *params) override;
gl::Error isResultAvailable(const gl::Context *context, bool *available) override; angle::Result isResultAvailable(const gl::Context *context, bool *available) override;
private: private:
angle::Result getResult(const gl::Context *context, bool wait); angle::Result getResult(const gl::Context *context, bool wait);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment