2#include <ossia/detail/variant.hpp>
4#include <score_plugin_gfx_export.h>
14class invalid_file :
public std::runtime_error
17 using std::runtime_error::runtime_error;
26 using value_type = bool;
27 using has_default = std::true_type;
33 using value_type = int64_t;
34 using has_minmax = std::true_type;
35 std::vector<ossia::variant<int64_t, double, std::string>> values;
36 std::vector<std::string> labels;
41 using value_type = double;
42 using has_minmax = std::true_type;
50 using value_type = std::array<double, 2>;
51 using has_minmax = std::true_type;
52 std::optional<value_type> def{};
53 std::optional<value_type> min{};
54 std::optional<value_type> max{};
59 using value_type = std::array<double, 3>;
60 using has_minmax = std::true_type;
61 std::optional<value_type> def{};
62 std::optional<value_type> min{};
63 std::optional<value_type> max{};
68 using value_type = std::array<double, 4>;
69 using has_minmax = std::true_type;
70 std::optional<value_type> def{};
71 std::optional<value_type> min{};
72 std::optional<value_type> max{};
105 std::vector<layout_field> layout;
113struct csf_image_input
118 std::string width_expression;
119 std::string height_expression;
124 using input_impl = ossia::variant<
125 float_input, long_input, event_input, bool_input, color_input, point2d_input,
126 point3d_input, image_input, audio_input, audioFFT_input, audioHist_input,
127 storage_input, texture_input, csf_image_input>;
136enum class attribute_type
219struct vertex_attribute
222 attribute_type type{};
226struct vertex_input : vertex_attribute
229struct vertex_output : vertex_attribute
232struct fragment_input : vertex_attribute
235struct fragment_output : vertex_attribute
243 bool float_storage{};
244 bool nearest_filter{};
245 std::string width_expression{};
246 std::string height_expression{};
258 std::string description;
260 std::vector<std::string> categories;
261 std::vector<input> inputs;
262 std::vector<pass> passes;
263 std::vector<std::string> pass_targets;
264 bool default_vertex_shader{};
268 std::string primitive_mode;
269 std::string line_size;
270 std::array<double, 4> background_color;
273 struct type_definition
276 std::vector<storage_input::layout_field> layout;
278 std::vector<type_definition> types;
282 std::array<int, 3> local_size{16, 16, 1};
283 std::string execution_type{
"2D_IMAGE"};
284 std::string target_resource;
285 std::array<int, 3> workgroups{1, 1, 1};
287 std::vector<dispatch_info> csf_passes;
291 std::vector<vertex_input> vertex_inputs;
292 std::vector<vertex_output> vertex_outputs;
293 std::vector<fragment_input> fragment_inputs;
294 std::vector<fragment_output> fragment_outputs;
297class SCORE_PLUGIN_GFX_EXPORT parser
299 std::string m_sourceVertex;
300 std::string m_sourceFragment;
301 std::string m_source_geometry_filter;
304 std::string m_vertex;
305 std::string m_fragment;
306 std::string m_geometry_filter;
311 enum class ShaderType
324 parser(std::string vert, std::string frag,
int glslVersion, ShaderType);
325 explicit parser(std::string isf_geom_filter, ShaderType t);
327 descriptor data()
const;
328 descriptor::Mode mode()
const;
329 std::string vertex()
const;
330 std::string fragment()
const;
331 std::string geometry_filter()
const;
332 std::string compute_shader()
const;
333 static std::pair<int, descriptor> parse_isf_header(std::string_view source);
334 void parse_shadertoy_json(
const std::string& json);
336 std::string write_isf()
const;
340 void parse_raw_raster_pipeline();
341 void parse_shadertoy();
342 void parse_glsl_sandbox();
343 void parse_geometry_filter();