Forgot to copy list. Right, this is probably not the clearest way to do this. Since there are limitations on the size of 1d vs 2d textures, doing it this way might needlessly restrict your 1d array lengths. All, please advise.
On Tue, Jan 12, 2010 at 5:28 PM, Dan Piponi <[email protected]> wrote: > On Tue, Jan 12, 2010 at 11:59 AM, Ahmed Fasih <[email protected]> wrote: > > Dan, this is a hastily-thrown-together example to make 4 channel textures > I > > ripped out of working code.... > > If I read that correctly you're suggesting using > make_multichannel_2d_array to make a 1D texture accessed by tex1D. > That apparently works in my code, but I was under the impression that > I shouldn't be applying tex1D to a 2D texture and that it's not > guaranteed to work. Maybe I'm just being overly paranoid. > > Thanks, > -- > Dan > On Tue, Jan 12, 2010 at 2:59 PM, Ahmed Fasih <[email protected]> wrote: > Dan, this is a hastily-thrown-together example to make 4 channel textures I > ripped out of working code. A cleaner way will probably be suggested by > others soon, but hopefully this'll get you going for now: > > myarray = numpy.asarray(numpy.dstack((xdata.reshape(1,Nphi), > ydata.reshape(1,Nphi), zdata.reshape(1,Nphi), wdata.reshape(1,Nphi))), > dtype=numpy.float32, order='F') > > mycudaarray = cuda.make_multichannel_2d_array( > numpy.asarray(myarray.transpose((2,1,0)), dtype=numpy.float32, order="F"), > order="F") > > cuda.bind_array_to_texref(mycudaarray, mytexture) > > > On Tue, Jan 12, 2010 at 2:21 PM, Dan Piponi <[email protected]> wrote: > >> I'm having trouble figuring out how to make a 4 channel 1D texture for >> use with tex1D. >> >> I can easily make a 2D 4 channel texture, from an MxNx4 numpy 3D >> array, using make_multichannel_2d_array and bind_array_to_texref. The >> third axis of the array has size 4 and becomes the 4 channels in a >> float4 texture. Works fine with tex2D. >> >> But I can't find a sequence of calls that takes an Nx4 numpy 2D array, >> with size 4 in the second axis, and turns it into a 4 channel 1D >> texture suitable for use with tex1D. I can't find something >> corresponding to make_multichannel_1d_array. >> >> So starting with an Nx4 2D numpy array, what sequence of calls do I >> need to make to get 1D texture with float4 elements? >> -- >> Dan >> >> _______________________________________________ >> PyCUDA mailing list >> [email protected] >> http://tiker.net/mailman/listinfo/pycuda_tiker.net >> > >
_______________________________________________ PyCUDA mailing list [email protected] http://tiker.net/mailman/listinfo/pycuda_tiker.net
