1 #include <msp/core/algorithm.h>
2 #include <msp/debug/demangle.h>
3 #include <msp/io/print.h>
8 #include "pipelinestate.h"
10 #include "programdata.h"
11 #include "uniformblock.h"
19 ProgramData::ProgramData(const Program *p):
23 ProgramData::ProgramData(ProgramData &&other):
24 tied_program(other.tied_program),
25 uniforms(move(other.uniforms)),
26 uniform_data(move(other.uniform_data)),
27 generation(other.generation),
28 blocks(move(other.blocks)),
29 programs(move(other.programs)),
30 last_buffer_block(other.last_buffer_block),
33 debug_name(move(other.debug_name))
39 ProgramData::~ProgramData()
41 for(SharedBlock &b: blocks)
43 if(b.indices.type_flag==0xFE)
44 delete[] b.indices.dynamic.values;
50 void ProgramData::uniform(Tag tag, DataType type, unsigned array_size, const void *value)
52 if(!validate_tag(tag))
55 auto i = lower_bound_member(uniforms, tag, &TaggedUniform::tag);
56 if(i==uniforms.end() || i->tag!=tag)
58 if(uniforms.size()>=MASK_BITS)
59 throw too_many_uniforms(tag.str());
64 tu.array_size = array_size;
65 tu.data_offset = uniform_data.size();
66 tu.data_size = array_size*get_type_size(type);
67 i = uniforms.insert(i, tu);
68 uniform_data.resize(tu.data_offset+tu.data_size);
72 else if(type!=i->type)
73 throw invalid_operation("ProgramData::uniform");
74 else if(array_size>i->array_size)
76 unsigned add_bytes = (array_size-i->array_size)*get_type_size(type);
77 uniform_data.insert(uniform_data.begin()+i->data_offset+i->data_size, add_bytes, 0);
78 for(TaggedUniform &u: uniforms)
79 if(u.data_offset>i->data_offset)
80 u.data_offset += add_bytes;
81 i->array_size = array_size;
82 i->data_size = array_size*get_type_size(type);
85 const char *val_begin = static_cast<const char *>(value);
86 const char *val_end = val_begin+array_size*get_type_size(type);
87 char *store_begin = uniform_data.data()+i->data_offset;
88 copy(val_begin, val_end, store_begin);
90 mark_dirty(1<<(i-uniforms.begin()));
93 bool ProgramData::validate_tag(Tag tag) const
101 const ReflectData::UniformInfo &info = tied_program->get_uniform_info(tag);
102 if(is_image(info.type))
103 throw invalid_operation("ProgramData::uniform");
108 catch(const exception &e)
110 IO::print(IO::cerr, "Error while setting uniform %s: %s: %s\n", tag, Debug::demangle(typeid(e).name()), e.what());
116 void ProgramData::mark_dirty(Mask bits)
120 if(generation && !streaming)
123 if(buffer && buffer->get_size())
131 void ProgramData::uniform(Tag tag, int v)
133 uniform(tag, INT, 1, &v);
136 void ProgramData::uniform(Tag tag, unsigned v)
138 uniform(tag, UNSIGNED_INT, 1, &v);
141 void ProgramData::uniform(Tag tag, float v)
143 uniform(tag, FLOAT, 1, &v);
146 void ProgramData::uniform(Tag tag, int v0, int v1)
148 int va[2] = { v0, v1 };
152 void ProgramData::uniform(Tag tag, unsigned v0, unsigned v1)
154 unsigned va[2] = { v0, v1 };
158 void ProgramData::uniform(Tag tag, float v0, float v1)
160 float va[2] = { v0, v1 };
164 void ProgramData::uniform2(Tag tag, const int *v)
166 uniform(tag, INT_VEC2, 1, v);
169 void ProgramData::uniform2(Tag tag, const unsigned *v)
171 uniform(tag, UINT_VEC2, 1, v);
174 void ProgramData::uniform2(Tag tag, const float *v)
176 uniform(tag, FLOAT_VEC2, 1, v);
179 void ProgramData::uniform(Tag tag, int v0, int v1, int v2)
181 int va[3] = { v0, v1, v2 };
185 void ProgramData::uniform(Tag tag, unsigned v0, unsigned v1, unsigned v2)
187 unsigned va[3] = { v0, v1, v2 };
191 void ProgramData::uniform(Tag tag, float v0, float v1, float v2)
193 float va[3] = { v0, v1, v2 };
197 void ProgramData::uniform3(Tag tag, const int *v)
199 uniform(tag, INT_VEC3, 1, v);
202 void ProgramData::uniform3(Tag tag, const unsigned *v)
204 uniform(tag, UINT_VEC3, 1, v);
207 void ProgramData::uniform3(Tag tag, const float *v)
209 uniform(tag, FLOAT_VEC3, 1, v);
212 void ProgramData::uniform(Tag tag, int v0, int v1, int v2, int v3)
214 int va[4] = { v0, v1, v2, v3 };
218 void ProgramData::uniform(Tag tag, unsigned v0, unsigned v1, unsigned v2, unsigned v3)
220 unsigned va[4] = { v0, v1, v2, v3 };
224 void ProgramData::uniform(Tag tag, float v0, float v1, float v2, float v3)
226 float va[4] = { v0, v1, v2, v3 };
230 void ProgramData::uniform(Tag tag, const Color &c)
232 uniform(tag, c.r, c.g, c.b, c.a);
235 void ProgramData::uniform4(Tag tag, const int *v)
237 uniform(tag, INT_VEC4, 1, v);
240 void ProgramData::uniform4(Tag tag, const unsigned *v)
242 uniform(tag, UINT_VEC4, 1, v);
245 void ProgramData::uniform4(Tag tag, const float *v)
247 uniform(tag, FLOAT_VEC4, 1, v);
250 void ProgramData::uniform_matrix2(Tag tag, const float *v)
252 uniform(tag, FLOAT_MAT2, 1, v);
255 void ProgramData::uniform_matrix3x2(Tag tag, const float *v)
257 uniform(tag, FLOAT_MAT3x2, 1, v);
260 void ProgramData::uniform_matrix4x2(Tag tag, const float *v)
262 uniform(tag, FLOAT_MAT4x2, 1, v);
265 void ProgramData::uniform_matrix2x3(Tag tag, const float *v)
267 uniform(tag, FLOAT_MAT2x3, 1, v);
270 void ProgramData::uniform_matrix3(Tag tag, const float *v)
272 uniform(tag, FLOAT_MAT3, 1, v);
275 void ProgramData::uniform_matrix4x3(Tag tag, const float *v)
277 uniform(tag, FLOAT_MAT4x3, 1, v);
280 void ProgramData::uniform_matrix2x4(Tag tag, const float *v)
282 uniform(tag, FLOAT_MAT2x4, 1, v);
285 void ProgramData::uniform_matrix3x4(Tag tag, const float *v)
287 uniform(tag, FLOAT_MAT3x4, 1, v);
290 void ProgramData::uniform(Tag tag, const Matrix &m)
292 uniform_matrix4(tag, m.data());
295 void ProgramData::uniform_matrix4(Tag tag, const float *v)
297 uniform(tag, FLOAT_MAT4, 1, v);
300 void ProgramData::uniform_array(Tag tag, unsigned n, const int *v)
302 uniform(tag, INT, n, v);
305 void ProgramData::uniform_array(Tag tag, unsigned n, const unsigned *v)
307 uniform(tag, UNSIGNED_INT, n, v);
310 void ProgramData::uniform_array(Tag tag, unsigned n, const float *v)
312 uniform(tag, FLOAT, n, v);
315 void ProgramData::uniform1_array(Tag tag, unsigned n, const int *v)
317 uniform(tag, INT, n, v);
320 void ProgramData::uniform1_array(Tag tag, unsigned n, const unsigned *v)
322 uniform(tag, UNSIGNED_INT, n, v);
325 void ProgramData::uniform1_array(Tag tag, unsigned n, const float *v)
327 uniform(tag, FLOAT, n, v);
330 void ProgramData::uniform2_array(Tag tag, unsigned n, const int *v)
332 uniform(tag, INT_VEC2, n, v);
335 void ProgramData::uniform2_array(Tag tag, unsigned n, const unsigned *v)
337 uniform(tag, UINT_VEC2, n, v);
340 void ProgramData::uniform2_array(Tag tag, unsigned n, const float *v)
342 uniform(tag, FLOAT_VEC2, n, v);
345 void ProgramData::uniform3_array(Tag tag, unsigned n, const int *v)
347 uniform(tag, INT_VEC3, n, v);
350 void ProgramData::uniform3_array(Tag tag, unsigned n, const unsigned *v)
352 uniform(tag, INT_VEC3, n, v);
355 void ProgramData::uniform3_array(Tag tag, unsigned n, const float *v)
357 uniform(tag, FLOAT_VEC3, n, v);
360 void ProgramData::uniform4_array(Tag tag, unsigned n, const int *v)
362 uniform(tag, INT_VEC4, n, v);
365 void ProgramData::uniform4_array(Tag tag, unsigned n, const unsigned *v)
367 uniform(tag, UINT_VEC4, n, v);
370 void ProgramData::uniform4_array(Tag tag, unsigned n, const float *v)
372 uniform(tag, FLOAT_VEC4, n, v);
375 void ProgramData::uniform_matrix2_array(Tag tag, unsigned n, const float *v)
377 uniform(tag, FLOAT_MAT2, n, v);
380 void ProgramData::uniform_matrix3x2_array(Tag tag, unsigned n, const float *v)
382 uniform(tag, FLOAT_MAT3x2, n, v);
385 void ProgramData::uniform_matrix4x2_array(Tag tag, unsigned n, const float *v)
387 uniform(tag, FLOAT_MAT4x2, n, v);
390 void ProgramData::uniform_matrix2x3_array(Tag tag, unsigned n, const float *v)
392 uniform(tag, FLOAT_MAT2x3, n, v);
395 void ProgramData::uniform_matrix3_array(Tag tag, unsigned n, const float *v)
397 uniform(tag, FLOAT_MAT3, n, v);
400 void ProgramData::uniform_matrix4x3_array(Tag tag, unsigned n, const float *v)
402 uniform(tag, FLOAT_MAT4x3, n, v);
405 void ProgramData::uniform_matrix2x4_array(Tag tag, unsigned n, const float *v)
407 uniform(tag, FLOAT_MAT2x4, n, v);
410 void ProgramData::uniform_matrix3x4_array(Tag tag, unsigned n, const float *v)
412 uniform(tag, FLOAT_MAT3x4, n, v);
415 void ProgramData::uniform_matrix4_array(Tag tag, unsigned n, const float *v)
417 uniform(tag, FLOAT_MAT4, n, v);
420 void ProgramData::remove_uniform(Tag tag)
422 auto i = lower_bound_member(uniforms, tag, &TaggedUniform::tag);
423 if(i==uniforms.end() || i->tag!=tag)
426 uniform_data.erase(uniform_data.begin()+i->data_offset, uniform_data.begin()+i->data_offset+i->data_size);
427 for(TaggedUniform &u: uniforms)
428 if(u.data_offset>i->data_offset)
429 u.data_offset -= i->data_size;
432 mark_dirty(ALL_ONES);
435 vector<Tag> ProgramData::get_uniform_tags() const
438 tags.reserve(uniforms.size());
439 for(const TaggedUniform &u: uniforms)
440 tags.push_back(u.tag);
444 void ProgramData::copy_uniform(const ProgramData &source, Tag tag)
446 int i = source.find_uniform_index(tag);
448 throw key_error(tag);
449 const TaggedUniform &tu = source.uniforms[i];
450 uniform(tag, tu.type, tu.array_size, source.uniform_data.data()+tu.data_offset);
453 void ProgramData::copy_uniforms(const ProgramData &source)
455 for(const TaggedUniform &u: source.uniforms)
456 uniform(u.tag, u.type, u.array_size, source.uniform_data.data()+u.data_offset);
459 int ProgramData::find_uniform_index(Tag tag) const
461 auto i = lower_bound_member(uniforms, tag, &TaggedUniform::tag);
462 return ((i!=uniforms.end() && i->tag==tag) ? i-uniforms.begin() : -1);
465 vector<ProgramData::ProgramBlock>::iterator ProgramData::get_program(const Program &prog) const
467 ReflectData::LayoutHash prog_hash = prog.get_uniform_layout_hash();
468 auto i = lower_bound_member(programs, prog_hash, &ProgramBlock::prog_hash);
469 if(i!=programs.end() && i->prog_hash==prog_hash)
472 const vector<ReflectData::UniformBlockInfo> &block_infos = prog.get_uniform_blocks();
473 unsigned index = i-programs.begin();
474 programs.insert(i, 1+block_infos.size(), ProgramBlock(prog_hash));
476 /* Block indices may change if new shared blocks need to be inserted. Store
477 the hashes so they can be matched up later. */
478 vector<ReflectData::LayoutHash> block_hashes;
479 block_hashes.reserve(programs.size());
480 for(const ProgramBlock &b: programs)
481 block_hashes.push_back(b.block_index>=0 ? blocks[b.block_index].block_hash : 0);
483 for(unsigned j=0; j<block_infos.size(); ++j)
485 const ReflectData::UniformBlockInfo &info = block_infos[j];
486 block_hashes[index+1+j] = info.layout_hash;
487 programs[index+1+j].bind_point = info.bind_point;
489 auto k = lower_bound_member(blocks, info.layout_hash, &SharedBlock::block_hash);
490 if(k==blocks.end() || k->block_hash!=info.layout_hash)
492 k = blocks.insert(k, SharedBlock(info.layout_hash));
493 update_block_uniform_indices(*k, info);
497 /* Reassign shared block indices from the stored hashes. */
498 for(unsigned j=0; j<programs.size(); ++j)
500 unsigned hash = block_hashes[j];
503 auto k = lower_bound_member(blocks, hash, &SharedBlock::block_hash);
504 programs[j].block_index = k-blocks.begin();
507 programs[j].block_index = -1;
510 return programs.begin()+index;
513 void ProgramData::recreate_buffer() const
515 Buffer *old_buffer = buffer;
516 // Create the new buffer first to ensure it has a different address
519 if(last_buffer_block)
520 last_buffer_block->change_buffer(buffer);
523 if(!debug_name.empty())
524 buffer->set_debug_name(debug_name);
528 void ProgramData::update_block_uniform_indices(SharedBlock &block, const ReflectData::UniformBlockInfo &info) const
530 uint8_t *indices = block.indices.values;
531 if(info.uniforms.size()>16)
533 if(block.indices.type_flag==0xFD)
535 block.indices.dynamic.values = new uint8_t[info.uniforms.size()];
536 block.indices.type_flag = 0xFE;
538 indices = block.indices.dynamic.values;
541 bool any_missing = false;
544 for(unsigned i=0; i<info.uniforms.size(); ++i)
546 int j = find_uniform_index(info.uniforms[i]->tag);
550 if(static_cast<unsigned>(j)<MASK_BITS)
560 if(block.used && any_missing && info.bind_point>=0)
563 IO::print(IO::cerr, "Warning: not all uniforms for block %s are present\n", info.name);
565 throw incomplete_uniform_block(info.name);
569 block.dirty = block.used;
571 if(block.used && !block.block)
573 block.block = new UniformBlock(info);
574 if(info.bind_point>=0)
579 block.block->use_buffer(buffer, last_buffer_block);
580 last_buffer_block = block.block;
585 void ProgramData::update_block(SharedBlock &block, const ReflectData::UniformBlockInfo &info) const
587 const uint8_t *indices = block.get_uniform_indices();
588 for(unsigned i=0; i<info.uniforms.size(); ++i)
590 if(is_image(info.uniforms[i]->type))
591 ; // Temporarily ignore deprecated use of sampler uniforms in ProgramData
592 else if(indices[i]!=0xFF)
594 const TaggedUniform &tu = uniforms[indices[i]];
595 block.block->store(*info.uniforms[i], tu.array_size, uniform_data.data()+tu.data_offset);
600 vector<ProgramData::ProgramBlock>::const_iterator ProgramData::prepare_program(const Program &prog) const
602 UniformBlock *old_last_block = last_buffer_block;
603 auto prog_begin = get_program(prog);
605 bool check_buffer = (buffer && !buffer->get_size());
606 Mask force_dirty = (dirty==ALL_ONES ? ALL_ONES : 0U);
607 Mask affected = (dirty&prog_begin->masks.used) | force_dirty;
608 if(affected|prog_begin->masks.dirty)
610 /* If the global dirty flag affects this program, add it to per-block and
611 per-program dirty flags and clear the global flag. A previously unseen
612 program will cause this to happen if there's any dirty uniforms. */
615 for(SharedBlock &b: blocks)
616 b.dirty |= (dirty&b.used) | force_dirty;
617 for(ProgramBlock &b: programs)
619 b.masks.dirty |= (dirty&b.masks.used) | force_dirty;
623 const vector<ReflectData::UniformBlockInfo> &block_infos = prog.get_uniform_blocks();
625 if(prog_begin->masks.dirty==ALL_ONES)
627 /* The set of uniforms has changed since this program was last used.
628 Refresh uniform indices within the program's blocks. */
629 prog_begin->masks.used = 0;
630 auto j = prog_begin+1;
631 for(const ReflectData::UniformBlockInfo &b: block_infos)
633 SharedBlock &shared = blocks[j->block_index];
634 if(shared.dirty==ALL_ONES)
635 update_block_uniform_indices(shared, b);
636 prog_begin->masks.used |= shared.used;
637 j->block = (shared.used ? shared.block : 0);
642 // Update the contents of all dirty blocks.
643 bool buffered_blocks_updated = false;
644 auto j = prog_begin+1;
645 for(const ReflectData::UniformBlockInfo &b: block_infos)
647 SharedBlock &shared = blocks[j->block_index];
650 update_block(shared, b);
652 buffered_blocks_updated |= (j->bind_point>=0);
657 prog_begin->masks.dirty = 0;
659 if(last_buffer_block!=old_last_block)
665 unsigned required_size = last_buffer_block->get_required_buffer_size(streaming);
666 if(last_buffer_block->get_required_buffer_size()>buffer->get_size())
668 if(buffer->get_size()>0)
671 buffer->storage(required_size, (streaming ? STREAMING : STATIC));
678 void ProgramData::apply(const Program &prog, PipelineState &state, unsigned frame) const
680 auto prog_begin = prepare_program(prog);
681 ReflectData::LayoutHash prog_hash = prog_begin->prog_hash;
683 for(auto i=prog_begin+1; (i!=programs.end() && i->prog_hash==prog_hash); ++i)
686 state.set_uniform_block(i->bind_point, i->block);
688 i->block->refresh(frame);
692 void ProgramData::set_debug_name(const string &name)
697 buffer->set_debug_name(name);
704 ProgramData::SharedBlock::SharedBlock(ReflectData::LayoutHash h):
710 indices.type_flag = 0xFD;
713 const uint8_t *ProgramData::SharedBlock::get_uniform_indices() const
715 return (indices.type_flag==0xFE ? indices.dynamic.values : indices.values);
719 ProgramData::ProgramBlock::ProgramBlock(ReflectData::LayoutHash h):
724 masks.used = ALL_ONES;
725 masks.dirty = ALL_ONES;
729 ProgramData::Loader::Loader(ProgramData &pd):
730 DataFile::ObjectLoader<ProgramData>(pd)
732 add("uniform", &Loader::uniform1i);
733 add("uniform1i", &Loader::uniform1i);
734 add("uniform", &Loader::uniform1f);
735 add("uniform1f", &Loader::uniform1f);
736 add("uniform", &Loader::uniform2i);
737 add("uniform2i", &Loader::uniform2i);
738 add("uniform", &Loader::uniform2f);
739 add("uniform2f", &Loader::uniform2f);
740 add("uniform", &Loader::uniform3i);
741 add("uniform3i", &Loader::uniform3i);
742 add("uniform", &Loader::uniform3f);
743 add("uniform3f", &Loader::uniform3f);
744 add("uniform", &Loader::uniform4i);
745 add("uniform4i", &Loader::uniform4i);
746 add("uniform", &Loader::uniform4f);
747 add("uniform4f", &Loader::uniform4f);
748 add("uniform1i_array", &Loader::uniform1i_array);
749 add("uniform1f_array", &Loader::uniform1f_array);
750 add("uniform2f_array", &Loader::uniform2f_array);
751 add("uniform3f_array", &Loader::uniform3f_array);
752 add("uniform4f_array", &Loader::uniform4f_array);
753 add("uniform_array", &Loader::uniform_array);
756 void ProgramData::Loader::uniform1i(const string &n, int v)
761 void ProgramData::Loader::uniform1f(const string &n, float v)
766 void ProgramData::Loader::uniform2i(const string &n, int v0, int v1)
768 obj.uniform(n, v0, v1);
771 void ProgramData::Loader::uniform2f(const string &n, float v0, float v1)
773 obj.uniform(n, v0, v1);
776 void ProgramData::Loader::uniform3i(const string &n, int v0, int v1, int v2)
778 obj.uniform(n, v0, v1, v2);
781 void ProgramData::Loader::uniform3f(const string &n, float v0, float v1, float v2)
783 obj.uniform(n, v0, v1, v2);
786 void ProgramData::Loader::uniform4i(const string &n, int v0, int v1, int v2, int v3)
788 obj.uniform(n, v0, v1, v2, v3);
791 void ProgramData::Loader::uniform4f(const string &n, float v0, float v1, float v2, float v3)
793 obj.uniform(n, v0, v1, v2, v3);
796 void ProgramData::Loader::uniform_array_(const string &n, DataType t, unsigned e)
798 ArrayLoader ldr(t, e);
800 unsigned size = ldr.get_size();
802 throw logic_error("empty uniform array");
804 DataType type = ldr.get_data_type();
805 unsigned elem_size = ldr.get_element_size();
808 const int *data = reinterpret_cast<const int *>(ldr.get_data());
810 obj.uniform1_array(n, size, data);
811 else if(elem_size==2)
812 obj.uniform2_array(n, size, data);
813 else if(elem_size==3)
814 obj.uniform3_array(n, size, data);
815 else if(elem_size==4)
816 obj.uniform4_array(n, size, data);
818 throw logic_error("unsupported combination of array type and element size");
822 const float *data = reinterpret_cast<const float *>(ldr.get_data());
824 obj.uniform1_array(n, size, data);
825 else if(elem_size==2)
826 obj.uniform2_array(n, size, data);
827 else if(elem_size==3)
828 obj.uniform3_array(n, size, data);
829 else if(elem_size==4)
830 obj.uniform4_array(n, size, data);
832 throw logic_error("unsupported combination of array type and element size");
835 throw logic_error("unsupported array type");
838 void ProgramData::Loader::uniform1i_array(const string &n)
840 uniform_array_(n, INT, 1);
843 void ProgramData::Loader::uniform1f_array(const string &n)
845 uniform_array_(n, FLOAT, 1);
848 void ProgramData::Loader::uniform2i_array(const string &n)
850 uniform_array_(n, INT, 2);
853 void ProgramData::Loader::uniform2f_array(const string &n)
855 uniform_array_(n, FLOAT, 2);
858 void ProgramData::Loader::uniform3i_array(const string &n)
860 uniform_array_(n, INT, 3);
863 void ProgramData::Loader::uniform3f_array(const string &n)
865 uniform_array_(n, FLOAT, 3);
868 void ProgramData::Loader::uniform4i_array(const string &n)
870 uniform_array_(n, INT, 4);
873 void ProgramData::Loader::uniform4f_array(const string &n)
875 uniform_array_(n, FLOAT, 4);
878 void ProgramData::Loader::uniform_array(const string &n)
880 uniform_array_(n, static_cast<DataType>(0), 0);
884 ProgramData::ArrayLoader::ArrayLoader(DataType t, unsigned e):
888 add("uniform", &ArrayLoader::uniform1i);
889 add("uniform1i", &ArrayLoader::uniform1i);
890 add("uniform", &ArrayLoader::uniform1f);
891 add("uniform1f", &ArrayLoader::uniform1f);
892 add("uniform", &ArrayLoader::uniform2f);
893 add("uniform2f", &ArrayLoader::uniform2f);
894 add("uniform", &ArrayLoader::uniform3f);
895 add("uniform3f", &ArrayLoader::uniform3f);
896 add("uniform", &ArrayLoader::uniform4f);
897 add("uniform4f", &ArrayLoader::uniform4f);
900 void ProgramData::ArrayLoader::uniform(DataType t, unsigned e, const void *v)
902 if(element_size && (t!=type || e!=element_size))
903 throw logic_error("heterogeneous array contents");
911 const char *cv = reinterpret_cast<const char *>(v);
912 data.insert(data.end(), cv, cv+element_size*4);
915 void ProgramData::ArrayLoader::uniform1i(int v)
920 void ProgramData::ArrayLoader::uniform1f(float v)
922 uniform(FLOAT, 1, &v);
925 void ProgramData::ArrayLoader::uniform2i(int v0, int v1)
927 int va[2] = { v0, v1 };
931 void ProgramData::ArrayLoader::uniform2f(float v0, float v1)
933 float va[2] = { v0, v1 };
934 uniform(FLOAT, 2, va);
937 void ProgramData::ArrayLoader::uniform3i(int v0, int v1, int v2)
939 int va[3] = { v0, v1, v2 };
943 void ProgramData::ArrayLoader::uniform3f(float v0, float v1, float v2)
945 float va[3] = { v0, v1, v2 };
946 uniform(FLOAT, 3, va);
949 void ProgramData::ArrayLoader::uniform4i(int v0, int v1, int v2, int v3)
951 int va[4] = { v0, v1, v2, v3 };
955 void ProgramData::ArrayLoader::uniform4f(float v0, float v1, float v2, float v3)
957 float va[4] = { v0, v1, v2, v3 };
958 uniform(FLOAT, 4, va);