1 #include <msp/core/algorithm.h>
2 #include <msp/core/maputils.h>
3 #include <msp/debug/demangle.h>
4 #include <msp/gl/extensions/arb_direct_state_access.h>
5 #include <msp/io/print.h>
11 #include "programdata.h"
13 #include "uniformblock.h"
21 ProgramData::ProgramData(const Program *p):
29 // Blocks are intentionally left uncopied
30 ProgramData::ProgramData(const ProgramData &other):
31 tied_program(other.tied_program),
32 uniforms(other.uniforms),
33 generation(other.generation),
38 for(vector<TaggedUniform>::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
39 i->value = i->value->clone();
42 ProgramData::ProgramData(const ProgramData &other, const Program *p):
50 for(vector<TaggedUniform>::const_iterator i=other.uniforms.begin(); i!=other.uniforms.end(); ++i)
54 uniforms = other.uniforms;
55 for(vector<TaggedUniform>::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
56 i->value = i->value->clone();
59 ProgramData &ProgramData::operator=(const ProgramData &other)
61 tied_program = other.tied_program;
63 uniforms = other.uniforms;
64 for(vector<TaggedUniform>::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
65 i->value = i->value->clone();
67 for(vector<SharedBlock>::iterator i=blocks.begin(); i!=blocks.end(); ++i)
71 last_buffer_block = 0;
78 ProgramData::~ProgramData()
80 for(vector<TaggedUniform>::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
82 for(vector<SharedBlock>::iterator i=blocks.begin(); i!=blocks.end(); ++i)
84 if(i->indices.type_flag==0xFE)
85 delete[] i->indices.dynamic.values;
91 void ProgramData::uniform(Tag tag, Uniform *uni)
95 if(!validate_tag(tag))
107 int i = find_uniform_index(tag);
109 return add_uniform(tag, uni);
111 uniforms[i].replace_value(uni);
115 template<typename T, typename V>
116 void ProgramData::uniform(Tag tag, V value)
118 if(!validate_tag(tag))
121 int i = find_uniform_index(tag);
123 return add_uniform(tag, new T(value));
125 if(T *uni = dynamic_cast<T *>(uniforms[i].value))
128 uniforms[i].replace_value(new T(value));
133 template<typename T, typename V>
134 void ProgramData::uniform_array(Tag tag, unsigned n, V value)
136 if(!validate_tag(tag))
139 int i = find_uniform_index(tag);
141 return add_uniform(tag, new UniformArray<T>(n, value));
143 UniformArray<T> *uni = dynamic_cast<UniformArray<T> *>(uniforms[i].value);
144 if(uni && n==uni->size())
147 uniforms[i].replace_value(new UniformArray<T>(n, value));
152 bool ProgramData::validate_tag(Tag tag) const
160 const Program::UniformInfo &info = tied_program->get_uniform_info(tag);
161 if(is_image(info.type))
162 throw invalid_operation("ProgramData::uniform");
167 catch(const exception &e)
169 IO::print(IO::cerr, "Error while setting uniform %s: %s: %s\n", tag, Debug::demangle(typeid(e).name()), e.what());
175 void ProgramData::add_uniform(Tag tag, Uniform *uni)
177 if(uniforms.size()>=MASK_BITS)
180 throw too_many_uniforms(tag.str());
183 vector<TaggedUniform>::iterator j = lower_bound_member(uniforms, tag, &TaggedUniform::tag);
188 uniforms.insert(j, nu);
190 mark_dirty(ALL_ONES);
193 void ProgramData::mark_dirty(Mask bits)
200 void ProgramData::uniform(Tag tag, const Uniform &u)
202 uniform(tag, u.clone());
205 void ProgramData::uniform(Tag tag, int v)
207 uniform<Uniform1i>(tag, v);
210 void ProgramData::uniform(Tag tag, float v)
212 uniform<Uniform1f>(tag, v);
215 void ProgramData::uniform(Tag tag, int v0, int v1)
217 int va[2] = { v0, v1 };
221 void ProgramData::uniform(Tag tag, float v0, float v1)
223 float va[2] = { v0, v1 };
227 void ProgramData::uniform2(Tag tag, const int *v)
229 uniform<Uniform2i>(tag, v);
232 void ProgramData::uniform2(Tag tag, const float *v)
234 uniform<Uniform2f>(tag, v);
237 void ProgramData::uniform(Tag tag, int v0, int v1, int v2)
239 int va[3] = { v0, v1, v2 };
243 void ProgramData::uniform(Tag tag, float v0, float v1, float v2)
245 float va[3] = { v0, v1, v2 };
249 void ProgramData::uniform3(Tag tag, const int *v)
251 uniform<Uniform3i>(tag, v);
254 void ProgramData::uniform3(Tag tag, const float *v)
256 uniform<Uniform3f>(tag, v);
259 void ProgramData::uniform(Tag tag, int v0, int v1, int v2, int v3)
261 int va[4] = { v0, v1, v2, v3 };
265 void ProgramData::uniform(Tag tag, float v0, float v1, float v2, float v3)
267 float va[4] = { v0, v1, v2, v3 };
271 void ProgramData::uniform(Tag tag, const Color &c)
273 uniform(tag, c.r, c.g, c.b, c.a);
276 void ProgramData::uniform4(Tag tag, const int *v)
278 uniform<Uniform4i>(tag, v);
281 void ProgramData::uniform4(Tag tag, const float *v)
283 uniform<Uniform4f>(tag, v);
286 void ProgramData::uniform_matrix2(Tag tag, const float *v)
288 uniform<UniformMatrix2x2f>(tag, v);
291 void ProgramData::uniform_matrix3x2(Tag tag, const float *v)
293 uniform<UniformMatrix3x2f>(tag, v);
296 void ProgramData::uniform_matrix4x2(Tag tag, const float *v)
298 uniform<UniformMatrix4x2f>(tag, v);
301 void ProgramData::uniform_matrix2x3(Tag tag, const float *v)
303 uniform<UniformMatrix2x3f>(tag, v);
306 void ProgramData::uniform_matrix3(Tag tag, const float *v)
308 uniform<UniformMatrix3x3f>(tag, v);
311 void ProgramData::uniform_matrix4x3(Tag tag, const float *v)
313 uniform<UniformMatrix4x3f>(tag, v);
316 void ProgramData::uniform_matrix2x4(Tag tag, const float *v)
318 uniform<UniformMatrix2x4f>(tag, v);
321 void ProgramData::uniform_matrix3x4(Tag tag, const float *v)
323 uniform<UniformMatrix3x4f>(tag, v);
326 void ProgramData::uniform(Tag tag, const Matrix &m)
328 uniform_matrix4(tag, m.data());
331 void ProgramData::uniform_matrix4(Tag tag, const float *v)
333 uniform<UniformMatrix4x4f>(tag, v);
336 void ProgramData::uniform_array(Tag tag, unsigned n, const int *v)
338 uniform_array<Uniform1i>(tag, n, v);
341 void ProgramData::uniform_array(Tag tag, unsigned n, const float *v)
343 uniform_array<Uniform1f>(tag, n, v);
346 void ProgramData::uniform1_array(Tag tag, unsigned n, const int *v)
348 uniform_array<Uniform1i>(tag, n, v);
351 void ProgramData::uniform1_array(Tag tag, unsigned n, const float *v)
353 uniform_array<Uniform1f>(tag, n, v);
356 void ProgramData::uniform2_array(Tag tag, unsigned n, const int *v)
358 uniform_array<Uniform2i>(tag, n, v);
361 void ProgramData::uniform2_array(Tag tag, unsigned n, const float *v)
363 uniform_array<Uniform2f>(tag, n, v);
366 void ProgramData::uniform3_array(Tag tag, unsigned n, const int *v)
368 uniform_array<Uniform3i>(tag, n, v);
371 void ProgramData::uniform3_array(Tag tag, unsigned n, const float *v)
373 uniform_array<Uniform3f>(tag, n, v);
376 void ProgramData::uniform4_array(Tag tag, unsigned n, const int *v)
378 uniform_array<Uniform4i>(tag, n, v);
381 void ProgramData::uniform4_array(Tag tag, unsigned n, const float *v)
383 uniform_array<Uniform4f>(tag, n, v);
386 void ProgramData::uniform_matrix2_array(Tag tag, unsigned n, const float *v)
388 uniform_array<UniformMatrix2x2f>(tag, n, v);
391 void ProgramData::uniform_matrix3x2_array(Tag tag, unsigned n, const float *v)
393 uniform_array<UniformMatrix3x2f>(tag, n, v);
396 void ProgramData::uniform_matrix4x2_array(Tag tag, unsigned n, const float *v)
398 uniform_array<UniformMatrix4x2f>(tag, n, v);
401 void ProgramData::uniform_matrix2x3_array(Tag tag, unsigned n, const float *v)
403 uniform_array<UniformMatrix2x3f>(tag, n, v);
406 void ProgramData::uniform_matrix3_array(Tag tag, unsigned n, const float *v)
408 uniform_array<UniformMatrix3x3f>(tag, n, v);
411 void ProgramData::uniform_matrix4x3_array(Tag tag, unsigned n, const float *v)
413 uniform_array<UniformMatrix4x3f>(tag, n, v);
416 void ProgramData::uniform_matrix2x4_array(Tag tag, unsigned n, const float *v)
418 uniform_array<UniformMatrix2x4f>(tag, n, v);
421 void ProgramData::uniform_matrix3x4_array(Tag tag, unsigned n, const float *v)
423 uniform_array<UniformMatrix3x4f>(tag, n, v);
426 void ProgramData::uniform_matrix4_array(Tag tag, unsigned n, const float *v)
428 uniform_array<UniformMatrix4x4f>(tag, n, v);
431 void ProgramData::remove_uniform(Tag tag)
433 vector<TaggedUniform>::const_iterator i = lower_bound_member(uniforms, tag, &TaggedUniform::tag);
434 if(i==uniforms.end() || i->tag!=tag)
440 mark_dirty(ALL_ONES);
443 vector<Tag> ProgramData::get_uniform_tags() const
446 tags.reserve(uniforms.size());
447 for(vector<TaggedUniform>::const_iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
448 tags.push_back(i->tag);
452 const Uniform &ProgramData::get_uniform(Tag tag) const
454 int i = find_uniform_index(tag);
456 throw key_error(tag);
457 return *uniforms[i].value;
460 const Uniform *ProgramData::find_uniform(Tag tag) const
462 int i = find_uniform_index(tag);
463 return (i>=0 ? uniforms[i].value : 0);
466 int ProgramData::find_uniform_index(Tag tag) const
468 vector<TaggedUniform>::const_iterator i = lower_bound_member(uniforms, tag, &TaggedUniform::tag);
469 return ((i!=uniforms.end() && i->tag==tag) ? i-uniforms.begin() : -1);
472 vector<ProgramData::ProgramBlock>::iterator ProgramData::get_program(const Program &prog) const
474 Program::LayoutHash prog_hash = prog.get_uniform_layout_hash();
475 vector<ProgramBlock>::iterator i = lower_bound_member(programs, prog_hash, &ProgramBlock::prog_hash);
476 if(i!=programs.end() && i->prog_hash==prog_hash)
479 const vector<Program::UniformBlockInfo> &block_infos = prog.get_uniform_blocks();
480 unsigned index = i-programs.begin();
481 programs.insert(i, 1+block_infos.size(), ProgramBlock(prog_hash));
483 /* Block indices may change if new shared blocks need to be inserted. Store
484 the hashes so they can be matched up later. */
485 vector<Program::LayoutHash> block_hashes;
486 block_hashes.reserve(programs.size());
487 for(vector<ProgramBlock>::iterator j=programs.begin(); j!=programs.end(); ++j)
488 block_hashes.push_back(j->block_index>=0 ? blocks[j->block_index].block_hash : 0);
490 for(unsigned j=0; j<block_infos.size(); ++j)
492 const Program::UniformBlockInfo &info = block_infos[j];
493 block_hashes[index+1+j] = info.layout_hash;
494 programs[index+1+j].bind_point = info.bind_point;
496 vector<SharedBlock>::iterator k = lower_bound_member(blocks, info.layout_hash, &SharedBlock::block_hash);
497 if(k==blocks.end() || k->block_hash!=info.layout_hash)
499 k = blocks.insert(k, SharedBlock(info.layout_hash));
500 update_block_uniform_indices(*k, info);
504 /* Reassign shared block indices from the stored hashes. */
505 for(unsigned j=0; j<programs.size(); ++j)
507 unsigned hash = block_hashes[j];
510 vector<SharedBlock>::const_iterator k = lower_bound_member(blocks, hash, &SharedBlock::block_hash);
511 programs[j].block_index = k-blocks.begin();
514 programs[j].block_index = -1;
517 return programs.begin()+index;
520 void ProgramData::update_block_uniform_indices(SharedBlock &block, const Program::UniformBlockInfo &info) const
522 UInt8 *indices = block.indices.values;
523 if(info.uniforms.size()>16)
525 if(block.indices.type_flag==0xFD)
527 block.indices.dynamic.values = new UInt8[info.uniforms.size()];
528 block.indices.type_flag = 0xFE;
530 indices = block.indices.dynamic.values;
533 bool any_missing = false;
536 for(unsigned i=0; i<info.uniforms.size(); ++i)
538 int j = find_uniform_index(info.uniforms[i]->tag);
542 if(static_cast<unsigned>(j)<MASK_BITS)
552 if(block.used && any_missing && info.bind_point>=0)
555 IO::print(IO::cerr, "Warning: not all uniforms for block %s are present\n", info.name);
557 throw incomplete_uniform_block(info.name);
561 block.dirty = block.used;
563 if(block.used && !block.block)
565 if(info.bind_point>=0)
569 buffer = new Buffer();
572 if(!debug_name.empty())
573 buffer->set_debug_name(debug_name);
577 BufferBackedUniformBlock *bb_block = new BufferBackedUniformBlock(info.data_size);
578 block.block = bb_block;
579 bb_block->use_buffer(buffer, last_buffer_block);
580 last_buffer_block = bb_block;
583 block.block = new DefaultUniformBlock;
587 void ProgramData::update_block(SharedBlock &block, const Program::UniformBlockInfo &info) const
589 const UInt8 *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)
595 block.block->attach(*info.uniforms[i], *uniforms[indices[i]].value);
599 void ProgramData::apply() const
601 const Program *prog = Program::current();
603 throw invalid_operation("ProgramData::apply");
605 BufferBackedUniformBlock *old_last_block = last_buffer_block;
606 vector<ProgramBlock>::iterator prog_begin = get_program(*prog);
607 Program::LayoutHash prog_hash = prog->get_uniform_layout_hash();
609 Mask force_dirty = (dirty==ALL_ONES ? ALL_ONES : 0U);
610 Mask affected = (dirty&prog_begin->masks.used) | force_dirty;
611 if(affected|prog_begin->masks.dirty)
613 /* If the global dirty flag affects this program, add it to per-block and
614 per-program dirty flags and clear the global flag. A previously unseen
615 program will cause this to happen if there's any dirty uniforms. */
618 for(vector<SharedBlock>::iterator i=blocks.begin(); i!=blocks.end(); ++i)
619 i->dirty |= (dirty&i->used) | force_dirty;
620 for(vector<ProgramBlock>::iterator i=programs.begin(); i!=programs.end(); ++i)
622 i->masks.dirty |= (dirty&i->masks.used) | force_dirty;
626 const vector<Program::UniformBlockInfo> &block_infos = prog->get_uniform_blocks();
628 if(prog_begin->masks.dirty==ALL_ONES)
630 /* The set of uniforms has changed since this program was last used.
631 Refresh uniform indices within the program's blocks. */
632 prog_begin->masks.used = 0;
633 vector<ProgramBlock>::iterator j = prog_begin+1;
634 for(vector<Program::UniformBlockInfo>::const_iterator i=block_infos.begin(); i!=block_infos.end(); ++i, ++j)
636 SharedBlock &shared = blocks[j->block_index];
637 if(shared.dirty==ALL_ONES)
638 update_block_uniform_indices(shared, *i);
639 prog_begin->masks.used |= shared.used;
640 j->block = (shared.used ? shared.block : 0);
644 // Update the contents of all dirty blocks.
645 bool buffered_blocks_updated = false;
646 vector<ProgramBlock>::iterator j = prog_begin+1;
647 for(vector<Program::UniformBlockInfo>::const_iterator i=block_infos.begin(); i!=block_infos.end(); ++i, ++j)
649 SharedBlock &shared = blocks[j->block_index];
652 update_block(shared, *i);
654 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);
682 for(vector<ProgramBlock>::iterator i=prog_begin+1; (i!=programs.end() && i->prog_hash==prog_hash); ++i)
684 i->block->apply(i->bind_point);
687 void ProgramData::set_debug_name(const string &name)
692 buffer->set_debug_name(name);
699 ProgramData::TaggedUniform::TaggedUniform():
703 void ProgramData::TaggedUniform::replace_value(Uniform *v)
705 /* UniformBlock does not copy the uniforms, so existing default blocks
706 will be left with stale pointers. This is not a problem as long as no
707 one stores pointers to the blocks and expects them to stay valid. */
713 ProgramData::SharedBlock::SharedBlock(Program::LayoutHash h):
719 indices.type_flag = 0xFD;
722 const UInt8 *ProgramData::SharedBlock::get_uniform_indices() const
724 return (indices.type_flag==0xFE ? indices.dynamic.values : indices.values);
728 ProgramData::ProgramBlock::ProgramBlock(Program::LayoutHash h):
733 masks.used = ALL_ONES;
734 masks.dirty = ALL_ONES;
738 ProgramData::Loader::Loader(ProgramData &pd):
739 DataFile::ObjectLoader<ProgramData>(pd)
741 add("uniform", &Loader::uniform1i);
742 add("uniform1i", &Loader::uniform1i);
743 add("uniform", &Loader::uniform1f);
744 add("uniform1f", &Loader::uniform1f);
745 add("uniform", &Loader::uniform2i);
746 add("uniform2i", &Loader::uniform2i);
747 add("uniform", &Loader::uniform2f);
748 add("uniform2f", &Loader::uniform2f);
749 add("uniform", &Loader::uniform3i);
750 add("uniform3i", &Loader::uniform3i);
751 add("uniform", &Loader::uniform3f);
752 add("uniform3f", &Loader::uniform3f);
753 add("uniform", &Loader::uniform4i);
754 add("uniform4i", &Loader::uniform4i);
755 add("uniform", &Loader::uniform4f);
756 add("uniform4f", &Loader::uniform4f);
757 add("uniform1i_array", &Loader::uniform1i_array);
758 add("uniform1f_array", &Loader::uniform1f_array);
759 add("uniform2f_array", &Loader::uniform2f_array);
760 add("uniform3f_array", &Loader::uniform3f_array);
761 add("uniform4f_array", &Loader::uniform4f_array);
762 add("uniform_array", &Loader::uniform_array);
765 void ProgramData::Loader::uniform1i(const string &n, int v)
770 void ProgramData::Loader::uniform1f(const string &n, float v)
775 void ProgramData::Loader::uniform2i(const string &n, int v0, int v1)
777 obj.uniform(n, v0, v1);
780 void ProgramData::Loader::uniform2f(const string &n, float v0, float v1)
782 obj.uniform(n, v0, v1);
785 void ProgramData::Loader::uniform3i(const string &n, int v0, int v1, int v2)
787 obj.uniform(n, v0, v1, v2);
790 void ProgramData::Loader::uniform3f(const string &n, float v0, float v1, float v2)
792 obj.uniform(n, v0, v1, v2);
795 void ProgramData::Loader::uniform4i(const string &n, int v0, int v1, int v2, int v3)
797 obj.uniform(n, v0, v1, v2, v3);
800 void ProgramData::Loader::uniform4f(const string &n, float v0, float v1, float v2, float v3)
802 obj.uniform(n, v0, v1, v2, v3);
805 void ProgramData::Loader::uniform_array_(const string &n, DataType t, unsigned e)
807 ArrayLoader ldr(t, e);
809 unsigned size = ldr.get_size();
811 throw logic_error("empty uniform array");
813 DataType type = ldr.get_data_type();
814 unsigned elem_size = ldr.get_element_size();
817 const int *data = reinterpret_cast<const int *>(ldr.get_data());
819 obj.uniform1_array(n, size, data);
820 else if(elem_size==2)
821 obj.uniform2_array(n, size, data);
822 else if(elem_size==3)
823 obj.uniform3_array(n, size, data);
824 else if(elem_size==4)
825 obj.uniform4_array(n, size, data);
827 throw logic_error("unsupported combination of array type and element size");
831 const float *data = reinterpret_cast<const float *>(ldr.get_data());
833 obj.uniform1_array(n, size, data);
834 else if(elem_size==2)
835 obj.uniform2_array(n, size, data);
836 else if(elem_size==3)
837 obj.uniform3_array(n, size, data);
838 else if(elem_size==4)
839 obj.uniform4_array(n, size, data);
841 throw logic_error("unsupported combination of array type and element size");
844 throw logic_error("unsupported array type");
847 void ProgramData::Loader::uniform1i_array(const string &n)
849 uniform_array_(n, INT, 1);
852 void ProgramData::Loader::uniform1f_array(const string &n)
854 uniform_array_(n, FLOAT, 1);
857 void ProgramData::Loader::uniform2i_array(const string &n)
859 uniform_array_(n, INT, 2);
862 void ProgramData::Loader::uniform2f_array(const string &n)
864 uniform_array_(n, FLOAT, 2);
867 void ProgramData::Loader::uniform3i_array(const string &n)
869 uniform_array_(n, INT, 3);
872 void ProgramData::Loader::uniform3f_array(const string &n)
874 uniform_array_(n, FLOAT, 3);
877 void ProgramData::Loader::uniform4i_array(const string &n)
879 uniform_array_(n, INT, 4);
882 void ProgramData::Loader::uniform4f_array(const string &n)
884 uniform_array_(n, FLOAT, 4);
887 void ProgramData::Loader::uniform_array(const string &n)
889 uniform_array_(n, static_cast<DataType>(0), 0);
893 ProgramData::ArrayLoader::ArrayLoader(DataType t, unsigned e):
897 add("uniform", &ArrayLoader::uniform1i);
898 add("uniform1i", &ArrayLoader::uniform1i);
899 add("uniform", &ArrayLoader::uniform1f);
900 add("uniform1f", &ArrayLoader::uniform1f);
901 add("uniform", &ArrayLoader::uniform2f);
902 add("uniform2f", &ArrayLoader::uniform2f);
903 add("uniform", &ArrayLoader::uniform3f);
904 add("uniform3f", &ArrayLoader::uniform3f);
905 add("uniform", &ArrayLoader::uniform4f);
906 add("uniform4f", &ArrayLoader::uniform4f);
909 void ProgramData::ArrayLoader::uniform(DataType t, unsigned e, const void *v)
911 if(element_size && (t!=type || e!=element_size))
912 throw logic_error("heterogeneous array contents");
920 const char *cv = reinterpret_cast<const char *>(v);
921 data.insert(data.end(), cv, cv+element_size*4);
924 void ProgramData::ArrayLoader::uniform1i(int v)
929 void ProgramData::ArrayLoader::uniform1f(float v)
931 uniform(FLOAT, 1, &v);
934 void ProgramData::ArrayLoader::uniform2i(int v0, int v1)
936 int va[2] = { v0, v1 };
940 void ProgramData::ArrayLoader::uniform2f(float v0, float v1)
942 float va[2] = { v0, v1 };
943 uniform(FLOAT, 2, va);
946 void ProgramData::ArrayLoader::uniform3i(int v0, int v1, int v2)
948 int va[3] = { v0, v1, v2 };
952 void ProgramData::ArrayLoader::uniform3f(float v0, float v1, float v2)
954 float va[3] = { v0, v1, v2 };
955 uniform(FLOAT, 3, va);
958 void ProgramData::ArrayLoader::uniform4i(int v0, int v1, int v2, int v3)
960 int va[4] = { v0, v1, v2, v3 };
964 void ProgramData::ArrayLoader::uniform4f(float v0, float v1, float v2, float v3)
966 float va[4] = { v0, v1, v2, v3 };
967 uniform(FLOAT, 4, va);