Skip to content

Commit

Permalink
Hotfix for Squeak3D on 64bits VM
Browse files Browse the repository at this point in the history
The B3DRasterizer state.objects store pointers to B3D objects into a 4-bytes Smalltalk WordArray.
This means that appropriate arithmetic has to take place in order to compute the number of objects stored in that WordArray
Indeed, on 64bits VM, each object pointer is going to consume 8-bytes (2 words).

That also means that proper allocation of Smalltalk WordArray has to take place at image side.
A fix to `B3DPrimitiveRasterizerState>>initObjects:` is thus also required

    objects := B3DPrimitiveRasterizerData new: nObjects * (Smalltalk wordSize / 4)

The slang and image Smalltalk code have not been published yet.
They are waiting for approval of my Developer status on http://www.squeaksource.com/Balloon3D.html
  • Loading branch information
nicolas-cellier-aka-nice committed Feb 27, 2020
1 parent 98f6b50 commit 11a8128
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/plugins/Squeak3D/Squeak3D.c
@@ -1,9 +1,9 @@
/* Automatically generated by
VMPluginCodeGenerator VMMaker.oscog-eem.2719 uuid: e40f3e94-3a54-411b-9613-5d19114ea131
VMPluginCodeGenerator VMMaker.oscog-eem.2721 uuid: ae80c101-9b76-4d26-907a-6466e4269ad7
from
B3DEnginePlugin Balloon3D-Plugins-eem.15 uuid: d694149b-363b-4754-aa4a-7ef0cb2c5eab
B3DEnginePlugin Balloon3D-Plugins-nice.16 uuid: 961cec73-badd-4b71-8d02-9233e3122e21
*/
static char __buildInfo[] = "B3DEnginePlugin Balloon3D-Plugins-eem.15 uuid: d694149b-363b-4754-aa4a-7ef0cb2c5eab " __DATE__ ;
static char __buildInfo[] = "B3DEnginePlugin Balloon3D-Plugins-nice.16 uuid: 961cec73-badd-4b71-8d02-9233e3122e21 " __DATE__ ;



Expand Down Expand Up @@ -280,7 +280,7 @@ static double l2vSpecDir[3];
static sqInt lightFlags;
static float* litVertex;
static sqInt loadBBFn;
static const char *moduleName = "Squeak3D Balloon3D-Plugins-eem.15 " INT_EXT;
static const char *moduleName = "Squeak3D Balloon3D-Plugins-nice.16 " INT_EXT;
static float* primLight;
static float* primMaterial;
static sqInt vbFlags;
Expand Down Expand Up @@ -2942,10 +2942,10 @@ loadRasterizerState(sqInt stackIndex)
if (!(isWords(obj))) {
return 0;
}
objLen = slotSizeOf(obj);
objLen = byteSizeOf(obj);
objPtr = firstIndexableField(obj);
state.objects = (B3DPrimitiveObject **)objPtr;
state.nObjects = objLen;
state.nObjects = objLen/sizeof(B3DPrimitiveObject *);
}
obj = fetchPointerofObject(7, stateOop);
if (obj == (nilObject())) {
Expand Down

0 comments on commit 11a8128

Please sign in to comment.