[gtk+/wip/otte/shader: 173/203] gskslstatement: Add SPV code for return statement
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/shader: 173/203] gskslstatement: Add SPV code for return statement
- Date: Wed, 11 Oct 2017 04:00:37 +0000 (UTC)
commit 4a7ae3dd414b7a7aba4ccfed684e712c3b0ed901
Author: Benjamin Otte <otte redhat com>
Date: Wed Oct 4 23:52:30 2017 +0200
gskslstatement: Add SPV code for return statement
gsk/gskslstatement.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/gsk/gskslstatement.c b/gsk/gskslstatement.c
index 81a4f38..e2bc0f5 100644
--- a/gsk/gskslstatement.c
+++ b/gsk/gskslstatement.c
@@ -301,7 +301,25 @@ static void
gsk_sl_statement_return_write_spv (const GskSlStatement *statement,
GskSpvWriter *writer)
{
- g_assert_not_reached ();
+ GskSlStatementReturn *return_statement = (GskSlStatementReturn *) statement;
+
+ if (return_statement->value)
+ {
+ guint32 value_id;
+
+ value_id = gsk_sl_expression_write_spv (return_statement->value, writer);
+ gsk_spv_writer_add (writer,
+ GSK_SPV_WRITER_SECTION_CODE,
+ 2, GSK_SPV_OP_RETURN_VALUE,
+ (guint32[1]) { value_id });
+ }
+ else
+ {
+ gsk_spv_writer_add (writer,
+ GSK_SPV_WRITER_SECTION_CODE,
+ 1, GSK_SPV_OP_RETURN,
+ NULL);
+ }
}
static const GskSlStatementClass GSK_SL_STATEMENT_RETURN = {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]