X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frender%2Fprogramdata.h;h=4e8ee37302a90b23a7d64f05cd4ce7cb024586f2;hb=8544116298d7a1be176f52be48c9952529f5c446;hp=380f352a66376b6b168805bea5f6c46f4ee0cae5;hpb=1b23728908f5ec9beb08b2b70737c3903745fddc;p=libs%2Fgl.git diff --git a/source/render/programdata.h b/source/render/programdata.h index 380f352a..4e8ee373 100644 --- a/source/render/programdata.h +++ b/source/render/programdata.h @@ -1,14 +1,12 @@ #ifndef MSP_GL_PROGRAMDATA_H_ #define MSP_GL_PROGRAMDATA_H_ -#include #include #include #include "datatype.h" #include "matrix.h" #include "reflectdata.h" #include "tag.h" -#include "uniform.h" #include "vector.h" namespace Msp { @@ -22,7 +20,6 @@ public: }; class Buffer; -class BufferBackedUniformBlock; class PipelineState; class Program; class UniformBlock; @@ -104,11 +101,10 @@ private: struct TaggedUniform { Tag tag; - Uniform *value; - - TaggedUniform(); - - void replace_value(Uniform *); + DataType type = VOID; + unsigned array_size = 0; + unsigned data_offset = 0; + unsigned data_size = 0; }; struct SharedBlock @@ -154,12 +150,13 @@ private: // XXX All these mutables are a bit silly, but I'm out of better ideas const Program *tied_program; std::vector uniforms; - unsigned generation; + std::vector uniform_data; + unsigned generation = 0; mutable std::vector blocks; mutable std::vector programs; - mutable BufferBackedUniformBlock *last_buffer_block; - mutable Buffer *buffer; - mutable Mask dirty; + mutable UniformBlock *last_buffer_block = 0; + mutable Buffer *buffer = 0; + mutable Mask dirty = 0; std::string debug_name; public: @@ -170,16 +167,10 @@ public: ~ProgramData(); private: - void uniform(Tag, Uniform *); - template - void uniform(Tag, V); - template - void uniform_array(Tag, unsigned, V); + void uniform(Tag, DataType, unsigned, const void *); bool validate_tag(Tag) const; - void add_uniform(Tag, Uniform *); void mark_dirty(Mask); public: - void uniform(Tag, const Uniform &); void uniform(Tag, int); void uniform(Tag, float); void uniform(Tag, int, int); @@ -242,8 +233,7 @@ public: unsigned get_generation() const { return generation; } std::vector get_uniform_tags() const; - const Uniform &get_uniform(Tag) const; - const Uniform *find_uniform(Tag) const; + void copy_uniform(const ProgramData &, Tag); private: int find_uniform_index(Tag) const; @@ -260,19 +250,19 @@ public: template void ProgramData::uniform(Tag tag, const LinAl::Vector &v) -{ uniform >(tag, &v.x); } +{ uniform(tag, TypeTraits>::type, 1, &v.x); } template void ProgramData::uniform(Tag tag, const LinAl::Matrix &v) -{ uniform >(tag, &v(0, 0)); } +{ uniform(tag, TypeTraits>::type, 1, &v(0, 0)); } template void ProgramData::uniform_array(Tag tag, unsigned n, const LinAl::Vector *v) -{ uniform_array >(tag, n, &v[0].x); } +{ uniform(tag, TypeTraits>::type, n, &v[0].x); } template void ProgramData::uniform_array(Tag tag, unsigned n, const LinAl::Matrix *v) -{ uniform_array >(tag, n, &v[0](0, 0)); } +{ uniform(tag, TypeTraits>::type, n, &v[0](0, 0)); } } // namespace GL } // namespace Msp