[Mesa-dev] [PATCH 4/7] nir: add shader_clock intrinsic
Matt Turner
mattst88 at gmail.com
Mon Oct 19 11:25:30 PDT 2015
On Mon, Oct 19, 2015 at 7:45 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> v2: Add flags and inline comment/description.
> v3: None of the input/outputs are variables
>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> src/glsl/nir/glsl_to_nir.cpp | 6 ++++++
> src/glsl/nir/nir_intrinsics.h | 8 ++++++++
> 2 files changed, 14 insertions(+)
>
> diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
> index cf5bb93..9dd3d07 100644
> --- a/src/glsl/nir/glsl_to_nir.cpp
> +++ b/src/glsl/nir/glsl_to_nir.cpp
> @@ -685,6 +685,8 @@ nir_visitor::visit(ir_call *ir)
> op = nir_intrinsic_ssbo_atomic_exchange;
> } else if (strcmp(ir->callee_name(), "__intrinsic_ssbo_atomic_comp_swap_internal") == 0) {
> op = nir_intrinsic_ssbo_atomic_comp_swap;
> + } else if (strcmp(ir->callee_name(), "__intrinsic_shader_clock") == 0) {
> + op = nir_intrinsic_shader_clock;
> } else {
> unreachable("not reached");
> }
> @@ -789,6 +791,10 @@ nir_visitor::visit(ir_call *ir)
> case nir_intrinsic_memory_barrier:
> nir_instr_insert_after_cf_list(this->cf_node_list, &instr->instr);
> break;
> + case nir_intrinsic_shader_clock:
> + nir_ssa_dest_init(&instr->instr, &instr->dest, 1, NULL);
> + nir_instr_insert_after_cf_list(this->cf_node_list, &instr->instr);
> + break;
> case nir_intrinsic_store_ssbo: {
> exec_node *param = ir->actual_parameters.get_head();
> ir_rvalue *block = ((ir_instruction *)param)->as_rvalue();
> diff --git a/src/glsl/nir/nir_intrinsics.h b/src/glsl/nir/nir_intrinsics.h
> index 49bf3b2..0302152 100644
> --- a/src/glsl/nir/nir_intrinsics.h
> +++ b/src/glsl/nir/nir_intrinsics.h
> @@ -83,6 +83,14 @@ BARRIER(discard)
> */
> BARRIER(memory_barrier)
>
> +/*
> + * Shader clock intrinsic with semantics analogous to the clock2x32ARB()
> + * clockARB() GLSL intrinsic.
> + * The latter can be used as code motion barrier, which is currently not
> + * feasible with NIR.
> + */
This comment is confusing. I assume it's supposed to read "to the
clock2x32ARB()/clockARB() GLSL intrinsic.", that is, with a / between
the two function names. But then, the next sentence says "The latter
can ...". The latter of those two? That's not what the spec says:
> The clockARB() and clock2x32ARB() functions serve as a code motion barriers. [sic]
I think I'd drop the second sentence entirely.
More information about the mesa-dev
mailing list