Skip to content

Commit

Permalink
Add Permissions Policy Integration and initial createContext() hooks
Browse files Browse the repository at this point in the history
Fix #145
  • Loading branch information
anssiko committed Apr 7, 2021
1 parent 0f913d6 commit ce01a73
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,40 @@ interface ML {
};
</script>

The {{ML/createContext()}} method steps are:
1. If the [=responsible document=] is not [=allowed to use=] the [=webnn-feature|webnn=] feature, then throw a "{{SecurityError!!exception}}" {{DOMException}} and abort these steps.
1. Let |context| be a new {{MLContext}} object.
1. Switch on the method's first argument:
<dl class=switch>
<dt>{{MLContextOptions}}
<dd>Set |context|'s [=context type=] to [=default-context|default=].

<dt>{{WebGLRenderingContext}}
<dd>Set |context|'s [=context type=] to [=webgl-context|webgl=].

<dt>{{GPUDevice}}
<dd>Set |context|'s [=context type=] to [=webgpu-context|webgpu=].

<dt>Otherwise
<dd>Set |context|'s [=context type=] to [=default-context|default=].
</dl>
1. Return |context|.

### Permissions Policy Integration ### {#permissions-policy-integration}

This specification defines a <a>policy-controlled feature</a> identified by the
string "<code><dfn data-lt="webnn-feature">webnn</dfn></code>".
Its <a>default allowlist</a> is <code>'self'</code>.

## MLContext ## {#api-mlcontext}
The {{MLContext}} interface represents a global state of neural network compute workload and execution processes.
<script type=idl>
[SecureContext, Exposed=Window]
interface MLContext {};
</script>

The <dfn>context type</dfn> for an {{MLContext}} is either "<code><dfn data-lt="default-context">default</dfn></code>", "<code><dfn data-lt="webgl-context">webgl</dfn></code>" or "<code><dfn data-lt="webgpu-context">webgpu</dfn></code>".

## MLOperandDescriptor ## {#api-mloperanddescriptor}
<script type=idl>
enum MLInputOperandLayout {
Expand Down

0 comments on commit ce01a73

Please sign in to comment.