-
Notifications
You must be signed in to change notification settings - Fork 0
/
memory.lua
27 lines (24 loc) · 959 Bytes
/
memory.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
local cl = require 'ffi.req' 'OpenCL'
local GCWrapper = require 'cl.gcwrapper'
local GetInfo = require 'cl.getinfo'
local Memory = GetInfo(GCWrapper{
ctype = 'cl_mem',
retain = function(self) return cl.clRetainMemObject(self.id) end,
release = function(self) return cl.clReleaseMemObject(self.id) end,
}):subclass()
Memory.getInfo = Memory:makeGetter{
getter = cl.clGetMemObjectInfo,
vars = {
{name='CL_MEM_TYPE', type='cl_device_local_mem_type'}, -- ???
{name='CL_MEM_FLAGS', type='cl_mem_flags'}, -- ???
{name='CL_MEM_SIZE', type='size_t'}, -- ???
{name='CL_MEM_HOST_PTR', type='void*'}, -- ???
{name='CL_MEM_MAP_COUNT', type='cl_uint'}, -- ???
{name='CL_MEM_REFERENCE_COUNT', type='cl_uint'}, -- ???
{name='CL_MEM_CONTEXT', type='cl_context'}, -- ???
{name='CL_MEM_ASSOCIATED_MEMOBJECT', type=''}, -- ???
{name='CL_MEM_OFFSET', type='size_t'}, -- ???
{name='CL_MEM_USES_SVM_POINTER', type='cl_bool'}, -- ???
},
}
return Memory