Use 64-bit math in work group size assertion.
authorKenneth Graunke <kenneth.w.graunke@intel.com>
Thu, 13 Jul 2017 01:44:11 +0000 (18:44 -0700)
committerKenneth Graunke <kenneth.w.graunke@intel.com>
Fri, 8 Sep 2017 21:02:14 +0000 (14:02 -0700)
If the maximum workgroup size in each dimension is large enough, this
can overflow, causing the comparison to fail.  For example, on Intel
Haswell, we get:

   assert(2048 * 2048 * 2048 > 2048) -> assert(0 > 2048) -> fail

Casting one value to deInt64 causes the multiplications to occur as
64-bit values, so we don't overflow.

Affects:

dEQP-GLES31.functional.debug.negative_coverage.*.compute.invalid_maximum_work_group_sizes

Components: AOSP

Change-Id: Ie03627a378f4fdc46ce241bbdd3693ae829c217d

modules/gles31/functional/es31fNegativeComputeTests.cpp

index 8fc9f10..8d492ab 100644 (file)
@@ -646,7 +646,7 @@ void invalid_maximum_work_group_sizes (NegativeTestContext& ctx)
        ctx.glGetIntegerv(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, &maxWorkGroupInvocations);
        ctx.expectError(GL_NO_ERROR);
 
-       DE_ASSERT((maxWorkGroupSizeX * maxWorkGroupSizeY * maxWorkGroupSizeZ) > maxWorkGroupInvocations );
+       DE_ASSERT(((deInt64) maxWorkGroupSizeX * maxWorkGroupSizeY * maxWorkGroupSizeZ) > maxWorkGroupInvocations );
 
        const bool                              isES32                  = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
        const char* const               shaderVersion   = isES32