Skip to content

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

Description

@mdparker

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);
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions