#pragma once #include "opengl/handles/shader_program_handle.hpp" #include #include namespace zgl { class shader_program_lookup { public: void add( const shader_program_handle& shader_program_handle, std::span all_attributes, std::span all_uniforms ); [[nodiscard]] std::optional find( shader_program_handle::attribute_support_type attributes, shader_program_handle::uniform_support_type uniforms, std::span all_attributes ) const; void print(); private: using attribute_locations_type = ztu::u32; [[nodiscard]] static attribute_locations_type attribute_location_flags( shader_program_handle::attribute_support_type attributes, std::span all_attributes ); struct attribute_entry_type { shader_program_handle::attribute_support_type attributes; attribute_locations_type locations; // Do not go past location 31!!! }; std::vector m_mesh_shader_program_uniforms; std::vector m_mesh_shader_program_attributes; std::vector m_mesh_shader_programs; }; }