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,
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));
mImplementation->pushDebugGroup(source, id, msg);
ANGLE_CONTEXT_TRY(mImplementation->pushDebugGroup(this, source, id, msg));
mState.getDebug().pushGroup(source, id, std::move(msg));
}
void Context::popDebugGroup()
{
mState.getDebug().popGroup();
mImplementation->popDebugGroup();
ANGLE_CONTEXT_TRY(mImplementation->popDebugGroup(this));
}
void Context::primitiveBoundingBox(GLfloat minX,
......
......@@ -174,8 +174,11 @@ class ContextImpl : public GLImplFactory
virtual void popGroupMarker() = 0;
// KHR_debug
virtual void pushDebugGroup(GLenum source, GLuint id, const std::string &message) = 0;
virtual void popDebugGroup() = 0;
virtual angle::Result pushDebugGroup(const gl::Context *context,
GLenum source,
GLuint id,
const std::string &message) = 0;
virtual angle::Result popDebugGroup(const gl::Context *context) = 0;
// KHR_parallel_shader_compile
virtual void setMaxShaderCompilerThreads(GLuint count) {}
......
......@@ -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
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
popGroupMarker();
return angle::Result::Continue;
}
angle::Result Context11::syncState(const gl::Context *context,
......
......@@ -163,8 +163,11 @@ class Context11 : public ContextD3D, public MultisampleTextureInitializer
void popGroupMarker() override;
// KHR_debug
void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override;
void popDebugGroup() override;
angle::Result pushDebugGroup(const gl::Context *context,
GLenum source,
GLuint id,
const std::string &message) override;
angle::Result popDebugGroup(const gl::Context *context) override;
// State sync with dirty bits.
angle::Result syncState(const gl::Context *context,
......
......@@ -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
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
popGroupMarker();
return angle::Result::Continue;
}
angle::Result Context9::syncState(const gl::Context *context,
......
......@@ -162,8 +162,11 @@ class Context9 : public ContextD3D
void popGroupMarker() override;
// KHR_debug
void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override;
void popDebugGroup() override;
angle::Result pushDebugGroup(const gl::Context *context,
GLenum source,
GLuint id,
const std::string &message) override;
angle::Result popDebugGroup(const gl::Context *context) override;
// State sync with dirty bits.
angle::Result syncState(const gl::Context *context,
......
......@@ -789,14 +789,19 @@ void ContextGL::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);
return angle::Result::Continue;
}
void ContextGL::popDebugGroup()
angle::Result ContextGL::popDebugGroup(const gl::Context *context)
{
mRenderer->popDebugGroup();
return angle::Result::Continue;
}
angle::Result ContextGL::syncState(const gl::Context *context,
......@@ -911,5 +916,4 @@ void ContextGL::flushIfNecessaryBeforeDeleteTextures()
mRenderer->flushIfNecessaryBeforeDeleteTextures();
}
} // namespace rx
......@@ -221,8 +221,11 @@ class ContextGL : public ContextImpl
void popGroupMarker() override;
// KHR_debug
void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override;
void popDebugGroup() override;
angle::Result pushDebugGroup(const gl::Context *context,
GLenum source,
GLuint id,
const std::string &message) override;
angle::Result popDebugGroup(const gl::Context *context) override;
// State sync with dirty bits.
angle::Result syncState(const gl::Context *context,
......
......@@ -127,8 +127,11 @@ class ContextMtl : public ContextImpl, public mtl::Context
void popGroupMarker() override;
// KHR_debug
void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override;
void popDebugGroup() override;
angle::Result pushDebugGroup(const gl::Context *context,
GLenum source,
GLuint id,
const std::string &message) override;
angle::Result popDebugGroup(const gl::Context *context) override;
// State sync with dirty bits.
angle::Result syncState(const gl::Context *context,
......
......@@ -491,8 +491,18 @@ void ContextMtl::popGroupMarker()
}
// KHR_debug
void ContextMtl::pushDebugGroup(GLenum source, GLuint id, const std::string &message) {}
void ContextMtl::popDebugGroup() {}
angle::Result ContextMtl::pushDebugGroup(const gl::Context *context,
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.
angle::Result ContextMtl::syncState(const gl::Context *context,
......@@ -1435,8 +1445,7 @@ angle::Result ContextMtl::setupDraw(const gl::Context *context,
ANGLE_TRY(handleDirtyDepthBias(context));
break;
case DIRTY_BIT_STENCIL_REF:
mRenderEncoder.setStencilRefVals(mStencilRefFront,
mStencilRefBack);
mRenderEncoder.setStencilRefVals(mStencilRefFront, mStencilRefBack);
break;
case DIRTY_BIT_BLEND_COLOR:
mRenderEncoder.setBlendColor(
......
......@@ -324,9 +324,18 @@ void ContextNULL::pushGroupMarker(GLsizei length, const char *marker) {}
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,
const gl::State::DirtyBits &dirtyBits,
......
......@@ -175,8 +175,11 @@ class ContextNULL : public ContextImpl
void popGroupMarker() override;
// KHR_debug
void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override;
void popDebugGroup() override;
angle::Result pushDebugGroup(const gl::Context *context,
GLenum source,
GLuint id,
const std::string &message) override;
angle::Result popDebugGroup(const gl::Context *context) override;
// State sync with dirty bits.
angle::Result syncState(const gl::Context *context,
......
......@@ -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())
{
......@@ -2146,9 +2149,11 @@ void ContextVk::pushDebugGroup(GLenum source, GLuint id, const std::string &mess
// TODO(jmadill): http://anglebug.com/4029
UNIMPLEMENTED();
}
return angle::Result::Continue;
}
void ContextVk::popDebugGroup()
angle::Result ContextVk::popDebugGroup(const gl::Context *context)
{
if (commandGraphEnabled())
{
......@@ -2159,6 +2164,8 @@ void ContextVk::popDebugGroup()
// TODO(jmadill): http://anglebug.com/4029
UNIMPLEMENTED();
}
return angle::Result::Continue;
}
bool ContextVk::isViewportFlipEnabledForDrawFBO() const
......
......@@ -302,8 +302,11 @@ class ContextVk : public ContextImpl, public vk::Context, public vk::RenderPassO
void popGroupMarker() override;
// KHR_debug
void pushDebugGroup(GLenum source, GLuint id, const std::string &message) override;
void popDebugGroup() override;
angle::Result pushDebugGroup(const gl::Context *context,
GLenum source,
GLuint id,
const std::string &message) override;
angle::Result popDebugGroup(const gl::Context *context) override;
bool isViewportFlipEnabledForDrawFBO() const;
bool isViewportFlipEnabledForReadFBO() const;
......
......@@ -103,11 +103,12 @@ angle::Result SyncHelper::clientWait(Context *context,
return angle::Result::Continue;
}
void SyncHelper::serverWait(ContextVk *contextVk)
angle::Result SyncHelper::serverWait(ContextVk *contextVk)
{
CommandGraph *commandGraph = contextVk->getCommandGraph();
commandGraph->waitFenceSync(mEvent);
contextVk->getResourceUseList().add(mUse);
return angle::Result::Continue;
}
angle::Result SyncHelper::getStatus(Context *context, bool *signaled)
......@@ -181,8 +182,7 @@ angle::Result SyncVk::serverWait(const gl::Context *context, GLbitfield flags, G
ASSERT(timeout == GL_TIMEOUT_IGNORED);
ContextVk *contextVk = vk::GetImpl(context);
mFenceSync.serverWait(contextVk);
return angle::Result::Continue;
return mFenceSync.serverWait(contextVk);
}
angle::Result SyncVk::getStatus(const gl::Context *context, GLint *outResult)
......@@ -269,9 +269,10 @@ egl::Error EGLSyncVk::serverWait(const egl::Display *display,
// No flags are currently implemented.
ASSERT(flags == 0);
DisplayVk *displayVk = vk::GetImpl(display);
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)
......
......@@ -39,7 +39,7 @@ class SyncHelper
bool flushCommands,
uint64_t timeout,
VkResult *outResult);
void serverWait(ContextVk *contextVk);
angle::Result serverWait(ContextVk *contextVk);
angle::Result getStatus(Context *context, bool *signaled);
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