Commit 38c637ed authored by jchen10's avatar jchen10 Committed by Commit Bot

Add LINK_STATUS to completion query

This stores program LINK_STATUS to the GL_QUERY_RESULT of
GL_PROGRAM_COMPLETION_QUERY_CHROMIUM. WebGL useProgram checks
the status before using it. By caching this status, useProgram
no longer stalls on the round-trip to the GPU thread.

Bug: 962337
Change-Id: Ifcc15044b1e6e6813e0599d90a76556b2401396a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1607573
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Reviewed-by: default avatarKai Ninomiya <kainino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661134}
parent be8d487a
......@@ -28,8 +28,13 @@ Overview
glEndQueryEXT(PROGRAM_COMPLETION_QUERY_CHROMIUM);
GLuint available = 0u;
glGetQueryObjectuivEXT(query, GL_QUERY_RESULT_AVAILABLE, &available);
if (available)
{
GLuint result = 0u;
glGetQueryObjectuivEXT(query, GL_QUERY_RESULT, &result);
}
If 'available' returns true, that's equivalent to COMPLETION_STATUS_KHR
returning true.
returning true. Then LINK_STATUS can be obtained from 'result'.
New Procedures and Functions
......
......@@ -2156,8 +2156,13 @@ error::Error GLES2DecoderPassthroughImpl::ProcessQueries(bool did_finish) {
} else {
program_completion_query_deferred = true;
}
}
result = 0;
} else {
GLint link_status = 0;
api()->glGetProgramivFn(query.program_service_id, GL_LINK_STATUS,
&link_status);
result = link_status;
}
break;
default:
......
......@@ -162,8 +162,16 @@ void WebGLProgram::CacheInfoIfNeeded(WebGLRenderingContextBase* context) {
if (!object_)
return;
gpu::gles2::GLES2Interface* gl = context->ContextGL();
link_status_ = 0;
gl->GetProgramiv(object_, GL_LINK_STATUS, &link_status_);
GLint link_status = 0;
gl->GetProgramiv(object_, GL_LINK_STATUS, &link_status);
setLinkStatus(link_status);
}
void WebGLProgram::setLinkStatus(bool link_status) {
if (info_valid_)
return;
link_status_ = link_status;
if (link_status_ == GL_TRUE) {
required_transform_feedback_buffer_count_ =
required_transform_feedback_buffer_count_after_next_link_;
......
......@@ -42,6 +42,7 @@ class WebGLProgram final : public WebGLSharedPlatform3DObject {
static WebGLProgram* Create(WebGLRenderingContextBase*);
bool LinkStatus(WebGLRenderingContextBase*);
void setLinkStatus(bool link_status);
bool CompletionStatus(WebGLRenderingContextBase*);
......
......@@ -8210,6 +8210,11 @@ bool WebGLRenderingContextBase::checkProgramCompletionQueryAvailable(
GLuint available;
ContextGL()->GetQueryObjectuivEXT(id, GL_QUERY_RESULT_AVAILABLE,
&available);
if (available) {
GLuint result = 0u;
ContextGL()->GetQueryObjectuivEXT(id, GL_QUERY_RESULT, &result);
program->setLinkStatus(result);
}
*completed = (available == GL_TRUE);
return true;
}
......
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