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)
568 buffer = new Buffer(UNIFORM_BUFFER);
570 BufferBackedUniformBlock *bb_block = new BufferBackedUniformBlock(info.data_size);
571 block.block = bb_block;
572 bb_block->use_buffer(buffer, last_buffer_block);
573 last_buffer_block = bb_block;
576 block.block = new DefaultUniformBlock;
580 void ProgramData::update_block(SharedBlock &block, const Program::UniformBlockInfo &info) const
582 const UInt8 *indices = block.get_uniform_indices();
583 for(unsigned i=0; i<info.uniforms.size(); ++i)
585 if(is_image(info.uniforms[i]->type))
586 ; // Temporarily ignore deprecated use of sampler uniforms in ProgramData
587 else if(indices[i]!=0xFF)
588 block.block->attach(*info.uniforms[i], *uniforms[indices[i]].value);
592 void ProgramData::apply() const
594 const Program *prog = Program::current();
596 throw invalid_operation("ProgramData::apply");
598 BufferBackedUniformBlock *old_last_block = last_buffer_block;
599 vector<ProgramBlock>::iterator prog_begin = get_program(*prog);
600 Program::LayoutHash prog_hash = prog->get_uniform_layout_hash();
602 Mask force_dirty = (dirty==ALL_ONES ? ALL_ONES : 0U);
603 Mask affected = (dirty&prog_begin->masks.used) | force_dirty;
604 if(affected|prog_begin->masks.dirty)
606 /* If the global dirty flag affects this program, add it to per-block and
607 per-program dirty flags and clear the global flag. A previously unseen
608 program will cause this to happen if there's any dirty uniforms. */
611 for(vector<SharedBlock>::iterator i=blocks.begin(); i!=blocks.end(); ++i)
612 i->dirty |= (dirty&i->used) | force_dirty;
613 for(vector<ProgramBlock>::iterator i=programs.begin(); i!=programs.end(); ++i)
615 i->masks.dirty |= (dirty&i->masks.used) | force_dirty;
619 const vector<Program::UniformBlockInfo> &block_infos = prog->get_uniform_blocks();
621 if(prog_begin->masks.dirty==ALL_ONES)
623 /* The set of uniforms has changed since this program was last used.
624 Refresh uniform indices within the program's blocks. */
625 prog_begin->masks.used = 0;
626 vector<ProgramBlock>::iterator j = prog_begin+1;
627 for(vector<Program::UniformBlockInfo>::const_iterator i=block_infos.begin(); i!=block_infos.end(); ++i, ++j)
629 SharedBlock &shared = blocks[j->block_index];
630 if(shared.dirty==ALL_ONES)
631 update_block_uniform_indices(shared, *i);
632 prog_begin->masks.used |= shared.used;
633 j->block = (shared.used ? shared.block : 0);
637 // Update the contents of all dirty blocks.
638 bool buffered_blocks_updated = false;
639 vector<ProgramBlock>::iterator j = prog_begin+1;
640 for(vector<Program::UniformBlockInfo>::const_iterator i=block_infos.begin(); i!=block_infos.end(); ++i, ++j)
642 SharedBlock &shared = blocks[j->block_index];
645 update_block(shared, *i);
647 buffered_blocks_updated |= (j->bind_point>=0);
651 prog_begin->masks.dirty = 0;
653 /* If any blocks stored in the buffer were updated, bind the buffer here
654 to avoid state thrashing. */
655 if(buffered_blocks_updated && !ARB_direct_state_access)
658 if(last_buffer_block!=old_last_block)
660 unsigned required_size = last_buffer_block->get_required_buffer_size();
661 if(last_buffer_block->get_required_buffer_size()>buffer->get_size())
663 if(buffer->get_size()>0)
666 buffer = new Buffer(UNIFORM_BUFFER);
667 last_buffer_block->change_buffer(buffer);
670 buffer->storage(required_size);
675 for(vector<ProgramBlock>::iterator i=prog_begin+1; (i!=programs.end() && i->prog_hash==prog_hash); ++i)
677 i->block->apply(i->bind_point);
681 ProgramData::TaggedUniform::TaggedUniform():
685 void ProgramData::TaggedUniform::replace_value(Uniform *v)
687 /* UniformBlock does not copy the uniforms, so existing default blocks
688 will be left with stale pointers. This is not a problem as long as no
689 one stores pointers to the blocks and expects them to stay valid. */
695 ProgramData::SharedBlock::SharedBlock(Program::LayoutHash h):
701 indices.type_flag = 0xFD;
704 const UInt8 *ProgramData::SharedBlock::get_uniform_indices() const
706 return (indices.type_flag==0xFE ? indices.dynamic.values : indices.values);
710 ProgramData::ProgramBlock::ProgramBlock(Program::LayoutHash h):
715 masks.used = ALL_ONES;
716 masks.dirty = ALL_ONES;
720 ProgramData::Loader::Loader(ProgramData &pd):
721 DataFile::ObjectLoader<ProgramData>(pd)
723 add("uniform", &Loader::uniform1i);
724 add("uniform1i", &Loader::uniform1i);
725 add("uniform", &Loader::uniform1f);
726 add("uniform1f", &Loader::uniform1f);
727 add("uniform", &Loader::uniform2i);
728 add("uniform2i", &Loader::uniform2i);
729 add("uniform", &Loader::uniform2f);
730 add("uniform2f", &Loader::uniform2f);
731 add("uniform", &Loader::uniform3i);
732 add("uniform3i", &Loader::uniform3i);
733 add("uniform", &Loader::uniform3f);
734 add("uniform3f", &Loader::uniform3f);
735 add("uniform", &Loader::uniform4i);
736 add("uniform4i", &Loader::uniform4i);
737 add("uniform", &Loader::uniform4f);
738 add("uniform4f", &Loader::uniform4f);
739 add("uniform1i_array", &Loader::uniform1i_array);
740 add("uniform1f_array", &Loader::uniform1f_array);
741 add("uniform2f_array", &Loader::uniform2f_array);
742 add("uniform3f_array", &Loader::uniform3f_array);
743 add("uniform4f_array", &Loader::uniform4f_array);
744 add("uniform_array", &Loader::uniform_array);
747 void ProgramData::Loader::uniform1i(const string &n, int v)
752 void ProgramData::Loader::uniform1f(const string &n, float v)
757 void ProgramData::Loader::uniform2i(const string &n, int v0, int v1)
759 obj.uniform(n, v0, v1);
762 void ProgramData::Loader::uniform2f(const string &n, float v0, float v1)
764 obj.uniform(n, v0, v1);
767 void ProgramData::Loader::uniform3i(const string &n, int v0, int v1, int v2)
769 obj.uniform(n, v0, v1, v2);
772 void ProgramData::Loader::uniform3f(const string &n, float v0, float v1, float v2)
774 obj.uniform(n, v0, v1, v2);
777 void ProgramData::Loader::uniform4i(const string &n, int v0, int v1, int v2, int v3)
779 obj.uniform(n, v0, v1, v2, v3);
782 void ProgramData::Loader::uniform4f(const string &n, float v0, float v1, float v2, float v3)
784 obj.uniform(n, v0, v1, v2, v3);
787 void ProgramData::Loader::uniform_array_(const string &n, DataType t, unsigned e)
789 ArrayLoader ldr(t, e);
791 unsigned size = ldr.get_size();
793 throw logic_error("empty uniform array");
795 DataType type = ldr.get_data_type();
796 unsigned elem_size = ldr.get_element_size();
799 const int *data = reinterpret_cast<const int *>(ldr.get_data());
801 obj.uniform1_array(n, size, data);
802 else if(elem_size==2)
803 obj.uniform2_array(n, size, data);
804 else if(elem_size==3)
805 obj.uniform3_array(n, size, data);
806 else if(elem_size==4)
807 obj.uniform4_array(n, size, data);
809 throw logic_error("unsupported combination of array type and element size");
813 const float *data = reinterpret_cast<const float *>(ldr.get_data());
815 obj.uniform1_array(n, size, data);
816 else if(elem_size==2)
817 obj.uniform2_array(n, size, data);
818 else if(elem_size==3)
819 obj.uniform3_array(n, size, data);
820 else if(elem_size==4)
821 obj.uniform4_array(n, size, data);
823 throw logic_error("unsupported combination of array type and element size");
826 throw logic_error("unsupported array type");
829 void ProgramData::Loader::uniform1i_array(const string &n)
831 uniform_array_(n, INT, 1);
834 void ProgramData::Loader::uniform1f_array(const string &n)
836 uniform_array_(n, FLOAT, 1);
839 void ProgramData::Loader::uniform2i_array(const string &n)
841 uniform_array_(n, INT, 2);
844 void ProgramData::Loader::uniform2f_array(const string &n)
846 uniform_array_(n, FLOAT, 2);
849 void ProgramData::Loader::uniform3i_array(const string &n)
851 uniform_array_(n, INT, 3);
854 void ProgramData::Loader::uniform3f_array(const string &n)
856 uniform_array_(n, FLOAT, 3);
859 void ProgramData::Loader::uniform4i_array(const string &n)
861 uniform_array_(n, INT, 4);
864 void ProgramData::Loader::uniform4f_array(const string &n)
866 uniform_array_(n, FLOAT, 4);
869 void ProgramData::Loader::uniform_array(const string &n)
871 uniform_array_(n, static_cast<DataType>(0), 0);
875 ProgramData::ArrayLoader::ArrayLoader(DataType t, unsigned e):
879 add("uniform", &ArrayLoader::uniform1i);
880 add("uniform1i", &ArrayLoader::uniform1i);
881 add("uniform", &ArrayLoader::uniform1f);
882 add("uniform1f", &ArrayLoader::uniform1f);
883 add("uniform", &ArrayLoader::uniform2f);
884 add("uniform2f", &ArrayLoader::uniform2f);
885 add("uniform", &ArrayLoader::uniform3f);
886 add("uniform3f", &ArrayLoader::uniform3f);
887 add("uniform", &ArrayLoader::uniform4f);
888 add("uniform4f", &ArrayLoader::uniform4f);
891 void ProgramData::ArrayLoader::uniform(DataType t, unsigned e, const void *v)
893 if(element_size && (t!=type || e!=element_size))
894 throw logic_error("heterogeneous array contents");
902 const char *cv = reinterpret_cast<const char *>(v);
903 data.insert(data.end(), cv, cv+element_size*4);
906 void ProgramData::ArrayLoader::uniform1i(int v)
911 void ProgramData::ArrayLoader::uniform1f(float v)
913 uniform(FLOAT, 1, &v);
916 void ProgramData::ArrayLoader::uniform2i(int v0, int v1)
918 int va[2] = { v0, v1 };
922 void ProgramData::ArrayLoader::uniform2f(float v0, float v1)
924 float va[2] = { v0, v1 };
925 uniform(FLOAT, 2, va);
928 void ProgramData::ArrayLoader::uniform3i(int v0, int v1, int v2)
930 int va[3] = { v0, v1, v2 };
934 void ProgramData::ArrayLoader::uniform3f(float v0, float v1, float v2)
936 float va[3] = { v0, v1, v2 };
937 uniform(FLOAT, 3, va);
940 void ProgramData::ArrayLoader::uniform4i(int v0, int v1, int v2, int v3)
942 int va[4] = { v0, v1, v2, v3 };
946 void ProgramData::ArrayLoader::uniform4f(float v0, float v1, float v2, float v3)
948 float va[4] = { v0, v1, v2, v3 };
949 uniform(FLOAT, 4, va);