Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
74ab31b7
Commit
74ab31b7
authored
Apr 11, 2019
by
Rémi Verschelde
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vhacd: Fix -fpermissive build issue with MinGW
Fixes #27926.
parent
668439d1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
2 deletions
+82
-2
0002-fpermissive-fix.patch
thirdparty/vhacd/0002-fpermissive-fix.patch
+53
-0
btScalar.h
thirdparty/vhacd/inc/btScalar.h
+23
-0
btAlignedAllocator.cpp
thirdparty/vhacd/src/btAlignedAllocator.cpp
+6
-2
No files found.
thirdparty/vhacd/0002-fpermissive-fix.patch
0 → 100644
View file @
74ab31b7
diff --git a/thirdparty/vhacd/inc/btScalar.h b/thirdparty/vhacd/inc/btScalar.h
index 487205062..52297cd78 100644
--- a/thirdparty/vhacd/inc/btScalar.h
+++ b/thirdparty/vhacd/inc/btScalar.h
@@ -535,6 +535,29 @@ struct btTypedObject {
}
};
+// -- GODOT start --
+// Cherry-picked from Bullet 2.88 to fix GH-27926
+///align a pointer to the provided alignment, upwards
+template <typename T>
+T *btAlignPointer(T *unalignedPtr, size_t alignment)
+{
+ struct btConvertPointerSizeT
+ {
+ union {
+ T *ptr;
+ size_t integer;
+ };
+ };
+ btConvertPointerSizeT converter;
+
+ const size_t bit_mask = ~(alignment - 1);
+ converter.ptr = unalignedPtr;
+ converter.integer += alignment - 1;
+ converter.integer &= bit_mask;
+ return converter.ptr;
+}
+// -- GODOT end --
+
// -- GODOT start --
}; // namespace VHACD
// -- GODOT end --
diff --git a/thirdparty/vhacd/src/btAlignedAllocator.cpp b/thirdparty/vhacd/src/btAlignedAllocator.cpp
index ce0e7f26f..8dee31e7e 100644
--- a/thirdparty/vhacd/src/btAlignedAllocator.cpp
+++ b/thirdparty/vhacd/src/btAlignedAllocator.cpp
@@ -72,8 +72,12 @@ static inline void* btAlignedAllocDefault(size_t size, int32_t alignment)
real = (char*)sAllocFunc(size + sizeof(void*) + (alignment - 1));
if (real) {
- offset = (alignment - (unsigned long)(real + sizeof(void*))) & (alignment - 1);
- ret = (void*)((real + sizeof(void*)) + offset);
+ // -- GODOT start --
+ // Synced with Bullet 2.88 to fix GH-27926
+ //offset = (alignment - (unsigned long)(real + sizeof(void*))) & (alignment - 1);
+ //ret = (void*)((real + sizeof(void*)) + offset);
+ ret = btAlignPointer(real + sizeof(void *), alignment);
+ // -- GODOT end --
*((void**)(ret)-1) = (void*)(real);
}
else {
thirdparty/vhacd/inc/btScalar.h
View file @
74ab31b7
...
...
@@ -544,6 +544,29 @@ struct btTypedObject {
};
// -- GODOT start --
// Cherry-picked from Bullet 2.88 to fix GH-27926
///align a pointer to the provided alignment, upwards
template
<
typename
T
>
T
*
btAlignPointer
(
T
*
unalignedPtr
,
size_t
alignment
)
{
struct
btConvertPointerSizeT
{
union
{
T
*
ptr
;
size_t
integer
;
};
};
btConvertPointerSizeT
converter
;
const
size_t
bit_mask
=
~
(
alignment
-
1
);
converter
.
ptr
=
unalignedPtr
;
converter
.
integer
+=
alignment
-
1
;
converter
.
integer
&=
bit_mask
;
return
converter
.
ptr
;
}
// -- GODOT end --
// -- GODOT start --
};
// namespace VHACD
// -- GODOT end --
...
...
thirdparty/vhacd/src/btAlignedAllocator.cpp
View file @
74ab31b7
...
...
@@ -72,8 +72,12 @@ static inline void* btAlignedAllocDefault(size_t size, int32_t alignment)
real
=
(
char
*
)
sAllocFunc
(
size
+
sizeof
(
void
*
)
+
(
alignment
-
1
));
if
(
real
)
{
offset
=
(
alignment
-
(
unsigned
long
)(
real
+
sizeof
(
void
*
)))
&
(
alignment
-
1
);
ret
=
(
void
*
)((
real
+
sizeof
(
void
*
))
+
offset
);
// -- GODOT start --
// Synced with Bullet 2.88 to fix GH-27926
//offset = (alignment - (unsigned long)(real + sizeof(void*))) & (alignment - 1);
//ret = (void*)((real + sizeof(void*)) + offset);
ret
=
btAlignPointer
(
real
+
sizeof
(
void
*
),
alignment
);
// -- GODOT end --
*
((
void
**
)(
ret
)
-
1
)
=
(
void
*
)(
real
);
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment