Commit 986ec296 authored by Christopher Grant's avatar Christopher Grant Committed by Commit Bot

VR: Have testapp DCHECK against GL errors in UI code

Unbinding of frames appears to generate GL errors, on the first frame,
but otherwise, the UI is clean.  Checking for GL errors in the testapp
is a way to sanity check against new UI errors without affecting GPU
scheduling on dev/release Android builds.

BUG=768905
R=vollick

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_vr
Change-Id: I7ba27f20e59f4eb642f129795abb74d66a0894f5
Reviewed-on: https://chromium-review.googlesource.com/1070309Reviewed-by: default avatarTibor Goldschwendt <tiborg@chromium.org>
Commit-Queue: Christopher Grant <cjgrant@chromium.org>
Cr-Commit-Position: refs/heads/master@{#562962}
parent d637b5fa
......@@ -20,6 +20,13 @@ void OnPresentedFrame(const gfx::PresentationFeedback& feedback) {
// Do nothing for now.
}
bool ClearGlErrors() {
bool errors = false;
while (glGetError() != GL_NO_ERROR)
errors = true;
return errors;
}
} // namespace
GlRenderer::GlRenderer(const scoped_refptr<gl::GLSurface>& surface,
......@@ -50,10 +57,18 @@ bool GlRenderer::Initialize() {
void GlRenderer::RenderFrame() {
context_->MakeCurrent(surface_.get());
// Checking and clearing GL errors can be expensive, but we can afford to do
// this in the testapp as a sanity check. Clear errors before drawing UI,
// then assert no new errors after drawing. See https://crbug.com/768905.
ClearGlErrors();
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
vr_->DrawFrame();
DCHECK(!ClearGlErrors());
PostRenderFrameTask(
surface_->SwapBuffers(base::BindRepeating(&OnPresentedFrame)));
}
......
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