diff options
author | Denis Steckelmacher <steckdenis@yahoo.fr> | 2011-08-07 18:41:54 +0200 |
---|---|---|
committer | Denis Steckelmacher <steckdenis@yahoo.fr> | 2011-08-07 18:41:54 +0200 |
commit | f7d2dab69657e1a204bf814ccbdb3ea8ca4af933 (patch) | |
tree | 810d675bca1f818057e466bb91b0e6aa4330b99f /src | |
parent | 09ebb3aa706e0123e912c703e48de995dbe29996 (diff) |
Test infrastructure for built-in functions, test Samplers.
Diffstat (limited to 'src')
-rw-r--r-- | src/api/api_event.cpp | 3 | ||||
-rw-r--r-- | src/core/commandqueue.cpp | 5 | ||||
-rw-r--r-- | src/core/commandqueue.h | 1 | ||||
-rw-r--r-- | src/core/sampler.cpp | 2 | ||||
-rw-r--r-- | src/core/sampler.h | 2 | ||||
-rw-r--r-- | src/runtime/stdlib.h | 15 |
6 files changed, 24 insertions, 4 deletions
diff --git a/src/api/api_event.cpp b/src/api/api_event.cpp index 029506c..14f6ac0 100644 --- a/src/api/api_event.cpp +++ b/src/api/api_event.cpp @@ -91,7 +91,10 @@ clReleaseEvent(cl_event event) return CL_INVALID_EVENT; if (event->dereference()) + { + event->freeDeviceData(); delete event; + } return CL_SUCCESS; } diff --git a/src/core/commandqueue.cpp b/src/core/commandqueue.cpp index 32858a5..9e6aeca 100644 --- a/src/core/commandqueue.cpp +++ b/src/core/commandqueue.cpp @@ -403,7 +403,7 @@ Event::Event(CommandQueue *parent, } } -Event::~Event() +void Event::freeDeviceData() { if (parent() && p_device_data) { @@ -412,7 +412,10 @@ Event::~Event() device->freeEventDeviceData(this); } +} +Event::~Event() +{ for (int i=0; i<p_num_events_in_wait_list; ++i) clReleaseEvent((cl_event)p_event_wait_list[i]); diff --git a/src/core/commandqueue.h b/src/core/commandqueue.h index 0ea10bd..a64c506 100644 --- a/src/core/commandqueue.h +++ b/src/core/commandqueue.h @@ -112,6 +112,7 @@ class Event : public Object const Event **event_wait_list, cl_int *errcode_ret); + void freeDeviceData(); virtual ~Event(); virtual Type type() const = 0; diff --git a/src/core/sampler.cpp b/src/core/sampler.cpp index aae8b89..bdf0f14 100644 --- a/src/core/sampler.cpp +++ b/src/core/sampler.cpp @@ -13,7 +13,7 @@ Sampler::Sampler(Context *ctx, cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, cl_int *errcode_ret) -: Object(Object::T_Sampler), p_bitfield(0) +: Object(Object::T_Sampler, ctx), p_bitfield(0) { if (normalized_coords) p_bitfield |= CLK_NORMALIZED_COORDS_TRUE; diff --git a/src/core/sampler.h b/src/core/sampler.h index 515a0c6..6df24a2 100644 --- a/src/core/sampler.h +++ b/src/core/sampler.h @@ -4,6 +4,8 @@ #include <CL/cl.h> #include "object.h" +// WARNING: Keep in sync with stdlib.h + #define CLK_NORMALIZED_COORDS_FALSE 0x00000000 #define CLK_NORMALIZED_COORDS_TRUE 0x00000001 #define CLK_ADDRESS_NONE 0x00000000 diff --git a/src/runtime/stdlib.h b/src/runtime/stdlib.h index f1c7749..dae9043 100644 --- a/src/runtime/stdlib.h +++ b/src/runtime/stdlib.h @@ -7,13 +7,13 @@ typedef unsigned long ulong; typedef int *intptr_t; typedef uint *uintptr_t; +typedef unsigned int sampler_t; + /* Standard types from Clang's stddef, Copyright (C) 2008 Eli Friedman */ typedef __typeof__(((int*)0)-((int*)0)) ptrdiff_t; typedef __typeof__(sizeof(int)) size_t; /* Vectors */ - -//typedef float float4 __attribute__((ext_vector_type(4))); #define COAL_VECTOR(type, len) \ typedef type type##len __attribute__((ext_vector_type(len))) #define COAL_VECTOR_SET(type) \ @@ -55,6 +55,17 @@ COAL_VECTOR_SET(float); #define write_only __write_only #define read_only __read_only +/* Defines */ +#define CLK_NORMALIZED_COORDS_FALSE 0x00000000 +#define CLK_NORMALIZED_COORDS_TRUE 0x00000001 +#define CLK_ADDRESS_NONE 0x00000000 +#define CLK_ADDRESS_MIRRORED_REPEAT 0x00000010 +#define CLK_ADDRESS_REPEAT 0x00000020 +#define CLK_ADDRESS_CLAMP_TO_EDGE 0x00000030 +#define CLK_ADDRESS_CLAMP 0x00000040 +#define CLK_FILTER_NEAREST 0x00000000 +#define CLK_FILTER_LINEAR 0x00000100 + /* Management functions */ uint get_work_dim(); size_t get_global_size(uint dimindx); |