1 /* 2 * Copyright 2017 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can 5 * be found in the LICENSE file. 6 * 7 */ 8 9 #pragma once 10 11 // 12 // 13 // 14 15 #include <CL/opencl.h> 16 17 // 18 // 19 // 20 21 #define SKC_CL_ARG(arg) sizeof(arg),&arg 22 23 // 24 // 25 // 26 27 typedef enum skc_device_kernel_id { 28 SKC_DEVICE_KERNEL_ID_BLOCK_POOL_INIT_IDS, 29 SKC_DEVICE_KERNEL_ID_BLOCK_POOL_INIT_ATOMICS, 30 31 SKC_DEVICE_KERNEL_ID_PATHS_ALLOC, 32 SKC_DEVICE_KERNEL_ID_PATHS_COPY, 33 34 SKC_DEVICE_KERNEL_ID_FILLS_EXPAND, 35 36 SKC_DEVICE_KERNEL_ID_RASTERIZE_ALL, 37 SKC_DEVICE_KERNEL_ID_RASTERIZE_LINES, 38 SKC_DEVICE_KERNEL_ID_RASTERIZE_QUADS, 39 SKC_DEVICE_KERNEL_ID_RASTERIZE_CUBICS, 40 SKC_DEVICE_KERNEL_ID_RASTERIZE_RAT_QUADS, 41 SKC_DEVICE_KERNEL_ID_RASTERIZE_RAT_CUBICS, 42 43 SKC_DEVICE_KERNEL_ID_SEGMENT_TTRK, 44 SKC_DEVICE_KERNEL_ID_RASTERS_ALLOC, 45 46 SKC_DEVICE_KERNEL_ID_PREFIX, 47 SKC_DEVICE_KERNEL_ID_PLACE, 48 SKC_DEVICE_KERNEL_ID_SEGMENT_TTCK, 49 50 SKC_DEVICE_KERNEL_ID_RENDER, 51 52 SKC_DEVICE_KERNEL_ID_PATHS_RECLAIM, 53 SKC_DEVICE_KERNEL_ID_RASTERS_RECLAIM, 54 55 // 56 SKC_DEVICE_KERNEL_ID_COUNT 57 58 } skc_device_kernel_id; 59 60 // 61 // 62 // 63 64 void 65 skc_device_create(struct skc_runtime * const runtime); 66 67 68 void 69 skc_device_dispose(struct skc_runtime * const runtime); 70 71 72 // 73 // multi-threading/context/device requires multiple kernel instances 74 // 75 76 cl_kernel 77 skc_device_acquire_kernel(struct skc_device * const device, 78 skc_device_kernel_id const type); 79 80 void 81 skc_device_release_kernel(struct skc_device * const device, 82 cl_kernel kernel); 83 84 // 85 // grid shape can vary greatly by target platform 86 // 87 void 88 skc_device_enqueue_kernel(struct skc_device * const device, 89 skc_device_kernel_id const type, 90 cl_command_queue cq, 91 cl_kernel kernel, 92 size_t const work_size, 93 cl_uint num_events_in_wait_list, 94 cl_event const * const event_wait_list, 95 cl_event * const event); 96 97 // 98 // 99 // 100