q.pipe->set_sampler_views(q.pipe, PIPE_SHADER_COMPUTE, 0,
exec.sviews.size(), exec.sviews.data());
+ q.pipe->set_shader_images(q.pipe, PIPE_SHADER_COMPUTE, 0,
+ exec.iviews.size(), exec.iviews.data());
q.pipe->set_compute_resources(q.pipe, 0, exec.resources.size(),
exec.resources.data());
q.pipe->set_global_binding(q.pipe, 0, exec.g_buffers.size(),
q.pipe->set_global_binding(q.pipe, 0, exec.g_buffers.size(), NULL, NULL);
q.pipe->set_compute_resources(q.pipe, 0, exec.resources.size(), NULL);
+ q.pipe->set_shader_images(q.pipe, PIPE_SHADER_COMPUTE, 0,
+ exec.iviews.size(), NULL);
q.pipe->set_sampler_views(q.pipe, PIPE_SHADER_COMPUTE, 0,
exec.sviews.size(), NULL);
q.pipe->bind_sampler_states(q.pipe, PIPE_SHADER_COMPUTE, 0,
input.clear();
samplers.clear();
sviews.clear();
+ iviews.clear();
resources.clear();
g_buffers.clear();
g_handles.clear();
void
kernel::image_wr_argument::bind(exec_context &ctx,
const module::argument &marg) {
- auto v = bytes(ctx.resources.size());
+ auto v = bytes(ctx.iviews.size());
extend(v, module::argument::zero_ext, marg.target_size);
byteswap(v, ctx.q->device().endianness());
align(ctx.input, marg.target_align);
insert(ctx.input, v);
-
- st = img->resource_in(*ctx.q).bind_surface(*ctx.q, true);
- ctx.resources.push_back(st);
+ ctx.iviews.push_back(img->resource_in(*ctx.q).create_image_view(*ctx.q));
}
void
kernel::image_wr_argument::unbind(exec_context &ctx) {
- img->resource_in(*ctx.q).unbind_surface(*ctx.q, st);
}
void
std::vector<uint8_t> input;
std::vector<void *> samplers;
std::vector<pipe_sampler_view *> sviews;
+ std::vector<pipe_image_view> iviews;
std::vector<pipe_surface *> resources;
std::vector<pipe_resource *> g_buffers;
std::vector<size_t> g_handles;
virtual void bind(exec_context &ctx,
const module::argument &marg);
virtual void unbind(exec_context &ctx);
-
- private:
- pipe_surface *st;
};
class sampler_argument : public argument {
q.pipe->sampler_view_destroy(q.pipe, st);
}
+pipe_image_view
+resource::create_image_view(command_queue &q) {
+ pipe_image_view view;
+ view.resource = pipe;
+ view.format = pipe->format;
+ view.access = 0;
+ view.shader_access = PIPE_IMAGE_ACCESS_WRITE;
+
+ if (pipe->target == PIPE_BUFFER) {
+ view.u.buf.offset = 0;
+ view.u.buf.size = obj.size();
+ } else {
+ view.u.tex.first_layer = 0;
+ view.u.tex.last_layer = 0;
+ view.u.tex.level = 0;
+ }
+
+ return view;
+}
+
pipe_surface *
resource::bind_surface(command_queue &q, bool rw) {
pipe_surface info {};