TheCherno / Sparky

Cross-Platform High Performance 2D/3D game engine for people like me who like to write code.
Apache License 2.0
1.1k stars 221 forks source link

Still getting very low FPS count despite using Batch Rendering #119

Closed ncgreco1440 closed 8 years ago

ncgreco1440 commented 8 years ago

Just finished up Episode 10 on Sparky Game Engine and I'm finding that I seem to still be getting a very low FPS count despite Batch Rendering using only ~30MB on my system. If any improvement at all over simple2D renderer it's about 10 FPS which cannot be correct at all, but it feels like it is based on the mouse movement I'm seeing on the screen.

I'm running a GTX 750 Ti and I'm looking at roughly 15 FPS for those 57,000 sprites where as some people I'm seeing in the 800 - 3300 fps range...this seriously has me thinking "lolwut?!?!" Unless it has nothing to do with my GPU and maybe it's my AMD Phenom II CPU that's bottlenecking the vector and matrix multiplication?

Debug mode or Release I see no improvement...actually on Release I'm finding that simple2D renderer is BETTER than batch rendering... /facepalm

Up until now I've been following the series pretty well, but with the lack of information on what hardware Cherno was using I just can't seem to pinpoint what I could've done wrong here, or is my hardware just not up to par.

My Repo

supersammy7000 commented 8 years ago

To figure out what your fps should be you can just clone the episode 10 commit on the sparky project 48ea13b.

ncgreco1440 commented 8 years ago

I'm hitting about 27-35 FPS out of the box with Sparky on the E.10 commit, but I had to switch up glfw and glew to use dynamic libraries instead of the static ones, but despite what the FPS meter says it feels REALLY smooth like it should be telling me 60+ easy.

Anyways, I found my herp derp error...I felt very ambitious and wrote up all the possible overloads for the vec2, vec3, vec4, and mat4 structs and along the way I wrote something like this little number...

vec3& operator=(const vec3& vec)
{
    if(*this != vec)
    {
        this->x = vec.x;
        this->y = vec.y;
        this->z = vec.z;
    }
    return *this;
}

I dereferenced the this pointer and then did a comparison...when I should've been just comparing address values from the start...so at some moments I could've been running 3 comparisons for a pair of vec3 objects every assignment for every frame...

Edit: Just testing Release build and now we're in business, was hitting 380 FPS! So glad I got this sorted out, thanks for the tip.

supersammy7000 commented 8 years ago

No problem. If the issue is fixed please close the issue.