[gtk+/wip/otte/shader: 131/150] gskslexpression: Function arguments are evaluated randomly
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/shader: 131/150] gskslexpression: Function arguments are evaluated randomly
- Date: Sat, 21 Oct 2017 02:37:11 +0000 (UTC)
commit 3f8ebd76be385b835bac5a84c52d1d7bf003cb36
Author: Benjamin Otte <otte redhat com>
Date: Mon Oct 16 02:31:45 2017 +0200
gskslexpression: Function arguments are evaluated randomly
The C spec doesn't guarantee an order of evaluation for function
arguments. In fact, gcc evaluates them last to first while clang
evaluated them first to last.
We would like the left argument to be written into the SPIRV file first
(the GLSL spec wants that), so enforce this by calling the functions
before.
gsk/gskslexpression.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gskslexpression.c b/gsk/gskslexpression.c
index de822ba..c324f08 100644
--- a/gsk/gskslexpression.c
+++ b/gsk/gskslexpression.c
@@ -266,14 +266,18 @@ gsk_sl_expression_binary_write_spv (const GskSlExpression *expression,
GskSpvWriter *writer)
{
const GskSlExpressionBinary *binary = (const GskSlExpressionBinary *) expression;
+ guint left_id, right_id;
+
+ left_id = gsk_sl_expression_write_spv (binary->left, writer);
+ right_id = gsk_sl_expression_write_spv (binary->right, writer);
return gsk_sl_binary_write_spv (binary->binary,
writer,
binary->type,
gsk_sl_expression_get_return_type (binary->left),
- gsk_sl_expression_write_spv (binary->left, writer),
+ left_id,
gsk_sl_expression_get_return_type (binary->right),
- gsk_sl_expression_write_spv (binary->right, writer));
+ right_id);
}
static const GskSlExpressionClass GSK_SL_EXPRESSION_BINARY = {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]