Does any buddy meet the eclipse4.2 bug : another file changed when i paste
some characters in one file . that`s
>
> Which clearly did the trick...
>
> forEach_root - calls the script "for each" float in the array. So I
> shouldn't try to loop around the input array copying data - that's handled
> by RenderScript calling root multiple times itself (per CPU/core) - duh!
> From memory - changed to:
>
> void root(const float *v_in, float *v_out) {
>    const float *data = v_in;
>    float *outData = v_out;
>    *outData = *data;
> }
>
> and set the outputFloatPointer to be of Allocation.USAGE_SCRIPT so I could
> read the data afterwards (though not sure why I had to do this at the
> moment - my own memory is suffering from sig-11 ;) ).
>
> On Saturday, 18 August 2012 13:29:01 UTC+1, barclakj wrote:
>>
>> I'm clearly missing something here but have been going round in circles
>> all day so can someone please can you point out where my blind spot is...
>>
>> I have a very simple RenderScript (.rs) file which tries to copy data
>> from one float pointer to another (please note that this is a contrived
>> case for test purposes):
>>
>> void root(const float *v_in, float *v_out) {
>>         const float *data = v_in;
>>         float *outData = v_out;
>>
>>         for(int i=0;i<size;i++) {
>>                 *outData = *data; // [X] DOES NOT WORK!
>>                 data ++;
>>                 outData ++;
>>         }
>> }
>>
>>
>> In the Java code I create the script and allocations then call the script
>> as:
>>
>> RenderScript rs = RenderScript.create(ctx);
>> ScriptC_protomask protomaskScript = new ScriptC_protomask(rs,
>> getResources(), R.raw.protomask);
>>
>> Allocation inFloatPointer = Allocation.createSized(rs, Element.F32(rs),
>> data.length, Allocation.USAGE_IO_INPUT);
>> Allocation outFloatPointer = Allocation.createSized(rs, Element.F32(rs),
>> data.length, Allocation.USAGE_IO_OUTPUT);
>>
>> inFloatPointer.copyFrom(data); // copies from an array of floats (random
>> numbers in this test case).
>> protomaskScript.set_size(data.length);
>>
>> protomaskScript.forEach_root(inFloatPointer, outFloatPointer);
>>
>>
>> Now my expectation is that this will just copy the data from one
>> allocation to another (pointless, but again, this is just a test case).
>> When I comment out the line in the .rs file ([x] above) the script runs but
>> clearly does nothing. When I leave it in, the code crashes with sig 11
>> suggesting I'm attempting to write to some memory I'm not allowed to. But
>> why not? I've created and sized both allocations - why can I not just write
>> to the output float pointer? :(
>>
>> Off to get some fresh air and kick a football round the garden.. Thanks.
>>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to