1 // Copyright 2016-2021 Doug Moen 2 // Licensed under the Apache License, version 2.0 3 // See accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0 4 5 #ifndef LIBCURV_GPU_PROGRAM_H 6 #define LIBCURV_GPU_PROGRAM_H 7 8 #include <libcurv/render.h> 9 #include <libcurv/shape.h> 10 #include <libcurv/viewed_shape.h> 11 12 namespace curv { 13 14 struct GPU_Program 15 { 16 Source_State& sstate_; 17 Shared<const Phrase> nub_; 18 bool is_2d_; 19 bool is_3d_; 20 BBox bbox_; 21 Viewed_Shape vshape_; 22 23 GPU_Program(Program&); 24 25 // If the value is a shape, fill in most fields and return true. 26 // Used with the (Program&) constructor. 27 bool recognize(Value, Render_Opts); 28 29 // abstract interface to PROGRAM classes (see At_Program) syntaxGPU_Program30 const Phrase& syntax() const { return *nub_; } 31 32 void write_json(std::ostream&) const; 33 void write_curv(std::ostream&) const; 34 }; 35 36 } // namespace 37 #endif // header guard 38