Hi i have a constant buffer that contains a struct that has a few different params required for kernel execution which needs to be updated every frame, however the entire buffer doesn’t seem to get written, some of the members do not get their values updated. The struct is 88 bytes in size, and only the first 84 bytes get written correctly. The cl code looks like this:
typedef struct
{
float16 invWorldView;
int3 size;
float3 invSize;
} Params;
__kernel void VolRT(__write_only image2d_t bmp, __read_only image3d_t volTex, __constant Params* params)
{
...
The application code allocates and updates the buffer with the following calls:
ocl.paramBuffer = clCreateBuffer(ocl.context, CL_MEM_READ_ONLY, sizeof(RTParams), NULL, &resultCL); //allocate
clSetKernelArg(ocl.rtKernel, 2, sizeof(cl_mem), &ocl.paramBuffer); //assign to third kernel arg
clEnqueueWriteBuffer(ocl.queue, ocl.paramBuffer, true, 0, sizeof(RTParams), &RTParams, 0, NULL, NULL); //update
RTParams looks like this:
struct
{
float invWorldView[16];
int sizeX;
int sizeY;
int sizeZ;
float invSize[3];
} RTParams;
Can anyone shed any light on this?