Commit 77a2b4c3 by Xinghua Cao Committed by Commit Bot

Validate the total invocations within a work group

If the total number of invocations within a work group is greater than MAX_COMPUTE_WORK_GROUP_INVOCATIONS, a compile-time error will occur. BUG=angleproject:2572 TEST=dEQP.GLES31/functional_debug_negative_coverage_callbacks_compute_invalid_maximum_work_group_sizes dEQP.GLES31/functional_debug_negative_coverage_log_compute_invalid_maximum_work_group_sizes dEQP.GLES31/functional_debug_negative_coverage_get_error_compute_invalid_maximum_work_group_sizes Change-Id: I8218b618d1b347df2c85cfc67ba82ae91d756e05 Reviewed-on: https://chromium-review.googlesource.com/1066076 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 1da46774
...@@ -398,6 +398,30 @@ void Shader::resolveCompile(const Context *context) ...@@ -398,6 +398,30 @@ void Shader::resolveCompile(const Context *context)
case ShaderType::Compute: case ShaderType::Compute:
{ {
mState.mLocalSize = sh::GetComputeShaderLocalGroupSize(compilerHandle); mState.mLocalSize = sh::GetComputeShaderLocalGroupSize(compilerHandle);
if (mState.mLocalSize.isDeclared())
{
angle::CheckedNumeric<uint32_t> checked_local_size_product(mState.mLocalSize[0]);
checked_local_size_product *= mState.mLocalSize[1];
checked_local_size_product *= mState.mLocalSize[2];
if (!checked_local_size_product.IsValid())
{
WARN() << std::endl
<< "Integer overflow when computing the product of local_size_x, "
<< "local_size_y and local_size_z.";
mState.mCompileStatus = CompileStatus::NOT_COMPILED;
return;
}
if (checked_local_size_product.ValueOrDie() >
context->getCaps().maxComputeWorkGroupInvocations)
{
WARN() << std::endl
<< "The total number of invocations within a work group exceeds "
<< "MAX_COMPUTE_WORK_GROUP_INVOCATIONS.";
mState.mCompileStatus = CompileStatus::NOT_COMPILED;
return;
}
}
break; break;
} }
case ShaderType::Vertex: case ShaderType::Vertex:
......
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