[gtk+/wip/otte/shader: 6/44] 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: 6/44] gskslstatement: Add SPV code for return statement
- Date: Thu, 12 Oct 2017 00:58:00 +0000 (UTC)
commit 2090a1169660c1cbec0762a48d2144c8fe42ba7c
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]