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 std::optional<int64_t> min;
42 std::optional<int64_t> max;
46 using value_type = double;
47 using has_minmax = std::true_type;
55 using value_type = std::array<double, 2>;
56 using has_minmax = std::true_type;
57 std::optional<value_type> def{};
58 std::optional<value_type> min{};
59 std::optional<value_type> max{};
64 using value_type = std::array<double, 3>;
65 using has_minmax = std::true_type;
66 std::optional<value_type> def{};
67 std::optional<value_type> min{};
68 std::optional<value_type> max{};
73 using value_type = std::array<double, 4>;
74 using has_minmax = std::true_type;
75 std::optional<value_type> def{};
76 std::optional<value_type> min{};
77 std::optional<value_type> max{};
100struct audioHist_input
116 std::vector<layout_field> layout;
118 std::string buffer_usage;
126struct csf_image_input
131 std::string width_expression;
132 std::string height_expression;
133 std::string depth_expression;
137 bool is3D() const noexcept {
return dimensions == 3 || !depth_expression.empty(); }
148 std::string geometry;
149 std::string attribute;
150 std::string auxiliary;
153 struct attribute_request
156 std::string semantic;
164 std::optional<copy_from> forward;
169 struct auxiliary_request
173 std::vector<storage_input::layout_field> layout;
177 std::optional<copy_from> forward;
180 std::vector<attribute_request> attributes;
181 std::vector<auxiliary_request> auxiliary;
183 std::string vertex_count;
184 std::string instance_count;
186 bool indirect_draw{
false};
187 std::string indirect_draw_type;
192 using input_impl = ossia::variant<
193 float_input, long_input, event_input, bool_input, color_input, point2d_input,
194 point3d_input, image_input, cubemap_input, audio_input, audioFFT_input,
195 audioHist_input, storage_input, texture_input, csf_image_input,
205enum class attribute_type
288struct vertex_attribute
291 attribute_type type{};
295struct vertex_input : vertex_attribute
298struct vertex_output : vertex_attribute
301struct fragment_input : vertex_attribute
304struct fragment_output : vertex_attribute
312 bool float_storage{};
313 bool nearest_filter{};
314 std::string width_expression{};
315 std::string height_expression{};
318struct output_declaration
333 std::string description;
335 std::vector<std::string> categories;
336 std::vector<input> inputs;
337 std::vector<output_declaration> outputs;
338 std::vector<pass> passes;
339 std::vector<std::string> pass_targets;
340 bool default_vertex_shader{};
344 std::string primitive_mode;
345 std::string line_size;
346 std::array<double, 4> background_color;
349 struct type_definition
352 std::vector<storage_input::layout_field> layout;
354 std::vector<type_definition> types;
358 std::array<int, 3> local_size{16, 16, 1};
359 std::string execution_type{
"2D_IMAGE"};
360 std::string target_resource;
361 std::array<int, 3> workgroups{1, 1, 1};
362 std::array<std::string, 3> stride{
"1",
"1",
"1"};
363 std::array<int, 3> user_dispatch_ports{-1, -1, -1};
365 std::vector<dispatch_info> csf_passes;
369 std::vector<vertex_input> vertex_inputs;
370 std::vector<vertex_output> vertex_outputs;
371 std::vector<fragment_input> fragment_inputs;
372 std::vector<fragment_output> fragment_outputs;
376 std::vector<geometry_input::auxiliary_request> auxiliary;
379class SCORE_PLUGIN_GFX_EXPORT parser
381 std::string m_sourceVertex;
382 std::string m_sourceFragment;
383 std::string m_source_geometry_filter;
386 std::string m_vertex;
387 std::string m_fragment;
388 std::string m_geometry_filter;
393 enum class ShaderType
406 parser(std::string vert, std::string frag,
int glslVersion, ShaderType);
407 explicit parser(std::string isf_geom_filter, ShaderType t);
409 descriptor data()
const;
410 descriptor::Mode mode()
const;
411 std::string vertex()
const;
412 std::string fragment()
const;
413 std::string geometry_filter()
const;
414 std::string compute_shader()
const;
415 static std::pair<int, descriptor> parse_isf_header(std::string_view source);
416 void parse_shadertoy_json(
const std::string& json);
418 std::string write_isf()
const;
422 void parse_raw_raster_pipeline();
423 void parse_shadertoy();
424 void parse_glsl_sandbox();
425 void parse_geometry_filter();