/* Create a device */ struct si_opencl_device_t *si_opencl_device_create() { struct si_opencl_device_t *device; /* Initialize */ device = xcalloc(1, sizeof(struct si_opencl_device_t)); device->id = si_opencl_repo_new_object_id(si_emu->opencl_repo, si_opencl_object_device); /* Return */ si_opencl_repo_add_object(si_emu->opencl_repo, device); return device; }
struct si_opencl_platform_t *si_opencl_platform_create() { struct si_opencl_platform_t *platform; /* Initialize */ platform = xcalloc(1, sizeof(struct si_opencl_platform_t)); platform->id = si_opencl_repo_new_object_id(si_emu->opencl_repo, si_opencl_object_platform); /* Return */ si_opencl_repo_add_object(si_emu->opencl_repo, platform); return platform; }
/* Create a context */ struct si_opencl_context_t *si_opencl_context_create() { struct si_opencl_context_t *context; /* Initialize */ context = xcalloc(1, sizeof(struct si_opencl_context_t)); context->id = si_opencl_repo_new_object_id(si_emu->opencl_repo, si_opencl_object_context); context->ref_count = 1; /* Return */ si_opencl_repo_add_object(si_emu->opencl_repo, context); return context; }
struct si_opencl_sampler_t *si_opencl_sampler_create() { struct si_opencl_sampler_t *sampler; /* Initialize */ sampler = xcalloc(1, sizeof(struct si_opencl_sampler_t)); sampler->id = si_opencl_repo_new_object_id(si_emu->opencl_repo, si_opencl_object_sampler); sampler->ref_count = 1; /* Return */ si_opencl_repo_add_object(si_emu->opencl_repo, sampler); return sampler; }
struct si_opencl_event_t *si_opencl_event_create(enum si_opencl_event_kind_t kind) { struct si_opencl_event_t *event; /* Initialize */ event = xcalloc(1, sizeof(struct si_opencl_event_t)); event->id = si_opencl_repo_new_object_id(si_emu->opencl_repo, si_opencl_object_event); event->ref_count = 1; event->kind = kind; /* Return */ si_opencl_repo_add_object(si_emu->opencl_repo, event); return event; }
/* Create a command queue */ struct si_opencl_command_queue_t *si_opencl_command_queue_create() { struct si_opencl_command_queue_t *command_queue; /* Initialize */ command_queue = xcalloc(1, sizeof(struct si_opencl_command_queue_t)); command_queue->id = si_opencl_repo_new_object_id(si_emu->opencl_repo, si_opencl_object_command_queue); command_queue->ref_count = 1; command_queue->command_list = linked_list_create(); /* Return */ si_opencl_repo_add_object(si_emu->opencl_repo, command_queue); return command_queue; }
struct si_opencl_sampler_t *si_opencl_sampler_create() { struct si_opencl_sampler_t *sampler; /* Allocate */ sampler = calloc(1, sizeof(struct si_opencl_sampler_t)); if (!sampler) fatal("%s: out of memory", __FUNCTION__); /* Initialize */ sampler->id = si_opencl_repo_new_object_id(si_emu->opencl_repo, si_opencl_object_sampler); sampler->ref_count = 1; /* Return */ si_opencl_repo_add_object(si_emu->opencl_repo, sampler); return sampler; }
struct si_opencl_kernel_t *si_opencl_kernel_create() { struct si_opencl_kernel_t *kernel; /* Initialize */ kernel = xcalloc(1, sizeof(struct si_opencl_kernel_t)); kernel->id = si_opencl_repo_new_object_id(si_emu->opencl_repo, si_opencl_object_kernel); kernel->ref_count = 1; kernel->arg_list = list_create(); /* Create the UAV-to-physical-address lookup lists */ kernel->constant_buffer_list = list_create(); /* Return */ si_opencl_repo_add_object(si_emu->opencl_repo, kernel); return kernel; }