コード例 #1
0
static void PIPE_CDECL generic_run( struct translate *translate,
                                    unsigned start,
                                    unsigned count,
                                    unsigned instance_id,
                                    void *output_buffer )
{
   struct translate_generic *tg = translate_generic(translate);
   char *vert = output_buffer;
   unsigned nr_attrs = tg->nr_attrib;
   unsigned attr;
   unsigned i;

   /* loop over vertex attributes (vertex shader inputs)
    */
   for (i = 0; i < count; i++) {
      unsigned elt = start + i;

      for (attr = 0; attr < nr_attrs; attr++) {
	 float data[4];

	 char *dst = (vert + 
		      tg->attrib[attr].output_offset);

         if (tg->attrib[attr].type == TRANSLATE_ELEMENT_NORMAL) {
            const char *src;

            if (tg->attrib[attr].instance_divisor) {
               src = tg->attrib[attr].input_ptr +
                     tg->attrib[attr].input_stride *
                     (instance_id / tg->attrib[attr].instance_divisor);
            } else {
               src = tg->attrib[attr].input_ptr +
                     tg->attrib[attr].input_stride * elt;
            }

            tg->attrib[attr].fetch( src, data );
         } else {
            data[0] = (float)instance_id;
         }

         if (0) debug_printf("vert %d attr %d: %f %f %f %f\n",
                             i, attr, data[0], data[1], data[2], data[3]);

	 tg->attrib[attr].emit( data, dst );
      }
      
      vert += tg->translate.key.output_stride;
   }
}
コード例 #2
0
static void PIPE_CDECL generic_run( struct translate *translate,
                                    unsigned start,
                                    unsigned count,
                                    unsigned instance_id,
                                    void *output_buffer )
{
   struct translate_generic *tg = translate_generic(translate);
   char *vert = output_buffer;
   unsigned i;

   for (i = 0; i < count; i++) {
      generic_run_one(tg, start + i, instance_id, vert);
      vert += tg->translate.key.output_stride;
   }
}
コード例 #3
0
static void generic_set_buffer( struct translate *translate,
				unsigned buf,
				const void *ptr,
				unsigned stride )
{
   struct translate_generic *tg = translate_generic(translate);
   unsigned i;

   for (i = 0; i < tg->nr_attrib; i++) {
      if (tg->attrib[i].buffer == buf) {
	 tg->attrib[i].input_ptr = ((char *)ptr +
				    tg->attrib[i].input_offset);
	 tg->attrib[i].input_stride = stride;
      }
   }
}