TheCherno / Sparky

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

Pressing "R" using Direct3D Rendering API #76

Closed AlexVasiluta closed 8 years ago

AlexVasiluta commented 8 years ago

If I press the letter "R" when using the Direct3D Rendering API I get this exception: http://imgur.com/3oMZ6nq and if I click continue I get these errors: http://imgur.com/Pbpdfht and redirects me here: https://imgur.com/AYSMwkl please solve this TheCherno!

Ilohama commented 8 years ago

The error is a stck overflow, in other words, there is too much calls of functions. That's why i was looking for code and don't understand how a function can be ended : File Shader.cpp : L48

    bool Shader::TryCompile(const String& source, String& error)
    {
        switch (Context::GetRenderAPI())
        {
            case RenderAPI::OPENGL:     return GLShader::TryCompile(source, error);
            case RenderAPI::DIRECT3D:   return D3DShader::TryCompile(source, error);
        }
        return nullptr;
    }

Edit: After looking in D3DShader, there's no override of the TryCompile function so case RenderAPI::DIRECT3D: return D3DShader::TryCompile(source, error); is calling bool Shader::TryCompile(const String& source, String& error)

TheCherno commented 8 years ago

Ah, I see. Pressing the 'R' key in Test3D is supposed to reload and recompile the PBR shader, and recompiling shaders isn't supported yet in DirectX. Hence why it's calling itself. Basically just don't press the 'R' key when running Test3D in DirectX mode until I or someone else fixes this.

Any takers?

Ilohama commented 8 years ago

Well, I'll try my best.