Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/device/device_cuda.cpp
| Show First 20 Lines • Show All 670 Lines • ▼ Show 20 Lines | void shader(DeviceTask& task) | ||||
| else { | else { | ||||
| cuda_assert(cuModuleGetFunction(&cuShader, cuModule, "kernel_cuda_shader")); | cuda_assert(cuModuleGetFunction(&cuShader, cuModule, "kernel_cuda_shader")); | ||||
| } | } | ||||
| /* do tasks in smaller chunks, so we can cancel it */ | /* do tasks in smaller chunks, so we can cancel it */ | ||||
| const int shader_chunk_size = 65536; | const int shader_chunk_size = 65536; | ||||
| const int start = task.shader_x; | const int start = task.shader_x; | ||||
| const int end = task.shader_x + task.shader_w; | const int end = task.shader_x + task.shader_w; | ||||
| int offset = task.offset; | |||||
| bool canceled = false; | bool canceled = false; | ||||
| for(int sample = 0; sample < task.num_samples && !canceled; sample++) { | for(int sample = 0; sample < task.num_samples && !canceled; sample++) { | ||||
| for(int shader_x = start; shader_x < end; shader_x += shader_chunk_size) { | for(int shader_x = start; shader_x < end; shader_x += shader_chunk_size) { | ||||
| int shader_w = min(shader_chunk_size, end - shader_x); | int shader_w = min(shader_chunk_size, end - shader_x); | ||||
| /* pass in parameters */ | /* pass in parameters */ | ||||
| void *args[] = {&d_input, | void *args[] = {&d_input, | ||||
| &d_output, | &d_output, | ||||
| &task.shader_eval_type, | &task.shader_eval_type, | ||||
| &shader_x, | &shader_x, | ||||
| &shader_w, | &shader_w, | ||||
| &offset, | |||||
| &sample}; | &sample}; | ||||
| /* launch kernel */ | /* launch kernel */ | ||||
| int threads_per_block; | int threads_per_block; | ||||
| cuda_assert(cuFuncGetAttribute(&threads_per_block, CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK, cuShader)); | cuda_assert(cuFuncGetAttribute(&threads_per_block, CU_FUNC_ATTRIBUTE_MAX_THREADS_PER_BLOCK, cuShader)); | ||||
| int xblocks = (shader_w + threads_per_block - 1)/threads_per_block; | int xblocks = (shader_w + threads_per_block - 1)/threads_per_block; | ||||
| ▲ Show 20 Lines • Show All 381 Lines • Show Last 20 Lines | |||||