On Tuesday, 13 December 2016 at 21:27:57 UTC, Xavier Bigand wrote:
Hi,
I have the following code snippet :
void set()
{
GLfloat[] data = [
-1.0f, -1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
0.0f, 1.0f, 0.0f,
];
glBindVertexArray(mVAO);
glBufferData(GL_ARRAY_BUFFER, data.sizeof, cast(void*)data,
GL_STATIC_DRAW);
}
And I ask my self about the memory management of data, as my
data array is statically initialized is it allocated on stack?
Note that if you can define the data array as immutable, you save
on heap memory allocation + copying (LDC, from -O0):
https://godbolt.org/g/CNrZR7
-Johan