diff --git a/wgsl/index.bs b/wgsl/index.bs index ea4a8ee2fd..e501c59486 100644 --- a/wgsl/index.bs +++ b/wgsl/index.bs @@ -995,9 +995,7 @@ statements statement : SEMICOLON - | RETURN logical_or_expression SEMICOLON - OpReturn - OpReturnValue + | return_stmt SEMICOLON | if_stmt | unless_stmt | switch_stmt @@ -1306,6 +1304,25 @@ const_expr +## Return statement ## {#return-statement} + +
+return_stmt + : RETURN logical_or_expression? ++ +A `return` statement ends execution of the current function. +If the function is an entry point, then the current shader invocation +is terminated. +Otherwise, evaluation continues with the next expression or statement after +the evaluation of the call site of the current function invocation. + +If the return type of the function is the void type, then the return statement +must not have an expression. +Otherwise the expression must be present, and is called the *return value*. +In this case the call site of this function invocation evaluates to the return value. +The type of the return value must match the return type of the function. + # Validation # {#validation} Each validation item will be given a unique ID and a test must be provided