Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (546)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  RGB vs RGBA texture upload  (Read 2520 times)
0 Members and 1 Guest are viewing this topic.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Posted 2005-05-13 07:45:24 »

I recently benchmarked texture uploading-speed of OpenGL.

Ofcourse I didn't mipmap, as that's done on the cpu.

For a 1024x1024 texture:
as LUMI: 3.4ms
as RGB: 220.8ms Shocked
as RGBA: 12.2ms
as DXT3: 5.6ms
as DXT5: 6.3ms
Uploading as: GL_UNSIGNED_BYTE

I can understand that uploading RGB could be somewhat slower, because the gpu might have to do some conversions, but ~20x slower... doesn't seem to make much sense.

Update:
Benchmark is just sending an 'empty' direct ByteBuffer of the appropriate length to the gpu.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #1 - Posted 2005-05-13 10:58:06 »

Over how many runs are these results averaged?  Was there much variance in the runs, or were all results for a particular test pretty much the same?

Hellomynameis Charlie Dobbie.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #2 - Posted 2005-05-16 09:23:51 »

16 runs, same performance per run

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #3 - Posted 2005-05-16 11:06:21 »

How interesting!  Could you post your benchmark code so we can try it on a variety of hardware, please?

Hellomynameis Charlie Dobbie.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #4 - Posted 2005-05-16 16:24:54 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
import java.nio.IntBuffer;
import java.nio.ByteBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.PixelFormat;

public class TextureUploadBenchmark
{
   public static void main(String[] args) throws Exception
   {
      Display.setTitle("Texture Upload Benchmark");
      Display.setFullscreen(false);

      Display.create();

      GL11.glClearColor(0, 0, 1, 1);
      GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

      Display.update();

      GL11.glEnable(GL11.GL_TEXTURE_2D);

      int dim = 1024;
      int count = 16;

      System.out.println("Texture-Upload Benchmark");
      System.out.println();
      System.out.println("   Texture dimension: " + dim);
      System.out.println("   Number of textures per run: " + count);
      System.out.println();
      System.out.println("   Results:");
      System.out.println("    - LUMI: " + benchmarkUpload(dim, GL11.GL_LUMINANCE, count) + "ms / texture");
      System.out.println("    - RGB:  " + benchmarkUpload(dim, GL11.GL_RGB, count) + "ms / texture");
      System.out.println("    - RGBA: " + benchmarkUpload(dim, GL11.GL_RGBA, count) + "ms / texture");
      System.out.println();
      System.out.println("Done.");

      Display.destroy();
   }



   private static final float benchmarkUpload(int dim, int format, int count)
   {
      int bytesPerPixel = -1;

      switch (format)
      {
         case GL11.GL_LUMINANCE:
            bytesPerPixel = 1;
            break;
         case GL11.GL_RGB:
            bytesPerPixel = 3;
            break;
         case GL11.GL_RGBA:
            bytesPerPixel = 4;
            break;
      }

      ByteBuffer buf = BufferUtils.createByteBuffer(dim * dim * bytesPerPixel);
      IntBuffer idBuf = BufferUtils.createIntBuffer(count);
      GL11.glGenTextures(idBuf);

      long t0 = System.currentTimeMillis();
      for (int i = 0; i < count; i++)
      {
         GL11.glBindTexture(GL11.GL_TEXTURE_2D, idBuf.get(i));

         GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, format, dim, dim, 0, format, GL11.GL_UNSIGNED_BYTE, buf);
         GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
         GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
         GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
         GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
      }
      long t1 = System.currentTimeMillis();

      GL11.glDeleteTextures(idBuf);

      float took = (t1 - t0) / (float) count;

      // format to 1 decimal
     return ((int) (took * 10)) / 10.0F;
   }
}


Output for:
ATi Radeon 9700 PRO

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
Texture-Upload Benchmark

   Texture dimension: 1024
   Number of textures per run: 16

   Results:
    - LUMI: 3.8ms / texture
    - RGB:  229.5ms / texture
    - RGBA: 15.6ms / texture

Done.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #5 - Posted 2005-05-16 16:35:55 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
   Texture dimension: 1024
   Number of textures per run: 16

   Results:
    - LUMI: 4.8ms / texture
    - RGB:  17.5ms / texture
    - RGBA: 17.5ms / texture

Done.
GeForce 6600GT

Offline Spasi
« Reply #6 - Posted 2005-05-16 17:27:15 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
   Texture dimension: 1024
   Number of textures per run: 16

   Results:
    - LUMI: 4.9ms / texture
    - RGB:  15.6ms / texture
    - RGBA: 17.5ms / texture

Done.

-----------------------

   Texture dimension: 2048
   Number of textures per run: 16

   Results:
    - LUMI: 17.5ms / texture
    - RGB:  46.8ms / texture
    - RGBA: 77.1ms / texture

Done.


GeFX 5900, Forceware 76.91
Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #7 - Posted 2005-05-16 18:02:51 »

Thanks.

Anyone with ATi card please?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Inquisitor
Guest
« Reply #8 - Posted 2005-05-16 18:24:44 »

Radeon 8500 (needed to remove multisampling to get it run):

Texture-Upload Benchmark

  Texture dimension: 1024
  Number of textures per run: 16

  Results:
   - LUMI: 10.7ms / texture
   - RGB:  344.7ms / texture
   - RGBA: 29.3ms / texture

Done.

ATI, we have a problem...
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #9 - Posted 2005-05-16 18:56:26 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
Texture-Upload Benchmark

   Texture dimension: 1024
   Number of textures per run: 16

   Results:
    - LUMI: 12.6ms / texture
    - RGB:  29.3ms / texture
    - RGBA: 30.3ms / texture

Done.

GF FX 5200.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline tom
« Reply #10 - Posted 2005-05-16 18:59:33 »

Radeon 9500 Pro

   - LUMI: 9.7ms / texture
   - RGB:  225.5ms / texture
   - RGBA: 29.3ms / texture

Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #11 - Posted 2005-05-16 19:51:39 »

So now we know it's ATi's issue, what's the next step? :-/

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #12 - Posted 2005-05-16 22:24:43 »

  Texture dimension: 1024
  Number of textures per run: 16

  Results:
   - LUMI: 16.8ms / texture
   - RGB:  65.0ms / texture
   - RGBA: 75.6ms / texture

gf2mx (classic/400) 30.82 deto.

>what's the next step?

a) ignore it
b) say "ati sucks" and never buy an ati card again
c) contact em... if they don't do something about it fallback to a) or b)

弾幕 ☆ @mahonnaiseblog
Offline cfmdobbie

Senior Member


Medals: 1


Who, me?


« Reply #13 - Posted 2005-05-17 12:45:10 »

Quote
So now we know it's ATi's issue, what's the next step? :-/


Pointing, and laughing. Grin

Hellomynameis Charlie Dobbie.
Online EgonOlsen
« Reply #14 - Posted 2005-05-17 19:06:14 »

ATI X800XT-PE, Cat5.4:

  Texture dimension: 1024

  Results:

   - LUMI: 2.0ms / texture
   - RGB:  7.8ms / texture
   - RGBA: 9.7ms / texture

Offline Alan_W

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #15 - Posted 2005-05-17 19:17:16 »

ATI Mobility 9200 (in notebook)

Quote
  Results:
   - LUMI: 7.8ms / texture
   - RGB:  140.6ms / texture
   - RGBA: 13.6ms / texture



Time flies like a bird. Fruit flies like a banana.
Online EgonOlsen
« Reply #16 - Posted 2005-05-18 06:54:29 »

Intel 915 integrated graphics:

  Results:

   - LUMI: 0.9ms / texture
   - RGB:  9.7ms / texture
   - RGBA: 11.6ms / texture

Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #17 - Posted 2005-05-18 07:56:42 »

lol, scary that the Intel chipset is that fast Roll Eyes

Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #18 - Posted 2005-05-19 14:21:41 »

Maybe it uses system-ram, that would explain it.

Or it's running software-renderer Cheesy

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Online EgonOlsen
« Reply #19 - Posted 2005-05-19 20:27:12 »

Quote
Maybe it uses system-ram, that would explain it.

Or it's running software-renderer Cheesy
Of course it uses system ram...and no, it doesn't do software rendering. LWJGL stuff works just fine on the machine...just not very fast...
Wink

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

atombrot (19 views)
2014-08-19 09:29:53

Tekkerue (21 views)
2014-08-16 06:45:27

Tekkerue (21 views)
2014-08-16 06:22:17

Tekkerue (11 views)
2014-08-16 06:20:21

Tekkerue (19 views)
2014-08-16 06:12:11

Rayexar (55 views)
2014-08-11 02:49:23

BurntPizza (37 views)
2014-08-09 21:09:32

BurntPizza (26 views)
2014-08-08 02:01:56

Norakomi (35 views)
2014-08-06 19:49:38

BurntPizza (64 views)
2014-08-03 02:57:17
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!