mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
tint/transform: Implement div / mod polyfill
Prevents UB for divide-by-zero and integer overflow when dividing Fixed: tint:1349 Change-Id: Ieef66d27d7aec3011628ced076b2bccc7770a8af Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108925 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
9418152d08
commit
46ee63933c
@@ -37,10 +37,8 @@ int idx6() {
|
||||
}
|
||||
|
||||
void main() {
|
||||
const int tint_symbol_4 = idx1();
|
||||
const int tint_symbol_5 = idx2();
|
||||
const int tint_symbol_save = tint_symbol_4;
|
||||
const int tint_symbol_save_1 = tint_symbol_5;
|
||||
const int tint_symbol_save = idx1();
|
||||
const int tint_symbol_save_1 = idx2();
|
||||
const int tint_symbol_1 = idx3();
|
||||
{
|
||||
buffer.Store((((64u * uint(tint_symbol_save)) + (16u * uint(tint_symbol_save_1))) + (4u * uint(tint_symbol_1))), asuint((asint(buffer.Load((((64u * uint(tint_symbol_save)) + (16u * uint(tint_symbol_save_1))) + (4u * uint(tint_symbol_1))))) + 1)));
|
||||
@@ -51,10 +49,8 @@ void main() {
|
||||
{
|
||||
}
|
||||
{
|
||||
const int tint_symbol_6 = idx4();
|
||||
const int tint_symbol_7 = idx5();
|
||||
const int tint_symbol_2_save = tint_symbol_6;
|
||||
const int tint_symbol_2_save_1 = tint_symbol_7;
|
||||
const int tint_symbol_2_save = idx4();
|
||||
const int tint_symbol_2_save_1 = idx5();
|
||||
const int tint_symbol_3 = idx6();
|
||||
buffer.Store((((64u * uint(tint_symbol_2_save)) + (16u * uint(tint_symbol_2_save_1))) + (4u * uint(tint_symbol_3))), asuint((asint(buffer.Load((((64u * uint(tint_symbol_2_save)) + (16u * uint(tint_symbol_2_save_1))) + (4u * uint(tint_symbol_3))))) + 1)));
|
||||
}
|
||||
|
||||
@@ -37,10 +37,8 @@ int idx6() {
|
||||
}
|
||||
|
||||
void main() {
|
||||
const int tint_symbol_4 = idx1();
|
||||
const int tint_symbol_5 = idx2();
|
||||
const int tint_symbol_save = tint_symbol_4;
|
||||
const int tint_symbol_save_1 = tint_symbol_5;
|
||||
const int tint_symbol_save = idx1();
|
||||
const int tint_symbol_save_1 = idx2();
|
||||
const int tint_symbol_1 = idx3();
|
||||
{
|
||||
buffer.Store((((64u * uint(tint_symbol_save)) + (16u * uint(tint_symbol_save_1))) + (4u * uint(tint_symbol_1))), asuint((asint(buffer.Load((((64u * uint(tint_symbol_save)) + (16u * uint(tint_symbol_save_1))) + (4u * uint(tint_symbol_1))))) + 1)));
|
||||
@@ -51,10 +49,8 @@ void main() {
|
||||
{
|
||||
}
|
||||
{
|
||||
const int tint_symbol_6 = idx4();
|
||||
const int tint_symbol_7 = idx5();
|
||||
const int tint_symbol_2_save = tint_symbol_6;
|
||||
const int tint_symbol_2_save_1 = tint_symbol_7;
|
||||
const int tint_symbol_2_save = idx4();
|
||||
const int tint_symbol_2_save_1 = idx5();
|
||||
const int tint_symbol_3 = idx6();
|
||||
buffer.Store((((64u * uint(tint_symbol_2_save)) + (16u * uint(tint_symbol_2_save_1))) + (4u * uint(tint_symbol_3))), asuint((asint(buffer.Load((((64u * uint(tint_symbol_2_save)) + (16u * uint(tint_symbol_2_save_1))) + (4u * uint(tint_symbol_3))))) + 1)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user