mirror of
https://github.com/MartinOpat/cuda-based-raytrace.git
synced 2025-06-07 02:13:10 +02:00
fix: forgor to allocate gpu memory
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "MainWindow.h"
|
||||
|
||||
#include "cuda_runtime.h"
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
@@ -56,7 +57,7 @@ int Window::init(float* data) {
|
||||
Window::tick();
|
||||
}
|
||||
|
||||
Window::free();
|
||||
Window::free(data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -73,10 +74,11 @@ int Window::init_quad(float* data) {
|
||||
}
|
||||
|
||||
|
||||
void Window::free() {
|
||||
void Window::free(float* data) {
|
||||
// To preserve the proper destruction order we forcefully set the quads to null (calling their destructor in the process)
|
||||
// Not strictly necessary, but i saw some weird errors on exit without this so best to keep it in.
|
||||
this->current_quad = nullptr;
|
||||
cudaFree(data);
|
||||
|
||||
glfwDestroyWindow(window);
|
||||
glfwTerminate();
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
Window(unsigned int w, unsigned int h);
|
||||
|
||||
int init(float* data);
|
||||
void free();
|
||||
void free(float* data);
|
||||
void resize(unsigned int w, unsigned int h);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user