I work with ray tracing and use GPU to calculate pixel colours. I was using NVIDIA CUDA and now want to go to VexCL. I'm trying to use such code:
struct Ray;
vex::Context ctx(...);
...
unsigned int frame_width, frame_height;
std::array<float, 4> camera_direction, camera_up;
float camera_fov;
...
// initialize values and store them in GPU memory too
...
vex::vector<Ray> rays(ctx, frame_width * frame_height);
and something like
rays = some_expression_to_calculate_ray(vex::element_index(), frame_width,
camera_direction, camera_up, camera_fov);
So my question is: how can I explain to VexCL that some values must be common for all vector elements?
I was trying VEX_CONSTANT
, vex::raw_pointer
but it is not what I need.