このカーネルは正常に動作します:
__kernel void test(__global float* a_Direction, __global float* a_Output, const unsigned int a_Count)
{
int index = get_global_id(0);
if (index < a_Count)
{
a_Output[index * 3 + 0] = a_Direction[index * 3 + 0] * 0.5f + 0.5f;
a_Output[index * 3 + 1] = a_Direction[index * 3 + 1] * 0.5f + 0.5f;
a_Output[index * 3 + 2] = a_Direction[index * 3 + 2] * 0.5f + 0.5f;
}
}
このカーネルは範囲外エラーを生成します。
__kernel void test(__global float3* a_Direction, __global float3* a_Output, const unsigned int a_Count)
{
int index = get_global_id(0);
if (index < a_Count)
{
a_Output[index].x = a_Direction[index].x * 0.5f + 0.5f;
a_Output[index].y = a_Direction[index].y * 0.5f + 0.5f;
a_Output[index].z = a_Direction[index].z * 0.5f + 0.5f;
}
}
私には、どちらもまったく同じことをするべきだと思われます。しかし、何らかの理由で、2 つのうちの 1 つしか機能しません。明らかな何かが欠けていますか?
正確なエラーは次のとおりです。「GeForce GTX580M (デバイス 0) で CL_COMMAND_READ_BUFFER を実行中に CL_OUT_OF_RESOURCES エラーが発生しました。