31 using ProgramType = isf::parser::ShaderType;
38 : type{isf::parser::ShaderType::ISF}
46 SCORE_ASSERT(vec.size() == 2);
47 type = isf::parser::ShaderType::ISF;
51 ShaderSource(ProgramType tp,
const QString& vert,
const QString& frag)
58 ShaderSource(ProgramType tp,
const std::vector<QString>& vec)
60 SCORE_ASSERT(vec.size() == 2);
68 SCORE_ASSERT(vec.size() == 2);
70 fragment = std::move(vec[0]);
71 vertex = std::move(vec[1]);
85 const std::string_view language{};
88 static const inline std::array<MemberSpec, 2> specification{
89 MemberSpec{QObject::tr(
"Fragment"), &ShaderSource::fragment,
"GLSL"},
90 MemberSpec{QObject::tr(
"Vertex"), &ShaderSource::vertex,
"GLSL"},
93 friend QDebug& operator<<(QDebug& d,
const ShaderSource& sp)
95 return (d << sp.vertex << sp.fragment);
97 friend bool operator==(
const ShaderSource& lhs,
const ShaderSource& rhs)
noexcept
103 return lhs.type == rhs.type && lhs.vertex == rhs.vertex
104 && lhs.fragment == rhs.fragment;
106 friend bool operator!=(
const ShaderSource& lhs,
const ShaderSource& rhs)
noexcept
108 return !(lhs == rhs);
112 operator==(
const std::vector<QString>& lhs,
const ShaderSource& rhs)
noexcept
114 SCORE_ASSERT(lhs.size() == 2);
115 return lhs[0] == rhs.*(ShaderSource::specification[0].pointer)
116 && lhs[1] == rhs.*(ShaderSource::specification[1].pointer);
119 operator!=(
const std::vector<QString>& lhs,
const ShaderSource& rhs)
noexcept
121 return !(lhs == rhs);
160programFromVSAVertexShaderPath(
const QString& vertexFilename, QByteArray vertexData);
170preprocessShaderIncludes(QByteArray source,
const QString& originPath = {})
noexcept;
245 std::pair<std::optional<ProcessedProgram>, QString>
246 get(
const ShaderSource& program,
const QString& originPath = {})
noexcept;
248 ossia::hash_map<ProgramCacheKey, ProcessedProgram> programs;
258 ossia::hash_map<ProgramCacheKey, std::vector<IncludedFile>> includes;