Jump to content

Light remove in real time causes a Crash


Dreikblack
 Share

Go to solution Solved by Josh,

Recommended Posts

image.thumb.png.6739a68eb135e2460e9e88eb82a7c1fd.png

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[]) {
    auto displays = GetDisplays();
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);
    auto framebuffer = CreateFramebuffer(window);
    auto world = CreateWorld();

    auto camera = CreateCamera(world);
    camera->SetClearColor(0.125);
    camera->SetFov(70);
    camera->Move(0, 2, -8);

    auto ground = CreateBox(world, 20, 1, 20);
    ground->SetPosition(0, -0.5, 0);
    ground->SetColor(0, 1, 0);

    auto light = CreatePointLight(world);

    //Main loop
    while (window->Closed() == false and window->KeyHit(KEY_ESCAPE) == false) {
        world->Update();
        world->Render(framebuffer);
        if (window->KeyHit(KEY_SPACE)) {
            light = nullptr;//crash
        }
    }
    return 0;
}

 

Link to comment
Share on other sites

No problems here. I just made some small changes to make the light easier to see:
 

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[]) {
    auto displays = GetDisplays();
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);
    auto framebuffer = CreateFramebuffer(window);
    auto world = CreateWorld();
    world->SetAmbientLight(0);

    auto camera = CreateCamera(world);
    camera->SetClearColor(0.125);
    camera->SetFov(70);
    camera->Move(0, 2, -8);

    auto ground = CreateBox(world, 20, 1, 20);
    ground->SetPosition(0, -0.5, 0);
    ground->SetColor(0, 1, 0);

    auto light = CreatePointLight(world);
    light->SetPosition(0, 2, 0);
    light->SetRange(0.1, 20);

    //Main loop
    while (window->Closed() == false and window->KeyHit(KEY_ESCAPE) == false) {
        world->Update();
        world->Render(framebuffer);
        if (window->KeyHit(KEY_SPACE)) {
            light = nullptr;//crash
        }
    }
    return 0;
}

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

The location of the call stack indicates the crash is happening in the Nvidia driver. Maybe the shadow map is being used after deletion. Let me swap out GPUs and see what my Nvidia card does.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Okay, my Nvidia card does the same thing. Did this behavior start recently? It could be related to the use of bindless textures for shadow maps.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

If I get rid of the call to glDeleteTextures() the problem goes away, so this seems very likely...

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...