From: Steinar H. Gunderson Date: Fri, 28 Mar 2014 20:15:05 +0000 (+0100) Subject: Merge branch 'epoxy' X-Git-Tag: 1.1~12 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=7ea0b3a5be9bafaa2d1fa5a17ce285a725ce132b Merge branch 'epoxy' Conflicts: effect_chain.cpp resource_pool.cpp --- 7ea0b3a5be9bafaa2d1fa5a17ce285a725ce132b diff --cc effect_chain.cpp index c6f1e89,7bce60f..0a01bd3 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@@ -279,9 -288,31 +279,10 @@@ void EffectChain::compile_glsl_program( frag_shader += "\n"; } frag_shader += string("#define INPUT ") + phase->effect_ids[phase->effects.back()] + "\n"; - frag_shader.append(read_file("footer.frag")); + frag_shader.append(read_version_dependent_file("footer", "frag")); - phase->glsl_program_num = resource_pool->compile_glsl_program(read_file("vs.vert"), frag_shader); + string vert_shader = read_version_dependent_file("vs", "vert"); + phase->glsl_program_num = resource_pool->compile_glsl_program(vert_shader, frag_shader); - - // Prepare the geometry for the fullscreen quad used in this phase. - // (We have separate VAOs per shader, since the bindings can in theory - // be different.) - float vertices[] = { - 0.0f, 1.0f, - 0.0f, 0.0f, - 1.0f, 1.0f, - 1.0f, 0.0f - }; - - glGenVertexArrays(1, &phase->vao); - check_error(); - glBindVertexArray(phase->vao); - check_error(); - - phase->position_vbo = fill_vertex_attribute(phase->glsl_program_num, "position", 2, GL_FLOAT, sizeof(vertices), vertices); - phase->texcoord_vbo = fill_vertex_attribute(phase->glsl_program_num, "texcoord", 2, GL_FLOAT, sizeof(vertices), vertices); // Same as vertices. - - glBindVertexArray(0); - check_error(); } // Construct GLSL programs, starting at the given effect and following diff --cc effect_chain.h index 2b959bd,e7d99d5..593232c --- a/effect_chain.h +++ b/effect_chain.h @@@ -16,12 -16,8 +16,12 @@@ // but if so, the threads' contexts need to be set up to share resources, since // the EffectChain holds textures and other OpenGL objects that are tied to the // context. +// +// Memory management (only relevant if you use multiple contexts): +// See corresponding comment in resource_pool.h. This holds even if you don't +// allocate your own ResourcePool, but let EffectChain hold its own. - #include + #include #include #include #include diff --cc resource_pool.h index aad95c9,7029fbf..a331f4f --- a/resource_pool.h +++ b/resource_pool.h @@@ -15,14 -15,8 +15,14 @@@ // Thread-safety: All functions except the constructor and destructor can be // safely called from multiple threads at the same time, provided they have // separate (but sharing) OpenGL contexts. +// +// Memory management (only relevant if you use multiple contexts): Some objects, +// like FBOs, are not shareable across contexts, and can only be deleted from +// the context they were created in. Thus, you will need to tell the +// ResourcePool explicitly if you delete a context, or they will leak (and the +// ResourcePool destructor will assert-fail). See clean_context(). - #include + #include #include #include #include