ENIGMA Forums

General fluff => General ENIGMA => Topic started by: Goombert on August 29, 2013, 06:16:48 am

Title: Shaders
Post by: Goombert on August 29, 2013, 06:16:48 am
I rewrote all of ENIGMA's model batching last night to do some kickass batching. OpenGL 1 now uses this class and OGL 1.0 support is dropped minimum is now 1.1, as those have vertex arrays allowing me to use the same class and not be forced to use call lists which are slow as dog shit and bloat the ram they can't even handle big models. Anyway, I have programmed model batching not even that efficiently and it still whomps Game Makers ass using the fixed function pipeline.

The commit I am working on is available on Git, but I am not quite ready for it to be merged, when it is your games with models should have a huge performance increase.
https://github.com/enigma-dev/enigma-dev/pull/374

ENIGMA OpenGL 1
Ram Usage: 135,000 K
FPS: 25

GameMaker: Studio
Ram Usage: 180,000 K
FPS: 240ish

ENIGMA Direct3D 9.0
Ram Usage: 137,000 K
FPS: 260ish

ENIGMA OpenGL 3
Ram Usage: 59,000 K
FPS: 320ish

OpenGL 3 kicks studio's ass by a whopping 100 frames per second on their own fucking demo...
(http://oi39.tinypic.com/2w53cqv.jpg)

GameMaker: Studio sucks donkey dick, slower than a fuckin snail...
(http://oi41.tinypic.com/9vhxyt.jpg)

Direct3D 9.0 is a really shitty graphics API but still beats Studio a little bit...
(http://oi40.tinypic.com/208d1sj.jpg)

OpenGL 1 graphics are still slow but at least thanks to my new batching they can handle some models without killing over and bloating the ram.
(http://oi39.tinypic.com/ics9pw.jpg)

The memory usage of OpenGL 1 running their demo was almost half of what Stupido was using...
(http://oi43.tinypic.com/2lcnte0.jpg)

Direct3D 9.0 is really out of date, and too bloaty of an API...
(http://oi44.tinypic.com/er0j80.jpg)

I wish this software would die a miserable death...
(http://oi39.tinypic.com/2u883t3.jpg)

OpenGL 3 uses 1/4th the ram Stupido does...
(http://oi41.tinypic.com/154apue.jpg)

And the first one now, will later be last....
Title: Re: GameMaker: Studio sucks dick, and is massively fuckin slow
Post by: TheExDeus on August 29, 2013, 06:53:32 am
I like how you use swear words every 10 syllables and yet ironically was the one whining about them in ENIGMA.

Anyway, good job. Can you also test the current GL3 batching system and compare? Because while this is better on many levels (as in we should only use triangles anyway) I don't think there will be any noticeable difference between this and the one before. Less memory usage is nice of course.
I played around with shaders yesterday and had some problems with binding textures to texture units. It seems you also made a change to texture_set_stage() which maybe would fix the problem I was having.
Title: Re: The Times They Are A Changin'
Post by: Goombert on August 29, 2013, 07:24:46 am
Thanks, I will run tests for you later, I was up all night writing that and I need to get breakfast, etc. I still have like 1 or 2 things to fix, mainly d3d_model_cube, we can also add multitexturing to this mesh class. And yes harri, I did have to apply a fix to texture_set_stage() I really can't remember, just look at my commit I will check later and post back. I will later post my demo with bumpmapping and other shaders.

(http://oi43.tinypic.com/2e1ves7.jpg)

It also no longer matters how shitty you code the basic shapes, will be the same for DirectX since the batching will handle optimization for you. Also, Harri did you notice in ENIGMA its more anti-aliased? Are you guys setting those in the graphics system as default? I guess you were right they must just have never worked cause Linux blows, glad to be back on Windows.
Title: Re: The Times They Are A Changin'
Post by: DaSpirit on August 29, 2013, 10:11:19 am
This bechmark wasn't done well. Robert said in the forum that he was using the non-LLVM version of GM Studio. I ran YoYo's demos and the LLVM version gave me a 200 FPS boost (back when LLVM was in beta, and therefore free). In addition, Windows Task Manager is not meant for benchmarking. Use perfmon and resmon (both installed in Windows 7 by default).
Title: Re: The Times They Are A Changin'
Post by: Goombert on August 29, 2013, 10:15:58 am
Yes DaSpirit, and what are you trying your LLVM test on a for loop? If not you should try it on this specific demo since it is doing nothing more than calling d3d_model_draw, not to mention I have yet to add indexing.
Title: Re: The Times They Are A Changin'
Post by: polygone on August 29, 2013, 10:35:36 am
Why is GL1 so slow in comparison?
Title: Re: The Times They Are A Changin'
Post by: Goombert on August 29, 2013, 12:49:40 pm
Well it is the same speed as those old call lists ran, but it doesn't hit a limit or fuck up memory like they did, and wait until I add the indexing over to it as well it should be running games faster than those call lists. I will post back with its benchmark as well when it does the actual index batching.
Title: Re: The Times They Are A Changin'
Post by: TheExDeus on August 29, 2013, 02:07:19 pm
Quote
This bechmark wasn't done well. Robert said in the forum that he was using the non-LLVM version of GM Studio. I ran YoYo's demos and the LLVM version gave me a 200 FPS boost (back when LLVM was in beta, and therefore free). In addition, Windows Task Manager is not meant for benchmarking. Use perfmon and resmon (both installed in Windows 7 by default).
He was using task manager just to compare the ram usage. I think it's quite valid in that regard.
And I don't know about LLVM change, but you can probably run it faster in ENIGMA as well just by using types and such. I am not sure how effective it would be in this particular demo though (haven't seen the source).
Title: Re: The Times They Are A Changin'
Post by: Goombert on August 29, 2013, 08:59:53 pm
Well see Harri it would be useful if he would tell us what demo it was that he tested. And here is another thing, when I ran this from Studio 1.1 I got maximum 60fps or so, when I switched to 1.2 is when it went up to 240 some, so if that is the speed increase he is talking about, haha, I am sorry but they are going to have to try a little harder, because I clearly beat them.

Quote
There are several "performance bottlenecks", of which one of them is the pushing speed of data to the graphics card. When you call a OpenGL function, it will either calculate on the CPU or on the GPU (graphics card's processor). The GPU is optimized for graphics operations, but, the CPU must send it's data over to the GPU. This requires a lot of time.
That is why we are dropping call lists in favor of arrays. Cubes demo ends up well of 500,000 K ram usage with a fucking call list, this will make things better for people like polygonz who are stuck with shitty graphics hardware.
Title: Re: The Times They Are A Changin'
Post by: Goombert on August 31, 2013, 06:59:38 am
Alright guys I am pretty much finished I am just cleaning up a few things and resolving warnings this will be merged later on today. And the winner by far out of all of them is....


OpenGL 3!!!!!!
OpenGL 3!!!!!!
OpenGL 3!!!!!!

Edit: It is now ready to be merged...
https://github.com/enigma-dev/enigma-dev/pull/374
I also added the postfix ARB to OpenGL 3 model calls so that people with OpenGL 1.5 capable graphics hardware including polygonz should be able to use the newer graphics system, this was a huge fault in some earlier Intel chips.

Greg ran a test on Linux and this is what he got, but keep in mind he has very good hardware...
(https://dl.dropboxusercontent.com/u/26289275/perf.png)

Also the DirectX version is slow due to an issue with sprite batching I can get it up to 310 if I don't let it interfere with drawn models, I am searching for the fix.
Title: Re: The Times They Are A Changin'
Post by: TheExDeus on August 31, 2013, 05:08:05 pm
For me it seems OGL3 is slower now. At least when used with the new perf tester and drawing 200000 boxes I get only 28-30fps, while previously I had 660FPS. Maybe something else has happened. I will check later as not it's 1am.
Title: Re: The Times They Are A Changin'
Post by: Goombert on August 31, 2013, 05:21:21 pm
Harri, I think you forgot to set OpenGL 3, I made OGL1 work with the demo too by replacing call lists with vertex arrays since I know polygonz has that support, anybody with OGL 1.1 has support for Vertex Arrays, my speed went up by 7fps the mesh class also uses index buffering all the time now even if you do not supply the indices so that it can optimize different primitive types and automatically remove duplicate vertices from triangle fans. The only thing that could have possibly gotten slower is triangle or line list because I am adding an index buffer but that would only be for games that are already doing the super best batching they can, for other games that just repeatedly make new list primitives they should also be a fuckton faster. I would also appreciate it if you could test D3D9 harri.

I have also discovered what makes D3D9 100fps slower and its the sprite batching for some reason having it begin before I draw the model slows it down, I have to investigate.

Edit: Harri, also check and see if it was because I postfixed the glBuffer functions ARB, maybe that is why it slowed down on you. I did that so maybe I could get polygonz to be able to use OpenGL 3 as that is what the #opengl IRC channel advised me to do.
Title: Re: The Times They Are A Changin'
Post by: TheExDeus on September 01, 2013, 03:24:12 pm
Yup, never mind, forgot that the perftester is now egm, so it saves settings as well. When I set it to GL3 I get 545FPS with normal shading (shader - none) and up to 755FPS with toon shader. I see that you start to upload videos to youtube. I would do some too. Maybe some of the games in EDC. For recording I would want to use Shadowplay to get the most FPS, but Nvidia is really slow on releasing that.
Title: Re: The Times They Are A Changin'
Post by: Goombert on September 01, 2013, 03:37:27 pm
Just ask me Harri and I'll give you the credentials to log into our account, it should be on the staff board. Also, like I said triangle lists will slow down, well speed up if you have lots of primitives but down if a single primitive because and index buffer is added on top but its not checking for duplicate verts, triangle fans should really speed up as well as strips since it no longer takes duplicate verts to batch them to the triangle list but simply indexes them, but ya like I said we need to add an optimizer to triangle lists and line lists. But Harri, you said you used to get 600fps with my cubes demo? It should be going just as fast or faster now because my d3d_model_block already had them in the most optimal possible format with indexing, it should not have gotten one bit slower for you, it got 7fps faster for me.

I also wish you and polygonz would help me with DirectX some now since it can do models and quite a few games. There are still people on XP and OpenGL 1 is still horribly slow and nonsensical when on Windows without OpenGL 3 capable hardware.
Title: Re: The Times They Are A Changin'
Post by: TheExDeus on September 01, 2013, 04:13:43 pm
I can only test DX. I am not that interested in developing it right now. I would really want to finish porting GL3 now, but I am tight on time.

Anyway, DX segfaults in the meshes:
Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
0x005022ab in Mesh::BufferGenerate (this=0x34c350, subdata=false) at Graphics_Systems/Direct3D9/DX9model.cpp:364
364                     vertexbuffer->Lock(0, 0, (VOID**)&pVoid, 0);
(gdb) bt
#0  0x005022ab in Mesh::BufferGenerate (this=0x34c350, subdata=false) at Graphics_Systems/Direct3D9/DX9model.cpp:364
#1  0x0050365a in Mesh::Draw (this=0x34c350) at Graphics_Systems/Direct3D9/DX9model.cpp:387
#2  0x0041c56e in enigma_user::d3d_model_draw (id=1) at Graphics_Systems/Direct3D9/DX9model.cpp:564
#3  0x0042dbff in enigma_user::d3d_primitive_end () at Graphics_Systems/Direct3D9/DX9primitives.cpp:144
#4  0x004071a0 in enigma::OBJ_obj_floor::myevent_draw (this=0x348a10) at Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:322
#5  0x00434831 in enigma_user::screen_redraw () at Graphics_Systems/Direct3D9/DX9screen.cpp:179
#6  0x00403040 in enigma::ENIGMA_events () at Preprocessor_Environment_Editable/IDE_EDIT_events.h:103
#7  0x0041103e in WinMain@16 (hInstance=0x400000, hPrevInstance=hPrevInstance@entry=0x0, lpCmdLine=0xf23a78 "", iCmdShow=10) at Platforms/Win32/WINDOWSmain.cpp:313
#8  0x005c3b6d in main (flags=1, cmdline=0x340008, inst=0x11c1870) at /home/ruben/mingw-w64/src/mingw-w64/mingw-w64-crt/crt/crt0_c.c:18
(gdb)
Title: Re: The Times They Are A Changin'
Post by: Goombert on September 02, 2013, 02:16:37 am
Ok, now that, is fucked up, your segfaulting on locking a vertex buffer with a void pointer? How the fuck is that even occurring for you? Try it out on like a different game that just uses a model no basic shapes or d3d_draw_wall but d3d_model_wall and stuff.
Title: Re: The Times They Are A Changin'
Post by: Goombert on September 07, 2013, 02:36:58 pm
Hey guys just to update you again on this, I rewrote the cubes to use flat shading as was requested and switched it to my triangle fan batcher...

(http://s12.postimg.org/ctemkzdwc/test.jpg)

ENIGMA now out performs Studio by nearly 200 frames per second, the RAM usage went down to 45,000K
Title: Re: The Times They Are A Changin'
Post by: time-killer-games on September 07, 2013, 06:40:39 pm
Nice. :-)
Title: Re: The Times They Are A Changin'
Post by: Goombert on September 07, 2013, 06:42:24 pm
@TKG that is provided you switch the code in AddCube to d3d_model_block from what they had, so my model batcher handles it instead of just a huge fuck triangle list.
Title: Re: The Times They Are A Changin'
Post by: Kimidori on September 09, 2013, 11:02:20 pm
can I have that cube demo? I want to test it with YYC, can't find it anywhere.
Title: Re: The Times They Are A Changin'
Post by: Goombert on September 09, 2013, 11:18:42 pm
@Kimidori, when you launch/open Studio just select the "Demos" tab and run it, the GMX reader for LateralGM is not finished yet, I had to do a few special things to load it into ENIGMA. Nothing code wise, I've added the draw GUI event it's just postponed references with my reader not reading objects sprites and certain properties yet.
Title: Re: The Times They Are A Changin'
Post by: Goombert on August 10, 2014, 03:46:11 pm
I normally hate to bump topics but this is really important. I have now found an optimization for OpenGL1 static models that we were originally utilizing. Originally with fixed-function immediate mode and call lists there was drastic memory usage and crashing for some of us, I then sped models up by implementing vertex arrays, and now by compiling those with a gl call list I can buffer all of that to the GPU and remain compliant with GL1.1 which everyone's hardware supports including polygonz.

The framerate went from 13fps to 201 fps. The ram usage went from 100-113MB's down to 49MB's and then to 44MB's with the addition of clearing the data only for static models once they are buffered.
Note: Do not compare this to the earlier results of other systems, it was tested on a better graphics card, this system now outperforms GL3 and D3D9 on my computer.
(http://i.imgur.com/Nl0OroR.png)

Project Mario has also gone from 237/239fps for me to 261fps. These performances boosts should be for most games, but especially for those with very large models that have plenty of polygons.

This is the pull request where I am working on the improvements.
https://github.com/enigma-dev/enigma-dev/pull/788

Evidence of Display List and GL1.0 compliance.
http://wiki.processing.org/w/Display_List
Title: Re: GameMaker: Studio sucks dick, and is massively fuckin slow
Post by: Darkstar2 on August 10, 2014, 06:13:39 pm
I like how you use swear words every 10 syllables and yet ironically was the one whining about them in ENIGMA.

Was it him or was it yourself who whined about it, I reckon it was you who mentioned something about it.  There is lots of that in the source code even, by ENIGMA's own developers....for starters the developers should practice what they preach and that goes for everyone and stop putting the blame on users for giving the community a bad name because I strongly disagree with that.

As to Robert I think in this case the cussing was appropriate and made a strong point about GM, which I fully agree with.  I mean people pay for software that is bloated and expensive, and finding out that FREE software that is far from even being optimised still blows GM in terms of size and speed, that is a major **** in the arse for those of us who paid money for said software.

@Robert:  Wait for GMS 2 coming out next year, it'll probably be just as slow if not slower.  They took the lazy approach from day 1 and will not change their ways any time soon.  Their focus is getting the product out the door and cashing out $$$.  ENIGMA's development is slow but it aims to get things done right and as fast as possible in terms of performance.  Now imagine if ENIGMA cut ties with GM and did its OWN engine, with similar features to GM, with its own set of functions and more, it would be even better......

LOL @ the 25fps of OGL1
I didn't realise it was that bad.

BTW these changes you are doing, only affect 3D stuff right ? Does not affect (either positively or negatively) 2D stuff, which most people use, right ?
Title: Re: The Times They Are A Changin'
Post by: Goombert on August 10, 2014, 06:21:07 pm
No that quick optimization only applies to very large 3D models, Project Mario only got a slight boost because it really only has two high polygonal models, Mario and Yoshi. The rest is me redesigning threads and fixing bugs.

Also you should relax about the other stuff, I generally don't complain about anything anymore, ENIGMA being laid back is a very nice feature of this community that I've come to respect, second we should still remain professional on the outside, there is a time and place for everything, and I think the balance is kept well.
Title: Re: The Times They Are A Changin'
Post by: Darkstar2 on August 10, 2014, 06:50:10 pm
I love irony....
but you did not get the meaning.


Also you should relax about the other stuff, I generally don't complain about anything anymore,

Actually nothing wrong with complaining, when backing up arguments more than just saying "this sucks ****" etc..... you and many of us here have backed up with solid FACTS your complaints, for some, in lengthy detail :D  Besides I don't think people care, people want results and will judge ENIGMA by what it delivers - some of you clearly have not seen the bashing and flaming and unprofessional nature of many gaming and software forums out there, as I observed through the years.......:P  That's what moderators are there for.

Quote
ENIGMA being laid back is a very nice feature of this community that I've come to respect, second we should still remain professional on the outside, there is a time and place for everything, and I think the balance is kept well.

I agree however we shouldn't hold back on saying what we think just to please others.

You sure have not held back :P and neither have many developers of ENIGMA :P It should not stop its users either.

There are 2 differences between GMC and ENIGMA.

Here, if you don't agree with the administrator or developer, you still get to keep your account and post, and your post won't get deleted, edited or locked.

Is the GMC any more "professional" quite the opposite........
Title: Re: The Times They Are A Changin'
Post by: egofree on August 11, 2014, 04:13:42 am
I have now found an optimization for OpenGL1 static models that we were originally utilizing

This optimization seems great Robert, but i wonder : does it apply only to OpenGL 1.1 ? I am not sure if it is worth working on a version of a technology which is 17 years old ! (OpenGl 1.1 was released in 1997).
Title: Re: The Times They Are A Changin'
Post by: TheExDeus on August 11, 2014, 07:16:49 am
Quote
Was it him or was it yourself who whined about it, I reckon it was you who mentioned something about it.  There is lots of that in the source code even, by ENIGMA's own developers....for starters the developers should practice what they preach and that goes for everyone and stop putting the blame on users for giving the community a bad name because I strongly disagree with that.
This topic is a year old, so yes, he was the one who made a commit just to remove swear words from ENIGMA (and the steaming pile of **** error message) and in the commit message said how we should be more "professional". And I agreed, yet his topic's kept being filled with colorful language, thus the irony. He has mostly stopped doing that since.
Also, to my knowledge, I have never used language like that in ENIGMA's source.
Title: Re: The Times They Are A Changin'
Post by: Darkstar2 on August 11, 2014, 07:26:19 pm
This topic is a year old, so yes, he was the one who made a commit just to remove swear words from ENIGMA (and the steaming pile of **** error message) and in the commit message said how we should be more "professional". And I agreed, yet his topic's kept being filled with colorful language, thus the irony. He has mostly stopped doing that since.

Actually sometimes when used reasonably there is no harm in forum post, but there are some things I found in the source code, beyond unacceptable, certain things that could have serious implications, it goes far beyond cussing, and I won't go into it, but
agree, none of that shit should be present in the source code of all places, especially not racism, bigotry or slandering other companies or persons.

As far as keeping supporting old technology,
like OGL 1, that is a good point, you don't see many new generation games work with old hardware, games now require minimum DX9.....however, let's be honest about the type of games people make with crap studio and ENGIMA, it's not exactly state of the art.  Most of the rubbish people make in GM could easily be achieved in OGL1.  Very few people raise the bar and will do 3D stuff or stuff requiring advanced functionality.

I've actually seen some really amazing stuff done with GM, a really nice graphically rich FPS with reflections, grass and commercial quality.....but those are pins in a bloody hay stack. :D  Why because GayMaker (and ENIGMA) makes it easy for people to make 2D games, but the better games, 3D stuff, shaders, modeling, requires more advanced skill that most people using these software don't have :D
Title: Re: The Times They Are A Changin'
Post by: Goombert on August 11, 2014, 11:26:51 pm
Well a lot of that can be attributed to the cultural, social, and environmental influences I am no longer around people that make me want to curse like a maniac, or rather not as frequently. The reason for me being so contradictory is because I merely found swearing that intrusive to the users experience with our software to be a nuisance and also not very helpful.

Also I make a practice of putting my name on comments left in the source whenever they are extraneously descriptive, and therefore responsible for such comments. At any rate, this is off-topic, so please let's get back on topic.
Title: Re: The Times They Are A Changin'
Post by: sorlok_reaves on August 12, 2014, 02:14:50 pm
This topic is a year old, so yes, he was the one who made a commit just to remove swear words from ENIGMA (and the steaming pile of **** error message) and in the commit message said how we should be more "professional".

Don't worry, there's still a few rambling cursing error messages in the source (mostly in the compiler and instance system). It's a testament to ENIGMA's quality, though, since no-one ever actually sees them (since the compiler and instance system are fairly robust).