[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48157] trunk/blender/source/blender/ makesdna: Fixes for 8vytes scalar types used in DNA (int64 and double)
Sergey Sharybin
sergey.vfx at gmail.com
Thu Jun 21 12:52:33 CEST 2012
Revision: 48157
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48157
Author: nazgul
Date: 2012-06-21 10:52:23 +0000 (Thu, 21 Jun 2012)
Log Message:
-----------
Fixes for 8vytes scalar types used in DNA (int64 and double)
- makesdna wasn't checking whether such scalars are aligned to 8 bytes.
Now it should be handled correct.
- Some scalars in Object structure weren't 8 bytes aligned, which lead
to some incorrectly loaded files.
Fixed by adding void *pad. It's a bit tricky part of patch, but can't
see clearer way to make alignment correct
Usually ints/chars were used for padding, but in this case there are
some leading pointer properties before int64 properties and using
pointer as a padding resolves alignment on both 32 and 64 bit
platforms.
Using pointers as padding weren't needed before, because all types
were correctly aligned independent of whether pointers are 4 or 8
bytes.
This fixes #31774: Empty offset Y parameter is resetting
Modified Paths:
--------------
trunk/blender/source/blender/makesdna/DNA_object_types.h
trunk/blender/source/blender/makesdna/intern/makesdna.c
Modified: trunk/blender/source/blender/makesdna/DNA_object_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_object_types.h 2012-06-21 09:47:30 UTC (rev 48156)
+++ trunk/blender/source/blender/makesdna/DNA_object_types.h 2012-06-21 10:52:23 UTC (rev 48157)
@@ -258,6 +258,7 @@
struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */
struct DerivedMesh *derivedDeform, *derivedFinal;
+ int *pad;
uint64_t lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
uint64_t customdata_mask; /* (extra) custom data layer mask to use for creating derivedmesh, set by depsgraph */
unsigned int state; /* bit masks of game controllers that are active */
Modified: trunk/blender/source/blender/makesdna/intern/makesdna.c
===================================================================
--- trunk/blender/source/blender/makesdna/intern/makesdna.c 2012-06-21 09:47:30 UTC (rev 48156)
+++ trunk/blender/source/blender/makesdna/intern/makesdna.c 2012-06-21 10:52:23 UTC (rev 48157)
@@ -798,7 +798,11 @@
}
}
- /* 2-4 aligned/ */
+ /* 2-4-8 aligned/ */
+ if (type < firststruct && typelens[type] > 4 && (len % 8)) {
+ printf("Align 8 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len % 8);
+ dna_error = 1;
+ }
if (typelens[type] > 3 && (len % 4) ) {
printf("Align 4 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len % 4);
dna_error = 1;
More information about the Bf-blender-cvs
mailing list