On Fri, Apr 3, 2015 at 9:46 AM, Matt Turner <matts...@gmail.com> wrote:
> On Fri, Apr 3, 2015 at 1:07 AM, Jordan Justen <jordan.l.jus...@intel.com> 
> wrote:
>> On 2015-04-02 20:56:15, Jason Ekstrand wrote:
>>> ---
>>>  src/mesa/drivers/dri/i965/brw_context.c | 10 +++++++++-
>>>  src/mesa/drivers/dri/i965/brw_fs.cpp    |  4 ++--
>>>  src/mesa/drivers/dri/i965/brw_vec4.cpp  |  4 +++-
>>>  3 files changed, 14 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
>>> b/src/mesa/drivers/dri/i965/brw_context.c
>>> index 84818f0..f0de711 100644
>>> --- a/src/mesa/drivers/dri/i965/brw_context.c
>>> +++ b/src/mesa/drivers/dri/i965/brw_context.c
>>> @@ -560,6 +560,12 @@ brw_initialize_context_constants(struct brw_context 
>>> *brw)
>>>        .lower_ffma = true,
>>>     };
>>>
>>> +   bool use_nir_default[MESA_SHADER_STAGES];
>>> +   use_nir_default[MESA_SHADER_VERTEX] = false;
>>> +   use_nir_default[MESA_SHADER_GEOMETRY] = false;
>>> +   use_nir_default[MESA_SHADER_FRAGMENT] = false;
>>> +   use_nir_default[MESA_SHADER_COMPUTE] = false;
>>
>> How about memset to 0 for now to make sure all stages are set? We can
>> add use_nir_default[MESA_SHADER_FOO] = true; after the memset to
>> update the default for the shader stage.

Sure, we could do that.  I'm not sure if it really saves us anything.
I guess it would make sure that we initialize everything.

> Isn't this sufficient?
>
> bool use_nir_default[MESA_SHADER_STAGES] = {false};

Yes, that would accomplish the memset in less code.

> and use C99 designated initializers when we want to change the default
> per-stage.

No, we can't do this.  When we flip the switch, we're going to have

> use_nir_default[MESA_SHADER_VERTEX] = brw->gen >= 8;

and you can only use compile-time constants in initializers.

>> +      if (brw_env_var_as_boolean("INTEL_USE_NIR", use_nir_default[i]))
>
> This will read the var more once per shader type, right? Maybe read
> INTEL_USE_NIR once before the loop?

I'd like to have a single read of the INTEL_USE_NIR variable.
However, doing that *and* handling defaults will be annoying.  Since
this code isn't going to be around for a real long time, I'm not
terribly concerned about reading it extra times.  As is, we read it
once per shader compile anyway.
--Jason
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to