|
|
|
@ -85,6 +85,8 @@ addShaderProgram(MemoryArena* arena, |
|
|
|
snprintf(input_str, max_len, "%s%s", vs, fs); |
|
|
|
snprintf(input_str, max_len, "%s%s", vs, fs); |
|
|
|
u64 hash = utilFNV64a_str(input_str); |
|
|
|
u64 hash = utilFNV64a_str(input_str); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: replace with utilCStrMatch, and remove getShaderByHash, we don't
|
|
|
|
|
|
|
|
// need a hashing function if we're not storing in a hash table
|
|
|
|
if (getShaderByHash(gl_ctx, hash)) { |
|
|
|
if (getShaderByHash(gl_ctx, hash)) { |
|
|
|
LOGF(Error, "shader is already loaded\n"); |
|
|
|
LOGF(Error, "shader is already loaded\n"); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
@ -319,11 +321,13 @@ initGLAttribBuffer(GLBuffer* buf, GLenum target, GLVertexAttrib* attrib) |
|
|
|
buf->target = target; |
|
|
|
buf->target = target; |
|
|
|
buf->data_type = attrib->data_type; |
|
|
|
buf->data_type = attrib->data_type; |
|
|
|
buf->location = attrib->location; |
|
|
|
buf->location = attrib->location; |
|
|
|
|
|
|
|
// FIXME: this should be allocated on the same arena as the parent GLBuffer
|
|
|
|
|
|
|
|
// with utilAllocateCStr
|
|
|
|
buf->name = utilAllocateCStr(attrib->name); |
|
|
|
buf->name = utilAllocateCStr(attrib->name); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TODO: might as well pass in pointer to GLMesh, since that's how we're
|
|
|
|
// TODO: might as well pass in pointer to GLMesh, since that's how we're
|
|
|
|
// going to use this, can void copying GLMesh twice that way
|
|
|
|
// going to use this, can avoid copying GLMesh twice that way
|
|
|
|
GLMesh |
|
|
|
GLMesh |
|
|
|
loadGLMesh(MemoryArena* arena, |
|
|
|
loadGLMesh(MemoryArena* arena, |
|
|
|
const Mesh& m, |
|
|
|
const Mesh& m, |
|
|
|
@ -363,6 +367,7 @@ loadGLMesh(MemoryArena* arena, |
|
|
|
glEnableVertexAttribArray(attrib->location); |
|
|
|
glEnableVertexAttribArray(attrib->location); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: should we be re-using initGLAttribBuffer here?
|
|
|
|
glGenBuffers(1, &glm.element_buf->id); |
|
|
|
glGenBuffers(1, &glm.element_buf->id); |
|
|
|
glm.element_buf->target = GL_ELEMENT_ARRAY_BUFFER; |
|
|
|
glm.element_buf->target = GL_ELEMENT_ARRAY_BUFFER; |
|
|
|
glm.element_buf->data_type = GL_UNSIGNED_SHORT; |
|
|
|
glm.element_buf->data_type = GL_UNSIGNED_SHORT; |
|
|
|
|