Commit bceb5936 authored by Johannes Braun's avatar Johannes Braun
Browse files

Removed all 'new' keywords. (Grid LS not working all too correctly btw)

parent 1f0c5485
......@@ -4,7 +4,7 @@ Size=353,64
Collapsed=0
[Scene]
Pos=10,88
Pos=11,89
Size=352,837
Collapsed=0
......
#include <raytrace/data/grid_linespace.h>
#include <core/numeric/geometry.h>
#include <core/state.h>
int main(int argc, char* argv[])
{
math::Bounds bounds{ {0, 0, 0, 1}, {10, 10, 10, 1} };
glare::raytrace::compute(bounds, 4, 10);
return 0;
......
......@@ -56,9 +56,14 @@ namespace glare::core
for (int i = 0; i < num_uniforms; ++i) {
UniformInfo data;
char* name = new char[max_length];
gl::getActiveUniform(m_handle, i, max_length, &data.size, &data.type, name);
//char* name = new char[max_length];
int length;
std::string name;
name.resize(max_length);
gl::getActiveUniform(m_handle, i, max_length, &length, &data.size, &data.type, name.data());
name.resize(length);
data.name = name;
data.index = uniformLocation(name);
m_uniforms[data.name] = data;
......@@ -74,8 +79,6 @@ namespace glare::core
m_uniforms[data.name] = data;
}
}
delete[] name;
}
}
......@@ -91,9 +94,9 @@ namespace glare::core
for (int sr = 0; sr < num_subroutines; ++sr)
{
int length;
char* name = new char[max_length];
gl::getActiveSubroutineName(m_handle, shader->type(), sr, max_length, &length, name);
std::string name;
gl::getActiveSubroutineName(m_handle, shader->type(), sr, max_length, &length, name.data());
name.resize(length);
SubroutineInfo info;
info.index = sr;
info.name = name;
......@@ -101,8 +104,6 @@ namespace glare::core
m_subroutines[info.name].emplace(info.shader_type, info);
delete[] name;
}
}
}
......
......@@ -58,7 +58,8 @@ namespace glare::core
Context::id_type Context::create()
{
auto new_context = std::unique_ptr<Context>(new Context());
struct unique_context_enable : public Context {};
auto new_context = std::make_unique<unique_context_enable>();
const auto id = new_context->id();
m_contexts.emplace(new_context->id(), std::move(new_context));
return id;
......@@ -203,10 +204,7 @@ namespace glare::core
if (m_current_context == this)
m_current_context = nullptr;
m_contexts.erase(id());
//m_messages->lock();
m_window.close();
//m_graph_root->clearChildren();
//messaging::Handler::getInstance().unlock();
}
void Context::update()
......
......@@ -150,7 +150,8 @@ namespace glare::core
template<typename... Args>
Context::id_type Context::create(Args&&... args)
{
auto new_context = std::unique_ptr<Context>(new Context());
struct unique_context_enable : public Context {};
auto new_context = std::make_unique<unique_context_enable>();
m_contexts.emplace(new_context->id(), std::move(new_context));
new_context->initialize(std::forward<Args>(args)...);
return new_context->id();
......
......@@ -869,9 +869,9 @@ namespace gl
glShaderStorageBlockBinding(program, index, binding);
}
void getActiveUniform(unsigned program, unsigned index, int buffer_size, int* out_uniform_size, gl::UniformType* out_type, char* out_name)
void getActiveUniform(unsigned program, unsigned index, int buffer_size, int* characters, int* out_uniform_size, gl::UniformType* out_type, char* out_name)
{
glGetActiveUniform(program, index, buffer_size, &buffer_size, out_uniform_size, reinterpret_cast<unsigned*>(out_type), out_name);
glGetActiveUniform(program, index, buffer_size, characters, out_uniform_size, reinterpret_cast<unsigned*>(out_type), out_name);
}
void programUniformui64(unsigned program, unsigned location, uint64_t value)
......
......@@ -1107,7 +1107,7 @@ namespace gl
void shaderStorageBlockBinding(unsigned program, unsigned index, unsigned binding);
// program uniforms
void getActiveUniform(unsigned program, unsigned index, int buffer_size, int* out_uniform_size, gl::UniformType* out_type, char* out_name);
void getActiveUniform(unsigned program, unsigned index, int buffer_size, int* characters, int* out_uniform_size, gl::UniformType* out_type, char* out_name);
void programUniformui64(unsigned program, unsigned location, uint64_t value);
void programUniformi64(unsigned program, unsigned location, int64_t value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment