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

Kenneth Graunke kenneth at whitecape.org
Mon Sep 9 10:46:53 PDT 2013


On 09/09/2013 10:39 AM, Matt Turner wrote:
> 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.

Already done.  Thanks for pointing this out.

>> +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.

Sure.  I hadn't since there was only one instance of an out var being 
created, but apparently there are more coming in future built-ins.  Done.

--Ken



More information about the mesa-dev mailing list