[Vm-dev] VM Maker: VMMaker.oscog-eem.1032.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Jan 31 01:12:25 UTC 2015
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1032.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.1032
Author: eem
Time: 30 January 2015, 5:10:58.812 pm
UUID: a3c915e6-d663-4d65-ab41-493c71498549
Ancestors: VMMaker.oscog-eem.1031
Eliminate some warnings in the B3DAcceleratorPlugin
=============== Diff against VMMaker.oscog-eem.1031 ===============
Item was changed:
----- Method: B3DAcceleratorPlugin>>loadClientState:vertices:colors:normals:texCoords: (in category 'primitives-qwaq') -----
loadClientState: handle vertices: vertices colors: colors normals: normals texCoords: texCoords
"Common method to set up client state for some render ops"
+ | nilOop vtxSize sz colorPtr normalPtr txPtr vertexPtr ok |
- | vtxSize sz colorPtr normalPtr txPtr vertexPtr ok |
<var: #colorPtr type: 'void *'>
<var: #normalPtr type: 'void *'>
<var: #txPtr type: 'void *'>
<var: #vertexPtr type: 'void *'>
colorPtr := normalPtr := txPtr := vertexPtr := nil.
+ sz := 0.
"Verify vertex data"
+ (interpreterProxy isWords: vertices) ifFalse:
+ [^interpreterProxy primitiveFail].
- (interpreterProxy isWords: vertices)
- ifFalse:[^interpreterProxy primitiveFail].
vtxSize := (interpreterProxy slotSizeOf: vertices) / 3.
"Verify assumptions of color, normal, texCoords data"
+ nilOop := interpreterProxy nilObject.
+ (colors = nilOop
+ or: [(interpreterProxy isWords: colors)
+ and: [(interpreterProxy slotSizeOf: colors) = (vtxSize * 4)]]) ifFalse:
+ [^interpreterProxy primitiveFail].
+ (normals = nilOop
+ or: [(interpreterProxy isWords: normals)
+ and: [(interpreterProxy slotSizeOf: normals) = (vtxSize * 3)]]) ifFalse:
+ [^interpreterProxy primitiveFail].
- (colors = interpreterProxy nilObject
- or:[(interpreterProxy isWords: colors)
- and:[(interpreterProxy slotSizeOf: colors) = (vtxSize * 4)]])
- ifFalse:[^interpreterProxy primitiveFail].
- (normals = interpreterProxy nilObject
- or:[(interpreterProxy isWords: normals)
- and:[(interpreterProxy slotSizeOf: normals) = (vtxSize * 3)]])
- ifFalse:[^interpreterProxy primitiveFail].
"Don't check size for texCoords since they can be 2,3,4 elements"
+ (texCoords = nilOop
+ or: [(interpreterProxy isWords: texCoords)]) ifFalse:
+ [^interpreterProxy primitiveFail].
- (texCoords = interpreterProxy nilObject
- or:[(interpreterProxy isWords: texCoords)])
- ifFalse:[^interpreterProxy primitiveFail].
"Finally submit the data to OpenGL"
+ colors = nilOop ifFalse:
+ [colorPtr := interpreterProxy firstIndexableField: colors].
+ normals = nilOop ifFalse:
+ [normalPtr := interpreterProxy firstIndexableField: normals].
+ texCoords = nilOop ifFalse:
+ [sz := (interpreterProxy slotSizeOf: texCoords) / vtxSize.
+ txPtr := interpreterProxy firstIndexableField: texCoords].
- (colors = interpreterProxy nilObject) ifFalse:[
- colorPtr := interpreterProxy firstIndexableField: colors.
- ].
- (normals = interpreterProxy nilObject) ifFalse:[
- normalPtr := interpreterProxy firstIndexableField: normals.
- ].
- (texCoords = interpreterProxy nilObject) ifFalse:[
- sz := (interpreterProxy slotSizeOf: texCoords) / vtxSize.
- txPtr := interpreterProxy firstIndexableField: texCoords.
- ].
vertexPtr := interpreterProxy firstIndexableField: vertices.
+ interpreterProxy failed ifFalse:
+ [ok := self
+ cCode:'b3dLoadClientState(handle, vertexPtr, 3, colorPtr, 4, normalPtr, 3, txPtr, sz)'
+ inSmalltalk: [vertexPtr. colorPtr. normalPtr. txPtr. sz touch].
+ ok ifFalse: [interpreterProxy primitiveFail]].
+ ^nil "keep compiler quiet"
- interpreterProxy failed ifTrue:[^nil].
- ok := self cCode:'b3dLoadClientState(handle, vertexPtr, 3, colorPtr, 4, normalPtr, 3, txPtr, sz)'
- inSmalltalk:[vertexPtr. colorPtr. normalPtr. txPtr. sz false].
- ok ifFalse:[^interpreterProxy primitiveFail].
!
Item was changed:
----- Method: B3DAcceleratorPlugin>>primitiveDrawArrays (in category 'primitives-qwaq') -----
primitiveDrawArrays
"Primitive. Setup non-VBO client state and call drawRangeElements in one go to avoid
garbage collection to move the buffers underneith."
| maxIdx minIdx mode texCoords normals colors vertices handle vtxSize ok |
<export: true>
+ interpreterProxy methodArgumentCount = 8 ifFalse:
+ [^interpreterProxy primitiveFail].
- interpreterProxy methodArgumentCount = 8
- ifFalse:[^interpreterProxy primitiveFail].
maxIdx := interpreterProxy stackIntegerValue: 0.
minIdx := interpreterProxy stackIntegerValue: 1.
mode := interpreterProxy stackIntegerValue: 2.
texCoords := interpreterProxy stackValue: 3.
normals := interpreterProxy stackValue: 4.
colors := interpreterProxy stackValue: 5.
vertices := interpreterProxy stackValue: 6.
handle := interpreterProxy stackIntegerValue: 7.
self loadClientState: handle vertices: vertices colors: colors normals: normals texCoords: texCoords.
interpreterProxy failed ifTrue:[^nil].
+ doRangeChecks ifTrue:
+ ["Verify the vertex data itself"
- doRangeChecks ifTrue:[
- "Verify the vertex data itself"
self checkVertexData: vertices.
"Verify min-max range in bounds for given vertex array"
vtxSize := (interpreterProxy slotSizeOf: vertices) / 3.
+ (minIdx < 0 or:[minIdx > maxIdx or:[maxIdx > vtxSize]]) ifTrue:
+ [interpreterProxy primitiveFail]].
+ interpreterProxy failed ifFalse:
+ [ok := self cCode: 'b3dDrawArrays(handle, mode, minIdx, maxIdx)'
+ inSmalltalk:[mode. false].
+ ok ifTrue:
+ [interpreterProxy pop: interpreterProxy methodArgumentCount]].
+ ^nil "keep compiler quiet"
- (minIdx < 0 or:[minIdx > maxIdx or:[maxIdx > vtxSize]])
- ifTrue:[^interpreterProxy primitiveFail].
- ].
- interpreterProxy failed ifTrue:[^nil].
- ok := self cCode: 'b3dDrawArrays(handle, mode, minIdx, maxIdx)'
- inSmalltalk:[mode. false].
- ok ifFalse:[^interpreterProxy primitiveFail].
- interpreterProxy failed
- ifFalse:[interpreterProxy pop: interpreterProxy methodArgumentCount].
!
Item was changed:
----- Method: B3DAcceleratorPlugin>>primitiveDrawElements (in category 'primitives-qwaq') -----
primitiveDrawElements
"Primitive. Setup non-VBO client state and call drawElements in one go to avoid
garbage collection to move the buffers underneith."
| faces mode texCoords normals colors vertices handle ok facePtr faceSize |
<export: true>
<var: #facePtr type: 'unsigned int *'>
+ interpreterProxy methodArgumentCount = 7 ifFalse:
+ [^interpreterProxy primitiveFail].
- interpreterProxy methodArgumentCount = 7
- ifFalse:[^interpreterProxy primitiveFail].
faces := interpreterProxy stackValue: 0.
+ (interpreterProxy isWords: faces) ifFalse:
+ [^interpreterProxy primitiveFail].
- (interpreterProxy isWords: faces)
- ifFalse:[^interpreterProxy primitiveFail].
faceSize := interpreterProxy slotSizeOf: faces.
facePtr := interpreterProxy firstIndexableField: faces.
mode := interpreterProxy stackIntegerValue: 1.
texCoords := interpreterProxy stackValue: 2.
normals := interpreterProxy stackValue: 3.
colors := interpreterProxy stackValue: 4.
vertices := interpreterProxy stackValue: 5.
handle := interpreterProxy stackIntegerValue: 6.
self loadClientState: handle vertices: vertices colors: colors normals: normals texCoords: texCoords.
interpreterProxy failed ifTrue:[^nil].
+ doRangeChecks ifTrue:
+ ["Verify the vertex data itself"
- doRangeChecks ifTrue:[
- "Verify the vertex data itself"
self checkVertexData: vertices.
"Change bounds range to make sure the data is valid"
+ self checkBoundsRange: vertices faces: facePtr count: faceSize].
- self checkBoundsRange: vertices faces: facePtr count: faceSize.
- ].
+ interpreterProxy failed ifFalse:
+ [ok := self cCode: 'b3dDrawElements(handle, mode, faceSize, facePtr)'
+ inSmalltalk:[mode. facePtr. false].
+ ok ifTrue:
+ [interpreterProxy pop: interpreterProxy methodArgumentCount]].
+ ^nil "keep compiler quiet"
- interpreterProxy failed ifTrue:[^nil].
- ok := self cCode: 'b3dDrawElements(handle, mode, faceSize, facePtr)'
- inSmalltalk:[mode. facePtr. false].
- ok ifFalse:[^interpreterProxy primitiveFail].
- interpreterProxy failed
- ifFalse:[interpreterProxy pop: interpreterProxy methodArgumentCount].
!
Item was changed:
----- Method: B3DAcceleratorPlugin>>primitiveDrawRangeElements (in category 'primitives-qwaq') -----
primitiveDrawRangeElements
"Primitive. Setup non-VBO client state and call drawRangeElements in one go to avoid
garbage collection to move the buffers underneith."
| faces maxIdx minIdx mode texCoords normals colors vertices handle vtxSize ok facePtr faceSize |
<export: true>
<var: #facePtr type: 'unsigned int *'>
+ interpreterProxy methodArgumentCount = 9 ifFalse:
+ [^interpreterProxy primitiveFail].
- interpreterProxy methodArgumentCount = 9
- ifFalse:[^interpreterProxy primitiveFail].
faces := interpreterProxy stackValue: 0.
+ (interpreterProxy isWords: faces) ifFalse:
+ [^interpreterProxy primitiveFail].
- (interpreterProxy isWords: faces)
- ifFalse:[^interpreterProxy primitiveFail].
faceSize := interpreterProxy slotSizeOf: faces.
facePtr := interpreterProxy firstIndexableField: faces.
maxIdx := interpreterProxy stackIntegerValue: 1.
minIdx := interpreterProxy stackIntegerValue: 2.
mode := interpreterProxy stackIntegerValue: 3.
texCoords := interpreterProxy stackValue: 4.
normals := interpreterProxy stackValue: 5.
colors := interpreterProxy stackValue: 6.
vertices := interpreterProxy stackValue: 7.
handle := interpreterProxy stackIntegerValue: 8.
self loadClientState: handle vertices: vertices colors: colors normals: normals texCoords: texCoords.
interpreterProxy failed ifTrue:[^nil].
+ doRangeChecks ifTrue:
+ ["Verify the vertex data itself"
- doRangeChecks ifTrue:[
- "Verify the vertex data itself"
self checkVertexData: vertices.
"Change bounds range to make sure the data is valid"
self checkBoundsRange: vertices faces: facePtr count: faceSize.
"Verify min-max range in bounds for given vertex array"
vtxSize := (interpreterProxy slotSizeOf: vertices) / 3.
+ (minIdx < 0 or:[minIdx > maxIdx or:[maxIdx > vtxSize]]) ifTrue:
+ [interpreterProxy primitiveFail]].
- (minIdx < 0 or:[minIdx > maxIdx or:[maxIdx > vtxSize]])
- ifTrue:[^interpreterProxy primitiveFail].
- ].
+ interpreterProxy failed ifFalse:
+ [ok := self cCode: 'b3dDrawRangeElements(handle, mode, minIdx, maxIdx, faceSize, facePtr)'
+ inSmalltalk:[mode. facePtr. false].
+ ok ifTrue:
+ [interpreterProxy pop: interpreterProxy methodArgumentCount]].
+ ^nil "keep compiler quiet"
- interpreterProxy failed ifTrue:[^nil].
- ok := self cCode: 'b3dDrawRangeElements(handle, mode, minIdx, maxIdx, faceSize, facePtr)'
- inSmalltalk:[mode. facePtr. false].
- ok ifFalse:[^interpreterProxy primitiveFail].
- interpreterProxy failed
- ifFalse:[interpreterProxy pop: interpreterProxy methodArgumentCount].
!
Item was changed:
----- Method: B3DAcceleratorPlugin>>primitiveEnableDrawRangeChecks (in category 'primitives-qwaq') -----
primitiveEnableDrawRangeChecks
"Primitive. Enable/disable draw (range) checks"
| enabled |
<export: true>
+ interpreterProxy methodArgumentCount = 0 ifTrue:
+ [interpreterProxy pop: 1.
+ ^interpreterProxy pushBool: doRangeChecks].
+ interpreterProxy methodArgumentCount = 1 ifTrue:
+ [enabled := interpreterProxy booleanValueOf: (interpreterProxy stackValue: 0).
+ interpreterProxy failed ifFalse:
+ [doRangeChecks := enabled.
+ ^interpreterProxy pop: 1]]. "pop arg; return rcvr"
+ ^nil "keep compiler quiet"!
- interpreterProxy methodArgumentCount = 0 ifTrue:[
- interpreterProxy pop: 1.
- ^interpreterProxy pushBool: doRangeChecks.
- ].
- interpreterProxy methodArgumentCount = 1 ifTrue:[
- enabled := interpreterProxy booleanValueOf: (interpreterProxy stackValue: 0).
- interpreterProxy failed ifTrue:[^nil].
- doRangeChecks := enabled.
- ^interpreterProxy pop: 1. "pop arg; return recvr"
- ].!
Item was removed:
- ----- Method: B3DAcceleratorPlugin>>stackPrimitiveVertex: (in category 'primitive support') -----
- stackPrimitiveVertex: index
- "Load a primitive vertex from the interpreter stack.
- Return a pointer to the vertex data if successful, nil otherwise."
- | oop |
- <inline: false>
- <returnTypeC:'void*'>
- oop := interpreterProxy stackObjectValue: index.
- oop = nil ifTrue:[^nil].
- ((interpreterProxy isWords: oop) and:[(interpreterProxy slotSizeOf: oop) = 16])
- ifTrue:[^interpreterProxy firstIndexableField: oop].
- ^nil!
More information about the Vm-dev
mailing list