Mercurial > hg > Game > Cerium
changeset 1823:8be14797e5ce draft
clear memout size
author | kkb |
---|---|
date | Fri, 13 Dec 2013 20:46:46 +0900 |
parents | 4251e9b607b4 |
children | 016746241fc7 |
files | TaskManager/Gpu/GpuScheduler.cc |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Gpu/GpuScheduler.cc Fri Dec 13 17:13:53 2013 +0900 +++ b/TaskManager/Gpu/GpuScheduler.cc Fri Dec 13 20:46:46 2013 +0900 @@ -54,6 +54,7 @@ const char *msg=convert_error_status(ret); error(msg); } + } GpuScheduler::~GpuScheduler() @@ -115,18 +116,19 @@ kernel_event[1-cur] = 0; } if (memout[1-cur].size > 0) { - for (int i=0; i < memout[1-cur].size; i++) { - int ret=clWaitForEvents(memout[1-cur].size, &memout[1-cur].event[i]); - if (ret<0) { - error(convert_error_status(ret)); - } + + int ret=clWaitForEvents(memout[1-cur].size, memout[1-cur].event); + if (ret<0) { + error(convert_error_status(ret)); } + for (int i=0; i < memout[1-cur].size; i++) { clReleaseEvent(memout[1-cur].event[i]); memout[1-cur].event[i] = 0; clReleaseMemObject(memout[1-cur].buf[i]); memout[1-cur].buf[i] = 0; } + memout[1-cur].size = 0; } if (memin[1-cur].size > 0) { @@ -136,6 +138,7 @@ clReleaseMemObject(memin[1-cur].buf[i]); memin[1-cur].buf[i] = 0; } + memin[1-cur].size = 0; } if(reply[1-cur]) { @@ -393,10 +396,13 @@ GpuScheduler::load_kernel(int cmd) { if (gpu_task_list[cmd].run == null_run) { + return 1; + } + + if (gpu_task_list[cmd].gputask == 0 || gpu_task_list[cmd].gputask->program == 0) { fprintf(stderr, "GPU kernel %d not defined.\n",cmd); return 0; } - const char *filename = (const char *)gpu_task_list[cmd].gputask->program; int fd;