Skip to content

Handle signed arithmetic edge cases that would be UB in Metal, HLSL and SPIRV #6961

Open
@teoxoy

Description

The following operations would overflow with signed integer operands. The results are what the WGSL spec requires.

div: T::MIN / -1 = T::MIN
rem: T::MIN % -1 = 0
abs: abs(T::MIN) = T::MIN
neg: -T::MIN = T::MIN

Related: #6666 / #6959

Metadata

Assignees

Labels

area: naga back-endOutputs of naga shader conversionlang: MetalMetal Shading LanguagenagaShader Translator

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions