[Mesa-dev] [RFC 1/3] glsl: add an assignment_recipient parameter on ast_expression
Alejandro PiƱeiro
apinheiro at igalia.com
Wed Feb 24 19:04:45 UTC 2016
The idea is pass through the ast-to-hir conversion if the current
expression is the recipient of the assignment or not. Default
value is false (so default value is being rhs).
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94129
---
src/compiler/glsl/ast.h | 11 ++++++++++-
src/compiler/glsl/ast_function.cpp | 8 ++++++++
src/compiler/glsl/ast_to_hir.cpp | 15 ++++++++++++---
3 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
index 9aa5bb9..f0f4c65 100644
--- a/src/compiler/glsl/ast.h
+++ b/src/compiler/glsl/ast.h
@@ -221,6 +221,10 @@ public:
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
+ virtual ir_rvalue *hir(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool assignment_recipient);
+
virtual void hir_no_rvalue(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
@@ -228,7 +232,8 @@ public:
ir_rvalue *do_hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state,
- bool needs_rvalue);
+ bool needs_rvalue,
+ bool assignment_recipient);
virtual void print(void) const;
@@ -301,6 +306,10 @@ public:
virtual ir_rvalue *hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
+ virtual ir_rvalue *hir(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool assignment_recipient);
+
virtual void hir_no_rvalue(exec_list *instructions,
struct _mesa_glsl_parse_state *state);
diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index 1a44020..0edc9b7 100644
--- a/src/compiler/glsl/ast_function.cpp
+++ b/src/compiler/glsl/ast_function.cpp
@@ -1781,6 +1781,14 @@ ir_rvalue *
ast_function_expression::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
+ return hir(instructions, state, true);
+}
+
+ir_rvalue *
+ast_function_expression::hir(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool right)
+{
void *ctx = state;
/* There are three sorts of function calls.
*
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 75abef6..6b70e1f 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -1237,22 +1237,31 @@ constant_one_for_inc_dec(void *ctx, const glsl_type *type)
ir_rvalue *
ast_expression::hir(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state,
+ bool assignment_recipient)
+{
+ return do_hir(instructions, state, true, assignment_recipient);
+}
+
+ir_rvalue *
+ast_expression::hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
- return do_hir(instructions, state, true);
+ return hir(instructions, state, false);
}
void
ast_expression::hir_no_rvalue(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
- do_hir(instructions, state, false);
+ do_hir(instructions, state, false, false);
}
ir_rvalue *
ast_expression::do_hir(exec_list *instructions,
struct _mesa_glsl_parse_state *state,
- bool needs_rvalue)
+ bool needs_rvalue,
+ bool assignment_recipient)
{
void *ctx = state;
static const int operations[AST_NUM_OPERATORS] = {
--
2.5.0
More information about the mesa-dev
mailing list