mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
mesa: fix total_invocations computation
The multiplication of 32 bits integers will be truncated before being widened to the destination variable' size. Reported by static analysis. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35877>
This commit is contained in:
parent
fddd5bc2e5
commit
f7890c0df9
1 changed files with 1 additions and 1 deletions
|
|
@ -167,7 +167,7 @@ validate_DispatchComputeGroupSizeARB(struct gl_context *ctx,
|
|||
* for compute shaders with variable group size
|
||||
* (MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB)."
|
||||
*/
|
||||
uint64_t total_invocations = info->block[0] * info->block[1];
|
||||
uint64_t total_invocations = info->block[0] * (uint64_t) info->block[1];
|
||||
if (total_invocations <= UINT32_MAX) {
|
||||
/* Only bother multiplying the third value if total still fits in
|
||||
* 32-bit, since MaxComputeVariableGroupInvocations is also 32-bit.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue