This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void bPhysics::Step_CL(int numWidgets, widget*& _widgets) | |
{ | |
int numContacts = 0; | |
int maxPairsSize = numWidgets * numWidgets; | |
contacts.clear(); | |
resizeBuffers_CL(numWidgets); | |
_contacts = (manifold_cl*)malloc(maxPairsSize * sizeof(manifold_cl)); | |
for (int i = 0; i < maxPairsSize; i++) | |
{ | |
_contacts[i] = d_contacts[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics : enable | |
#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics : enable | |
__kernel void broadphase_kernel(__global widget *_widgets, __global manifold_cl *_contacts, int _WidgetSize, __global int* _contactsSize) | |
{ | |
int i = get_global_id(0); | |
int j = get_global_id(1); | |
int index; | |
index = (_WidgetSize * j) + i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__kernel void test_kernel(__global int *device_a_array, __global int *device_b_array, int _aSize, __global int *_bFinalSize) | |
{ | |
int i = get_global_id(0); | |
int j = get_global_id(1); | |
// map a 2D array index to a 1D array | |
int index = (_aSize * j) + i; | |
// increment "final size" to get count of all kernels that did work | |
atom_inc(&_bFinalSize[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool bPhysics::OpenCLArrayTest() | |
{ | |
cl_context context = NULL; // OpenCL Context | |
cl_command_queue command_queue = NULL; // OpenCL Command Queue | |
cl_mem memobj_a = NULL; | |
cl_mem memobj_a_size = NULL; | |
cl_mem memobj_b = NULL; | |
cl_mem memobj_b_size = NULL; | |
cl_program program = NULL; | |
cl_kernel kernel = NULL; |