Commit f9a47960 authored by James Darpinian's avatar James Darpinian Committed by Commit Bot

Don't clobber results when GL_CLIENT_FAIL_GL_ERRORS is set

The ScopedResultPtr returned by GetResultAs<> needs to go out of scope before
CheckGLError can be called, when GL_CLIENT_FAIL_GL_ERRORS is set.

Bug: 1120712
Change-Id: I5f5c83ba9deb6cb161e875037a4269b67119ab4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2391599Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: James Darpinian <jdarpinian@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804467}
parent 41e61b9b
......@@ -760,11 +760,14 @@ GLboolean GLES2Implementation::IsEnablediOES(GLenum target, GLuint index) {
<< ")");
bool state = false;
typedef cmds::IsEnabled::Result Result;
// Limit scope of result to avoid overlap with CheckGLError()
{
auto result = GetResultAs<Result>();
*result = 0;
helper_->IsEnablediOES(target, index, GetResultShmId(), result.offset());
WaitForCmd();
state = (*result) != 0;
}
GPU_CLIENT_LOG("returned " << state);
CheckGLError();
......@@ -4420,6 +4423,8 @@ void GLES2Implementation::GetShaderPrecisionFormat(GLenum shadertype,
<< static_cast<const void*>(precision) << ", ");
TRACE_EVENT0("gpu", "GLES2::GetShaderPrecisionFormat");
typedef cmds::GetShaderPrecisionFormat::Result Result;
// Limit scope of result to avoid overlap with CheckGLError()
{
auto result = GetResultAs<Result>();
if (!result) {
return;
......@@ -4451,6 +4456,7 @@ void GLES2Implementation::GetShaderPrecisionFormat(GLenum shadertype,
GPU_CLIENT_LOG(" min_range: " << precision[0]);
}
}
}
CheckGLError();
}
......@@ -4607,6 +4613,8 @@ void GLES2Implementation::GetUniformfv(GLuint program,
<< ")");
TRACE_EVENT0("gpu", "GLES2::GetUniformfv");
typedef cmds::GetUniformfv::Result Result;
// Limit scope of result to avoid overlap with CheckGLError()
{
auto result = GetResultAs<Result>();
if (!result) {
return;
......@@ -4620,6 +4628,7 @@ void GLES2Implementation::GetUniformfv(GLuint program,
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
}
CheckGLError();
}
......@@ -4632,6 +4641,8 @@ void GLES2Implementation::GetUniformiv(GLuint program,
<< ")");
TRACE_EVENT0("gpu", "GLES2::GetUniformiv");
typedef cmds::GetUniformiv::Result Result;
// Limit scope of result to avoid overlap with CheckGLError()
{
auto result = GetResultAs<Result>();
if (!result) {
return;
......@@ -4645,6 +4656,7 @@ void GLES2Implementation::GetUniformiv(GLuint program,
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
}
CheckGLError();
}
......@@ -4657,12 +4669,15 @@ void GLES2Implementation::GetUniformuiv(GLuint program,
<< static_cast<const void*>(params) << ")");
TRACE_EVENT0("gpu", "GLES2::GetUniformuiv");
typedef cmds::GetUniformuiv::Result Result;
// Limit scope of result to avoid overlap with CheckGLError()
{
auto result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetUniformuiv(program, location, GetResultShmId(), result.offset());
helper_->GetUniformuiv(program, location, GetResultShmId(),
result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
......@@ -4670,6 +4685,7 @@ void GLES2Implementation::GetUniformuiv(GLuint program,
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
}
CheckGLError();
}
......@@ -5510,6 +5526,8 @@ void GLES2Implementation::GetVertexAttribfv(GLuint index,
}
TRACE_EVENT0("gpu", "GLES2::GetVertexAttribfv");
typedef cmds::GetVertexAttribfv::Result Result;
// Limit scope of result to avoid overlap with CheckGLError()
{
auto result = GetResultAs<Result>();
if (!result) {
return;
......@@ -5523,6 +5541,7 @@ void GLES2Implementation::GetVertexAttribfv(GLuint index,
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
}
CheckGLError();
}
......@@ -5540,6 +5559,8 @@ void GLES2Implementation::GetVertexAttribiv(GLuint index,
}
TRACE_EVENT0("gpu", "GLES2::GetVertexAttribiv");
typedef cmds::GetVertexAttribiv::Result Result;
// Limit scope of result to avoid overlap with CheckGLError()
{
auto result = GetResultAs<Result>();
if (!result) {
return;
......@@ -5553,6 +5574,7 @@ void GLES2Implementation::GetVertexAttribiv(GLuint index,
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
}
CheckGLError();
}
......@@ -5570,12 +5592,15 @@ void GLES2Implementation::GetVertexAttribIiv(GLuint index,
}
TRACE_EVENT0("gpu", "GLES2::GetVertexAttribIiv");
typedef cmds::GetVertexAttribiv::Result Result;
// Limit scope of result to avoid overlap with CheckGLError()
{
auto result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetVertexAttribIiv(index, pname, GetResultShmId(), result.offset());
helper_->GetVertexAttribIiv(index, pname, GetResultShmId(),
result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
......@@ -5583,6 +5608,7 @@ void GLES2Implementation::GetVertexAttribIiv(GLuint index,
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
}
CheckGLError();
}
......@@ -5600,12 +5626,15 @@ void GLES2Implementation::GetVertexAttribIuiv(GLuint index,
}
TRACE_EVENT0("gpu", "GLES2::GetVertexAttribIuiv");
typedef cmds::GetVertexAttribiv::Result Result;
// Limit scope of result to avoid overlap with CheckGLError()
{
auto result = GetResultAs<Result>();
if (!result) {
return;
}
result->SetNumResults(0);
helper_->GetVertexAttribIuiv(index, pname, GetResultShmId(), result.offset());
helper_->GetVertexAttribIuiv(index, pname, GetResultShmId(),
result.offset());
WaitForCmd();
result->CopyResult(params);
GPU_CLIENT_LOG_CODE_BLOCK({
......@@ -5613,6 +5642,7 @@ void GLES2Implementation::GetVertexAttribIuiv(GLuint index,
GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
}
});
}
CheckGLError();
}
......@@ -7368,6 +7398,9 @@ GLenum GLES2Implementation::ClientWaitSync(GLsync sync,
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glClientWaitSync(" << sync << ", "
<< flags << ", " << timeout << ")");
typedef cmds::ClientWaitSync::Result Result;
// Limit scope of result to avoid overlap with CheckGLError()
Result localResult;
{
auto result = GetResultAs<Result>();
if (!result) {
SetGLError(GL_OUT_OF_MEMORY, "ClientWaitSync", "");
......@@ -7377,9 +7410,11 @@ GLenum GLES2Implementation::ClientWaitSync(GLsync sync,
helper_->ClientWaitSync(ToGLuint(sync), flags, timeout, GetResultShmId(),
result.offset());
WaitForCmd();
GPU_CLIENT_LOG("returned " << *result);
localResult = *result;
GPU_CLIENT_LOG("returned " << localResult);
}
CheckGLError();
return *result;
return localResult;
}
void GLES2Implementation::CopyBufferSubData(GLenum readtarget,
......@@ -7443,6 +7478,8 @@ void GLES2Implementation::GetInternalformativ(GLenum target,
return;
}
typedef cmds::GetInternalformativ::Result Result;
// Limit scope of result to avoid overlap with CheckGLError()
{
auto result = GetResultAs<Result>();
if (!result) {
return;
......@@ -7465,6 +7502,7 @@ void GLES2Implementation::GetInternalformativ(GLenum target,
params[ii] = data[ii];
}
}
}
CheckGLError();
}
......
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