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 // Blocks are intentionally left uncopied
24 ProgramData::ProgramData(const ProgramData &other):
25 tied_program(other.tied_program),
26 uniforms(other.uniforms),
27 uniform_data(other.uniform_data),
28 generation(other.generation)
31 ProgramData::ProgramData(const ProgramData &other, const Program *p):
36 for(const TaggedUniform &u: other.uniforms)
40 uniforms = other.uniforms;
41 uniform_data = other.uniform_data;
44 ProgramData &ProgramData::operator=(const ProgramData &other)
46 tied_program = other.tied_program;
48 uniforms = other.uniforms;
49 uniform_data = other.uniform_data;
51 for(SharedBlock &b: blocks)
56 last_buffer_block = 0;
63 ProgramData::~ProgramData()
65 for(SharedBlock &b: blocks)
67 if(b.indices.type_flag==0xFE)
68 delete[] b.indices.dynamic.values;
74 void ProgramData::uniform(Tag tag, DataType type, unsigned array_size, const void *value)
76 if(!validate_tag(tag))
79 auto i = lower_bound_member(uniforms, tag, &TaggedUniform::tag);
80 if(i==uniforms.end() || i->tag!=tag)
82 if(uniforms.size()>=MASK_BITS)
83 throw too_many_uniforms(tag.str());
88 tu.array_size = array_size;
89 tu.data_offset = uniform_data.size();
90 tu.data_size = array_size*get_type_size(type);
91 i = uniforms.insert(i, tu);
92 uniform_data.resize(tu.data_offset+tu.data_size);
96 else if(type!=i->type)
97 throw invalid_operation("ProgramData::uniform");
98 else if(array_size>i->array_size)
100 unsigned add_bytes = (array_size-i->array_size)*get_type_size(type);
101 uniform_data.insert(uniform_data.begin()+i->data_offset+i->data_size, add_bytes, 0);
102 for(TaggedUniform &u: uniforms)
103 if(u.data_offset>i->data_offset)
104 u.data_offset += add_bytes;
105 i->array_size = array_size;
106 i->data_size = array_size*get_type_size(type);
109 const char *val_begin = static_cast<const char *>(value);
110 const char *val_end = val_begin+array_size*get_type_size(type);
111 char *store_begin = uniform_data.data()+i->data_offset;
112 copy(val_begin, val_end, store_begin);
114 mark_dirty(1<<(i-uniforms.begin()));
117 bool ProgramData::validate_tag(Tag tag) const
125 const ReflectData::UniformInfo &info = tied_program->get_uniform_info(tag);
126 if(is_image(info.type))
127 throw invalid_operation("ProgramData::uniform");
132 catch(const exception &e)
134 IO::print(IO::cerr, "Error while setting uniform %s: %s: %s\n", tag, Debug::demangle(typeid(e).name()), e.what());
140 void ProgramData::mark_dirty(Mask bits)
147 void ProgramData::uniform(Tag tag, int v)
149 uniform(tag, INT, 1, &v);
152 void ProgramData::uniform(Tag tag, unsigned v)
154 uniform(tag, UNSIGNED_INT, 1, &v);
157 void ProgramData::uniform(Tag tag, float v)
159 uniform(tag, FLOAT, 1, &v);
162 void ProgramData::uniform(Tag tag, int v0, int v1)
164 int va[2] = { v0, v1 };
168 void ProgramData::uniform(Tag tag, unsigned v0, unsigned v1)
170 unsigned va[2] = { v0, v1 };
174 void ProgramData::uniform(Tag tag, float v0, float v1)
176 float va[2] = { v0, v1 };
180 void ProgramData::uniform2(Tag tag, const int *v)
182 uniform(tag, INT_VEC2, 1, v);
185 void ProgramData::uniform2(Tag tag, const unsigned *v)
187 uniform(tag, UINT_VEC2, 1, v);
190 void ProgramData::uniform2(Tag tag, const float *v)
192 uniform(tag, FLOAT_VEC2, 1, v);
195 void ProgramData::uniform(Tag tag, int v0, int v1, int v2)
197 int va[3] = { v0, v1, v2 };
201 void ProgramData::uniform(Tag tag, unsigned v0, unsigned v1, unsigned v2)
203 unsigned va[3] = { v0, v1, v2 };
207 void ProgramData::uniform(Tag tag, float v0, float v1, float v2)
209 float va[3] = { v0, v1, v2 };
213 void ProgramData::uniform3(Tag tag, const int *v)
215 uniform(tag, INT_VEC3, 1, v);
218 void ProgramData::uniform3(Tag tag, const unsigned *v)
220 uniform(tag, UINT_VEC3, 1, v);
223 void ProgramData::uniform3(Tag tag, const float *v)
225 uniform(tag, FLOAT_VEC3, 1, v);
228 void ProgramData::uniform(Tag tag, int v0, int v1, int v2, int v3)
230 int va[4] = { v0, v1, v2, v3 };
234 void ProgramData::uniform(Tag tag, unsigned v0, unsigned v1, unsigned v2, unsigned v3)
236 unsigned va[4] = { v0, v1, v2, v3 };
240 void ProgramData::uniform(Tag tag, float v0, float v1, float v2, float v3)
242 float va[4] = { v0, v1, v2, v3 };
246 void ProgramData::uniform(Tag tag, const Color &c)
248 uniform(tag, c.r, c.g, c.b, c.a);
251 void ProgramData::uniform4(Tag tag, const int *v)
253 uniform(tag, INT_VEC4, 1, v);
256 void ProgramData::uniform4(Tag tag, const unsigned *v)
258 uniform(tag, UINT_VEC4, 1, v);
261 void ProgramData::uniform4(Tag tag, const float *v)
263 uniform(tag, FLOAT_VEC4, 1, v);
266 void ProgramData::uniform_matrix2(Tag tag, const float *v)
268 uniform(tag, FLOAT_MAT2, 1, v);
271 void ProgramData::uniform_matrix3x2(Tag tag, const float *v)
273 uniform(tag, FLOAT_MAT3x2, 1, v);
276 void ProgramData::uniform_matrix4x2(Tag tag, const float *v)
278 uniform(tag, FLOAT_MAT4x2, 1, v);
281 void ProgramData::uniform_matrix2x3(Tag tag, const float *v)
283 uniform(tag, FLOAT_MAT2x3, 1, v);
286 void ProgramData::uniform_matrix3(Tag tag, const float *v)
288 uniform(tag, FLOAT_MAT3, 1, v);
291 void ProgramData::uniform_matrix4x3(Tag tag, const float *v)
293 uniform(tag, FLOAT_MAT4x3, 1, v);
296 void ProgramData::uniform_matrix2x4(Tag tag, const float *v)
298 uniform(tag, FLOAT_MAT2x4, 1, v);
301 void ProgramData::uniform_matrix3x4(Tag tag, const float *v)
303 uniform(tag, FLOAT_MAT3x4, 1, v);
306 void ProgramData::uniform(Tag tag, const Matrix &m)
308 uniform_matrix4(tag, m.data());
311 void ProgramData::uniform_matrix4(Tag tag, const float *v)
313 uniform(tag, FLOAT_MAT4, 1, v);
316 void ProgramData::uniform_array(Tag tag, unsigned n, const int *v)
318 uniform(tag, INT, n, v);
321 void ProgramData::uniform_array(Tag tag, unsigned n, const unsigned *v)
323 uniform(tag, UNSIGNED_INT, n, v);
326 void ProgramData::uniform_array(Tag tag, unsigned n, const float *v)
328 uniform(tag, FLOAT, n, v);
331 void ProgramData::uniform1_array(Tag tag, unsigned n, const int *v)
333 uniform(tag, INT, n, v);
336 void ProgramData::uniform1_array(Tag tag, unsigned n, const unsigned *v)
338 uniform(tag, UNSIGNED_INT, n, v);
341 void ProgramData::uniform1_array(Tag tag, unsigned n, const float *v)
343 uniform(tag, FLOAT, n, v);
346 void ProgramData::uniform2_array(Tag tag, unsigned n, const int *v)
348 uniform(tag, INT_VEC2, n, v);
351 void ProgramData::uniform2_array(Tag tag, unsigned n, const unsigned *v)
353 uniform(tag, UINT_VEC2, n, v);
356 void ProgramData::uniform2_array(Tag tag, unsigned n, const float *v)
358 uniform(tag, FLOAT_VEC2, n, v);
361 void ProgramData::uniform3_array(Tag tag, unsigned n, const int *v)
363 uniform(tag, INT_VEC3, n, v);
366 void ProgramData::uniform3_array(Tag tag, unsigned n, const unsigned *v)
368 uniform(tag, INT_VEC3, n, v);
371 void ProgramData::uniform3_array(Tag tag, unsigned n, const float *v)
373 uniform(tag, FLOAT_VEC3, n, v);
376 void ProgramData::uniform4_array(Tag tag, unsigned n, const int *v)
378 uniform(tag, INT_VEC4, n, v);
381 void ProgramData::uniform4_array(Tag tag, unsigned n, const unsigned *v)
383 uniform(tag, UINT_VEC4, n, v);
386 void ProgramData::uniform4_array(Tag tag, unsigned n, const float *v)
388 uniform(tag, FLOAT_VEC4, n, v);
391 void ProgramData::uniform_matrix2_array(Tag tag, unsigned n, const float *v)
393 uniform(tag, FLOAT_MAT2, n, v);
396 void ProgramData::uniform_matrix3x2_array(Tag tag, unsigned n, const float *v)
398 uniform(tag, FLOAT_MAT3x2, n, v);
401 void ProgramData::uniform_matrix4x2_array(Tag tag, unsigned n, const float *v)
403 uniform(tag, FLOAT_MAT4x2, n, v);
406 void ProgramData::uniform_matrix2x3_array(Tag tag, unsigned n, const float *v)
408 uniform(tag, FLOAT_MAT2x3, n, v);
411 void ProgramData::uniform_matrix3_array(Tag tag, unsigned n, const float *v)
413 uniform(tag, FLOAT_MAT3, n, v);
416 void ProgramData::uniform_matrix4x3_array(Tag tag, unsigned n, const float *v)
418 uniform(tag, FLOAT_MAT4x3, n, v);
421 void ProgramData::uniform_matrix2x4_array(Tag tag, unsigned n, const float *v)
423 uniform(tag, FLOAT_MAT2x4, n, v);
426 void ProgramData::uniform_matrix3x4_array(Tag tag, unsigned n, const float *v)
428 uniform(tag, FLOAT_MAT3x4, n, v);
431 void ProgramData::uniform_matrix4_array(Tag tag, unsigned n, const float *v)
433 uniform(tag, FLOAT_MAT4, n, v);
436 void ProgramData::remove_uniform(Tag tag)
438 auto i = lower_bound_member(uniforms, tag, &TaggedUniform::tag);
439 if(i==uniforms.end() || i->tag!=tag)
442 uniform_data.erase(uniform_data.begin()+i->data_offset, uniform_data.begin()+i->data_offset+i->data_size);
443 for(TaggedUniform &u: uniforms)
444 if(u.data_offset>i->data_offset)
445 u.data_offset -= i->data_size;
448 mark_dirty(ALL_ONES);
451 vector<Tag> ProgramData::get_uniform_tags() const
454 tags.reserve(uniforms.size());
455 for(const TaggedUniform &u: uniforms)
456 tags.push_back(u.tag);
460 void ProgramData::copy_uniform(const ProgramData &source, Tag tag)
462 int i = source.find_uniform_index(tag);
464 throw key_error(tag);
465 const TaggedUniform &tu = source.uniforms[i];
466 uniform(tag, tu.type, tu.array_size, source.uniform_data.data()+tu.data_offset);
469 int ProgramData::find_uniform_index(Tag tag) const
471 auto i = lower_bound_member(uniforms, tag, &TaggedUniform::tag);
472 return ((i!=uniforms.end() && i->tag==tag) ? i-uniforms.begin() : -1);
475 vector<ProgramData::ProgramBlock>::iterator ProgramData::get_program(const Program &prog) const
477 ReflectData::LayoutHash prog_hash = prog.get_uniform_layout_hash();
478 auto i = lower_bound_member(programs, prog_hash, &ProgramBlock::prog_hash);
479 if(i!=programs.end() && i->prog_hash==prog_hash)
482 const vector<ReflectData::UniformBlockInfo> &block_infos = prog.get_uniform_blocks();
483 unsigned index = i-programs.begin();
484 programs.insert(i, 1+block_infos.size(), ProgramBlock(prog_hash));
486 /* Block indices may change if new shared blocks need to be inserted. Store
487 the hashes so they can be matched up later. */
488 vector<ReflectData::LayoutHash> block_hashes;
489 block_hashes.reserve(programs.size());
490 for(const ProgramBlock &b: programs)
491 block_hashes.push_back(b.block_index>=0 ? blocks[b.block_index].block_hash : 0);
493 for(unsigned j=0; j<block_infos.size(); ++j)
495 const ReflectData::UniformBlockInfo &info = block_infos[j];
496 block_hashes[index+1+j] = info.layout_hash;
497 programs[index+1+j].bind_point = info.bind_point;
499 auto k = lower_bound_member(blocks, info.layout_hash, &SharedBlock::block_hash);
500 if(k==blocks.end() || k->block_hash!=info.layout_hash)
502 k = blocks.insert(k, SharedBlock(info.layout_hash));
503 update_block_uniform_indices(*k, info);
507 /* Reassign shared block indices from the stored hashes. */
508 for(unsigned j=0; j<programs.size(); ++j)
510 unsigned hash = block_hashes[j];
513 auto k = lower_bound_member(blocks, hash, &SharedBlock::block_hash);
514 programs[j].block_index = k-blocks.begin();
517 programs[j].block_index = -1;
520 return programs.begin()+index;
523 void ProgramData::update_block_uniform_indices(SharedBlock &block, const ReflectData::UniformBlockInfo &info) const
525 uint8_t *indices = block.indices.values;
526 if(info.uniforms.size()>16)
528 if(block.indices.type_flag==0xFD)
530 block.indices.dynamic.values = new uint8_t[info.uniforms.size()];
531 block.indices.type_flag = 0xFE;
533 indices = block.indices.dynamic.values;
536 bool any_missing = false;
539 for(unsigned i=0; i<info.uniforms.size(); ++i)
541 int j = find_uniform_index(info.uniforms[i]->tag);
545 if(static_cast<unsigned>(j)<MASK_BITS)
555 if(block.used && any_missing && info.bind_point>=0)
558 IO::print(IO::cerr, "Warning: not all uniforms for block %s are present\n", info.name);
560 throw incomplete_uniform_block(info.name);
564 block.dirty = block.used;
566 if(block.used && !block.block)
568 block.block = new UniformBlock(info);
569 if(info.bind_point>=0)
573 buffer = new Buffer();
576 if(!debug_name.empty())
577 buffer->set_debug_name(debug_name);
581 block.block->use_buffer(buffer, last_buffer_block);
582 last_buffer_block = block.block;
587 void ProgramData::update_block(SharedBlock &block, const ReflectData::UniformBlockInfo &info) const
589 const uint8_t *indices = block.get_uniform_indices();
590 for(unsigned i=0; i<info.uniforms.size(); ++i)
592 if(is_image(info.uniforms[i]->type))
593 ; // Temporarily ignore deprecated use of sampler uniforms in ProgramData
594 else if(indices[i]!=0xFF)
596 const TaggedUniform &tu = uniforms[indices[i]];
597 block.block->store(*info.uniforms[i], tu.array_size, uniform_data.data()+tu.data_offset);
602 vector<ProgramData::ProgramBlock>::const_iterator ProgramData::prepare_program(const Program &prog) const
604 UniformBlock *old_last_block = last_buffer_block;
605 auto prog_begin = get_program(prog);
607 Mask force_dirty = (dirty==ALL_ONES ? ALL_ONES : 0U);
608 Mask affected = (dirty&prog_begin->masks.used) | force_dirty;
609 if(affected|prog_begin->masks.dirty)
611 /* If the global dirty flag affects this program, add it to per-block and
612 per-program dirty flags and clear the global flag. A previously unseen
613 program will cause this to happen if there's any dirty uniforms. */
616 for(SharedBlock &b: blocks)
617 b.dirty |= (dirty&b.used) | force_dirty;
618 for(ProgramBlock &b: programs)
620 b.masks.dirty |= (dirty&b.masks.used) | force_dirty;
624 const vector<ReflectData::UniformBlockInfo> &block_infos = prog.get_uniform_blocks();
626 if(prog_begin->masks.dirty==ALL_ONES)
628 /* The set of uniforms has changed since this program was last used.
629 Refresh uniform indices within the program's blocks. */
630 prog_begin->masks.used = 0;
631 auto j = prog_begin+1;
632 for(const ReflectData::UniformBlockInfo &b: block_infos)
634 SharedBlock &shared = blocks[j->block_index];
635 if(shared.dirty==ALL_ONES)
636 update_block_uniform_indices(shared, b);
637 prog_begin->masks.used |= shared.used;
638 j->block = (shared.used ? shared.block : 0);
643 // Update the contents of all dirty blocks.
644 bool buffered_blocks_updated = false;
645 auto j = prog_begin+1;
646 for(const ReflectData::UniformBlockInfo &b: block_infos)
648 SharedBlock &shared = blocks[j->block_index];
651 update_block(shared, b);
653 buffered_blocks_updated |= (j->bind_point>=0);
658 prog_begin->masks.dirty = 0;
660 if(last_buffer_block!=old_last_block)
662 unsigned required_size = last_buffer_block->get_required_buffer_size();
663 if(last_buffer_block->get_required_buffer_size()>buffer->get_size())
665 if(buffer->get_size()>0)
668 buffer = new Buffer();
669 last_buffer_block->change_buffer(buffer);
672 if(!debug_name.empty())
673 buffer->set_debug_name(debug_name);
677 buffer->storage(required_size);
685 void ProgramData::apply(const Program &prog, PipelineState &state) const
687 auto prog_begin = prepare_program(prog);
688 ReflectData::LayoutHash prog_hash = prog_begin->prog_hash;
689 for(auto i=prog_begin+1; (i!=programs.end() && i->prog_hash==prog_hash); ++i)
692 state.set_uniform_block(i->bind_point, i->block);
698 void ProgramData::set_debug_name(const string &name)
703 buffer->set_debug_name(name);
710 ProgramData::SharedBlock::SharedBlock(ReflectData::LayoutHash h):
716 indices.type_flag = 0xFD;
719 const uint8_t *ProgramData::SharedBlock::get_uniform_indices() const
721 return (indices.type_flag==0xFE ? indices.dynamic.values : indices.values);
725 ProgramData::ProgramBlock::ProgramBlock(ReflectData::LayoutHash h):
730 masks.used = ALL_ONES;
731 masks.dirty = ALL_ONES;
735 ProgramData::Loader::Loader(ProgramData &pd):
736 DataFile::ObjectLoader<ProgramData>(pd)
738 add("uniform", &Loader::uniform1i);
739 add("uniform1i", &Loader::uniform1i);
740 add("uniform", &Loader::uniform1f);
741 add("uniform1f", &Loader::uniform1f);
742 add("uniform", &Loader::uniform2i);
743 add("uniform2i", &Loader::uniform2i);
744 add("uniform", &Loader::uniform2f);
745 add("uniform2f", &Loader::uniform2f);
746 add("uniform", &Loader::uniform3i);
747 add("uniform3i", &Loader::uniform3i);
748 add("uniform", &Loader::uniform3f);
749 add("uniform3f", &Loader::uniform3f);
750 add("uniform", &Loader::uniform4i);
751 add("uniform4i", &Loader::uniform4i);
752 add("uniform", &Loader::uniform4f);
753 add("uniform4f", &Loader::uniform4f);
754 add("uniform1i_array", &Loader::uniform1i_array);
755 add("uniform1f_array", &Loader::uniform1f_array);
756 add("uniform2f_array", &Loader::uniform2f_array);
757 add("uniform3f_array", &Loader::uniform3f_array);
758 add("uniform4f_array", &Loader::uniform4f_array);
759 add("uniform_array", &Loader::uniform_array);
762 void ProgramData::Loader::uniform1i(const string &n, int v)
767 void ProgramData::Loader::uniform1f(const string &n, float v)
772 void ProgramData::Loader::uniform2i(const string &n, int v0, int v1)
774 obj.uniform(n, v0, v1);
777 void ProgramData::Loader::uniform2f(const string &n, float v0, float v1)
779 obj.uniform(n, v0, v1);
782 void ProgramData::Loader::uniform3i(const string &n, int v0, int v1, int v2)
784 obj.uniform(n, v0, v1, v2);
787 void ProgramData::Loader::uniform3f(const string &n, float v0, float v1, float v2)
789 obj.uniform(n, v0, v1, v2);
792 void ProgramData::Loader::uniform4i(const string &n, int v0, int v1, int v2, int v3)
794 obj.uniform(n, v0, v1, v2, v3);
797 void ProgramData::Loader::uniform4f(const string &n, float v0, float v1, float v2, float v3)
799 obj.uniform(n, v0, v1, v2, v3);
802 void ProgramData::Loader::uniform_array_(const string &n, DataType t, unsigned e)
804 ArrayLoader ldr(t, e);
806 unsigned size = ldr.get_size();
808 throw logic_error("empty uniform array");
810 DataType type = ldr.get_data_type();
811 unsigned elem_size = ldr.get_element_size();
814 const int *data = reinterpret_cast<const int *>(ldr.get_data());
816 obj.uniform1_array(n, size, data);
817 else if(elem_size==2)
818 obj.uniform2_array(n, size, data);
819 else if(elem_size==3)
820 obj.uniform3_array(n, size, data);
821 else if(elem_size==4)
822 obj.uniform4_array(n, size, data);
824 throw logic_error("unsupported combination of array type and element size");
828 const float *data = reinterpret_cast<const float *>(ldr.get_data());
830 obj.uniform1_array(n, size, data);
831 else if(elem_size==2)
832 obj.uniform2_array(n, size, data);
833 else if(elem_size==3)
834 obj.uniform3_array(n, size, data);
835 else if(elem_size==4)
836 obj.uniform4_array(n, size, data);
838 throw logic_error("unsupported combination of array type and element size");
841 throw logic_error("unsupported array type");
844 void ProgramData::Loader::uniform1i_array(const string &n)
846 uniform_array_(n, INT, 1);
849 void ProgramData::Loader::uniform1f_array(const string &n)
851 uniform_array_(n, FLOAT, 1);
854 void ProgramData::Loader::uniform2i_array(const string &n)
856 uniform_array_(n, INT, 2);
859 void ProgramData::Loader::uniform2f_array(const string &n)
861 uniform_array_(n, FLOAT, 2);
864 void ProgramData::Loader::uniform3i_array(const string &n)
866 uniform_array_(n, INT, 3);
869 void ProgramData::Loader::uniform3f_array(const string &n)
871 uniform_array_(n, FLOAT, 3);
874 void ProgramData::Loader::uniform4i_array(const string &n)
876 uniform_array_(n, INT, 4);
879 void ProgramData::Loader::uniform4f_array(const string &n)
881 uniform_array_(n, FLOAT, 4);
884 void ProgramData::Loader::uniform_array(const string &n)
886 uniform_array_(n, static_cast<DataType>(0), 0);
890 ProgramData::ArrayLoader::ArrayLoader(DataType t, unsigned e):
894 add("uniform", &ArrayLoader::uniform1i);
895 add("uniform1i", &ArrayLoader::uniform1i);
896 add("uniform", &ArrayLoader::uniform1f);
897 add("uniform1f", &ArrayLoader::uniform1f);
898 add("uniform", &ArrayLoader::uniform2f);
899 add("uniform2f", &ArrayLoader::uniform2f);
900 add("uniform", &ArrayLoader::uniform3f);
901 add("uniform3f", &ArrayLoader::uniform3f);
902 add("uniform", &ArrayLoader::uniform4f);
903 add("uniform4f", &ArrayLoader::uniform4f);
906 void ProgramData::ArrayLoader::uniform(DataType t, unsigned e, const void *v)
908 if(element_size && (t!=type || e!=element_size))
909 throw logic_error("heterogeneous array contents");
917 const char *cv = reinterpret_cast<const char *>(v);
918 data.insert(data.end(), cv, cv+element_size*4);
921 void ProgramData::ArrayLoader::uniform1i(int v)
926 void ProgramData::ArrayLoader::uniform1f(float v)
928 uniform(FLOAT, 1, &v);
931 void ProgramData::ArrayLoader::uniform2i(int v0, int v1)
933 int va[2] = { v0, v1 };
937 void ProgramData::ArrayLoader::uniform2f(float v0, float v1)
939 float va[2] = { v0, v1 };
940 uniform(FLOAT, 2, va);
943 void ProgramData::ArrayLoader::uniform3i(int v0, int v1, int v2)
945 int va[3] = { v0, v1, v2 };
949 void ProgramData::ArrayLoader::uniform3f(float v0, float v1, float v2)
951 float va[3] = { v0, v1, v2 };
952 uniform(FLOAT, 3, va);
955 void ProgramData::ArrayLoader::uniform4i(int v0, int v1, int v2, int v3)
957 int va[4] = { v0, v1, v2, v3 };
961 void ProgramData::ArrayLoader::uniform4f(float v0, float v1, float v2, float v3)
963 float va[4] = { v0, v1, v2, v3 };
964 uniform(FLOAT, 4, va);