Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using contexts, compiling with optimizations takes several minutes #58

Open
mdparker opened this issue Sep 15, 2017 · 0 comments
Open

Comments

@mdparker
Copy link
Member

This was reported in the forums. I've verified with the following test app. Compile with dub -brelease --single app.d (with or without -ax86_64) will appear to hang for several minutes. I've only tested on Windows with DMD.

#!user/bin/env dub
/+ dub.sdl:
name "testgl"
dependency "derelict-glfw3" version="~>4.0.0-beta"
dependency "derelict-gl3" version="~>2.0.0-beta"
versions "DerelictGL3_Contexts"
+/
import derelict.glfw3;
import derelict.opengl;

mixin glContext;
GLContext ctx;

void main()
{
    DerelictGL3.load();
    DerelictGLFW3.load();

    if(!glfwInit()) throw new Exception("Failed to initialize GLFW");
    scope(exit) glfwTerminate();

    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
    glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);

    auto window = glfwCreateWindow(1024, 768, "Testing 1...2...3!", null, null);
    if(!window) throw new Exception("Failed to create GLFW window");

    glfwMakeContextCurrent(window);
    glfwSetKeyCallback(window, &keyCallback);

    ctx.load();
    ctx.glClearColor(0.2f, 0.3f, 0.3f, 1.0f);

    while(!glfwWindowShouldClose(window)) {
        glfwPollEvents();
        ctx.glClear(GL_COLOR_BUFFER_BIT);

        glfwSwapBuffers(window);
    }
}

extern(C) nothrow
void keyCallback(GLFWwindow* window, int key, int scanCode, int action, int mode)
{
    if(key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) {
        glfwSetWindowShouldClose(window, GL_TRUE);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant