X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=effect_chain.h;h=de50512f204b7f15fd67f9620307026c44fad528;hp=5baf9a599cb8a791a3b622877ae50741303fb7d8;hb=abd6d031918db487e0724218dc604d4a51e5f650;hpb=4b08ab8b7c55672e8a44afea18f5a6b3a66bd502 diff --git a/effect_chain.h b/effect_chain.h index 5baf9a5..de50512 100644 --- a/effect_chain.h +++ b/effect_chain.h @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -147,6 +148,11 @@ struct Phase { Node *output_node; GLuint glsl_program_num; // Owned by the resource_pool. + + // Position and texcoord attribute indexes, although it doesn't matter + // which is which, because they contain the same data. + std::set attribute_indexes; + bool input_needs_mipmaps; // Inputs are only inputs from other phases (ie., those that come from RTT); @@ -173,8 +179,13 @@ struct Phase { std::vector > uniforms_vec4; std::vector > uniforms_mat3; + GLuint ubo; // GL_INVALID_INDEX if not using UBOs. + GLuint uniform_block_index; + std::vector ubo_data; + // For measurement of GPU time used. - GLuint timer_query_object; + std::list timer_query_objects_running; + std::list timer_query_objects_free; uint64_t time_elapsed_ns; uint64_t num_measured_iterations; }; @@ -187,7 +198,7 @@ public: // will create its own that is not shared with anything else. Does not take // ownership of the passed-in ResourcePool, but will naturally take ownership // of its own internal one if created. - EffectChain(float aspect_nom, float aspect_denom, ResourcePool *resource_pool = NULL); + EffectChain(float aspect_nom, float aspect_denom, ResourcePool *resource_pool = NULL, GLenum intermediate_format = GL_RGBA16F); ~EffectChain(); // User API: @@ -360,7 +371,10 @@ private: Phase *construct_phase(Node *output, std::map *completed_effects); // Execute one phase, ie. set up all inputs, effects and outputs, and render the quad. - void execute_phase(Phase *phase, bool last_phase, std::map *output_textures, std::set *generated_mipmaps); + void execute_phase(Phase *phase, bool last_phase, + std::set *bound__attribute_indices, + std::map *output_textures, + std::set *generated_mipmaps); // Set up uniforms for one phase. The program must already be bound. void setup_uniforms(Phase *phase); @@ -428,9 +442,11 @@ private: std::vector inputs; // Also contained in nodes. std::vector phases; + GLenum intermediate_format; unsigned num_dither_bits; OutputOrigin output_origin; bool finalized; + GLuint vbo; // Contains vertex and texture coordinate data. ResourcePool *resource_pool; bool owns_resource_pool;