Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-mesa: Commit

external/mesa


Commit MetaInfo

Revisiónf2c1d7acd0ca56a020a982425523ec8f7fade966 (tree)
Tiempo2019-01-31 21:05:54
AutorTimothy Arceri <tarceri@itsq...>
CommiterEmil Velikov

Log Message

glsl: Copy function out to temp if we don't directly ref a variable

Otherwise we can end up with IR that looks like this:

(
(declare (temporary ) vec4 f@8)
(assign (xyzw) (var_ref f@8) (var_ref f) )
(call f16 ((swiz y (var_ref f@8) )))
(assign (xyzw) (var_ref f) (var_ref f@8) )
))

When we really need:

(declare (temporary ) float inout_tmp)
(assign (x) (var_ref inout_tmp) (swiz y (var_ref f) ))
(call f16 ((var_ref inout_tmp) ))
(assign (y) (var_ref f) (swiz y (swiz xxxx (var_ref inout_tmp) )))
(declare (temporary ) void void_var)

The GLSL IR function inlining code seemed to produce correct code
even without this but we need the correct IR for GLSL IR -> NIR to
be able to understand whats going on.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 76c27e47b90647df047e785d6b3ab5d0d979a1ee)
Nominated-by: Matt Turner <mattst88@gmail.com>

Cambiar Resumen

Diferencia incremental

--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -402,7 +402,8 @@ fix_parameter(void *mem_ctx, ir_rvalue *actual, const glsl_type *formal_type,
402402 * nothing needs to be done to fix the parameter.
403403 */
404404 if (formal_type == actual->type
405- && (expr == NULL || expr->operation != ir_binop_vector_extract))
405+ && (expr == NULL || expr->operation != ir_binop_vector_extract)
406+ && actual->as_dereference_variable())
406407 return;
407408
408409 /* An array index could also be an out variable so we need to make a copy
@@ -456,7 +457,7 @@ fix_parameter(void *mem_ctx, ir_rvalue *actual, const glsl_type *formal_type,
456457 ir_dereference_variable *const deref_tmp_1 =
457458 new(mem_ctx) ir_dereference_variable(tmp);
458459 ir_assignment *const assignment =
459- new(mem_ctx) ir_assignment(deref_tmp_1, actual);
460+ new(mem_ctx) ir_assignment(deref_tmp_1, actual->clone(mem_ctx, NULL));
460461 before_instructions->push_tail(assignment);
461462 }
462463
Show on old repository browser