summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Rusin <zack@kde.org>2009-08-20 01:15:40 -0400
committerZack Rusin <zack@kde.org>2009-08-20 01:15:40 -0400
commit4d8f029a62bedfe829cbc3c57327ecfd8161b129 (patch)
tree108c5c4ac3f7aa472956ef412f3ee19a06d07fab
parent18182e8dd2c1760c23a11f05bcb224ebfa177435 (diff)
fix compilation and add some cmake code
-rw-r--r--cpuwinsys/cpuwinsys.c35
-rw-r--r--src/CMakeLists.txt88
-rw-r--r--src/api_command.cpp42
-rw-r--r--src/api_context.cpp47
-rw-r--r--src/api_device.cpp133
-rw-r--r--src/api_enqueue.cpp221
-rw-r--r--src/api_event.cpp31
-rw-r--r--src/api_flush.cpp14
-rw-r--r--src/api_gl.cpp86
-rw-r--r--src/api_kernel.cpp61
-rw-r--r--src/api_memory.cpp84
-rw-r--r--src/api_platform.cpp34
-rw-r--r--src/api_profiling.cpp13
-rw-r--r--src/api_program.cpp74
-rw-r--r--src/api_sampler.cpp34
-rw-r--r--src/context.h16
-rw-r--r--src/device.cpp230
-rw-r--r--src/device.h57
-rw-r--r--src/deviceinfo.h67
19 files changed, 82 insertions, 1285 deletions
diff --git a/cpuwinsys/cpuwinsys.c b/cpuwinsys/cpuwinsys.c
index 04a8a05..00d5efb 100644
--- a/cpuwinsys/cpuwinsys.c
+++ b/cpuwinsys/cpuwinsys.c
@@ -1,6 +1,6 @@
#include "cpuwinsys.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
@@ -105,7 +105,6 @@ cpu_buffer_create(struct pipe_winsys *pws,
{
struct cpu_buffer *buffer = CALLOC_STRUCT(cpu_buffer);
- buffer->base.refcount = 1;
buffer->base.alignment = alignment;
buffer->base.usage = usage;
buffer->base.size = size;
@@ -126,7 +125,6 @@ static struct pipe_buffer *
cpu_user_buffer_create(struct pipe_winsys *pws, void *ptr, unsigned bytes)
{
struct cpu_buffer *buffer = CALLOC_STRUCT(cpu_buffer);
- buffer->base.refcount = 1;
buffer->base.size = bytes;
buffer->userBuffer = TRUE;
buffer->data = ptr;
@@ -158,25 +156,8 @@ cpu_surface_alloc_storage(struct pipe_winsys *winsys,
surf->width = width;
surf->height = height;
surf->format = format;
- pf_get_block(format, &surf->block);
- surf->nblocksx = pf_get_nblocksx(&surf->block, width);
- surf->nblocksy = pf_get_nblocksy(&surf->block, height);
- surf->stride = round_up(surf->nblocksx * surf->block.size, alignment);
surf->usage = flags;
- assert(!surf->buffer);
- surf->buffer = winsys->buffer_create(winsys, alignment,
- PIPE_BUFFER_USAGE_PIXEL,
-#ifdef GALLIUM_CELL /* XXX a bit of a hack */
- surf->stride *
- round_up(surf->nblocksy, TILE_SIZE));
-#else
- surf->stride * surf->nblocksy);
-#endif
-
- if(!surf->buffer)
- return -1;
-
return 0;
}
@@ -191,9 +172,6 @@ cpu_surface_alloc(struct pipe_winsys *ws)
assert(ws);
- surface->refcount = 1;
- surface->winsys = ws;
-
return surface;
}
@@ -204,12 +182,6 @@ cpu_surface_release(struct pipe_winsys *winsys, struct pipe_surface **s)
{
struct pipe_surface *surf = *s;
assert(!surf->texture);
- surf->refcount--;
- if (surf->refcount == 0) {
- if (surf->buffer)
- winsys_buffer_reference(winsys, &surf->buffer, NULL);
- free(surf);
- }
*s = NULL;
}
@@ -255,11 +227,6 @@ struct pipe_winsys * cpu_winsys(void)
ws->base.user_buffer_create = cpu_user_buffer_create;
ws->base.buffer_map = cpu_buffer_map;
ws->base.buffer_unmap = cpu_buffer_unmap;
- ws->base.buffer_destroy = cpu_buffer_destroy;
-
- ws->base.surface_alloc = cpu_surface_alloc;
- ws->base.surface_alloc_storage = cpu_surface_alloc_storage;
- ws->base.surface_release = cpu_surface_release;
ws->base.fence_reference = cpu_fence_reference;
ws->base.fence_signalled = cpu_fence_signalled;
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f132770..5e67495 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -7,13 +7,13 @@ include_directories (${Clover_SOURCE_DIR}/include
)
add_library(OpenCL SHARED
- api_command.cpp api_device.cpp
- api_event.cpp api_kernel.cpp
- api_platform.cpp api_program.cpp
- device.cpp api_context.cpp
- api_enqueue.cpp api_flush.cpp
- api_memory.cpp api_profiling.cpp
- api_sampler.cpp api_gl.cpp
+ core/api_command.cpp core/api_device.cpp
+ core/api_event.cpp core/api_kernel.cpp
+ core/api_platform.cpp core/api_program.cpp
+ core/device.cpp core/api_context.cpp
+ core/api_enqueue.cpp core/api_flush.cpp
+ core/api_memory.cpp core/api_profiling.cpp
+ core/api_sampler.cpp core/api_gl.cpp
../cpuwinsys/cpuwinsys.c)
SET(LIBRARY_OUTPUT_PATH ${Clover_BINARY_DIR}/lib)
@@ -34,3 +34,77 @@ TARGET_LINK_LIBRARIES(OpenCL
${GALLIUM}/src/gallium/drivers/softpipe/libsoftpipe.a
${GALLIUM}/src/gallium/auxiliary/util/libutil.a
)
+
+
+find_library(CLANG_CODEGEN_LIB clangCodeGen)
+if (CLANG_CODEGEN_LIB)
+ target_link_libraries(OpenCL ${CLANG_CODEGEN_LIB})
+endif(CLANG_CODEGEN_LIB)
+
+find_library(CLANG_ANALYSIS_LIB clangAnalysis)
+if (CLANG_ANALYSIS_LIB)
+ target_link_libraries(OpenCL ${CLANG_ANALYSIS_LIB})
+endif(CLANG_ANALYSIS_LIB)
+
+find_library(CLANG_REWRITE_LIB clangRewrite)
+if (CLANG_REWRITE_LIB)
+ target_link_libraries(OpenCL ${CLANG_REWRITE_LIB})
+endif(CLANG_REWRITE_LIB)
+
+find_library(CLANG_SEMA_LIB clangSema)
+if (CLANG_SEMA_LIB)
+ target_link_libraries(OpenCL ${CLANG_SEMA_LIB})
+endif(CLANG_SEMA_LIB)
+
+find_library(CLANG_DRIVER_LIB clangDriver)
+if (CLANG_DRIVER_LIB)
+ target_link_libraries(OpenCL ${CLANG_DRIVER_LIB})
+endif(CLANG_DRIVER_LIB)
+
+find_library(CLANG_AST_LIB clangAST)
+if (CLANG_AST_LIB)
+ target_link_libraries(OpenCL ${CLANG_AST_LIB})
+endif(CLANG_AST_LIB)
+
+find_library(CLANG_PARSE_LIB clangParse)
+if (CLANG_PARSE_LIB)
+ target_link_libraries(OpenCL ${CLANG_PARSE_LIB})
+endif(CLANG_PARSE_LIB)
+
+find_library(CLANG_LEX_LIB clangLex)
+if (CLANG_LEX_LIB)
+ target_link_libraries(OpenCL ${CLANG_LEX_LIB})
+endif(CLANG_LEX_LIB)
+
+find_library(CLANG_BASIC_LIB clangBasic)
+if (CLANG_BASIC_LIB)
+ target_link_libraries(OpenCL ${CLANG_BASIC_LIB})
+endif(CLANG_BASIC_LIB)
+
+
+find_library(LLVM_BITREADER_LIB LLVMBitReader)
+if (LLVM_BITREADER_LIB)
+ target_link_libraries(OpenCL ${LLVM_BITREADER_LIB})
+endif(LLVM_BITREADER_LIB)
+
+
+find_library(LLVM_BITWRITER_LIB LLVMBitWriter)
+if (LLVM_BITWRITER_LIB)
+ target_link_libraries(OpenCL ${LLVM_BITWRITER_LIB})
+endif(LLVM_BITWRITER_LIB)
+
+
+find_library(LLVM_CODEGEN_LIB LLVMCodeGen)
+if (LLVM_CODEGEN_LIB)
+ target_link_libraries(OpenCL ${LLVM_CODEGEN_LIB})
+endif(LLVM_CODEGEN_LIB)
+
+find_library(LLVM_IPO_LIB LLVMipo)
+if (LLVM_IPO_LIB)
+ target_link_libraries(OpenCL ${LLVM_IPO_LIB})
+endif(LLVM_IPO_LIB)
+
+find_library(LLVM_SELECTIONDAG_LIB LLVMSelectionDAG)
+if (LLVM_SELECTIONDAG_LIB)
+ target_link_libraries(OpenCL ${LLVM_SELECTIONDAG_LIB})
+endif(LLVM_SELECTIONDAG_LIB)
diff --git a/src/api_command.cpp b/src/api_command.cpp
deleted file mode 100644
index 4f1c417..0000000
--- a/src/api_command.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-#include <OpenCL/cl.h>
-
-// Command Queue APIs
-cl_command_queue
-clCreateCommandQueue(cl_context context,
- cl_device_id device,
- cl_command_queue_properties properties,
- cl_int * errcode_ret)
-{
- return 0;
-}
-
-cl_int
-clRetainCommandQueue(cl_command_queue command_queue)
-{
- return 0;
-}
-
-cl_int
-clReleaseCommandQueue(cl_command_queue command_queue)
-{
- return 0;
-}
-
-cl_int
-clGetCommandQueueInfo(cl_command_queue command_queue,
- cl_command_queue_info param_name,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- return 0;
-}
-
-cl_int
-clSetCommandQueueProperty(cl_command_queue command_queue,
- cl_command_queue_properties properties,
- cl_bool enable,
- cl_command_queue_properties * old_properties)
-{
- return 0;
-}
diff --git a/src/api_context.cpp b/src/api_context.cpp
deleted file mode 100644
index fbf3af9..0000000
--- a/src/api_context.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <OpenCL/cl.h>
-
-
-// Context APIs
-
-cl_context
-clCreateContext(cl_context_properties properties,
- cl_uint num_devices,
- const cl_device_id * devices,
- logging_fn pfn_notify,
- void * user_data,
- cl_int * errcode_ret)
-{
- return 0;
-}
-
-cl_context
-clCreateContextFromType(cl_context_properties properties,
- cl_device_type device_type,
- logging_fn pfn_notify,
- void * user_data,
- cl_int * errcode_ret)
-{
- return 0;
-}
-
-cl_int
-clRetainContext(cl_context context)
-{
- return 0;
-}
-
-cl_int
-clReleaseContext(cl_context context)
-{
- return 0;
-}
-
-cl_int
-clGetContextInfo(cl_context context,
- cl_context_info param_name,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- return 0;
-}
diff --git a/src/api_device.cpp b/src/api_device.cpp
deleted file mode 100644
index 1428897..0000000
--- a/src/api_device.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-#include "OpenCL/cl.h"
-#include "OpenCL/cl_platform.h"
-
-#include "device.h"
-
-#include "pipe/p_screen.h"
-#include "pipe/p_format.h"
-#include "pipe/p_winsys.h"
-#include "util/u_memory.h"
-
-#include <string>
-
-// Device APIs
-
-struct CLConstValue {
- CLConstValue(int _id)
- : id(_id)
- {}
-
- virtual void param(size_t param_value_size,
- void * param_value,
- size_t *param_value_size_ret)
- {}
-
- int id;
-};
-template <class T>
-struct CLConstValueTemplate : public CLConstValue {
- CLConstValueTemplate(int _id, T _value)
- : CLConstValue(id), value(_value)
- {}
- T value;
-};
-
-const CLConstValue values[] = {
- CLConstValueTemplate<std::string>(CL_DEVICE_NAME, std::string("hello")),
- CLConstValueTemplate<int>(CL_DEVICE_TYPE, (int)3)
-};
-
-static void
-create_gpu_device(cl_device_id * devices,
- cl_uint * num_devices,
- cl_uint num_entries)
-{
-}
-
-static void
-create_cpu_device(cl_device_id * devices,
- cl_uint * num_devices,
- cl_uint num_entries)
-{
- Device *device = Device::create(CL_DEVICE_TYPE_CPU);
-
- devices[0] = (cl_device_id)device;
- *num_devices = 1;
-}
-
-static void
-create_accel_device(cl_device_id * devices,
- cl_uint * num_devices,
- cl_uint num_entries)
-{
-}
-
-
-cl_int
-clGetDeviceIDs(cl_device_type device_type,
- cl_uint num_entries,
- cl_device_id * devices,
- cl_uint * num_devices)
-{
- cl_bool gpu, cpu, accelerator;
- cl_uint original_num_entries = num_entries;
-
- gpu = (device_type & CL_DEVICE_TYPE_DEFAULT) ||
- (device_type & CL_DEVICE_TYPE_GPU) ||
- (device_type & CL_DEVICE_TYPE_ALL);
-
- cpu = (device_type & CL_DEVICE_TYPE_CPU) ||
- (device_type & CL_DEVICE_TYPE_ALL);
-
- accelerator = (device_type & CL_DEVICE_TYPE_ACCELERATOR) ||
- (device_type & CL_DEVICE_TYPE_ALL);
-
- if (!gpu && !cpu && !accelerator)
- return CL_INVALID_DEVICE_TYPE;
-
- if ((!num_entries && devices) || (!num_devices && !devices))
- return CL_INVALID_VALUE;
-
- if (gpu && num_entries > 0) {
- cl_uint num_gpus = 0;
- create_gpu_device(devices, &num_gpus, num_entries);
- num_entries -= num_gpus;
- if (num_devices)
- *num_devices += num_gpus;
- }
-
- if (cpu && num_entries > 0) {
- cl_uint num_cpus = 0;
- create_cpu_device(devices, &num_cpus, num_entries);
- num_entries -= num_cpus;
- if (num_devices)
- *num_devices += num_cpus;
- }
-
- if (accelerator && num_entries) {
- cl_uint num_accels = 0;
- create_accel_device(devices, &num_accels, num_entries);
- num_entries -= num_accels;
- if (num_devices)
- *num_devices += num_accels;
- }
-
- if (original_num_entries == num_entries)
- return CL_DEVICE_NOT_FOUND;
-
- return CL_SUCCESS;
-}
-
-cl_int
-clGetDeviceInfo(cl_device_id device,
- cl_device_info opcode,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- if (!device)
- return CL_INVALID_DEVICE;
-
- return device->info(opcode, param_value_size, param_value,
- param_value_size_ret);
-}
diff --git a/src/api_enqueue.cpp b/src/api_enqueue.cpp
deleted file mode 100644
index 15091b4..0000000
--- a/src/api_enqueue.cpp
+++ /dev/null
@@ -1,221 +0,0 @@
-#include <OpenCL/cl.h>
-
-// Enqueued Commands APIs
-cl_int
-clEnqueueReadBuffer(cl_command_queue command_queue,
- cl_mem buffer,
- cl_bool blocking_read,
- size_t offset,
- size_t cb,
- void * ptr,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
-
-cl_int
-clEnqueueWriteBuffer(cl_command_queue command_queue,
- cl_mem buffer,
- cl_bool blocking_write,
- size_t offset,
- size_t cb,
- const void * ptr,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
-
-cl_int
-clEnqueueCopyBuffer(cl_command_queue command_queue,
- cl_mem src_buffer,
- cl_mem dst_buffer,
- size_t src_offset,
- size_t dst_offset,
- size_t cb,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
-
-cl_int
-clEnqueueReadImage(cl_command_queue command_queue,
- cl_mem image,
- cl_bool blocking_read,
- const size_t * origin,
- const size_t * region,
- size_t row_pitch,
- size_t slice_pitch,
- void * ptr,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
-
-cl_int
-clEnqueueWriteImage(cl_command_queue command_queue,
- cl_mem image,
- cl_bool blocking_write,
- const size_t * origin,
- const size_t * region,
- size_t row_pitch,
- size_t slice_pitch,
- const void * ptr,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
-
-cl_int
-clEnqueueCopyImage(cl_command_queue command_queue,
- cl_mem src_image,
- cl_mem dst_image,
- const size_t * src_origin,
- const size_t * dst_origin,
- const size_t * region,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
-
-cl_int
-clEnqueueCopyImageToBuffer(cl_command_queue command_queue,
- cl_mem src_image,
- cl_mem dst_buffer,
- const size_t * src_origin,
- const size_t * region,
- size_t dst_offset,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
-
-cl_int
-clEnqueueCopyBufferToImage(cl_command_queue command_queue,
- cl_mem src_buffer,
- cl_mem dst_image,
- size_t src_offset,
- const size_t * dst_origin,
- const size_t * region,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
-
-void *
-clEnqueueMapBuffer(cl_command_queue command_queue,
- cl_mem buffer,
- cl_bool blocking_map,
- cl_map_flags map_flags,
- size_t offset,
- size_t cb,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event,
- cl_int * errcode_ret)
-{
- return 0;
-}
-
-void *
-clEnqueueMapImage(cl_command_queue command_queue,
- cl_mem image,
- cl_bool blocking_map,
- cl_map_flags map_flags,
- const size_t * origin,
- const size_t * region,
- size_t * image_row_pitch,
- size_t * image_slice_pitch,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event,
- cl_int * errcode_ret)
-{
- return 0;
-}
-
-cl_int
-clEnqueueUnmapMemObject(cl_command_queue command_queue,
- cl_mem memobj,
- void * mapped_ptr,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
-
-cl_int
-clEnqueueNDRangeKernel(cl_command_queue command_queue,
- cl_kernel kernel,
- cl_uint work_dim,
- const size_t * global_work_offset,
- const size_t * global_work_size,
- const size_t * local_work_size,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
-
-cl_int
-clEnqueueTask(cl_command_queue command_queue,
- cl_kernel kernel,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
-
-cl_int
-clEnqueueNativeFnAsKernel(cl_command_queue command_queue,
- void (*user_func)(void *),
- void * args,
- size_t cb_args,
- cl_uint num_mem_objects,
- const cl_mem * mem_list,
- const void ** args_mem_loc,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
-
-cl_int
-clEnqueueMarker(cl_command_queue command_queue,
- cl_event * event)
-{
- return 0;
-}
-
-cl_int
-clEnqueueWaitForEvents(cl_command_queue command_queue,
- cl_uint num_events,
- const cl_event * event_list)
-{
- return 0;
-}
-
-cl_int
-clEnqueueBarrier(cl_command_queue command_queue)
-{
- return 0;
-}
diff --git a/src/api_event.cpp b/src/api_event.cpp
deleted file mode 100644
index 9c08011..0000000
--- a/src/api_event.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <OpenCL/cl.h>
-
-// Event Object APIs
-cl_int
-clWaitForEvents(cl_uint num_events,
- const cl_event * event_list)
-{
- return 0;
-}
-
-cl_int
-clGetEventInfo(cl_event event,
- cl_event_info param_name,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- return 0;
-}
-
-cl_int
-clRetainEvent(cl_event event)
-{
- return 0;
-}
-
-cl_int
-clReleaseEvent(cl_event event)
-{
- return 0;
-}
diff --git a/src/api_flush.cpp b/src/api_flush.cpp
deleted file mode 100644
index 34afab0..0000000
--- a/src/api_flush.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <OpenCL/cl.h>
-
-// Flush and Finish APIs
-cl_int
-clFlush(cl_command_queue command_queue)
-{
- return 0;
-}
-
-cl_int
-clFinish(cl_command_queue command_queue)
-{
- return 0;
-}
diff --git a/src/api_gl.cpp b/src/api_gl.cpp
deleted file mode 100644
index 757df6a..0000000
--- a/src/api_gl.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-#define GL_GLEXT_PROTOTYPES
-#include "GL/gl.h"
-#include "GL/glext.h"
-
-#include "OpenCL/cl.h"
-#include "OpenCL/cl_gl.h"
-
-cl_mem
-clCreateFromGLBuffer(cl_context context,
- cl_mem_flags flags,
- GLuint bufobj,
- int * errcode_ret)
-{
- return 0;
-}
-
-cl_mem
-clCreateFromGLTexture2D(cl_context context,
- cl_mem_flags flags,
- GLenum target,
- GLint miplevel,
- GLuint texture,
- int * errcode_ret)
-{
- return 0;
-}
-
-cl_mem
-clCreateFromGLTexture3D(cl_context context,
- cl_mem_flags flags,
- GLenum target,
- GLint miplevel,
- GLuint texture,
- int * errcode_ret)
-{
- return 0;
-}
-
-cl_mem
-clCreateFromGLRenderbuffer(cl_context context,
- cl_mem_flags flags,
- GLuint renderbuffer,
- int * errcode_ret)
-{
- return 0;
-}
-
-cl_int
-clGetGLObjectInfo(cl_mem memobj,
- cl_gl_object_type * gl_object_type,
- GLuint * gl_object_name)
-{
- return 0;
-}
-
-cl_int
-clGetGLTextureInfo(cl_mem memobj,
- cl_gl_texture_info param_name,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- return 0;
-}
-
-cl_int
-clEnqueueAcquireGLObjects(cl_command_queue command_queue,
- cl_uint num_objects,
- const cl_mem * mem_objects,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
-
-cl_int
-clEnqueueReleaseGLObjects(cl_command_queue command_queue,
- cl_uint num_objects,
- const cl_mem * mem_objects,
- cl_uint num_events_in_wait_list,
- const cl_event * event_wait_list,
- cl_event * event)
-{
- return 0;
-}
diff --git a/src/api_kernel.cpp b/src/api_kernel.cpp
deleted file mode 100644
index 27d7c81..0000000
--- a/src/api_kernel.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-#include <OpenCL/cl.h>
-
-// Kernel Object APIs
-cl_kernel
-clCreateKernel(cl_program program,
- const char * kernel_name,
- cl_int * errcode_ret)
-{
- return 0;
-}
-
-cl_int
-clCreateKernelsInProgram(cl_program program,
- cl_uint num_kernels,
- cl_kernel * kernels,
- cl_uint * num_kernels_ret)
-{
- return 0;
-}
-
-cl_int
-clRetainKernel(cl_kernel kernel)
-{
- return 0;
-}
-
-cl_int
-clReleaseKernel(cl_kernel kernel)
-{
- return 0;
-}
-
-cl_int
-clSetKernelArg(cl_kernel kernel,
- cl_uint arg_indx,
- size_t arg_size,
- const void * arg_value)
-{
- return 0;
-}
-
-cl_int
-clGetKernelInfo(cl_kernel kernel,
- cl_kernel_info param_name,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- return 0;
-}
-
-cl_int
-clGetKernelWorkGroupInfo(cl_kernel kernel,
- cl_device_id device,
- cl_kernel_work_group_info param_name,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- return 0;
-}
diff --git a/src/api_memory.cpp b/src/api_memory.cpp
deleted file mode 100644
index 19d4095..0000000
--- a/src/api_memory.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-#include <OpenCL/cl.h>
-
-
-// Memory Object APIs
-cl_mem
-clCreateBuffer(cl_context context,
- cl_mem_flags flags,
- size_t size,
- void * host_ptr,
- cl_int * errcode_ret)
-{
- return 0;
-}
-
-cl_mem
-clCreateImage2D(cl_context context,
- cl_mem_flags flags,
- const cl_image_format * image_format,
- size_t image_width,
- size_t image_height,
- size_t image_row_pitch,
- void * host_ptr,
- cl_int * errcode_ret)
-{
- return 0;
-}
-
-cl_mem
-clCreateImage3D(cl_context context,
- cl_mem_flags flags,
- const cl_image_format * image_format,
- size_t image_width,
- size_t image_height,
- size_t image_depth,
- size_t image_row_pitch,
- size_t image_slice_pitch,
- void * host_ptr,
- cl_int * errcode_ret)
-{
- return 0;
-}
-
-cl_int
-clRetainMemObject(cl_mem memobj)
-{
- return 0;
-}
-
-cl_int
-clReleaseMemObject(cl_mem memobj)
-{
- return 0;
-}
-
-cl_int
-clGetSupportedImageFormats(cl_context context,
- cl_mem_flags flags,
- cl_mem_object_type image_type,
- cl_uint num_entries,
- cl_image_format * image_formats,
- cl_uint * num_image_formats)
-{
- return 0;
-}
-
-cl_int
-clGetMemObjectInfo(cl_mem memobj,
- cl_mem_info param_name,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- return 0;
-}
-
-cl_int
-clGetImageInfo(cl_mem image,
- cl_image_info param_name,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- return 0;
-}
diff --git a/src/api_platform.cpp b/src/api_platform.cpp
deleted file mode 100644
index b6429e7..0000000
--- a/src/api_platform.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <OpenCL/cl.h>
-
-#include <string.h>
-
-#define PROFILE_STR "FULL_PROFILE"
-#define PROFILE_STR_LEN 12
-
-#define VERSION_STR "OpenCL 1.0"
-#define VERSION_STR_LEN 10
-
-// Platform API
-cl_int
-clGetPlatformInfo(cl_platform_info param_name,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- switch(param_name) {
- case CL_PLATFORM_PROFILE:
- strcpy((char*)param_value, PROFILE_STR);
- *param_value_size_ret = PROFILE_STR_LEN;
- break;
-
- case CL_PLATFORM_VERSION:
- strcpy((char*)param_value, VERSION_STR);
- *param_value_size_ret = VERSION_STR_LEN;
- break;
-
- default:
- return CL_INVALID_VALUE;
- }
-
- return CL_SUCCESS;
-}
diff --git a/src/api_profiling.cpp b/src/api_profiling.cpp
deleted file mode 100644
index 5980dee..0000000
--- a/src/api_profiling.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <OpenCL/cl.h>
-
-// Profiling APIs
-cl_int
-clGetEventProfilingInfo(cl_event event,
- cl_profiling_info param_name,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- return 0;
-}
-
diff --git a/src/api_program.cpp b/src/api_program.cpp
deleted file mode 100644
index 98999fa..0000000
--- a/src/api_program.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-#include <OpenCL/cl.h>
-
-// Program Object APIs
-cl_program
-clCreateProgramWithSource(cl_context context,
- cl_uint count,
- const char ** strings,
- const size_t * lengths,
- cl_int * errcode_ret)
-{
- return 0;
-}
-
-cl_program
-clCreateProgramWithBinary(cl_context context,
- cl_uint num_devices,
- const cl_device_id * device_list,
- const size_t * lengths,
- const void ** binaries,
- cl_int * binary_status,
- cl_int * errcode_ret)
-{
- return 0;
-}
-
-cl_int
-clRetainProgram(cl_program program)
-{
- return 0;
-}
-
-cl_int
-clReleaseProgram(cl_program program)
-{
- return 0;
-}
-
-cl_int
-clBuildProgram(cl_program program,
- cl_uint num_devices,
- const cl_device_id * device_list,
- const char * options,
- void (*pfn_notify)(cl_program program, void * user_data),
- void * user_data)
-{
- return 0;
-}
-
-cl_int
-clUnloadCompiler(void)
-{
- return 0;
-}
-
-cl_int
-clGetProgramInfo(cl_program program,
- cl_program_info param_name,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- return 0;
-}
-
-cl_int
-clGetProgramBuildInfo(cl_program program,
- cl_device_id device,
- cl_program_build_info param_name,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- return 0;
-}
diff --git a/src/api_sampler.cpp b/src/api_sampler.cpp
deleted file mode 100644
index 8c4d74a..0000000
--- a/src/api_sampler.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <OpenCL/cl.h>
-
-// Sampler APIs
-cl_sampler
-clCreateSampler(cl_context context,
- cl_bool normalized_coords,
- cl_addressing_mode addressing_mode,
- cl_filter_mode filter_mode,
- cl_int * errcode_ret)
-{
- return 0;
-}
-
-cl_int
-clRetainSampler(cl_sampler sampler)
-{
- return 0;
-}
-
-cl_int
-clReleaseSampler(cl_sampler sampler)
-{
- return 0;
-}
-
-cl_int
-clGetSamplerInfo(cl_sampler sampler,
- cl_sampler_info param_name,
- size_t param_value_size,
- void * param_value,
- size_t * param_value_size_ret)
-{
- return 0;
-}
diff --git a/src/context.h b/src/context.h
deleted file mode 100644
index f74bcdb..0000000
--- a/src/context.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef CONTEXT_H
-#define CONTEXT_H
-
-#include "OpenCL/cl.h"
-
-#include "pipe/p_context.h"
-
-struct _cl_context {
- struct pipe_context *pipe;
- cl_uint id;
-};
-
-void cl_set_current_context(struct _cl_context *ctx);
-struct _cl_context *cl_current_context(void);
-
-#endif
diff --git a/src/device.cpp b/src/device.cpp
deleted file mode 100644
index 458bd46..0000000
--- a/src/device.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-#include "device.h"
-
-#include "OpenCL/cl.h"
-#include "OpenCL/cl_platform.h"
-
-#include "pipe/p_screen.h"
-#include "pipe/p_format.h"
-#include "pipe/p_winsys.h"
-#include "util/u_memory.h"
-
-#include "cpuwinsys/cpuwinsys.h"
-#include "softpipe/sp_winsys.h"
-
-
-Device * Device::create(cl_uint type)
-{
- switch(type) {
- case CL_DEVICE_TYPE_CPU: {
- struct pipe_winsys *ws = cpu_winsys();
- struct pipe_screen *screen =
- softpipe_create_screen(ws);
- return new Device(CL_DEVICE_TYPE_CPU, ws, screen);
- }
- break;
- case CL_DEVICE_TYPE_GPU:
- break;
- case CL_DEVICE_TYPE_ACCELERATOR:
-#ifdef GALLIUM_CELL
- if (!getenv("GALLIUM_NOCELL")) {
- struct cell_winsys *cws = cell_get_winsys(pixelformat);
- struct pipe_screen *screen = cell_create_screen(pws);
-
- pipe = cell_create_context(screen, cws);
- }
-#endif
- break;
- }
- return 0;
-}
-
-static void stringToParam(const std::string &str,
- void * paramValue,
- size_t * paramValueSizeRet)
-{
- strcpy((char*)paramValue, str.c_str());
- if (paramValueSizeRet)
- *paramValueSizeRet = str.size();
-}
-
-cl_int Device::info(cl_device_info opcode,
- size_t paramValueSize,
- void * paramValue,
- size_t * paramValueSizeRet) const
-{
- switch (opcode) {
- case CL_DEVICE_TYPE:
- ((cl_int*)paramValue)[0] = type();
- break;
- case CL_DEVICE_VENDOR_ID:
- break;
- case CL_DEVICE_MAX_COMPUTE_UNITS:
- break;
- case CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS:
- break;
- case CL_DEVICE_MAX_WORK_GROUP_SIZE:
- break;
- case CL_DEVICE_MAX_WORK_ITEM_SIZES:
- break;
- case CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR:
- break;
- case CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT:
- break;
- case CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT:
- break;
- case CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG:
- break;
- case CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT:
- break;
- case CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE:
- break;
- case CL_DEVICE_MAX_CLOCK_FREQUENCY:
- break;
- case CL_DEVICE_ADDRESS_BITS:
- break;
- case CL_DEVICE_MAX_READ_IMAGE_ARGS:
- break;
- case CL_DEVICE_MAX_WRITE_IMAGE_ARGS:
- break;
- case CL_DEVICE_MAX_MEM_ALLOC_SIZE:
- break;
- case CL_DEVICE_IMAGE2D_MAX_WIDTH:
- break;
- case CL_DEVICE_IMAGE2D_MAX_HEIGHT:
- break;
- case CL_DEVICE_IMAGE3D_MAX_WIDTH:
- break;
- case CL_DEVICE_IMAGE3D_MAX_HEIGHT:
- break;
- case CL_DEVICE_IMAGE3D_MAX_DEPTH:
- break;
- case CL_DEVICE_IMAGE_SUPPORT:
- break;
- case CL_DEVICE_MAX_PARAMETER_SIZE:
- break;
- case CL_DEVICE_MAX_SAMPLERS:
- break;
- case CL_DEVICE_MEM_BASE_ADDR_ALIGN:
- break;
- case CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE:
- break;
- case CL_DEVICE_SINGLE_FP_CONFIG:
- break;
- case CL_DEVICE_GLOBAL_MEM_CACHE_TYPE:
- break;
- case CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE:
- break;
- case CL_DEVICE_GLOBAL_MEM_CACHE_SIZE:
- break;
- case CL_DEVICE_GLOBAL_MEM_SIZE:
- break;
- case CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE:
- break;
- case CL_DEVICE_MAX_CONSTANT_ARGS:
- break;
- case CL_DEVICE_LOCAL_MEM_TYPE:
- break;
- case CL_DEVICE_LOCAL_MEM_SIZE:
- break;
- case CL_DEVICE_ERROR_CORRECTION_SUPPORT:
- break;
- case CL_DEVICE_PROFILING_TIMER_RESOLUTION:
- break;
- case CL_DEVICE_ENDIAN_LITTLE:
- break;
- case CL_DEVICE_AVAILABLE:
- break;
- case CL_DEVICE_COMPILER_AVAILABLE:
- break;
- case CL_DEVICE_EXECUTION_CAPABILITIES:
- break;
- case CL_DEVICE_QUEUE_PROPERTIES:
- break;
- case CL_DEVICE_NAME:
- stringToParam(m_info.name, paramValue, paramValueSizeRet);
- break;
- case CL_DEVICE_VENDOR:
- stringToParam(m_info.name, paramValue, paramValueSizeRet);
- break;
- case CL_DRIVER_VERSION:
- break;
- case CL_DEVICE_PROFILE:
- break;
- case CL_DEVICE_VERSION:
- break;
- case CL_DEVICE_EXTENSIONS:
- break;
-
- default:
- return CL_INVALID_VALUE;
- break;
- }
-
- return CL_SUCCESS;
-}
-
-Device::Device(cl_uint type, struct pipe_winsys *ws,
- struct pipe_screen *screen)
- : m_winsys(ws), m_screen(screen)
-{
- fillInfo(type);
-}
-
-void Device::fillInfo(cl_uint type)
-{
- m_info.type = type;
- m_info.vendorId = 0;//should be a PCIe ID
- m_info.maxComputeUnits = 1;//min
- m_info.maxWorkItemDimensions = 3;//min
-#if 0
- m_info.maxWorkGroupSize = ;
- m_info.maxWorkItemSizes = ;
- m_info.preferredVectorWidthChar = ;
- m_info.preferredVectorWidthShort = ;
- m_info.preferredVectorWidthInt = ;
- m_info.preferredVectorWidthLong = ;
- m_info.preferredVectorWidthFloat = ;
- m_info.preferredVectorWidthDouble = ;
-
- m_info.maxClockFrequency = ;
- m_info.addressBits = ;
- m_info.maxReadImageArgs = ;
- m_info.maxWriteImageArgs = ;
- m_info.maxMemAllocSize = ;
-
- m_info.image2dMaxWidth = ;
- m_info.image2dMaxHeight = ;
- m_info.image3dMaxWidth = ;
- m_info.image3dMaxHeight = ;
- m_info.image3dMaxDepth = ;
- m_info.imageSupport = ;
-
- m_info.maxParameterSize = ;
- m_info.maxSamplers = ;
- m_info.memBaseAddrAlign = ;
- m_info.minDataTypeAlignSize = ;
- m_info.singleFpConfig = ;
- m_info.globalMemCacheType = ;
- m_info.globalMemCachelineSize = ;
- m_info.globalMemCacheSize = ;
- m_info.globalMemSize = ;
- m_info.maxConstantBufferSize = ;
- m_info.maxConstantArgs = ;
- m_info.localMemType = ;
- m_info.localMemSize = ;
- m_info.errorCorrectionSupport = ;
- m_info.profilingTimerResolution = ;
- m_info.entianLittle = ;
- m_info.available = ;
- m_info.compilerAvailable = ;
- m_info.executionCapabilities = ;
- m_info.queueProperties = ;
-
-#endif
- m_info.name = m_screen->get_name(m_screen);
- m_info.vendor = m_screen->get_vendor(m_screen);
- //m_info.driverVersion = ;
- m_info.profile = "FULL_PROFILE";
- //m_info.version = ;
- //m_info.extensions = ;
-}
diff --git a/src/device.h b/src/device.h
deleted file mode 100644
index 74a360e..0000000
--- a/src/device.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef DEVICE_H
-#define DEVICE_H
-
-#include "deviceinfo.h"
-
-#include "OpenCL/cl.h"
-
-struct pipe_screen;
-struct pipe_winsys;
-
-
-class Device
-{
-public:
- static Device *create(cl_uint type);
-public:
- inline cl_uint type() const;
- inline struct pipe_screen *screen() const;
- inline struct pipe_winsys *winsys() const;
-
- cl_int info(cl_device_info opcode,
- size_t paramValueSize,
- void * paramValue,
- size_t * paramValueSizeRet) const;
-
-private:
- Device(cl_uint type, struct pipe_winsys *ws,
- struct pipe_screen *screen);
- void fillInfo(cl_uint type);
-
-private:
- DeviceInfo m_info;
-
- struct pipe_winsys *m_winsys;
- struct pipe_screen *m_screen;
-};
-
-inline cl_uint Device::type() const
-{
- return m_info.type;
-}
-
-inline struct pipe_screen *Device::screen() const
-{
- return m_screen;
-}
-
-inline struct pipe_winsys *Device::winsys() const
-{
- return m_winsys;
-}
-
-
-struct _cl_device_id : public Device
-{};
-
-#endif
diff --git a/src/deviceinfo.h b/src/deviceinfo.h
deleted file mode 100644
index afbad19..0000000
--- a/src/deviceinfo.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef DEVICEINFO_H
-#define DEVICEINFO_H
-
-#include "OpenCL/cl.h"
-
-#include <vector>
-#include <string>
-
-struct DeviceInfo
-{
- cl_uint type; //CL_DEVICE_TYPE
-
- cl_uint vendorId; //CL_DEVICE_VENDOR_ID
- cl_uint maxComputeUnits; //CL_DEVICE_MAX_COMPUTE_UNITS
- cl_uint maxWorkItemDimensions; //CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS
- std::vector<size_t> maxWorkItemSizes; //CL_DEVICE_MAX_WORK_ITEM_SIZES
- size_t maxWorkGroupSize; //CL_DEVICE_MAX_WORK_GROUP_SIZE
- cl_uint preferredVectorWidthChar; //CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR
- cl_uint preferredVectorWidthShort; //CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT
- cl_uint preferredVectorWidthInt; //CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT
- cl_uint preferredVectorWidthLong; //CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG
- cl_uint preferredVectorWidthFloat; //CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT
- cl_uint preferredVectorWidthDouble; //CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE
-
- cl_uint maxClockFrequency; //CL_DEVICE_MAX_CLOCK_FREQUENCY
- cl_bitfield addressBits; //CL_DEVICE_ADDRESS_BITS
- cl_uint maxReadImageArgs; //CL_DEVICE_MAX_READ_IMAGE_ARGS
- cl_uint maxWriteImageArgs; //CL_DEVICE_MAX_WRITE_IMAGE_ARGS
- cl_ulong maxMemAllocSize; //CL_DEVICE_MAX_MEM_ALLOC_SIZE
-
- size_t image2dMaxWidth; //CL_DEVICE_IMAGE2D_MAX_WIDTH
- size_t image2dMaxHeight; //CL_DEVICE_IMAGE2D_MAX_HEIGHT
- size_t image3dMaxWidth; //CL_DEVICE_IMAGE3D_MAX_WIDTH
- size_t image3dMaxHeight; //CL_DEVICE_IMAGE3D_MAX_HEIGHT
- size_t image3dMaxDepth; //CL_DEVICE_IMAGE3D_MAX_DEPTH
- cl_bool imageSupport; //CL_DEVICE_IMAGE_SUPPORT
-
- size_t maxParameterSize; //CL_DEVICE_MAX_PARAMETER_SIZE
- cl_uint maxSamplers; //CL_DEVICE_MAX_SAMPLERS
- cl_uint memBaseAddrAlign; //CL_DEVICE_MEM_BASE_ADDR_ALIGN
- cl_uint minDataTypeAlignSize; //CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE
- cl_device_fp_config singleFpConfig; //CL_DEVICE_SINGLE_FP_CONFIG
- cl_device_mem_cache_type globalMemCacheType; //CL_DEVICE_GLOBAL_MEM_CACHE_TYPE
- cl_uint globalMemCachelineSize; //CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE
- cl_ulong globalMemCacheSize; //CL_DEVICE_GLOBAL_MEM_CACHE_SIZE
- cl_ulong globalMemSize; //CL_DEVICE_GLOBAL_MEM_SIZE
- cl_ulong maxConstantBufferSize; //CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE
- cl_uint maxConstantArgs; //CL_DEVICE_MAX_CONSTANT_ARGS
- cl_device_local_mem_type localMemType; //CL_DEVICE_LOCAL_MEM_TYPE
- cl_ulong localMemSize; //CL_DEVICE_LOCAL_MEM_SIZE
- cl_bool errorCorrectionSupport; //CL_DEVICE_ERROR_CORRECTION_SUPPORT
- size_t profilingTimerResolution; //CL_DEVICE_PROFILING_TIMER_RESOLUTION
- cl_bool entianLittle; //CL_DEVICE_ENDIAN_LITTLE
- cl_bool available; //CL_DEVICE_AVAILABLE
- cl_bool compilerAvailable; //CL_DEVICE_COMPILER_AVAILABLE
- cl_device_exec_capabilities executionCapabilities; //CL_DEVICE_EXECUTION_CAPABILITIES
- cl_command_queue_properties queueProperties; //CL_DEVICE_QUEUE_PROPERTIES
-
- std::string name; //CL_DEVICE_NAME
- std::string vendor; //CL_DEVICE_VENDOR
- std::string driverVersion; //CL_DRIVER_VERSION
- std::string profile; //CL_DEVICE_PROFILE
- std::string version; //CL_DEVICE_VERSION
- std::string extensions; //CL_DEVICE_EXTENSIONS
-};
-
-#endif