Since I did not implement shaders into my java code yet (only did some simple 
test in separate test snippets) and I'm not a ogl/shader expert, I was focused 
to implementation aspects. Anyway I'm on a NV7600GT 256MB DDRIII and the 
shaders here are generally faster than the sw implementation. Can't say a 
number, sorry.

Cheers,

Mik
--
  ----- Original Message ----- 
  From: Michael Toula 
  To: [EMAIL PROTECTED] 
  Sent: Thursday, February 22, 2007 2:15 PM
  Subject: Re: [JAVA2D] java2d Compositing -> OpenGL fragment shaders



  Michele, 

  My question was more: 
  What speed improvement did you personally measure using the shader 
implementation vs the plain java one (x2 faster ?, x10 ? , ect...) 
  I'm also interested in the hardware config (CPU/GPU) you've used to take 
those measures,  because of course, the result will be dependent on the 
hardware. 
  It's really just to give me an idea of what to expect :o) 

  Thanks, 
  Mike 
  ******************************************
  Michael TOULA
  Software Engineer

  Dalim Software GmbH
  Strassburger Str. 6
  D-77694
  Kehl am Rhein 
  GERMANY

  tel:   +49 7851 919 612
  fax:  +49 7851 735 76
  web:   www.dalim.com 
  ****************************************** 


        Michele Puccini <[EMAIL PROTECTED]> 
        Sent by: Discussion list for Java 2D API <[EMAIL PROTECTED]> 
        22/02/07 13:00 Please respond to
              Michele Puccini <[EMAIL PROTECTED]> 


       To [EMAIL PROTECTED]  
              cc  
              Subject Re: [JAVA2D] java2d Compositing -> OpenGL fragment 
shaders 

              

       



  Hi Mike, 
    
  of course the main aim is always speed, speed, speed. 
  Your question about speed gains is quite crucial and the answer may be of 
course very complicated to elaborate. Just mix up some aspects: 
    
  implementation 
      - how can shaders be implemented in java2d-ogl ? 
      - what can be affected from the implemention ? 
      - which gfx ops can benefit from shaders implementation ? 
      - can we really avoid software loops in any case ? 
      - <add here>.. 
    
  application 
      - what kind of application am I developing 
      - how can I get the most out of the new hava2d implementation 
      - is it true that a faster graphics operation may speedup the whole 
application ? 
      - <add here>.. 
    
  hardware implementation 
      - are shaders implemented in my hardware ? 
      - which is their speed (n. of onboard shaders, pipeline implementation, 
gpu speed, mem speed,..) ? 
      - are there any compatibility issues from gpu to gpu / driver to driver ? 
      - <add here>.. 
    
  Well, given the current and future graphics hardware implementation, the use 
of shaders will definitely boost java2d speeds in many ways, from advanced 
compositing to bufferedimage ops, to convolves. 
    
  Cheers, 
    
  Mik 
  ============================================================================
  > ClassX Development Italy  Via Francesca, 368/I I-56030 S.M. a Monte (PI) <
  > Tel.(+39)-0587-705153  Fax.(+39)-0587-705153  WEB: http://www.classx.it  <
  ============================================================================ 
    
  ----- Original Message ----- 
  From: Michael Toula 
  To: [EMAIL PROTECTED] 
  Sent: Thursday, February 22, 2007 12:27 PM 
  Subject: Re: [JAVA2D] java2d Compositing -> OpenGL fragment shaders 


  Michele, 

  I guess the reason why you implement it using a fragment shader is to see a 
speed increase. 
  What speed increase can we expect using your technique (What CPU/Graphic card 
are you using) ? 
  I was thinking of implementing something similar for BufferedImageOp ( speed 
up ConvolveOp for exemple ), so I'm interested in your results. 
  On a side note, not everybody has a "fragment shader" capable graphic 
card/OpenGL driver. 

  Best, 
  Mike 
  ******************************************
  Michael TOULA
  Software Engineer

  Dalim Software GmbH
  Strassburger Str. 6
  D-77694
  Kehl am Rhein 
  GERMANY

  tel:   +49 7851 919 612
  fax:  +49 7851 735 76
  web:   www.dalim.com 
  ****************************************** 

        Michele Puccini <[EMAIL PROTECTED]> 
        Sent by: Discussion list for Java 2D API <[EMAIL PROTECTED]> 
        22/02/07 11:20 
              Please respond to
              Michele Puccini <[EMAIL PROTECTED]> 


       
              To [EMAIL PROTECTED]  
              cc  
              Subject [JAVA2D] java2d Compositing -> OpenGL fragment shaders 


              

       




  Hello all at java2d,
  Hello Chris,

  after bouncing my head for some time over OpenGL, alpha compositing,
  accumulated and premultiplied alpha I decided (curiosity) to take a look at
  the j2se6 source code just to see what happens behind the scenes.

  All I discovered (surprise ?) is that the OpenGL codepath of java2d has to
  deal with premultiplied alpha pixels. That's probably because the Porter and
  Duff compositing rules "work better" with premultiplied data ;)

  But premultiplying and unpremultiplying is done in software loops, so this
  generates some overhead, expecially when using java2d for creating offscreen
  graphics with unpremultiplied images (me).

  So I decided to implement my very first OpenGL fragment shader that does a
  SRC_OVER composite on unpremultiplied data. I'm a true beginer, so please
  forgive me.

  Here's the code

  -----

  uniform sampler2D texture;

  void main()
  {
  vec4 s = texture2D(texture,gl_TexCoord[0].st);
  vec4 d = gl_FragColor;

  float extra_alpha = 0.1;

  s.a = s.a * extra_alpha;

  if (s.a == 0.0) gl_FragColor = d;
  else if (s.a == 1.0) gl_FragColor = s;
  else if (d.a == 0.0) {gl_FragColor = s;}
  else
  {
     float a = s.a + d.a - s.a * d.a;
  gl_FragColor.a = a;
  gl_FragColor.r = (s.a*s.r+d.a*d.r-s.a*d.a*d.r)/a;
  gl_FragColor.g = (s.a*s.g+d.a*d.g-s.a*d.a*d.g)/a;
  gl_FragColor.b = (s.a*s.b+d.a*d.b-s.a*d.a*d.b)/a;
  }
  }

  -----

  I works very well and, apart that compiler warning (!), the results are 1:1
  the SRC_OVER I get from the Java2D software loops.

  So the question: why don't implement the entire OpenGL java2d Composite with
  fragment shaders and avoid premultiplied data ?

  Cheers!

  Mik
  ============================================================================
  > ClassX Development Italy  Via Francesca, 368/I I-56030 S.M. a Monte (PI) <
  > Tel.(+39)-0587-705153  Fax.(+39)-0587-705153  WEB: http://www.classx.it  <
  ============================================================================

  ===========================================================================
  To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
  of the message "signoff JAVA2D-INTEREST".  For general help, send email to
  [EMAIL PROTECTED] and include in the body of the message "help".

  =========================================================================== 
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the 
message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL 
PROTECTED] and include in the body of the message "help". 
  =========================================================================== 
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the 
message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL 
PROTECTED] and include in the body of the message "help". 
  =========================================================================== 
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the 
message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL 
PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to