TheCherno/Sparky

Pressing "R" using Direct3D Rendering API

AlexVasiluta opened this issue · 3 comments

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!

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)

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?

Well, I'll try my best.