--- src/gallium/state_trackers/clover/core/kernel.cpp | 7 +++++++ src/gallium/state_trackers/clover/core/sampler.cpp | 12 ++++++++++++ src/gallium/state_trackers/clover/core/sampler.hpp | 1 + 3 files changed, 20 insertions(+)
diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp index a226ec1..c3cf4eb 100644 --- a/src/gallium/state_trackers/clover/core/kernel.cpp +++ b/src/gallium/state_trackers/clover/core/kernel.cpp @@ -575,6 +575,13 @@ kernel::sampler_argument::set(size_t size, const void *value) { void kernel::sampler_argument::bind(exec_context &ctx, const module::argument &marg) { + auto v = bytes(s->bit_field()); + + 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 = s->bind(*ctx.q); ctx.samplers.push_back(st); } diff --git a/src/gallium/state_trackers/clover/core/sampler.cpp b/src/gallium/state_trackers/clover/core/sampler.cpp index 6f2784b..23fb76a 100644 --- a/src/gallium/state_trackers/clover/core/sampler.cpp +++ b/src/gallium/state_trackers/clover/core/sampler.cpp @@ -23,6 +23,11 @@ #include "core/sampler.hpp" #include "pipe/p_state.h" +// CLK_* constants are defined in libclc (include/clc/image/image_defines.h) +#define __CLOVER_NORM_MODE_BITS(x) (x) +#define __CLOVER_ADDR_MODE_BITS(x) (((x)-CL_ADDRESS_NONE)<<1) +#define __CLOVER_FILT_MODE_BITS(x) (((x)-CL_FILTER_NEAREST)<<4) + using namespace clover; sampler::sampler(clover::context &ctx, bool norm_mode, @@ -47,6 +52,13 @@ sampler::filter_mode() { return _filter_mode; } +cl_uint +sampler::bit_field() const { + return __CLOVER_NORM_MODE_BITS(_norm_mode) | + __CLOVER_ADDR_MODE_BITS(_addr_mode) | + __CLOVER_FILT_MODE_BITS(_filter_mode); +} + void * sampler::bind(command_queue &q) { struct pipe_sampler_state info {}; diff --git a/src/gallium/state_trackers/clover/core/sampler.hpp b/src/gallium/state_trackers/clover/core/sampler.hpp index 2632c30..d896252 100644 --- a/src/gallium/state_trackers/clover/core/sampler.hpp +++ b/src/gallium/state_trackers/clover/core/sampler.hpp @@ -40,6 +40,7 @@ namespace clover { bool norm_mode(); cl_addressing_mode addr_mode(); cl_filter_mode filter_mode(); + cl_uint bit_field() const; const intrusive_ref<clover::context> context; -- 2.4.6 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev