Results 1 to 10 of 46

Thread: Multithreaded resource loading

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2
    Hi Andru,

    I'm afraid, the first time it ran, this was all that was displayed where the speaker should be:-

    Corruption.png

    I've run it again, and it works perfectly. Here's the log from the first run.

    Code:
    =====================
    === ZenGL 0.2 RC4 ===
    =====================
    [00000000ms] Begin
    [00000001ms] Current mode: 1680 x 1050
    [00000628ms] wglChoosePixelFormatARB: zDepth = 24; stencil = 0; fsaa = 0
    [00000678ms] Create OpenGL Context
    [00000699ms] Making current OpenGL context
    [00000699ms] GL_VERSION: 2.1.2
    [00000699ms] GL_RENDERER: GeForce 7600 GT/PCI/SSE2/3DNOW!
    [00000699ms] GL_MAX_TEXTURE_SIZE: 4096
    [00000699ms] GL_ARB_TEXTURE_COMPRESSION: TRUE
    [00000699ms] GL_EXT_TEXTURE_COMPRESSION_S3TC: TRUE
    [00000699ms] GL_MAX_TEXTURE_UNITS_ARB: 4
    [00000700ms] GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: 16
    [00000700ms] GL_EXT_BLEND_FUNC_SEPARATE: TRUE
    [00000700ms] GL_ARB_VERTEX_BUFFER_OBJECT: TRUE
    [00000700ms] GL_EXT_FRAMEBUFFER_OBJECT: TRUE
    [00000700ms] WGL_PBUFFER: TRUE
    [00000700ms] Support WaitVSync: TRUE
    [00000702ms] DirectSound: loading DSound.dll
    [00001107ms] DirectSound: sound system initialized
    [00001505ms] Texture loaded: "data/font-page0.png"
    [00001602ms] Texture loaded: "data/halloween/Alien.png"
    [00001679ms] Texture loaded: "data/halloween/Bat.png"
    [00001752ms] Texture loaded: "data/halloween/Casper.png"
    [00001820ms] Texture loaded: "data/halloween/Chucky.png"
    [00001894ms] Texture loaded: "data/halloween/Devil.png"
    [00001959ms] Texture loaded: "data/halloween/Dracula.png"
    [00002022ms] Texture loaded: "data/halloween/Frankenstein.png"
    [00002090ms] Texture loaded: "data/halloween/Freddie.png"
    [00002145ms] Texture loaded: "data/halloween/Ghost.png"
    [00002204ms] Texture loaded: "data/halloween/Gomez.png"
    [00002254ms] Texture loaded: "data/halloween/Jack Skellington.png"
    [00002305ms] Texture loaded: "data/halloween/Jason.png"
    [00002367ms] Texture loaded: "data/halloween/Kokey.png"
    [00002426ms] Texture loaded: "data/halloween/Mike.png"
    [00002490ms] Texture loaded: "data/halloween/Mummy.png"
    [00002542ms] Texture loaded: "data/halloween/Pumpkin.png"
    [00002601ms] Texture loaded: "data/halloween/Scream.png"
    [00002657ms] Texture loaded: "data/halloween/Skull.png"
    [00002715ms] Texture loaded: "data/halloween/Slimer.png"
    [00002767ms] Texture loaded: "data/halloween/Squash.png"
    [00002773ms] Sound loaded: "data/click.wav"
    [00002786ms] Texture loaded: "data/audio-stop.png"
    [00002800ms] Texture loaded: "data/audio-play.png"
    [00002925ms] Texture loaded: "data/zengl.png"
    [00057600ms] Ogg: Initialized
    [00084432ms] Average FPS: 747
    [00084460ms] Timers to free: 2
    [00084461ms] Render Targets to free: 0
    [00084460ms] Atlases to free: 0
    [00084460ms] Textures to free: 26
    [00084460ms] Fonts to free: 1
    [00084461ms] Sounds to free: 1
    [00084624ms] DirectSound: sound system finalized
    [00084707ms] End
    Really, this is exactly the same as the first time I tried it. The first run, it failed with a corrupted image... after that, all seemed OK.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  2. #2
    Here's my run:

    Code:
    =====================
    === ZenGL 0.2 RC4 ===
    =====================
    [00000000ms] Begin
    [00000000ms] Current mode: 1680 x 1050
    [00000180ms] wglChoosePixelFormatARB: zDepth = 24; stencil = 0; fsaa = 0
    [00000197ms] Create OpenGL Context
    [00000199ms] Making current OpenGL context
    [00000200ms] GL_VERSION: 3.3.0
    [00000200ms] GL_RENDERER: GeForce 8800 GT/PCI/SSE2
    [00000200ms] GL_MAX_TEXTURE_SIZE: 8192
    [00000200ms] GL_ARB_TEXTURE_COMPRESSION: TRUE
    [00000200ms] GL_EXT_TEXTURE_COMPRESSION_S3TC: TRUE
    [00000200ms] GL_MAX_TEXTURE_UNITS_ARB: 4
    [00000200ms] GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: 16
    [00000200ms] GL_EXT_BLEND_FUNC_SEPARATE: TRUE
    [00000200ms] GL_ARB_VERTEX_BUFFER_OBJECT: TRUE
    [00000200ms] GL_EXT_FRAMEBUFFER_OBJECT: TRUE
    [00000200ms] WGL_PBUFFER: TRUE
    [00000201ms] Support WaitVSync: TRUE
    [00000201ms] DirectSound: loading DSound.dll
    [00000223ms] DirectSound: sound system initialized
    [00000465ms] Texture loaded: "data/font-page0.png"
    [00001069ms] Texture loaded: "data/halloween/Alien.png"
    [00001123ms] Texture loaded: "data/halloween/Bat.png"
    [00001174ms] Texture loaded: "data/halloween/Casper.png"
    [00001224ms] Texture loaded: "data/halloween/Chucky.png"
    [00001278ms] Texture loaded: "data/halloween/Devil.png"
    [00001327ms] Texture loaded: "data/halloween/Dracula.png"
    [00001377ms] Texture loaded: "data/halloween/Frankenstein.png"
    [00001432ms] Texture loaded: "data/halloween/Freddie.png"
    [00001484ms] Texture loaded: "data/halloween/Ghost.png"
    [00001534ms] Texture loaded: "data/halloween/Gomez.png"
    [00001582ms] Texture loaded: "data/halloween/Jack Skellington.png"
    [00001632ms] Texture loaded: "data/halloween/Jason.png"
    [00001684ms] Texture loaded: "data/halloween/Kokey.png"
    [00001737ms] Texture loaded: "data/halloween/Mike.png"
    [00001792ms] Texture loaded: "data/halloween/Mummy.png"
    [00001841ms] Texture loaded: "data/halloween/Pumpkin.png"
    [00001888ms] Texture loaded: "data/halloween/Scream.png"
    [00001941ms] Texture loaded: "data/halloween/Skull.png"
    [00001995ms] Texture loaded: "data/halloween/Slimer.png"
    [00002046ms] Texture loaded: "data/halloween/Squash.png"
    [00002049ms] Sound loaded: "data/click.wav"
    [00002061ms] Texture loaded: "data/audio-stop.png"
    [00002070ms] Texture loaded: "data/audio-play.png"
    [00002144ms] Texture loaded: "data/zengl.png"
    [00005586ms] Average FPS: 1901
    [00005608ms] Timers to free: 2
    [00005608ms] Render Targets to free: 0
    [00005608ms] Atlases to free: 0
    [00005608ms] Textures to free: 26
    [00005608ms] Fonts to free: 1
    [00005608ms] Sounds to free: 1
    [00005709ms] DirectSound: sound system finalized
    [00005728ms] End
    My pc is a
    Intel Core 2 Duo E6850 - 2gb ram
    8800gt - Nvidia driver 258.96


    The first time it ran, it didnt show the speaker graphic at all, just a black space.
    The next time it did show the speaker, then after that it didnt come back.

    It seemed to run okay (apart from the missing speaker) when I minimised it or dragged the window around while it was loading.
    My site: DelphiTuts.com (coming soon)...

    Download Font Studio 4.21 here.

  3. #3
    PGDCE Developer de_jean_7777's Avatar
    Join Date
    Nov 2006
    Location
    Bosnia and Herzegovina (Herzegovina)
    Posts
    287
    Here is the log file.

    Code:
    =====================
    === ZenGL 0.2 RC4 ===
    =====================
    [00000000ms] Begin
    [00000001ms] Current mode: 1152 x 864
    [00000067ms] wglChoosePixelFormatARB: zDepth = 24; stencil = 0; fsaa = 0
    [00000129ms] Create OpenGL Context
    [00000130ms] Making current OpenGL context
    [00000130ms] GL_VERSION: 1.3.0 - Build 4.14.10.4342
    [00000130ms] GL_RENDERER: Intel 845G
    [00000130ms] GL_MAX_TEXTURE_SIZE: 2048
    [00000130ms] GL_ARB_TEXTURE_COMPRESSION: TRUE
    [00000130ms] GL_EXT_TEXTURE_COMPRESSION_S3TC: TRUE
    [00000130ms] GL_MAX_TEXTURE_UNITS_ARB: 4
    [00000130ms] GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: 2
    [00000130ms] GL_EXT_BLEND_FUNC_SEPARATE: FALSE
    [00000130ms] GL_ARB_VERTEX_BUFFER_OBJECT: TRUE
    [00000130ms] GL_EXT_FRAMEBUFFER_OBJECT: FALSE
    [00000130ms] WGL_PBUFFER: TRUE
    [00000130ms] Support WaitVSync: TRUE
    [00000132ms] DirectSound: loading DSound.dll
    [00000261ms] DirectSound: sound system initialized
    [00000883ms] Texture loaded: "data/font-page0.png"
    [00001153ms] Texture loaded: "data/halloween/Alien.png"
    [00001284ms] Texture loaded: "data/halloween/Bat.png"
    [00001400ms] Texture loaded: "data/halloween/Casper.png"
    [00001525ms] Texture loaded: "data/halloween/Chucky.png"
    [00001661ms] Texture loaded: "data/halloween/Devil.png"
    [00001796ms] Texture loaded: "data/halloween/Dracula.png"
    [00001927ms] Texture loaded: "data/halloween/Frankenstein.png"
    [00002062ms] Texture loaded: "data/halloween/Freddie.png"
    [00002256ms] Texture loaded: "data/halloween/Ghost.png"
    [00002421ms] Texture loaded: "data/halloween/Gomez.png"
    [00002540ms] Texture loaded: "data/halloween/Jack Skellington.png"
    [00002660ms] Texture loaded: "data/halloween/Jason.png"
    [00002784ms] Texture loaded: "data/halloween/Kokey.png"
    [00002914ms] Texture loaded: "data/halloween/Mike.png"
    [00003046ms] Texture loaded: "data/halloween/Mummy.png"
    [00003160ms] Texture loaded: "data/halloween/Pumpkin.png"
    [00003271ms] Texture loaded: "data/halloween/Scream.png"
    [00003390ms] Texture loaded: "data/halloween/Skull.png"
    [00003524ms] Texture loaded: "data/halloween/Slimer.png"
    [00003650ms] Texture loaded: "data/halloween/Squash.png"
    [00003653ms] Sound loaded: "data/click.wav"
    [00003676ms] Texture loaded: "data/audio-stop.png"
    [00003699ms] Texture loaded: "data/audio-play.png"
    [00003893ms] Texture loaded: "data/zengl.png"
    Existence is pain

  4. #4
    Thanks for tests and logs. This weekend I will try to make a demo with second thread that will have own window and DC(maybe problem in one Device Context for two threads under Windows). Till that I will be waiting an answer from service centre, because today power supply from my PC died...

  5. #5
    my pc is P4 3 GHz
    Nvidia 8400 512Ram

    Runs great
    Code:
    =====================
    === ZenGL 0.2 RC4 ===
    =====================
    [00000001ms] Begin
    [00000001ms] Current mode: 1024 x 768
    [00001111ms] wglChoosePixelFormatARB: zDepth = 24; stencil = 0; fsaa = 0
    [00001195ms] Create OpenGL Context
    [00001211ms] Making current OpenGL context
    [00001212ms] GL_VERSION: 3.3.0
    [00001212ms] GL_RENDERER: GeForce 8400 GS/PCI/SSE2
    [00001212ms] GL_MAX_TEXTURE_SIZE: 8192
    [00001212ms] GL_ARB_TEXTURE_COMPRESSION: TRUE
    [00001212ms] GL_EXT_TEXTURE_COMPRESSION_S3TC: TRUE
    [00001213ms] GL_MAX_TEXTURE_UNITS_ARB: 4
    [00001220ms] GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: 16
    [00001220ms] GL_EXT_BLEND_FUNC_SEPARATE: TRUE
    [00001220ms] GL_ARB_VERTEX_BUFFER_OBJECT: TRUE
    [00001220ms] GL_EXT_FRAMEBUFFER_OBJECT: TRUE
    [00001220ms] WGL_PBUFFER: TRUE
    [00001220ms] Support WaitVSync: TRUE
    [00001276ms] DirectSound: loading DSound.dll
    [00001386ms] DirectSound: sound system initialized
    [00001756ms] Texture loaded: "data/font-page0.png"
    [00001891ms] Texture loaded: "data/halloween/Alien.png"
    [00001997ms] Texture loaded: "data/halloween/Bat.png"
    [00002098ms] Texture loaded: "data/halloween/Casper.png"
    [00002197ms] Texture loaded: "data/halloween/Chucky.png"
    [00002304ms] Texture loaded: "data/halloween/Devil.png"
    [00002403ms] Texture loaded: "data/halloween/Dracula.png"
    [00002500ms] Texture loaded: "data/halloween/Frankenstein.png"
    [00002607ms] Texture loaded: "data/halloween/Freddie.png"
    [00002711ms] Texture loaded: "data/halloween/Ghost.png"
    [00002810ms] Texture loaded: "data/halloween/Gomez.png"
    [00002903ms] Texture loaded: "data/halloween/Jack Skellington.png"
    [00003000ms] Texture loaded: "data/halloween/Jason.png"
    [00003102ms] Texture loaded: "data/halloween/Kokey.png"
    [00003205ms] Texture loaded: "data/halloween/Mike.png"
    [00003313ms] Texture loaded: "data/halloween/Mummy.png"
    [00003408ms] Texture loaded: "data/halloween/Pumpkin.png"
    [00003500ms] Texture loaded: "data/halloween/Scream.png"
    [00003597ms] Texture loaded: "data/halloween/Skull.png"
    [00003705ms] Texture loaded: "data/halloween/Slimer.png"
    [00003803ms] Texture loaded: "data/halloween/Squash.png"
    [00003824ms] Sound loaded: "data/click.wav"
    [00003844ms] Texture loaded: "data/audio-stop.png"
    [00003862ms] Texture loaded: "data/audio-play.png"
    [00004009ms] Texture loaded: "data/zengl.png"
    [00017844ms] Ogg: Initialized
    [00040080ms] Average FPS: 197
    [00040091ms] Timers to free: 2
    [00040091ms] Render Targets to free: 0
    [00040091ms] Atlases to free: 0
    [00040091ms] Textures to free: 26
    [00040126ms] Fonts to free: 1
    [00040126ms] Sounds to free: 1
    [00040132ms] DirectSound: sound system finalized
    [00040197ms] End

  6. #6
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    works 100% on both graphics cards (I have stretchable) with this spec:
    windows 7 Hp 64 bit
    4gb ddr3 ram
    ATI 4330HD and GMA 4500MHD
    SU4100 @ 1.3ghz

    loaded great, and wuite fast. Cpu tops out at around 7-8% with a few megs of ram.
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  7. #7
    I was able to make my ImageViewer work with separate thread properly.

    Execute doesn't free on exit but it sets Finished variable true. Main application loop checks in its start if Finished is set and then do the Finish; to bind texture and fill the data in with glTexImage2D().
    Code:
      TLoadThread = class(TThread)
      private
        fn: string;
        texIndex: integer;
        finished: boolean;
      public
        constructor Create(_texIndex: integer; _fn: string);
        procedure Execute; override;
        procedure Finish;
      end;
    
    constructor TLoadThread.Create(_texIndex: integer; _fn: string);
    begin
      inherited Create(False);
      texIndex:=_texIndex; fn:=_fn;
      finished:=false;
      FreeOnTerminate:=True;
    end;
    
    procedure TLoadThread.Execute;
    begin
      tex.LoadTextureData(@tex.texture[texIndex],fn);
      if terminated then exit;
      finished:=true;
    end;
    
    procedure TLoadThread.Finish;
    begin
      tex.Restore(texIndex);
      form1.loader:=nil;
      form1.MakeDispList;
      Terminate;
    end;
    ps. missing pascal tags...
    Last edited by User137; 07-10-2010 at 09:57 PM.

  8. #8
    Quote Originally Posted by User137
    Execute doesn't free on exit but it sets Finished variable true. Main application loop checks in its start if Finished is set and then do the Finish; to bind texture and fill the data in with glTexImage2D().
    Yeah, this is one of solution, but this is not so interesting as two independent threads And if I get a fail, I will use this method to load the resources(decoding in separate thread and uploading to videocard in main thread).

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •