Thanks for the test and the data. I'll file a bug (if there isn't already -
  I vaguely recall having filed something like this).

  There may be a way to speed up BufferedImage -> accelerated
  surface copies.

  Thanks,
    Dmitri


[EMAIL PROTECTED] wrote:
I'm using the latest one which is b22, as for the test case, I wrote a small 
program that update every pixels as fast as possible using VolatileImage and 
measure the performance by  frames per second

result (VolatileImage):
Java 6u5 1300+ fps
Java 6u10b22
450+ fps

result (BufferStrategy):
Java 6u5 1200+ fps
Java 6u10b22
400+ fps

the source code of the test program that I included is basically the same thing 
as my actual program, the drawing routine is an almost exact copy of the actual 
one minus the program mechanics to simplify things thus this should be able to 
reproduce the problem.

Also with b22 I noticed that under certain conditions such as pixel 
manipulation, Java2D suffers huge performance hit when it gains access to the 
pixels (regardless of image type)  yet outperforms the previous version (6u5) 
in all 2D operations (except pixel manipulation)

here is the output log

[I] OS Version = OS_WINXP Pro
[I] CheckAdaptersInfo
[I] ------------------
[I] Adapter Ordinal  : 0
[I] Adapter Handle   : 0x10001
[I] Description      : NVIDIA GeForce 7300 GT
[I] GDI Name, Driver : \\.\DISPLAY1, nv4_disp.dll
[I] Vendor Id        : 0x10de
[I] Device Id        : 0x02e2
[I] SubSys Id        : 0x0
[I] Driver Version   : 6.14.11.6921
[I] GUID             : {D7B71E3E-41A2-11CF-B978-0B2003C2CB35}
[I] D3DPPLM::CheckDeviceCaps: adapter 0: Passed
[I] ------------------
[I] D3DGD_getDeviceCapsNative
[I] D3DContext::InitContext device 0
[I] D3DContext::ConfigureContext device 0
[V] dwBehaviorFlags=D3DCREATE_FPU_PRESERVE|D3DCREATE_HARDWARE_VERTEXPROCESSING
[I] D3DContext::ConfigureContext: successfully created device: 0
[I] D3DContext::InitDevice: device 0
[I] D3DContext::InitDefice: successfully initialized device 0
[V]   | CAPS_DEVICE_OK
[V]   | CAPS_RT_PLAIN_ALPHA
[V]   | CAPS_RT_TEXTURE_ALPHA
[V]   | CAPS_RT_TEXTURE_OPAQUE
[V]   | CAPS_LCD_SHADER | CAPS_BIOP_SHADER | CAPS_PS20
[V]   | CAPS_PS30
[V]   | CAPS_MULTITEXTURE
[V]   | CAPS_TEXNONPOW2
[V]   | CAPS_TEXNONSQUARE

code:-

import javax.swing.*;
import javax.imageio.ImageIO;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.image.BufferedImage;
import java.awt.Graphics2D.*;
import java.nio.IntBuffer;

public class test
{
        private JFrame mainFrame;
        private VolatileImage vi;
        private BufferedImage im;
        private int[] pix;
        private Insets ins;
        private long st,en;
        private int colour,fps = 0;

        public test()
        {
                mainFrame = new JFrame();
                mainFrame.setVisible(true);
                mainFrame.setIgnoreRepaint(true);
                ins = mainFrame.getInsets();
                mainFrame.setSize(new 
Dimension(256+ins.left+ins.right,192+ins.top+ins.bottom));
                mainFrame.setLocationRelativeTo(null);
                mainFrame.setTitle("Test");
                mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

                vi = mainFrame.createVolatileImage(256, 192);
        vi.validate(mainFrame.getGraphicsConfiguration());

                im = new BufferedImage(256,192,BufferedImage.TYPE_INT_RGB );
                pix = ((DataBufferInt) 
((BufferedImage)im).getRaster().getDataBuffer()).getData();

                run();
        }

        public void run()
        {

                st = System.nanoTime();

                while(true)
                {
                        for(int i=0;i<192*256;i++)
                        {
                                pix[i] = colour;

                                colour++;
                                //colour &= 0xFFFFFFFF;

                                //if(colour>0xFFFFFFFF)
                                //      colour = 0;
                        }

                        vi.getGraphics().drawImage(im,0,0,256,192,null);
                        
mainFrame.getGraphics().drawImage(vi,ins.left,ins.top,null);

                        fps++;

                        if((System.nanoTime()-st) > 1000*1000*1000)
                        {
                                System.out.println("FPS : "+fps);
                                st = System.nanoTime();
                                fps = 0;
                        }
                }
        }

        public static void main(String[] args)
        {
                new test();
        }
}
[Message sent by forum member 'bonbon' (bonbon)]

http://forums.java.net/jive/thread.jspa?messageID=270705

===========================================================================
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