Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Minimally fix the known unsoundness in bevy_mikktspace #5299

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions crates/bevy_mikktspace/src/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1060,8 +1060,8 @@ unsafe fn InitTriInfo<I: Geometry>(
let mut bChooseOrientFirstTri: bool = false;
if (*pTriInfos.offset((t + 1) as isize)).iFlag & 4i32 != 0i32 {
bChooseOrientFirstTri = true
} else if CalcTexArea(geometry, &*piTriListIn.offset((t * 3 + 0) as isize))
>= CalcTexArea(geometry, &*piTriListIn.offset(((t + 1) * 3 + 0) as isize))
} else if CalcTexArea(geometry, piTriListIn.offset((t * 3 + 0) as isize))
>= CalcTexArea(geometry, piTriListIn.offset(((t + 1) * 3 + 0) as isize))
{
bChooseOrientFirstTri = true
}
Expand Down Expand Up @@ -1503,9 +1503,7 @@ unsafe fn GenerateSharedVerticesIndexList<I: Geometry>(
vP_1.z
};
let iCell_0 = FindGridCell(fMin, fMax, fVal_0);
let mut pTable: *mut i32 = 0 as *mut i32;
pTable = &mut piHashTable[piHashOffsets[iCell_0] as usize] as *mut i32;
*pTable.offset(piHashCount2[iCell_0] as isize) = i as i32;
piHashTable[(piHashOffsets[iCell_0] + piHashCount2[iCell_0]) as usize] = i as i32;
piHashCount2[iCell_0] += 1;
i += 1
}
Expand All @@ -1525,7 +1523,7 @@ unsafe fn GenerateSharedVerticesIndexList<I: Geometry>(
k = 0;
while k < g_iCells {
// extract table of cell k and amount of entries in it
let mut pTable_0 = &mut piHashTable[piHashOffsets[k] as usize] as *mut i32;
let pTable_0 = piHashTable.as_mut_ptr().offset(piHashOffsets[k] as isize);
let iEntries = piHashCount[k] as usize;
if !(iEntries < 2) {
e = 0;
Expand Down