2017-01-17 20:25:28 -05:00
|
|
|
/* Copyright 2015-2017 Philippe Tillet
|
2017-05-07 16:51:51 -07:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
* a copy of this software and associated documentation files
|
|
|
|
* (the "Software"), to deal in the Software without restriction,
|
|
|
|
* including without limitation the rights to use, copy, modify, merge,
|
|
|
|
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
|
|
* and to permit persons to whom the Software is furnished to do so,
|
2017-01-17 20:25:28 -05:00
|
|
|
* subject to the following conditions:
|
2017-05-07 16:51:51 -07:00
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
2017-01-17 20:25:28 -05:00
|
|
|
* included in all copies or substantial portions of the Software.
|
2017-05-07 16:51:51 -07:00
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
2017-01-17 20:25:28 -05:00
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
2017-05-07 16:51:51 -07:00
|
|
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
2017-01-17 20:25:28 -05:00
|
|
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
2015-12-21 17:04:09 -05:00
|
|
|
|
2015-04-29 15:50:57 -04:00
|
|
|
#ifndef ISAAC_DRIVER_BUFFER_H
|
|
|
|
#define ISAAC_DRIVER_BUFFER_H
|
|
|
|
|
|
|
|
#include "isaac/driver/handle.h"
|
2017-05-11 16:11:40 -07:00
|
|
|
#include "isaac/driver/context.h"
|
2017-05-07 16:51:51 -07:00
|
|
|
|
2015-04-29 15:50:57 -04:00
|
|
|
namespace isaac
|
|
|
|
{
|
|
|
|
namespace driver
|
|
|
|
{
|
|
|
|
|
2017-05-07 16:51:51 -07:00
|
|
|
class Stream;
|
|
|
|
|
2015-04-29 15:50:57 -04:00
|
|
|
// Buffer
|
2017-05-10 21:50:39 -07:00
|
|
|
class Buffer: public HandleInterface<Buffer, CUdeviceptr>
|
2015-04-29 15:50:57 -04:00
|
|
|
{
|
|
|
|
public:
|
2015-08-13 15:44:58 -07:00
|
|
|
Buffer(Context const & context, size_t size);
|
2017-11-09 13:11:41 -05:00
|
|
|
Buffer(Context const & context, CUdeviceptr cu, bool take_ownership);
|
2017-09-03 20:10:26 -04:00
|
|
|
void set_zero(Stream const & queue, size_t size);
|
2017-05-10 21:50:39 -07:00
|
|
|
Handle<CUdeviceptr> const & cu() const;
|
2017-11-09 13:11:41 -05:00
|
|
|
Handle<CUdeviceptr> & cu();
|
2017-05-07 16:51:51 -07:00
|
|
|
|
2015-04-29 15:50:57 -04:00
|
|
|
private:
|
2017-05-11 16:11:40 -07:00
|
|
|
Context context_;
|
2017-05-10 21:50:39 -07:00
|
|
|
Handle<CUdeviceptr> cu_;
|
2015-04-29 15:50:57 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|