Commit 9681190d by Jamie Madill Committed by Commit Bot

Make Debug marker functions return angle::Result.

Allows error handling in these functions. Necessary for the Vulkan back-end. Bug: angleproject:4209 Change-Id: I2092e58e719c6ee562807e1c7e8ad26988342855 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2040196Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent c3854ebc
...@@ -5482,14 +5482,14 @@ GLuint Context::getDebugMessageLog(GLuint count, ...@@ -5482,14 +5482,14 @@ GLuint Context::getDebugMessageLog(GLuint count,
void Context::pushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message) void Context::pushDebugGroup(GLenum source, GLuint id, GLsizei length, const GLchar *message)
{ {
std::string msg(message, (length > 0) ? static_cast<size_t>(length) : strlen(message)); std::string msg(message, (length > 0) ? static_cast<size_t>(length) : strlen(message));
mImplementation->pushDebugGroup(source, id, msg); ANGLE_CONTEXT_TRY(mImplementation->pushDebugGroup(this, source, id, msg));
mState.getDebug().pushGroup(source, id, std::move(msg)); mState.getDebug().pushGroup(source, id, std::move(msg));
} }
void Context::popDebugGroup() void Context::popDebugGroup()
{ {
mState.getDebug().popGroup(); mState.getDebug().popGroup();
mImplementation->popDebugGroup(); ANGLE_CONTEXT_TRY(mImplementation->popDebugGroup(this));
} }
void Context::primitiveBoundingBox(GLfloat minX, void Context::primitiveBoundingBox(GLfloat minX,
......
...@@ -174,8 +174,11 @@ class ContextImpl : public GLImplFactory ...@@ -174,8 +174,11 @@ class ContextImpl : public GLImplFactory
virtual void popGroupMarker() = 0; virtual void popGroupMarker() = 0;
// KHR_debug // KHR_debug
virtual void pushDebugGroup(GLenum source, GLuint id, const std::string &message) = 0; virtual angle::Result pushDebugGroup(const gl::Context *context,
virtual void popDebugGroup() = 0; GLenum source,
GLuint id,
const std::string &message) = 0;
virtual angle::Result popDebugGroup(const gl::Context *context) = 0;
// KHR_parallel_shader_compile // KHR_parallel_shader_compile
virtual void setMaxShaderCompilerThreads(GLuint count) {} virtual void setMaxShaderCompilerThreads(GLuint count) {}
......
...@@ -512,16 +512,21 @@ void Context11::popGroupMarker() ...@@ -512,16 +512,21 @@ void Context11::popGroupMarker()
} }
} }
void Context11::pushDebugGroup(GLenum source, GLuint id, const std::string &message) angle::Result Context11::pushDebugGroup(const gl::Context *context,
GLenum source,
GLuint id,
const std::string &message)
{ {
// Fall through to the EXT_debug_marker functions // Fall through to the EXT_debug_marker functions
pushGroupMarker(static_cast<GLsizei>(message.size()), message.c_str()); pushGroupMarker(static_cast<GLsizei>(message.size()), message.c_str());
return angle::Result::Continue;
} }
void Context11::popDebugGroup() angle::Result Context11::popDebugGroup(const gl::Context *context)
{ {
// Fall through to the EXT_debug_marker functions // Fall through to the EXT_debug_marker functions
popGroupMarker(); popGroupMarker();
return angle::Result::Continue;
} }
angle::Result Context11::syncState(const gl::Context *context, angle::Result Context11::syncState(const gl::Context *context,
......
...@@ -163,8 +163,11 @@ class Context11 : public ContextD3D, public MultisampleTextureInitializer ...@@ -163,8 +163,11 @@ class Context11 : public ContextD3D, public MultisampleTextureInitializer
void popGroupMarker() override; void popGroupMarker() override;
// KHR_debug // KHR_debug
void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override; angle::Result pushDebugGroup(const gl::Context *context,
void popDebugGroup() override; GLenum source,
GLuint id,
const std::string &message) override;
angle::Result popDebugGroup(const gl::Context *context) override;
// State sync with dirty bits. // State sync with dirty bits.
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
......
...@@ -325,16 +325,21 @@ void Context9::popGroupMarker() ...@@ -325,16 +325,21 @@ void Context9::popGroupMarker()
} }
} }
void Context9::pushDebugGroup(GLenum source, GLuint id, const std::string &message) angle::Result Context9::pushDebugGroup(const gl::Context *context,
GLenum source,
GLuint id,
const std::string &message)
{ {
// Fall through to the EXT_debug_marker functions // Fall through to the EXT_debug_marker functions
pushGroupMarker(static_cast<GLsizei>(message.size()), message.c_str()); pushGroupMarker(static_cast<GLsizei>(message.size()), message.c_str());
return angle::Result::Continue;
} }
void Context9::popDebugGroup() angle::Result Context9::popDebugGroup(const gl::Context *context)
{ {
// Fall through to the EXT_debug_marker functions // Fall through to the EXT_debug_marker functions
popGroupMarker(); popGroupMarker();
return angle::Result::Continue;
} }
angle::Result Context9::syncState(const gl::Context *context, angle::Result Context9::syncState(const gl::Context *context,
......
...@@ -162,8 +162,11 @@ class Context9 : public ContextD3D ...@@ -162,8 +162,11 @@ class Context9 : public ContextD3D
void popGroupMarker() override; void popGroupMarker() override;
// KHR_debug // KHR_debug
void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override; angle::Result pushDebugGroup(const gl::Context *context,
void popDebugGroup() override; GLenum source,
GLuint id,
const std::string &message) override;
angle::Result popDebugGroup(const gl::Context *context) override;
// State sync with dirty bits. // State sync with dirty bits.
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
......
...@@ -789,14 +789,19 @@ void ContextGL::popGroupMarker() ...@@ -789,14 +789,19 @@ void ContextGL::popGroupMarker()
mRenderer->popGroupMarker(); mRenderer->popGroupMarker();
} }
void ContextGL::pushDebugGroup(GLenum source, GLuint id, const std::string &message) angle::Result ContextGL::pushDebugGroup(const gl::Context *context,
GLenum source,
GLuint id,
const std::string &message)
{ {
mRenderer->pushDebugGroup(source, id, message); mRenderer->pushDebugGroup(source, id, message);
return angle::Result::Continue;
} }
void ContextGL::popDebugGroup() angle::Result ContextGL::popDebugGroup(const gl::Context *context)
{ {
mRenderer->popDebugGroup(); mRenderer->popDebugGroup();
return angle::Result::Continue;
} }
angle::Result ContextGL::syncState(const gl::Context *context, angle::Result ContextGL::syncState(const gl::Context *context,
...@@ -911,5 +916,4 @@ void ContextGL::flushIfNecessaryBeforeDeleteTextures() ...@@ -911,5 +916,4 @@ void ContextGL::flushIfNecessaryBeforeDeleteTextures()
mRenderer->flushIfNecessaryBeforeDeleteTextures(); mRenderer->flushIfNecessaryBeforeDeleteTextures();
} }
} // namespace rx } // namespace rx
...@@ -221,8 +221,11 @@ class ContextGL : public ContextImpl ...@@ -221,8 +221,11 @@ class ContextGL : public ContextImpl
void popGroupMarker() override; void popGroupMarker() override;
// KHR_debug // KHR_debug
void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override; angle::Result pushDebugGroup(const gl::Context *context,
void popDebugGroup() override; GLenum source,
GLuint id,
const std::string &message) override;
angle::Result popDebugGroup(const gl::Context *context) override;
// State sync with dirty bits. // State sync with dirty bits.
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
......
...@@ -127,8 +127,11 @@ class ContextMtl : public ContextImpl, public mtl::Context ...@@ -127,8 +127,11 @@ class ContextMtl : public ContextImpl, public mtl::Context
void popGroupMarker() override; void popGroupMarker() override;
// KHR_debug // KHR_debug
void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override; angle::Result pushDebugGroup(const gl::Context *context,
void popDebugGroup() override; GLenum source,
GLuint id,
const std::string &message) override;
angle::Result popDebugGroup(const gl::Context *context) override;
// State sync with dirty bits. // State sync with dirty bits.
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
......
...@@ -491,8 +491,18 @@ void ContextMtl::popGroupMarker() ...@@ -491,8 +491,18 @@ void ContextMtl::popGroupMarker()
} }
// KHR_debug // KHR_debug
void ContextMtl::pushDebugGroup(GLenum source, GLuint id, const std::string &message) {} angle::Result ContextMtl::pushDebugGroup(const gl::Context *context,
void ContextMtl::popDebugGroup() {} GLenum source,
GLuint id,
const std::string &message)
{
return angle::Result::Continue;
}
angle::Result ContextMtl::popDebugGroup(const gl::Context *context)
{
return angle::Result::Continue;
}
// State sync with dirty bits. // State sync with dirty bits.
angle::Result ContextMtl::syncState(const gl::Context *context, angle::Result ContextMtl::syncState(const gl::Context *context,
...@@ -1435,8 +1445,7 @@ angle::Result ContextMtl::setupDraw(const gl::Context *context, ...@@ -1435,8 +1445,7 @@ angle::Result ContextMtl::setupDraw(const gl::Context *context,
ANGLE_TRY(handleDirtyDepthBias(context)); ANGLE_TRY(handleDirtyDepthBias(context));
break; break;
case DIRTY_BIT_STENCIL_REF: case DIRTY_BIT_STENCIL_REF:
mRenderEncoder.setStencilRefVals(mStencilRefFront, mRenderEncoder.setStencilRefVals(mStencilRefFront, mStencilRefBack);
mStencilRefBack);
break; break;
case DIRTY_BIT_BLEND_COLOR: case DIRTY_BIT_BLEND_COLOR:
mRenderEncoder.setBlendColor( mRenderEncoder.setBlendColor(
......
...@@ -324,9 +324,18 @@ void ContextNULL::pushGroupMarker(GLsizei length, const char *marker) {} ...@@ -324,9 +324,18 @@ void ContextNULL::pushGroupMarker(GLsizei length, const char *marker) {}
void ContextNULL::popGroupMarker() {} void ContextNULL::popGroupMarker() {}
void ContextNULL::pushDebugGroup(GLenum source, GLuint id, const std::string &message) {} angle::Result ContextNULL::pushDebugGroup(const gl::Context *context,
GLenum source,
GLuint id,
const std::string &message)
{
return angle::Result::Continue;
}
void ContextNULL::popDebugGroup() {} angle::Result ContextNULL::popDebugGroup(const gl::Context *context)
{
return angle::Result::Continue;
}
angle::Result ContextNULL::syncState(const gl::Context *context, angle::Result ContextNULL::syncState(const gl::Context *context,
const gl::State::DirtyBits &dirtyBits, const gl::State::DirtyBits &dirtyBits,
......
...@@ -175,8 +175,11 @@ class ContextNULL : public ContextImpl ...@@ -175,8 +175,11 @@ class ContextNULL : public ContextImpl
void popGroupMarker() override; void popGroupMarker() override;
// KHR_debug // KHR_debug
void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override; angle::Result pushDebugGroup(const gl::Context *context,
void popDebugGroup() override; GLenum source,
GLuint id,
const std::string &message) override;
angle::Result popDebugGroup(const gl::Context *context) override;
// State sync with dirty bits. // State sync with dirty bits.
angle::Result syncState(const gl::Context *context, angle::Result syncState(const gl::Context *context,
......
...@@ -2135,7 +2135,10 @@ void ContextVk::popGroupMarker() ...@@ -2135,7 +2135,10 @@ void ContextVk::popGroupMarker()
} }
} }
void ContextVk::pushDebugGroup(GLenum source, GLuint id, const std::string &message) angle::Result ContextVk::pushDebugGroup(const gl::Context *context,
GLenum source,
GLuint id,
const std::string &message)
{ {
if (commandGraphEnabled()) if (commandGraphEnabled())
{ {
...@@ -2146,9 +2149,11 @@ void ContextVk::pushDebugGroup(GLenum source, GLuint id, const std::string &mess ...@@ -2146,9 +2149,11 @@ void ContextVk::pushDebugGroup(GLenum source, GLuint id, const std::string &mess
// TODO(jmadill): http://anglebug.com/4029 // TODO(jmadill): http://anglebug.com/4029
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
return angle::Result::Continue;
} }
void ContextVk::popDebugGroup() angle::Result ContextVk::popDebugGroup(const gl::Context *context)
{ {
if (commandGraphEnabled()) if (commandGraphEnabled())
{ {
...@@ -2159,6 +2164,8 @@ void ContextVk::popDebugGroup() ...@@ -2159,6 +2164,8 @@ void ContextVk::popDebugGroup()
// TODO(jmadill): http://anglebug.com/4029 // TODO(jmadill): http://anglebug.com/4029
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
return angle::Result::Continue;
} }
bool ContextVk::isViewportFlipEnabledForDrawFBO() const bool ContextVk::isViewportFlipEnabledForDrawFBO() const
......
...@@ -302,8 +302,11 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO ...@@ -302,8 +302,11 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
void popGroupMarker() override; void popGroupMarker() override;
// KHR_debug // KHR_debug
void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override; angle::Result pushDebugGroup(const gl::Context *context,
void popDebugGroup() override; GLenum source,
GLuint id,
const std::string &message) override;
angle::Result popDebugGroup(const gl::Context *context) override;
bool isViewportFlipEnabledForDrawFBO() const; bool isViewportFlipEnabledForDrawFBO() const;
bool isViewportFlipEnabledForReadFBO() const; bool isViewportFlipEnabledForReadFBO() const;
......
...@@ -103,11 +103,12 @@ angle::Result SyncHelper::clientWait(Context *context, ...@@ -103,11 +103,12 @@ angle::Result SyncHelper::clientWait(Context *context,
return angle::Result::Continue; return angle::Result::Continue;
} }
void SyncHelper::serverWait(ContextVk *contextVk) angle::Result SyncHelper::serverWait(ContextVk *contextVk)
{ {
CommandGraph *commandGraph = contextVk->getCommandGraph(); CommandGraph *commandGraph = contextVk->getCommandGraph();
commandGraph->waitFenceSync(mEvent); commandGraph->waitFenceSync(mEvent);
contextVk->getResourceUseList().add(mUse); contextVk->getResourceUseList().add(mUse);
return angle::Result::Continue;
} }
angle::Result SyncHelper::getStatus(Context *context, bool *signaled) angle::Result SyncHelper::getStatus(Context *context, bool *signaled)
...@@ -181,8 +182,7 @@ angle::Result SyncVk::serverWait(const gl::Context *context, GLbitfield flags, G ...@@ -181,8 +182,7 @@ angle::Result SyncVk::serverWait(const gl::Context *context, GLbitfield flags, G
ASSERT(timeout == GL_TIMEOUT_IGNORED); ASSERT(timeout == GL_TIMEOUT_IGNORED);
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
mFenceSync.serverWait(contextVk); return mFenceSync.serverWait(contextVk);
return angle::Result::Continue;
} }
angle::Result SyncVk::getStatus(const gl::Context *context, GLint *outResult) angle::Result SyncVk::getStatus(const gl::Context *context, GLint *outResult)
...@@ -269,9 +269,10 @@ egl::Error EGLSyncVk::serverWait(const egl::Display *display, ...@@ -269,9 +269,10 @@ egl::Error EGLSyncVk::serverWait(const egl::Display *display,
// No flags are currently implemented. // No flags are currently implemented.
ASSERT(flags == 0); ASSERT(flags == 0);
DisplayVk *displayVk = vk::GetImpl(display);
ContextVk *contextVk = vk::GetImpl(context); ContextVk *contextVk = vk::GetImpl(context);
mFenceSync.serverWait(contextVk);
return egl::NoError(); return angle::ToEGL(mFenceSync.serverWait(contextVk), displayVk, EGL_BAD_ALLOC);
} }
egl::Error EGLSyncVk::getStatus(const egl::Display *display, EGLint *outStatus) egl::Error EGLSyncVk::getStatus(const egl::Display *display, EGLint *outStatus)
......
...@@ -39,7 +39,7 @@ class SyncHelper ...@@ -39,7 +39,7 @@ class SyncHelper
bool flushCommands, bool flushCommands,
uint64_t timeout, uint64_t timeout,
VkResult *outResult); VkResult *outResult);
void serverWait(ContextVk *contextVk); angle::Result serverWait(ContextVk *contextVk);
angle::Result getStatus(Context *context, bool *signaled); angle::Result getStatus(Context *context, bool *signaled);
private: private:
......
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