clover/nir: Set constant buffer pointer size to host

The `argument::size` is supposed to represent the size of a pointer on
the host and not on the device (for which argument::target_size`
exists).

v3: Use `sizeof(buf)` instead of `marg.size`. (Francisco Jerez)

Fixes: 7c6f1d3bf9 ("clover/nir: extract constant buffer into its own section")

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Pierre Moreau <dev@pmoreau.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10256>
(cherry picked from commit b4e5bf0637)
This commit is contained in:
Pierre Moreau 2021-04-25 21:59:27 +02:00 committed by Dylan Baker
parent 90645f3eea
commit ecfa127381
3 changed files with 4 additions and 4 deletions

View file

@ -13,7 +13,7 @@
"description": "clover/nir: Set constant buffer pointer size to host",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "7c6f1d3bf9903fe403b31a995c4dfce726fd3a27"
},

View file

@ -247,7 +247,7 @@ kernel::exec_context::bind(intrusive_ptr<command_queue> _q,
case module::argument::constant_buffer: {
auto arg = argument::create(marg);
cl_mem buf = kern._constant_buffers.at(&q->device()).get();
arg->set(q->device().address_bits() / 8, &buf);
arg->set(sizeof(buf), &buf);
arg->bind(*this, marg);
break;
}

View file

@ -324,8 +324,8 @@ clover_lower_nir(nir_shader *nir, std::vector<module::argument> &args,
"constant_buffer_addr");
constant_var->data.location = args.size();
args.emplace_back(module::argument::global,
pointer_bit_size / 8, pointer_bit_size / 8, pointer_bit_size / 8,
args.emplace_back(module::argument::global, sizeof(cl_mem),
pointer_bit_size / 8, pointer_bit_size / 8,
module::argument::zero_ext,
module::argument::constant_buffer);
}