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)
123 void ProgramData::uniform(Tag tag, int v)
125 uniform(tag, INT, 1, &v);
128 void ProgramData::uniform(Tag tag, unsigned v)
130 uniform(tag, UNSIGNED_INT, 1, &v);
133 void ProgramData::uniform(Tag tag, float v)
135 uniform(tag, FLOAT, 1, &v);
138 void ProgramData::uniform(Tag tag, int v0, int v1)
140 int va[2] = { v0, v1 };
144 void ProgramData::uniform(Tag tag, unsigned v0, unsigned v1)
146 unsigned va[2] = { v0, v1 };
150 void ProgramData::uniform(Tag tag, float v0, float v1)
152 float va[2] = { v0, v1 };
156 void ProgramData::uniform2(Tag tag, const int *v)
158 uniform(tag, INT_VEC2, 1, v);
161 void ProgramData::uniform2(Tag tag, const unsigned *v)
163 uniform(tag, UINT_VEC2, 1, v);
166 void ProgramData::uniform2(Tag tag, const float *v)
168 uniform(tag, FLOAT_VEC2, 1, v);
171 void ProgramData::uniform(Tag tag, int v0, int v1, int v2)
173 int va[3] = { v0, v1, v2 };
177 void ProgramData::uniform(Tag tag, unsigned v0, unsigned v1, unsigned v2)
179 unsigned va[3] = { v0, v1, v2 };
183 void ProgramData::uniform(Tag tag, float v0, float v1, float v2)
185 float va[3] = { v0, v1, v2 };
189 void ProgramData::uniform3(Tag tag, const int *v)
191 uniform(tag, INT_VEC3, 1, v);
194 void ProgramData::uniform3(Tag tag, const unsigned *v)
196 uniform(tag, UINT_VEC3, 1, v);
199 void ProgramData::uniform3(Tag tag, const float *v)
201 uniform(tag, FLOAT_VEC3, 1, v);
204 void ProgramData::uniform(Tag tag, int v0, int v1, int v2, int v3)
206 int va[4] = { v0, v1, v2, v3 };
210 void ProgramData::uniform(Tag tag, unsigned v0, unsigned v1, unsigned v2, unsigned v3)
212 unsigned va[4] = { v0, v1, v2, v3 };
216 void ProgramData::uniform(Tag tag, float v0, float v1, float v2, float v3)
218 float va[4] = { v0, v1, v2, v3 };
222 void ProgramData::uniform(Tag tag, const Color &c)
224 uniform(tag, c.r, c.g, c.b, c.a);
227 void ProgramData::uniform4(Tag tag, const int *v)
229 uniform(tag, INT_VEC4, 1, v);
232 void ProgramData::uniform4(Tag tag, const unsigned *v)
234 uniform(tag, UINT_VEC4, 1, v);
237 void ProgramData::uniform4(Tag tag, const float *v)
239 uniform(tag, FLOAT_VEC4, 1, v);
242 void ProgramData::uniform_matrix2(Tag tag, const float *v)
244 uniform(tag, FLOAT_MAT2, 1, v);
247 void ProgramData::uniform_matrix3x2(Tag tag, const float *v)
249 uniform(tag, FLOAT_MAT3x2, 1, v);
252 void ProgramData::uniform_matrix4x2(Tag tag, const float *v)
254 uniform(tag, FLOAT_MAT4x2, 1, v);
257 void ProgramData::uniform_matrix2x3(Tag tag, const float *v)
259 uniform(tag, FLOAT_MAT2x3, 1, v);
262 void ProgramData::uniform_matrix3(Tag tag, const float *v)
264 uniform(tag, FLOAT_MAT3, 1, v);
267 void ProgramData::uniform_matrix4x3(Tag tag, const float *v)
269 uniform(tag, FLOAT_MAT4x3, 1, v);
272 void ProgramData::uniform_matrix2x4(Tag tag, const float *v)
274 uniform(tag, FLOAT_MAT2x4, 1, v);
277 void ProgramData::uniform_matrix3x4(Tag tag, const float *v)
279 uniform(tag, FLOAT_MAT3x4, 1, v);
282 void ProgramData::uniform(Tag tag, const Matrix &m)
284 uniform_matrix4(tag, m.data());
287 void ProgramData::uniform_matrix4(Tag tag, const float *v)
289 uniform(tag, FLOAT_MAT4, 1, v);
292 void ProgramData::uniform_array(Tag tag, unsigned n, const int *v)
294 uniform(tag, INT, n, v);
297 void ProgramData::uniform_array(Tag tag, unsigned n, const unsigned *v)
299 uniform(tag, UNSIGNED_INT, n, v);
302 void ProgramData::uniform_array(Tag tag, unsigned n, const float *v)
304 uniform(tag, FLOAT, n, v);
307 void ProgramData::uniform1_array(Tag tag, unsigned n, const int *v)
309 uniform(tag, INT, n, v);
312 void ProgramData::uniform1_array(Tag tag, unsigned n, const unsigned *v)
314 uniform(tag, UNSIGNED_INT, n, v);
317 void ProgramData::uniform1_array(Tag tag, unsigned n, const float *v)
319 uniform(tag, FLOAT, n, v);
322 void ProgramData::uniform2_array(Tag tag, unsigned n, const int *v)
324 uniform(tag, INT_VEC2, n, v);
327 void ProgramData::uniform2_array(Tag tag, unsigned n, const unsigned *v)
329 uniform(tag, UINT_VEC2, n, v);
332 void ProgramData::uniform2_array(Tag tag, unsigned n, const float *v)
334 uniform(tag, FLOAT_VEC2, n, v);
337 void ProgramData::uniform3_array(Tag tag, unsigned n, const int *v)
339 uniform(tag, INT_VEC3, n, v);
342 void ProgramData::uniform3_array(Tag tag, unsigned n, const unsigned *v)
344 uniform(tag, INT_VEC3, n, v);
347 void ProgramData::uniform3_array(Tag tag, unsigned n, const float *v)
349 uniform(tag, FLOAT_VEC3, n, v);
352 void ProgramData::uniform4_array(Tag tag, unsigned n, const int *v)
354 uniform(tag, INT_VEC4, n, v);
357 void ProgramData::uniform4_array(Tag tag, unsigned n, const unsigned *v)
359 uniform(tag, UINT_VEC4, n, v);
362 void ProgramData::uniform4_array(Tag tag, unsigned n, const float *v)
364 uniform(tag, FLOAT_VEC4, n, v);
367 void ProgramData::uniform_matrix2_array(Tag tag, unsigned n, const float *v)
369 uniform(tag, FLOAT_MAT2, n, v);
372 void ProgramData::uniform_matrix3x2_array(Tag tag, unsigned n, const float *v)
374 uniform(tag, FLOAT_MAT3x2, n, v);
377 void ProgramData::uniform_matrix4x2_array(Tag tag, unsigned n, const float *v)
379 uniform(tag, FLOAT_MAT4x2, n, v);
382 void ProgramData::uniform_matrix2x3_array(Tag tag, unsigned n, const float *v)
384 uniform(tag, FLOAT_MAT2x3, n, v);
387 void ProgramData::uniform_matrix3_array(Tag tag, unsigned n, const float *v)
389 uniform(tag, FLOAT_MAT3, n, v);
392 void ProgramData::uniform_matrix4x3_array(Tag tag, unsigned n, const float *v)
394 uniform(tag, FLOAT_MAT4x3, n, v);
397 void ProgramData::uniform_matrix2x4_array(Tag tag, unsigned n, const float *v)
399 uniform(tag, FLOAT_MAT2x4, n, v);
402 void ProgramData::uniform_matrix3x4_array(Tag tag, unsigned n, const float *v)
404 uniform(tag, FLOAT_MAT3x4, n, v);
407 void ProgramData::uniform_matrix4_array(Tag tag, unsigned n, const float *v)
409 uniform(tag, FLOAT_MAT4, n, v);
412 void ProgramData::remove_uniform(Tag tag)
414 auto i = lower_bound_member(uniforms, tag, &TaggedUniform::tag);
415 if(i==uniforms.end() || i->tag!=tag)
418 uniform_data.erase(uniform_data.begin()+i->data_offset, uniform_data.begin()+i->data_offset+i->data_size);
419 for(TaggedUniform &u: uniforms)
420 if(u.data_offset>i->data_offset)
421 u.data_offset -= i->data_size;
424 mark_dirty(ALL_ONES);
427 vector<Tag> ProgramData::get_uniform_tags() const
430 tags.reserve(uniforms.size());
431 for(const TaggedUniform &u: uniforms)
432 tags.push_back(u.tag);
436 void ProgramData::copy_uniform(const ProgramData &source, Tag tag)
438 int i = source.find_uniform_index(tag);
440 throw key_error(tag);
441 const TaggedUniform &tu = source.uniforms[i];
442 uniform(tag, tu.type, tu.array_size, source.uniform_data.data()+tu.data_offset);
445 void ProgramData::copy_uniforms(const ProgramData &source)
447 for(const TaggedUniform &u: source.uniforms)
448 uniform(u.tag, u.type, u.array_size, source.uniform_data.data()+u.data_offset);
451 int ProgramData::find_uniform_index(Tag tag) const
453 auto i = lower_bound_member(uniforms, tag, &TaggedUniform::tag);
454 return ((i!=uniforms.end() && i->tag==tag) ? i-uniforms.begin() : -1);
457 vector<ProgramData::ProgramBlock>::iterator ProgramData::get_program(const Program &prog) const
459 ReflectData::LayoutHash prog_hash = prog.get_uniform_layout_hash();
460 auto i = lower_bound_member(programs, prog_hash, &ProgramBlock::prog_hash);
461 if(i!=programs.end() && i->prog_hash==prog_hash)
464 const vector<ReflectData::UniformBlockInfo> &block_infos = prog.get_uniform_blocks();
465 unsigned index = i-programs.begin();
466 programs.insert(i, 1+block_infos.size(), ProgramBlock(prog_hash));
468 /* Block indices may change if new shared blocks need to be inserted. Store
469 the hashes so they can be matched up later. */
470 vector<ReflectData::LayoutHash> block_hashes;
471 block_hashes.reserve(programs.size());
472 for(const ProgramBlock &b: programs)
473 block_hashes.push_back(b.block_index>=0 ? blocks[b.block_index].block_hash : 0);
475 for(unsigned j=0; j<block_infos.size(); ++j)
477 const ReflectData::UniformBlockInfo &info = block_infos[j];
478 block_hashes[index+1+j] = info.layout_hash;
479 programs[index+1+j].bind_point = info.bind_point;
481 auto k = lower_bound_member(blocks, info.layout_hash, &SharedBlock::block_hash);
482 if(k==blocks.end() || k->block_hash!=info.layout_hash)
484 k = blocks.insert(k, SharedBlock(info.layout_hash));
485 update_block_uniform_indices(*k, info);
489 /* Reassign shared block indices from the stored hashes. */
490 for(unsigned j=0; j<programs.size(); ++j)
492 unsigned hash = block_hashes[j];
495 auto k = lower_bound_member(blocks, hash, &SharedBlock::block_hash);
496 programs[j].block_index = k-blocks.begin();
499 programs[j].block_index = -1;
502 return programs.begin()+index;
505 void ProgramData::update_block_uniform_indices(SharedBlock &block, const ReflectData::UniformBlockInfo &info) const
507 uint8_t *indices = block.indices.values;
508 if(info.uniforms.size()>16)
510 if(block.indices.type_flag==0xFD)
512 block.indices.dynamic.values = new uint8_t[info.uniforms.size()];
513 block.indices.type_flag = 0xFE;
515 indices = block.indices.dynamic.values;
518 bool any_missing = false;
521 for(unsigned i=0; i<info.uniforms.size(); ++i)
523 int j = find_uniform_index(info.uniforms[i]->tag);
527 if(static_cast<unsigned>(j)<MASK_BITS)
537 if(block.used && any_missing && info.bind_point>=0)
540 IO::print(IO::cerr, "Warning: not all uniforms for block %s are present\n", info.name);
542 throw incomplete_uniform_block(info.name);
546 block.dirty = block.used;
548 if(block.used && !block.block)
550 block.block = new UniformBlock(info);
551 if(info.bind_point>=0)
555 buffer = new Buffer();
558 if(!debug_name.empty())
559 buffer->set_debug_name(debug_name);
563 block.block->use_buffer(buffer, last_buffer_block);
564 last_buffer_block = block.block;
569 void ProgramData::update_block(SharedBlock &block, const ReflectData::UniformBlockInfo &info) const
571 const uint8_t *indices = block.get_uniform_indices();
572 for(unsigned i=0; i<info.uniforms.size(); ++i)
574 if(is_image(info.uniforms[i]->type))
575 ; // Temporarily ignore deprecated use of sampler uniforms in ProgramData
576 else if(indices[i]!=0xFF)
578 const TaggedUniform &tu = uniforms[indices[i]];
579 block.block->store(*info.uniforms[i], tu.array_size, uniform_data.data()+tu.data_offset);
584 vector<ProgramData::ProgramBlock>::const_iterator ProgramData::prepare_program(const Program &prog) const
586 UniformBlock *old_last_block = last_buffer_block;
587 auto prog_begin = get_program(prog);
589 Mask force_dirty = (dirty==ALL_ONES ? ALL_ONES : 0U);
590 Mask affected = (dirty&prog_begin->masks.used) | force_dirty;
591 if(affected|prog_begin->masks.dirty)
593 /* If the global dirty flag affects this program, add it to per-block and
594 per-program dirty flags and clear the global flag. A previously unseen
595 program will cause this to happen if there's any dirty uniforms. */
598 for(SharedBlock &b: blocks)
599 b.dirty |= (dirty&b.used) | force_dirty;
600 for(ProgramBlock &b: programs)
602 b.masks.dirty |= (dirty&b.masks.used) | force_dirty;
606 const vector<ReflectData::UniformBlockInfo> &block_infos = prog.get_uniform_blocks();
608 if(prog_begin->masks.dirty==ALL_ONES)
610 /* The set of uniforms has changed since this program was last used.
611 Refresh uniform indices within the program's blocks. */
612 prog_begin->masks.used = 0;
613 auto j = prog_begin+1;
614 for(const ReflectData::UniformBlockInfo &b: block_infos)
616 SharedBlock &shared = blocks[j->block_index];
617 if(shared.dirty==ALL_ONES)
618 update_block_uniform_indices(shared, b);
619 prog_begin->masks.used |= shared.used;
620 j->block = (shared.used ? shared.block : 0);
625 // Update the contents of all dirty blocks.
626 bool buffered_blocks_updated = false;
627 auto j = prog_begin+1;
628 for(const ReflectData::UniformBlockInfo &b: block_infos)
630 SharedBlock &shared = blocks[j->block_index];
633 update_block(shared, b);
635 buffered_blocks_updated |= (j->bind_point>=0);
640 prog_begin->masks.dirty = 0;
642 if(last_buffer_block!=old_last_block)
644 unsigned required_size = last_buffer_block->get_required_buffer_size();
645 if(last_buffer_block->get_required_buffer_size()>buffer->get_size())
647 if(buffer->get_size()>0)
650 buffer = new Buffer();
651 last_buffer_block->change_buffer(buffer);
654 if(!debug_name.empty())
655 buffer->set_debug_name(debug_name);
659 buffer->storage(required_size, STREAMING);
667 void ProgramData::apply(const Program &prog, PipelineState &state, unsigned frame) const
669 auto prog_begin = prepare_program(prog);
670 ReflectData::LayoutHash prog_hash = prog_begin->prog_hash;
672 for(auto i=prog_begin+1; (i!=programs.end() && i->prog_hash==prog_hash); ++i)
675 state.set_uniform_block(i->bind_point, i->block);
677 i->block->refresh(frame);
681 void ProgramData::set_debug_name(const string &name)
686 buffer->set_debug_name(name);
693 ProgramData::SharedBlock::SharedBlock(ReflectData::LayoutHash h):
699 indices.type_flag = 0xFD;
702 const uint8_t *ProgramData::SharedBlock::get_uniform_indices() const
704 return (indices.type_flag==0xFE ? indices.dynamic.values : indices.values);
708 ProgramData::ProgramBlock::ProgramBlock(ReflectData::LayoutHash h):
713 masks.used = ALL_ONES;
714 masks.dirty = ALL_ONES;
718 ProgramData::Loader::Loader(ProgramData &pd):
719 DataFile::ObjectLoader<ProgramData>(pd)
721 add("uniform", &Loader::uniform1i);
722 add("uniform1i", &Loader::uniform1i);
723 add("uniform", &Loader::uniform1f);
724 add("uniform1f", &Loader::uniform1f);
725 add("uniform", &Loader::uniform2i);
726 add("uniform2i", &Loader::uniform2i);
727 add("uniform", &Loader::uniform2f);
728 add("uniform2f", &Loader::uniform2f);
729 add("uniform", &Loader::uniform3i);
730 add("uniform3i", &Loader::uniform3i);
731 add("uniform", &Loader::uniform3f);
732 add("uniform3f", &Loader::uniform3f);
733 add("uniform", &Loader::uniform4i);
734 add("uniform4i", &Loader::uniform4i);
735 add("uniform", &Loader::uniform4f);
736 add("uniform4f", &Loader::uniform4f);
737 add("uniform1i_array", &Loader::uniform1i_array);
738 add("uniform1f_array", &Loader::uniform1f_array);
739 add("uniform2f_array", &Loader::uniform2f_array);
740 add("uniform3f_array", &Loader::uniform3f_array);
741 add("uniform4f_array", &Loader::uniform4f_array);
742 add("uniform_array", &Loader::uniform_array);
745 void ProgramData::Loader::uniform1i(const string &n, int v)
750 void ProgramData::Loader::uniform1f(const string &n, float v)
755 void ProgramData::Loader::uniform2i(const string &n, int v0, int v1)
757 obj.uniform(n, v0, v1);
760 void ProgramData::Loader::uniform2f(const string &n, float v0, float v1)
762 obj.uniform(n, v0, v1);
765 void ProgramData::Loader::uniform3i(const string &n, int v0, int v1, int v2)
767 obj.uniform(n, v0, v1, v2);
770 void ProgramData::Loader::uniform3f(const string &n, float v0, float v1, float v2)
772 obj.uniform(n, v0, v1, v2);
775 void ProgramData::Loader::uniform4i(const string &n, int v0, int v1, int v2, int v3)
777 obj.uniform(n, v0, v1, v2, v3);
780 void ProgramData::Loader::uniform4f(const string &n, float v0, float v1, float v2, float v3)
782 obj.uniform(n, v0, v1, v2, v3);
785 void ProgramData::Loader::uniform_array_(const string &n, DataType t, unsigned e)
787 ArrayLoader ldr(t, e);
789 unsigned size = ldr.get_size();
791 throw logic_error("empty uniform array");
793 DataType type = ldr.get_data_type();
794 unsigned elem_size = ldr.get_element_size();
797 const int *data = reinterpret_cast<const int *>(ldr.get_data());
799 obj.uniform1_array(n, size, data);
800 else if(elem_size==2)
801 obj.uniform2_array(n, size, data);
802 else if(elem_size==3)
803 obj.uniform3_array(n, size, data);
804 else if(elem_size==4)
805 obj.uniform4_array(n, size, data);
807 throw logic_error("unsupported combination of array type and element size");
811 const float *data = reinterpret_cast<const float *>(ldr.get_data());
813 obj.uniform1_array(n, size, data);
814 else if(elem_size==2)
815 obj.uniform2_array(n, size, data);
816 else if(elem_size==3)
817 obj.uniform3_array(n, size, data);
818 else if(elem_size==4)
819 obj.uniform4_array(n, size, data);
821 throw logic_error("unsupported combination of array type and element size");
824 throw logic_error("unsupported array type");
827 void ProgramData::Loader::uniform1i_array(const string &n)
829 uniform_array_(n, INT, 1);
832 void ProgramData::Loader::uniform1f_array(const string &n)
834 uniform_array_(n, FLOAT, 1);
837 void ProgramData::Loader::uniform2i_array(const string &n)
839 uniform_array_(n, INT, 2);
842 void ProgramData::Loader::uniform2f_array(const string &n)
844 uniform_array_(n, FLOAT, 2);
847 void ProgramData::Loader::uniform3i_array(const string &n)
849 uniform_array_(n, INT, 3);
852 void ProgramData::Loader::uniform3f_array(const string &n)
854 uniform_array_(n, FLOAT, 3);
857 void ProgramData::Loader::uniform4i_array(const string &n)
859 uniform_array_(n, INT, 4);
862 void ProgramData::Loader::uniform4f_array(const string &n)
864 uniform_array_(n, FLOAT, 4);
867 void ProgramData::Loader::uniform_array(const string &n)
869 uniform_array_(n, static_cast<DataType>(0), 0);
873 ProgramData::ArrayLoader::ArrayLoader(DataType t, unsigned e):
877 add("uniform", &ArrayLoader::uniform1i);
878 add("uniform1i", &ArrayLoader::uniform1i);
879 add("uniform", &ArrayLoader::uniform1f);
880 add("uniform1f", &ArrayLoader::uniform1f);
881 add("uniform", &ArrayLoader::uniform2f);
882 add("uniform2f", &ArrayLoader::uniform2f);
883 add("uniform", &ArrayLoader::uniform3f);
884 add("uniform3f", &ArrayLoader::uniform3f);
885 add("uniform", &ArrayLoader::uniform4f);
886 add("uniform4f", &ArrayLoader::uniform4f);
889 void ProgramData::ArrayLoader::uniform(DataType t, unsigned e, const void *v)
891 if(element_size && (t!=type || e!=element_size))
892 throw logic_error("heterogeneous array contents");
900 const char *cv = reinterpret_cast<const char *>(v);
901 data.insert(data.end(), cv, cv+element_size*4);
904 void ProgramData::ArrayLoader::uniform1i(int v)
909 void ProgramData::ArrayLoader::uniform1f(float v)
911 uniform(FLOAT, 1, &v);
914 void ProgramData::ArrayLoader::uniform2i(int v0, int v1)
916 int va[2] = { v0, v1 };
920 void ProgramData::ArrayLoader::uniform2f(float v0, float v1)
922 float va[2] = { v0, v1 };
923 uniform(FLOAT, 2, va);
926 void ProgramData::ArrayLoader::uniform3i(int v0, int v1, int v2)
928 int va[3] = { v0, v1, v2 };
932 void ProgramData::ArrayLoader::uniform3f(float v0, float v1, float v2)
934 float va[3] = { v0, v1, v2 };
935 uniform(FLOAT, 3, va);
938 void ProgramData::ArrayLoader::uniform4i(int v0, int v1, int v2, int v3)
940 int va[4] = { v0, v1, v2, v3 };
944 void ProgramData::ArrayLoader::uniform4f(float v0, float v1, float v2, float v3)
946 float va[4] = { v0, v1, v2, v3 };
947 uniform(FLOAT, 4, va);