This commit is contained in:
ZY4N
2024-12-22 16:58:40 +01:00
parent 2704814de2
commit db8db8f9d7
161 changed files with 17102 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
#pragma once
#include "opengl/handles/shader_program_handle.hpp"
#include <optional>
#include <vector>
namespace zgl {
class shader_program_lookup
{
public:
void add(
const shader_program_handle& shader_program_handle,
std::span<const shader_program_variable> all_attributes,
std::span<const shader_program_variable> all_uniforms
);
[[nodiscard]] std::optional<shader_program_handle> find(
shader_program_handle::attribute_support_type attributes,
shader_program_handle::uniform_support_type uniforms,
std::span<const shader_program_variable> 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<const shader_program_variable> 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<shader_program_handle::uniform_support_type> m_mesh_shader_program_uniforms;
std::vector<attribute_entry_type> m_mesh_shader_program_attributes;
std::vector<shader_program_handle> m_mesh_shader_programs;
};
}