#include "pipe/p_screen.h"
#include "util/u_sampler.h"
#include "util/u_format.h"
+#include "util/u_inlines.h"
using namespace clover;
}
root_resource::~root_resource() {
- device().pipe->resource_destroy(device().pipe, pipe);
+ pipe_resource_reference(&this->pipe, NULL);
}
sub_resource::sub_resource(resource &r, const vector &offset) :
cl_map_flags flags, bool blocking,
const resource::vector &origin,
const resource::vector ®ion) :
- pctx(q.pipe) {
+ pctx(q.pipe), pres(NULL) {
unsigned usage = ((flags & CL_MAP_WRITE ? PIPE_TRANSFER_WRITE : 0 ) |
(flags & CL_MAP_READ ? PIPE_TRANSFER_READ : 0 ) |
(flags & CL_MAP_WRITE_INVALIDATE_REGION ?
pxfer = NULL;
throw error(CL_OUT_OF_RESOURCES);
}
+ pipe_resource_reference(&pres, r.pipe);
}
mapping::mapping(mapping &&m) :
- pctx(m.pctx), pxfer(m.pxfer), p(m.p) {
+ pctx(m.pctx), pxfer(m.pxfer), pres(m.pres), p(m.p) {
m.pctx = NULL;
m.pxfer = NULL;
+ m.pres = NULL;
m.p = NULL;
}
if (pxfer) {
pctx->transfer_unmap(pctx, pxfer);
}
+ pipe_resource_reference(&pres, NULL);
}
mapping &
mapping::operator=(mapping m) {
std::swap(pctx, m.pctx);
std::swap(pxfer, m.pxfer);
+ std::swap(pres, m.pres);
std::swap(p, m.p);
return *this;
}