Login  Register

Hardcoded float not working?

Posted by Miha on Dec 19, 2013; 5:53pm
URL: https://forum.jogamp.org/Hardcoded-float-not-working-tp4030974.html

Hello,

compiler somehow recognizes all hardcoded floats as integers.

Starting from netbeans jocl template (http://plugins.netbeans.org/plugin/39980/netbeans-opencl-pack), example:

***
kernel void fill(global float* a, const int size, const int value) {
    int index = get_global_id(0);
    if (index >= size) {
        return;
    }
   
    a[index] = 0.5f;
}
***

From java:
System.out.println(value + "\t");

I get all zeros. If I put a[index]=1/(float)2 it works.

Also it works normally if I do not use jocl but C++ and g++ directly.

Any suggestions? It is driving me crazy.