On Wed, 2010-01-20 at 03:55 -0800, michal wrote: > Jose, > > How one can upload data to buffers in python state tracker? > > I am trying to do the following: > > + cb0_data = [ > + 0.0, 0.0, 0.0, 0.0, > + 0.0, 0.0, 0.0, 1.0, > + 1.0, 1.0, 1.0, 1.0, > + 2.0, 4.0, 8.0, 1.0, > + ] > + > + constbuf0 = dev.buffer_create( > + 16, > + PIPE_BUFFER_USAGE_CONSTANT | > + PIPE_BUFFER_USAGE_GPU_READ | > + PIPE_BUFFER_USAGE_GPU_WRITE | > + PIPE_BUFFER_USAGE_CPU_READ | > + PIPE_BUFFER_USAGE_CPU_WRITE, > + 4 * 4 * 4) > + > + constbuf0.write_(cb0_data, 4 * 4 * 4) > > But I can't find a way to convert a list of floats to (char *). Do have > an idea how to do it?
Hi Michal, The Gallium -> Python bindings are autogenerated by SWIG and there are several things which are not very "pythonic". Writing data into/out of the buffers is one of them. ATM the only way to do this is using the python struct module, and pack the floats into a string... That is: import struct data = '' data += struct.pack('4f', 1.0, 2.0, 3.0, 4.0) ... Jose ------------------------------------------------------------------------------ Throughout its 18-year history, RSA Conference consistently attracts the world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies. http://p.sf.net/sfu/rsaconf-dev2dev _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev