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{};
109 std::vector<layout_field> layout;
117struct csf_image_input
122 std::string width_expression;
123 std::string height_expression;
128 using input_impl = ossia::variant<
129 float_input, long_input, event_input, bool_input, color_input, point2d_input,
130 point3d_input, image_input, cubemap_input, audio_input, audioFFT_input,
131 audioHist_input, storage_input, texture_input, csf_image_input>;
140enum class attribute_type
223struct vertex_attribute
226 attribute_type type{};
230struct vertex_input : vertex_attribute
233struct vertex_output : vertex_attribute
236struct fragment_input : vertex_attribute
239struct fragment_output : vertex_attribute
247 bool float_storage{};
248 bool nearest_filter{};
249 std::string width_expression{};
250 std::string height_expression{};
262 std::string description;
264 std::vector<std::string> categories;
265 std::vector<input> inputs;
266 std::vector<pass> passes;
267 std::vector<std::string> pass_targets;
268 bool default_vertex_shader{};
272 std::string primitive_mode;
273 std::string line_size;
274 std::array<double, 4> background_color;
277 struct type_definition
280 std::vector<storage_input::layout_field> layout;
282 std::vector<type_definition> types;
286 std::array<int, 3> local_size{16, 16, 1};
287 std::string execution_type{
"2D_IMAGE"};
288 std::string target_resource;
289 std::array<int, 3> workgroups{1, 1, 1};
292 std::vector<dispatch_info> csf_passes;
296 std::vector<vertex_input> vertex_inputs;
297 std::vector<vertex_output> vertex_outputs;
298 std::vector<fragment_input> fragment_inputs;
299 std::vector<fragment_output> fragment_outputs;
302class SCORE_PLUGIN_GFX_EXPORT parser
304 std::string m_sourceVertex;
305 std::string m_sourceFragment;
306 std::string m_source_geometry_filter;
309 std::string m_vertex;
310 std::string m_fragment;
311 std::string m_geometry_filter;
316 enum class ShaderType
329 parser(std::string vert, std::string frag,
int glslVersion, ShaderType);
330 explicit parser(std::string isf_geom_filter, ShaderType t);
332 descriptor data()
const;
333 descriptor::Mode mode()
const;
334 std::string vertex()
const;
335 std::string fragment()
const;
336 std::string geometry_filter()
const;
337 std::string compute_shader()
const;
338 static std::pair<int, descriptor> parse_isf_header(std::string_view source);
339 void parse_shadertoy_json(
const std::string& json);
341 std::string write_isf()
const;
345 void parse_raw_raster_pipeline();
346 void parse_shadertoy();
347 void parse_glsl_sandbox();
348 void parse_geometry_filter();