std::vector<device> devices(cl_device_type type = CL_DEVICE_TYPE_ALL) const { size_t count = device_count(type); std::vector<cl_device_id> device_ids(count); cl_int ret = clGetDeviceIDs(m_platform, type, static_cast<cl_uint>(count), &device_ids[0], 0); if(ret != CL_SUCCESS){ BOOST_THROW_EXCEPTION(runtime_exception(ret)); } std::vector<device> devices; for(cl_uint i = 0; i < count; i++){ devices.push_back(device(device_ids[i])); } return devices; }
mess_image *image_from_devtype_and_index(iodevice_t type, int id) { int indx, i; mess_image *image = NULL; assert((multiple_dev_mask & (1 << type)) == 0); assert(id < device_count(type)); indx = 0; for (i = 0; Machine->devices[i].type < IO_COUNT; i++) { if (type == Machine->devices[i].type) { image = &images[indx + id]; break; } indx += Machine->devices[i].count; } assert(image); return image; }
void mess_ui_update(void) { static int ui_toggle_key = 0; static int ui_display_count = 30; char buf[2048]; int id; const struct IODevice *dev; /* traditional MESS interface */ if (Machine->gamedrv->flags & GAME_COMPUTER) { if( input_ui_pressed(IPT_UI_TOGGLE_UI) ) { if( !ui_toggle_key ) { ui_toggle_key = 1; ui_active = !ui_active; ui_display_count = 30; schedule_full_refresh(); } } else { ui_toggle_key = 0; } if (ui_active) { if( ui_display_count > 0 ) { buf[0] = 0; strcpy(buf,ui_getstring (UI_keyb1)); strcat(buf,"\n"); strcat(buf,ui_getstring (UI_keyb2)); strcat(buf,"\n"); strcat(buf,ui_getstring (UI_keyb3)); strcat(buf,"\n"); strcat(buf,ui_getstring (UI_keyb5)); strcat(buf,"\n"); strcat(buf,ui_getstring (UI_keyb2)); strcat(buf,"\n"); strcat(buf,ui_getstring (UI_keyb7)); strcat(buf,"\n"); ui_draw_message_window(buf); if( --ui_display_count == 0 ) schedule_full_refresh(); } } else { if( ui_display_count > 0 ) { buf[0] = 0; strcpy(buf,ui_getstring (UI_keyb1)); strcat(buf,"\n"); strcat(buf,ui_getstring (UI_keyb2)); strcat(buf,"\n"); strcat(buf,ui_getstring (UI_keyb4)); strcat(buf,"\n"); strcat(buf,ui_getstring (UI_keyb6)); strcat(buf,"\n"); strcat(buf,ui_getstring (UI_keyb2)); strcat(buf,"\n"); strcat(buf,ui_getstring (UI_keyb7)); strcat(buf,"\n"); ui_draw_message_window(buf); if( --ui_display_count == 0 ) schedule_full_refresh(); } } } /* run display routine for device */ if (devices_inited) { for (dev = Machine->devices; dev->type < IO_COUNT; dev++) { if (dev->display) { for (id = 0; id < device_count(dev->type); id++) { mess_image *img = image_from_devtype_and_index(dev->type, id); dev->display(img, NULL); } } } } }