Bug 657

Summary: PMVMatrix.glPushTransform shouldn't allocate a new float array per call
Product: [JogAmp] Jogl Reporter: Brice Figureau <brice.figureau>
Component: utilAssignee: Sven Gothel <sgothel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: ---    
Version: 2   
Hardware: All   
OS: all   
Type: --- SCM Refs:
gluegen: ac16df0bab94fab313030ead42644844d1690a82 gluegen: 8b3e5b94bcd3167278eb972b2be37086d3bd2996 jogl: 96f8f55a8db5f430fc17ce9ea1bf45e4728ab6ac
Workaround: ---

Description Brice Figureau 2012-12-28 19:28:53 CET
PMVMatrix is very convenient for GLES2 application, unfortunately on embedded hardware glPushTransform becomes quite stressfull because it allocates a new float array on every call.

At least on android, this is detrimental because this gives more work to the GC, especially during tight rendering loops.

This could be rewritten with a fixed 16 or 8 levels (or configurable) stacks.
Comment 1 Sven Gothel 2012-12-29 23:51:00 CET
You are referring to glPushMatrix/glPopMatrix ?
If so .. I agree.

Do you like to make that [git] patch ?
Comment 2 Sven Gothel 2012-12-31 15:10:25 CET
http://jogamp.org/git/?p=jogl.git;a=commit;h=96f8f55a8db5f430fc17ce9ea1bf45e4728ab6ac

    Enhance PMVMatrix: Use FloatStack to implement PushMatrix and PopMatrix (Bug 657)
    
    One FloatStack for each, MV, P and T, with initialialSize zero to save memore
    and growSizes: MV = 16 arrays, P = 2 arrays, T = 2 arrays,
    with array = 16 floats.
    
    This shall save performance due to the preallocated stack when used
    and growing only in the above mentioned grow intervals.
    
    We may finetune the growSize, if required.