Skip to content

Commit 3de8f3f

Browse files
authored
Merge pull request #184 from scschaefer/master
New ray masking and backface culling implementation
2 parents 95b4e28 + 4ed9c87 commit 3de8f3f

File tree

89 files changed

+856
-654
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+856
-654
lines changed

CLW/CLWBuffer.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ template <typename T> class CLWBuffer : public ReferenceCounter<cl_mem, clRetain
4848
static CLWBuffer<T> Create(cl_context context, cl_mem_flags flags, size_t elementCount, void* data);
4949
static CLWBuffer<T> CreateFromClBuffer(cl_mem buffer);
5050

51-
CLWBuffer() : elementCount_(0){}
52-
virtual ~CLWBuffer();
51+
CLWBuffer() = default;
52+
virtual ~CLWBuffer() = default;
5353

5454
size_t GetElementCount() const { return elementCount_; }
5555

@@ -70,7 +70,7 @@ template <typename T> class CLWBuffer : public ReferenceCounter<cl_mem, clRetain
7070

7171
CLWBuffer(cl_mem buffer, size_t elementCount);
7272

73-
size_t elementCount_;
73+
size_t elementCount_ = 0;
7474

7575
friend class CLWContext;
7676
};
@@ -122,10 +122,6 @@ template <typename T> CLWBuffer<T>::CLWBuffer(cl_mem buffer, size_t elementCount
122122

123123
}
124124

125-
template <typename T> CLWBuffer<T>::~CLWBuffer()
126-
{
127-
}
128-
129125
template <typename T> CLWEvent CLWBuffer<T>::WriteDeviceBuffer(CLWCommandQueue cmdQueue, T const* hostBuffer, size_t elemCount)
130126
{
131127
cl_int status = CL_SUCCESS;

CLW/CLWCommandQueue.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,6 @@ CLWCommandQueue::CLWCommandQueue(cl_command_queue cmdQueue)
5454
{
5555
}
5656

57-
CLWCommandQueue::CLWCommandQueue()
58-
{
59-
60-
}
61-
62-
CLWCommandQueue::~CLWCommandQueue()
63-
{
64-
}
65-
6657
#pragma warning(pop)
6758

6859

CLW/CLWCommandQueue.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ class CLWCommandQueue : public ReferenceCounter<cl_command_queue, clRetainComman
4343
static CLWCommandQueue Create(cl_command_queue queue);
4444

4545

46-
CLWCommandQueue();
47-
virtual ~CLWCommandQueue();
48-
46+
CLWCommandQueue() = default;
47+
virtual ~CLWCommandQueue() = default;
4948

5049

5150
private:

CLW/CLWContext.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,6 @@ CLWContext::CLWContext(CLWDevice device)
229229
InitCL();
230230
}
231231

232-
CLWContext::~CLWContext()
233-
{
234-
}
235-
236232
unsigned int CLWContext::GetDeviceCount() const
237233
{
238234
return (unsigned int)devices_.size();
@@ -264,17 +260,16 @@ CLWImage2D CLWContext::CreateImage2DFromGLTexture(cl_GLint texture) const
264260

265261
void CLWContext::AcquireGLObjects(unsigned int idx, std::vector<cl_mem> const& objects) const
266262
{
267-
cl_int status = clEnqueueAcquireGLObjects(commandQueues_[idx], (cl_uint)objects.size(), &objects[0], 0,0,0);
263+
cl_int status = clEnqueueAcquireGLObjects(commandQueues_[idx], (cl_uint)objects.size(), &objects[0], 0, nullptr, nullptr);
268264
ThrowIf(status != CL_SUCCESS, status, "clEnqueueAcquireGLObjects failed");
269265
}
270266

271267
void CLWContext::ReleaseGLObjects(unsigned int idx, std::vector<cl_mem> const& objects) const
272268
{
273-
cl_int status = clEnqueueReleaseGLObjects(commandQueues_[idx], (cl_uint)objects.size(), &objects[0], 0,0,0);
269+
cl_int status = clEnqueueReleaseGLObjects(commandQueues_[idx], (cl_uint)objects.size(), &objects[0], 0, nullptr, nullptr);
274270
ThrowIf(status != CL_SUCCESS, status, "clEnqueueReleaseGLObjects failed");
275271
}
276272

277-
278273
void CLWContext::Finish(unsigned int idx) const
279274
{
280275
cl_int status = clFinish(commandQueues_[idx]);

CLW/CLWContext.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ class CLWContext : public ReferenceCounter<cl_context, clRetainContext, clReleas
5151
static CLWContext Create(cl_context context, cl_device_id* device, cl_command_queue* commandQueues, int numDevices);
5252
static CLWContext Create(CLWDevice device, cl_context_properties* props = nullptr);
5353

54-
CLWContext(){}
55-
virtual ~CLWContext();
54+
CLWContext() = default;
55+
virtual ~CLWContext() = default;
5656

57-
unsigned int GetDeviceCount() const;
58-
CLWDevice GetDevice(unsigned int idx) const;
59-
CLWProgram CreateProgram(std::vector<char> const& sourceCode, char const* buildopts = nullptr) const;
57+
unsigned int GetDeviceCount() const;
58+
CLWDevice GetDevice(unsigned int idx) const;
59+
CLWProgram CreateProgram(std::vector<char> const& sourceCode, char const* buildopts = nullptr) const;
6060

6161
template <typename T> CLWBuffer<T> CreateBuffer(size_t elementCount, cl_mem_flags flags) const;
6262
template <typename T> CLWBuffer<T> CreateBuffer(size_t elementCount, cl_mem_flags flags ,void* data) const;
@@ -207,6 +207,4 @@ template <typename T> CLWEvent CLWContext::UnmapBuffer(unsigned int idx, CLWBu
207207
}
208208

209209

210-
211-
212210
#endif /* defined(__CLW__CLWContext__) */

CLW/CLWDevice.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ CLWDevice::CLWDevice(cl_device_id id) : ReferenceCounter<cl_device_id, clRetainD
4444
GetDeviceInfoParameter(*this, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, minAlignSize_);
4545
}
4646

47-
CLWDevice::~CLWDevice()
48-
{
49-
}
50-
5147
template <> void CLWDevice::GetDeviceInfoParameter<std::string>(cl_device_id id, cl_device_info param, std::string& value)
5248
{
5349
size_t length = 0;

CLW/CLWDevice.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ class CLWDevice : public ReferenceCounter<cl_device_id, clRetainDevice, clReleas
4343
public:
4444
static CLWDevice Create(cl_device_id id);
4545

46-
CLWDevice(){}
47-
virtual ~CLWDevice();
46+
CLWDevice() = default;
47+
virtual ~CLWDevice() = default;
4848

4949
// Device info
5050
cl_ulong GetLocalMemSize() const;

CLW/CLWEvent.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ void CLWEvent::Wait()
4141
ThrowIf(status != CL_SUCCESS, status, "clWaitForEvents failed");
4242
}
4343

44-
CLWEvent::~CLWEvent()
45-
{
46-
}
47-
4844
float CLWEvent::GetDuration() const
4945
{
5046
cl_ulong commandStart, commandEnd;

CLW/CLWEvent.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class CLWEvent : public ReferenceCounter<cl_event, clRetainEvent, clReleaseEvent
4040
{
4141
public:
4242
static CLWEvent Create(cl_event);
43-
CLWEvent(){}
44-
virtual ~CLWEvent();
43+
CLWEvent() = default;
44+
virtual ~CLWEvent() = default;
4545

4646
void Wait();
4747
float GetDuration() const;

CLW/CLWImage2D.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,4 @@ CLWImage2D::CLWImage2D(cl_mem image)
7474
{
7575
}
7676

77-
CLWImage2D::~CLWImage2D()
78-
{
79-
}
80-
8177
#pragma warning(pop)

0 commit comments

Comments
 (0)