English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 13 October 2015, 17:34   #81
tolkien
AmigaMan
 
tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 760
I have modified the palette and this is the result.




EDIT: trying differents values seems the format is BGRA. Now looks much better.


Last edited by tolkien; 13 October 2015 at 18:02.
tolkien is offline  
Old 13 October 2015, 18:12   #82
8bitbubsy
Registered User
 
8bitbubsy's Avatar
 
Join Date: Sep 2009
Location: Norway
Posts: 1,710
I modified the code and some tables now to make the program fully compliant with what pixel format is used by the target system (only in the normal non-OpenGL version).
Do an "svn checkout" again. Might make a conflict, better backup changes you did to diskop/helpers.c, then wipe folder and checkout, then copy changes over to the files. Let me know if it works...

Now Disk Op. and the realpath() stuff remains. Will look into that when I have more time.

Last edited by 8bitbubsy; 13 October 2015 at 18:22.
8bitbubsy is offline  
Old 13 October 2015, 18:53   #83
tolkien
AmigaMan
 
tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 760
Hey! Now It looks great! Good work mate. Good work!
tolkien is offline  
Old 13 October 2015, 22:16   #84
tolkien
AmigaMan
 
tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 760
I have testing It and I see that the CPU goes to 90% even with protracker stopped and without a mod loaded. Will see the main loop tomorrow.

Last edited by tolkien; 13 October 2015 at 23:20.
tolkien is offline  
Old 13 October 2015, 23:18   #85
Dunny
Registered User
 
Dunny's Avatar
 
Join Date: Aug 2006
Location: Scunthorpe/United Kingdom
Posts: 1,980
that might be SDL - I had that issue in one of my projects a while ago whilst using event waiting; SDL sits in a tight loop consuming 100% CPU time waiting for an event. Not nice.

D.
Dunny is offline  
Old 14 October 2015, 12:25   #86
8bitbubsy
Registered User
 
8bitbubsy's Avatar
 
Join Date: Sep 2009
Location: Norway
Posts: 1,710
No, it's not SDL, it's probably because I'm blitting a lot of 32-bit data 60 times a second, then I upscale it to 2x in software mode (also 60 times a second). I'm not blitting data only when it needs to be updated, I blit it all the time on top of eachother every frame. It doesn't even take 1% CPU on my Core i7-950 3GHz, but I guess there's not a single machine in the world running MorphOS locally with such a CPU. :P
I properly sleep when needed in the main loop so that the timeline is somewhat synced to 60Hz and so that it doesn't eat up all the CPU time.

Btw, the OpenGL version takes up more CPU time (ironically), but it also has a more stable 60Hz fps on modern GPUs (and it supports fullscreen mode - F11).
tolkien: Try to replace pt_main.c with this as a test to see how much CPU percentage it uses when rendering is disabled (no picture, just upscaling left): http://pastebin.com/CCssKPQ9

Last edited by 8bitbubsy; 14 October 2015 at 12:39.
8bitbubsy is offline  
Old 14 October 2015, 14:36   #87
Dunny
Registered User
 
Dunny's Avatar
 
Join Date: Aug 2006
Location: Scunthorpe/United Kingdom
Posts: 1,980
Ahh, yes. I also blit (though at 50fps) a full screen display, but obviously not on one of those CPUs

D.
Dunny is offline  
Old 14 October 2015, 14:39   #88
8bitbubsy
Registered User
 
8bitbubsy's Avatar
 
Join Date: Sep 2009
Location: Norway
Posts: 1,710
I'm in the process of rewriting the whole thing so that things are only blit when it needs to be updated. I already made the mouse pointer replace the background behind it when it moves, and started from scratch to make some update flags for status texts, ask dialogs etc... This will take a long time, but when it's done, it should be extremely fast, the only slow thing left then is the 2x screen blit routine and the audio mixer.
8bitbubsy is offline  
Old 14 October 2015, 16:45   #89
Bastich
Registered User
 
Bastich's Avatar
 
Join Date: Jul 2011
Location: UK
Posts: 341
Under DX or OGL rendering the whole screen every frame isn't an issue. Unless your hardware is as old as an Amiga Software rendering should be avoided at all costs.
Bastich is offline  
Old 14 October 2015, 16:53   #90
Dunny
Registered User
 
Dunny's Avatar
 
Join Date: Aug 2006
Location: Scunthorpe/United Kingdom
Posts: 1,980
Quote:
Originally Posted by Bastich View Post
Software rendering should be avoided at all costs.
Why do you say that? What's wrong with software rendering?

D.
Dunny is offline  
Old 14 October 2015, 17:02   #91
Bastich
Registered User
 
Bastich's Avatar
 
Join Date: Jul 2011
Location: UK
Posts: 341
Its very slow and can hog the CPU. The amount of data send to the GPU per frame should be minimized. In modern games etc in order to render a model all that is passed to the GPU is a matrix or 2 not every vertex and texture. Correct usage of GPU ram can speed rendering up massively. Hardware acceleration FTW.

Its what made the Amiga great to start with
Bastich is offline  
Old 14 October 2015, 18:28   #92
Dunny
Registered User
 
Dunny's Avatar
 
Join Date: Aug 2006
Location: Scunthorpe/United Kingdom
Posts: 1,980
Yeah, but in the context of a protracker remake hardware acceleration makes little sense. I mean, if all you're doing is displaying a 640x480 bitmap 60 times a second then it's going to take just as long to upload it to the gfx hardware as it is to blit it to the window surface.

D.
Dunny is offline  
Old 14 October 2015, 18:53   #93
Bastich
Registered User
 
Bastich's Avatar
 
Join Date: Jul 2011
Location: UK
Posts: 341
You would only upload the textures to the graphics card / GPU VRAM once and then its just a reference and coords that is passed (very few bytes) which is insanely faster than passing a texture across the bus each frame.

The only part that probably should be done in software is the oscilloscope and even that could be done using point spirites or in a pixel shader.

Great project runs full speed on my system

Last edited by Bastich; 14 October 2015 at 19:51.
Bastich is offline  
Old 14 October 2015, 20:32   #94
tolkien
AmigaMan
 
tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 760
Olav:
I have tried the new main. The CPU gets a bit lower but still high. Around 83% of cpu usage instead of the 90% with the original one.
Mates! My poor G4 need a few cycle saving!
tolkien is offline  
Old 15 October 2015, 01:44   #95
Dunny
Registered User
 
Dunny's Avatar
 
Join Date: Aug 2006
Location: Scunthorpe/United Kingdom
Posts: 1,980
Quote:
Originally Posted by Bastich View Post
You would only upload the textures to the graphics card / GPU VRAM once and then its just a reference and coords that is passed (very few bytes) which is insanely faster than passing a texture across the bus each frame.

The only part that probably should be done in software is the oscilloscope and even that could be done using point spirites or in a pixel shader.
Well, yes, for this project - but the rule "you should never use software rendering ever" is not true for all programs. My own tracks changes to the frame buffer as far as is possible, but as changes are impossible to predict it's actually faster to draw the buffer in software than it is to implement in hardware.

I know, I've tried it.

D.
Dunny is offline  
Old 15 October 2015, 09:39   #96
Bastich
Registered User
 
Bastich's Avatar
 
Join Date: Jul 2011
Location: UK
Posts: 341
You didn't quite quote me accurately there. What I actually said was "software rendering should be avoided at all costs" not "you should never use software rendering ever".

Out of interest thou which bit would be faster in software?
Bastich is offline  
Old 20 October 2015, 18:32   #97
8bitbubsy
Registered User
 
8bitbubsy's Avatar
 
Join Date: Sep 2009
Location: Norway
Posts: 1,710
I'm far in the new rewritten version that only blits data when it needs to be updated. A lot had to be changed, the only thing left is a couple of dialogs and some throughout testing of the whole tracker.
This version will actually be very close to the Amiga PT code. I even wrote a sprite engine that at the end of the frame render sprite objects from a list, then when the framebuffer is flipped, it erases them from the framebuffer again. Used for mouse pointer, loop points (sampler), sample play position line (sampler) and pattern cursor. This way I don't need to clear the screen every frame, and I use setSpritePos() just like in the original PT code.
This new version is not online yet, so the one on SVN is still the old one.

Anyways, the real CPU killer is the upscale function and apparently SDL_Flip().
SDL_Flip() on Windows seems to copy the surface pixels to the *real* framebuffer instead of just flipping, because in an SDL program with a big resolution and nothing more than sleep()+SDL_Flip(), it still takes quite some CPU time on my old Pentium M 2.0GHz laptop...

Last edited by 8bitbubsy; 20 October 2015 at 18:39.
8bitbubsy is offline  
Old 20 October 2015, 19:07   #98
tolkien
AmigaMan
 
tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 760
Cool mate. I'm here if you need some testing.
tolkien is offline  
Old 23 October 2015, 16:14   #99
8bitbubsy
Registered User
 
8bitbubsy's Avatar
 
Join Date: Sep 2009
Location: Norway
Posts: 1,710
The new optimized version is up at http://16-bits.org/pt.php and the SVN repository is updated.
This will probably not be faster on your system since the framebuffer flipping and upscaler is the CPU killer, as mentioned before, but it sure is faster in OpenGL mode for slower systems that still supports the ARB pixel buffer stuff. Much faster on my older Macs.
8bitbubsy is offline  
Old 23 October 2015, 18:06   #100
tolkien
AmigaMan
 
tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 760
Has SDL2 better performance than SDL? Is much different to try It with SDL2?
I'm only thinking
Will try your new version this weekend.
Thanks mate.
tolkien is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
SDL problem. tolkien Coders. C/C++ 10 24 March 2015 03:29
XAMOS - new cross-platform rewrite of jAMOS Mequa News 24 14 December 2012 09:49
use SDL 1.2.13 with AmyDevCpp TheDarkCoder Coders. General 3 18 August 2009 20:55
WinUAE w/SDL mangamuscle request.UAE Wishlist 8 31 January 2007 11:41
What do you know about Amiga SDL? Tolismlf Amiga scene 6 15 November 2004 18:54

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:25.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.11671 seconds with 13 queries