[Mesa-dev] [PATCH] glsl: Remove VS output varyings which are optimized out of the FS
Paul Berry
stereotype441 at gmail.com
Sun Feb 17 15:12:25 PST 2013
On 17 February 2013 14:32, Ian Romanick <idr at freedesktop.org> wrote:
> On 02/12/2013 06:59 PM, Jordan Justen wrote:
>
>> Previously when an input varying was optimized out of the
>> FS we would still retain it as an output of the VS.
>>
>> We now build a hash of live FS input varyings rather
>> than looking in the FS symbol table. (The FS symbol table
>> will still contain the optimized out varyings.)
>>
>> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
>> Cc: Paul Berry <stereotype441 at gmail.com>
>>
>
> Is this a candidate for 9.1?
Since the spec doesn't require us to optimize away these varyings, I
personally see this patch as more of a performance optimization than a bug
fix. So I would be inclined to leave it out of 9.1. I don't feel terribly
strongly about it, though.
>
>
> ---
>> src/glsl/link_varyings.cpp | 19 ++++++++++++++++++-
>> 1 file changed, 18 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
>> index b1317c8..616933d 100644
>> --- a/src/glsl/link_varyings.cpp
>> +++ b/src/glsl/link_varyings.cpp
>> @@ -964,6 +964,8 @@ assign_varying_locations(**struct gl_context *ctx,
>> varying_matches matches(ctx->Const.**DisableVaryingPacking);
>> hash_table *tfeedback_candidates
>> = hash_table_ctor(0, hash_table_string_hash,
>> hash_table_string_compare);
>> + hash_table *consumer_inputs
>> + = hash_table_ctor(0, hash_table_string_hash,
>> hash_table_string_compare);
>>
>> /* Operate in a total of three passes.
>> *
>> @@ -976,6 +978,18 @@ assign_varying_locations(**struct gl_context *ctx,
>> * not being inputs. This lets the optimizer eliminate them.
>> */
>>
>> + if (consumer) {
>> + foreach_list(node, consumer->ir) {
>> + ir_variable *const input_var =
>> + ((ir_instruction *) node)->as_variable();
>> +
>> + if ((input_var != NULL) && (input_var->mode ==
>> ir_var_shader_in)) {
>> + hash_table_insert(consumer_**inputs, input_var,
>> + ralloc_strdup(mem_ctx, input_var->name));
>> + }
>> + }
>> + }
>> +
>> foreach_list(node, producer->ir) {
>> ir_variable *const output_var = ((ir_instruction *)
>> node)->as_variable();
>>
>> @@ -986,7 +1000,7 @@ assign_varying_locations(**struct gl_context *ctx,
>> g.process(output_var);
>>
>> ir_variable *input_var =
>> - consumer ? consumer->symbols->get_**variable(output_var->name)
>> : NULL;
>> + (ir_variable *) hash_table_find(consumer_**inputs,
>> output_var->name);
>>
>> if (input_var && input_var->mode != ir_var_shader_in)
>> input_var = NULL;
>> @@ -1005,6 +1019,7 @@ assign_varying_locations(**struct gl_context *ctx,
>>
>> if (matched_candidate == NULL) {
>> hash_table_dtor(tfeedback_**candidates);
>> + hash_table_dtor(consumer_**inputs);
>> return false;
>> }
>>
>> @@ -1021,11 +1036,13 @@ assign_varying_locations(**struct gl_context
>> *ctx,
>>
>> if (!tfeedback_decls[i].assign_**location(ctx, prog)) {
>> hash_table_dtor(tfeedback_**candidates);
>> + hash_table_dtor(consumer_**inputs);
>> return false;
>> }
>> }
>>
>> hash_table_dtor(tfeedback_**candidates);
>> + hash_table_dtor(consumer_**inputs);
>>
>> if (ctx->Const.**DisableVaryingPacking) {
>> /* Transform feedback code assumes varyings are packed, so if the
>> driver
>>
>>
> ______________________________**_________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/**mailman/listinfo/mesa-dev<http://lists.freedesktop.org/mailman/listinfo/mesa-dev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130217/09b14834/attachment-0001.html>
More information about the mesa-dev
mailing list