summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2008-12-13 22:16:42 -0500
committerZack Rusin <zack@tungstengraphics.com>2008-12-13 22:16:42 -0500
commit5d26ef731231b2382c7dfe829ad31ec5425d985a (patch)
tree9c1b734d0c5e679b2ac32074b10e112bcd1f7f8a
parent22c6e1a9128f3e5d0c686efe2994a26a1a482658 (diff)
c++ is simply a better fit for opencl
due to the coming llvm/clang dependency c++ is a lot better fit for the project
-rw-r--r--Makefile39
-rw-r--r--cpuwinsys/cpuwinsys.h2
-rw-r--r--src/api_command.cpp (renamed from src/api_command.c)0
-rw-r--r--src/api_context.cpp (renamed from src/api_context.c)0
-rw-r--r--src/api_device.cpp (renamed from src/api_device.c)20
-rw-r--r--src/api_enqueue.cpp (renamed from src/api_enqueue.c)0
-rw-r--r--src/api_event.cpp (renamed from src/api_event.c)0
-rw-r--r--src/api_flush.cpp (renamed from src/api_flush.c)0
-rw-r--r--src/api_kernel.cpp (renamed from src/api_kernel.c)0
-rw-r--r--src/api_memory.cpp (renamed from src/api_memory.c)0
-rw-r--r--src/api_platform.cpp (renamed from src/api_platform.c)26
-rw-r--r--src/api_profiling.cpp (renamed from src/api_profiling.c)0
-rw-r--r--src/api_program.cpp (renamed from src/api_program.c)0
-rw-r--r--src/api_sampler.cpp (renamed from src/api_sampler.c)0
-rw-r--r--src/device.c10
-rw-r--r--src/device.h8
16 files changed, 63 insertions, 42 deletions
diff --git a/Makefile b/Makefile
index 3d29244..cc7f5c1 100644
--- a/Makefile
+++ b/Makefile
@@ -3,38 +3,43 @@ include $(TOP)/configs/current
CL_SOURCES = \
- src/api_command.c \
- src/api_context.c \
- src/api_device.c \
- src/api_enqueue.c \
- src/api_event.c \
- src/api_flush.c \
- src/api_kernel.c \
- src/api_memory.c \
- src/api_platform.c \
- src/api_profiling.c \
- src/api_program.c \
- src/api_sampler.c \
- cpuwinsys/cpuwinsys.c
-
+ src/api_command.cpp \
+ src/api_context.cpp \
+ src/api_device.cpp \
+ src/api_enqueue.cpp \
+ src/api_event.cpp \
+ src/api_flush.cpp \
+ src/api_kernel.cpp \
+ src/api_memory.cpp \
+ src/api_platform.cpp \
+ src/api_profiling.cpp \
+ src/api_program.cpp \
+ src/api_sampler.cpp
+
+CPUWS_SOURCES = \
+ cpuwinsys/cpuwinsys.c
### All the core C sources
ALL_SOURCES = \
- $(CL_SOURCES)
+ $(CL_SOURCES) \
+ $(CPUWS_SOURCES)
### Object files
CL_OBJECTS = \
- $(CL_SOURCES:.c=.o)
+ $(CL_SOURCES:.cpp=.o) \
+ $(CPUWS_SOURCES:.c=.o)
### Include directories
INCLUDE_DIRS = \
+ -I$(TOP) \
-I$(TOP)/include \
-I$(GALLIUM)/include \
-I$(GALLIUM)/src/gallium/include \
- -I$(GALLIUM)/src/gallium/auxiliary
+ -I$(GALLIUM)/src/gallium/auxiliary \
+ -I$(GALLIUM)/src/gallium/drivers
CL_LIB = OpenCL
CL_LIB_NAME = lib$(CL_LIB).so
diff --git a/cpuwinsys/cpuwinsys.h b/cpuwinsys/cpuwinsys.h
index b3a1a72..d5f67da 100644
--- a/cpuwinsys/cpuwinsys.h
+++ b/cpuwinsys/cpuwinsys.h
@@ -1,6 +1,8 @@
#ifndef CPUWINSYS_H
#define CPUWINSYS_H
+struct pipe_winsys;
+
struct pipe_winsys *cpu_winsys(void);
#endif
diff --git a/src/api_command.c b/src/api_command.cpp
index a4f2dcd..a4f2dcd 100644
--- a/src/api_command.c
+++ b/src/api_command.cpp
diff --git a/src/api_context.c b/src/api_context.cpp
index fbf3af9..fbf3af9 100644
--- a/src/api_context.c
+++ b/src/api_context.cpp
diff --git a/src/api_device.c b/src/api_device.cpp
index 2583f40..133656f 100644
--- a/src/api_device.c
+++ b/src/api_device.cpp
@@ -2,6 +2,15 @@
#include <OpenCL/cl_platform.h>
#include "device.h"
+#include "cpuwinsys/cpuwinsys.h"
+
+
+#include "pipe/p_screen.h"
+#include "pipe/p_format.h"
+#include "pipe/p_winsys.h"
+#include "util/u_memory.h"
+
+#include "softpipe/sp_winsys.h"
// Device APIs
@@ -17,6 +26,17 @@ create_cpu_device(cl_device_id * devices,
cl_uint * num_devices,
cl_uint num_entries)
{
+ struct pipe_winsys *pws = cpu_winsys();
+ struct pipe_screen *screen = softpipe_create_screen(pws);
+ struct _cl_device_id *device;
+
+ device = CALLOC_STRUCT(_cl_device_id);
+ device->screen = screen;
+ device->winsys = pws;
+ device->type = CL_DEVICE_TYPE_CPU;
+
+ devices[0] = device;
+ *num_devices = 1;
}
static void
diff --git a/src/api_enqueue.c b/src/api_enqueue.cpp
index 15091b4..15091b4 100644
--- a/src/api_enqueue.c
+++ b/src/api_enqueue.cpp
diff --git a/src/api_event.c b/src/api_event.cpp
index 9c08011..9c08011 100644
--- a/src/api_event.c
+++ b/src/api_event.cpp
diff --git a/src/api_flush.c b/src/api_flush.cpp
index 34afab0..34afab0 100644
--- a/src/api_flush.c
+++ b/src/api_flush.cpp
diff --git a/src/api_kernel.c b/src/api_kernel.cpp
index 27d7c81..27d7c81 100644
--- a/src/api_kernel.c
+++ b/src/api_kernel.cpp
diff --git a/src/api_memory.c b/src/api_memory.cpp
index 19d4095..19d4095 100644
--- a/src/api_memory.c
+++ b/src/api_memory.cpp
diff --git a/src/api_platform.c b/src/api_platform.cpp
index 28fdc3f..b6429e7 100644
--- a/src/api_platform.c
+++ b/src/api_platform.cpp
@@ -15,20 +15,20 @@ clGetPlatformInfo(cl_platform_info param_name,
void * param_value,
size_t * param_value_size_ret)
{
- switch(param_name) {
- case CL_PLATFORM_PROFILE:
- strcpy(param_value, PROFILE_STR);
- *param_value_size_ret = PROFILE_STR_LEN;
- break;
+ 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(param_value, VERSION_STR);
- *param_value_size_ret = VERSION_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;
- }
+ default:
+ return CL_INVALID_VALUE;
+ }
- return CL_SUCCESS;
+ return CL_SUCCESS;
}
diff --git a/src/api_profiling.c b/src/api_profiling.cpp
index 5980dee..5980dee 100644
--- a/src/api_profiling.c
+++ b/src/api_profiling.cpp
diff --git a/src/api_program.c b/src/api_program.cpp
index 98999fa..98999fa 100644
--- a/src/api_program.c
+++ b/src/api_program.cpp
diff --git a/src/api_sampler.c b/src/api_sampler.cpp
index 8c4d74a..8c4d74a 100644
--- a/src/api_sampler.c
+++ b/src/api_sampler.cpp
diff --git a/src/device.c b/src/device.c
deleted file mode 100644
index b34a525..0000000
--- a/src/device.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef DEVICE_H
-#define DEVICE_H
-
-#include "OpenCL/cl.h"
-
-struct _cl_device_id {
- struct pipe_screen *screen;
-};
-
-#endif
diff --git a/src/device.h b/src/device.h
index c6f8f51..ea8c7e0 100644
--- a/src/device.h
+++ b/src/device.h
@@ -3,10 +3,14 @@
#include "OpenCL/cl.h"
+struct pipe_screen;
+struct pipe_winsys;
+
struct _cl_device_id {
- struct pipe_screen *screen;
+ struct pipe_screen *screen;
+ struct pipe_winsys *winsys;
- cl_uint type;
+ cl_uint type;
};
#endif