[Mesa-dev] [PATCH 18/21] glsl: Write a new built-in function module.

Matt Turner mattst88 at gmail.com
Mon Sep 9 10:39:45 PDT 2013


On Wed, Sep 4, 2013 at 3:22 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> +static bool
> +texture_query_lod(const _mesa_glsl_parse_state *state)
> +{
> +   return state->target == fragment_shader &&
> +          (state->is_version(400, 0) || state->ARB_texture_query_lod_enable);
> +}

Reminder about the whole fiasco about textureQueryLOD vs
textureQueryLod. Probably just need to remove the
state->is_version(400, 0) for now.

> +ir_function_signature *
> +builtin_builder::_modf(const glsl_type *type)
> +{
> +   ir_variable *x = in_var(type, "x");
> +   ir_variable *i = new(mem_ctx) ir_variable(type, "i", ir_var_function_out);
> +   MAKE_SIG(type, v130, 2, x, i);
> +
> +   ir_variable *t = body.make_temp(type, "t");
> +   body.emit(assign(t, expr(ir_unop_trunc, x)));
> +   body.emit(assign(i, t));
> +   body.emit(ret(sub(x, t)));
> +
> +   return sig;
> +}

Create an out_var() helper function and use it here.


More information about the mesa-dev mailing list