Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aee44b1

Browse files
committed
Add GPUPipelineBase.getBindGroupLayout.
1 parent c1e5ed4 commit aee44b1

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

spec/index.bs

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,10 @@ Pipelines {#pipelines}
15901590
dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase {
15911591
required GPUPipelineLayout layout;
15921592
};
1593+
1594+
interface mixin GPUPipelineBase {
1595+
GPUBindGroupLayout getBindGroupLayout(unsigned long index);
1596+
};
15931597
</script>
15941598

15951599
<script type=idl>
@@ -1607,6 +1611,7 @@ dictionary GPUProgrammableStageDescriptor {
16071611
interface GPUComputePipeline {
16081612
};
16091613
GPUComputePipeline includes GPUObjectBase;
1614+
GPUComputePipeline includes GPUPipelineBase;
16101615
</script>
16111616

16121617
### Creation ### {#compute-pipeline-creation}
@@ -1624,6 +1629,7 @@ dictionary GPUComputePipelineDescriptor : GPUPipelineDescriptorBase {
16241629
interface GPURenderPipeline {
16251630
};
16261631
GPURenderPipeline includes GPUObjectBase;
1632+
GPURenderPipeline includes GPUPipelineBase;
16271633
</script>
16281634

16291635
### Creation ### {#render-pipeline-creation}
@@ -1894,6 +1900,111 @@ dictionary GPUVertexAttributeDescriptor {
18941900
};
18951901
</script>
18961902

1903+
## {{GPUPipelineBase/getBindGroupLayout()|getBindGroupLayout}} ## {#get-bind-group-layout}
1904+
1905+
<dl dfn-type="method" dfn-for="GPUPipelineBase">
1906+
: <dfn>getBindGroupLayout(unsigned long index)</dfn>
1907+
::
1908+
<div algorithm="GPUProgrammablePipeline.getBindGroupLayout(unsigned long index)">
1909+
1. If |index| is greater or equal to {{GPULimits/maxBindGroups}} :
1910+
1911+
1. Throw a {{RangeError}}.
1912+
1913+
1. If |this|.getBindGroupLayout has already been called with |index|:
1914+
1915+
1. Return the same object.
1916+
1917+
1. If |this| is an error:
1918+
1919+
1. Return an error {{GPUBindGroupLayout}}.
1920+
1921+
1. Let |bindings| be an empty sequence.
1922+
1. For each {{GPUProgrammableStageDescriptor}} |stage| in the descriptor for |this|:
1923+
1924+
1. For each resource |resource| in |stage|.{{GPUProgrammableStageDescriptor/module}}
1925+
for the |stage|.{{GPUProgrammableStageDescriptor/entryPoint}} entry-point:
1926+
1927+
1. If |resource|'s "group" decoration is not equal to |index|:
1928+
1929+
1. Continue to the next loop iteration over resources.
1930+
1931+
1. Let |binding| be a new {{GPUBindGroupLayoutBinding}}.
1932+
1. Set |binding|.{{GPUBindGroupLayoutBinding/binding}} to |resource|'s "binding"
1933+
decoration.
1934+
1. Set |binding|.{{GPUBindGroupLayoutBinding/visibility}} to
1935+
{{GPUShaderStage/VERTEX}} | {{GPUShaderStage/FRAGMENT}} |
1936+
{{GPUShaderStage/COMPUTE}}.
1937+
1938+
Issue: Have a set of all valid {{GPUShaderStage}} on the device.
1939+
1940+
1. If |resource| is for a sampler binding:
1941+
1942+
1. Set |binding|.{{GPUBindGroupLayoutBinding/type}} to
1943+
{{GPUBindingType/sampler}}.
1944+
1945+
1. If |resource| is for a buffer binding:
1946+
1947+
1. If |resource| is for a uniform buffer:
1948+
1949+
1. Set |binding|.{{GPUBindGroupLayoutBinding/type}} to
1950+
{{GPUBindingType/uniform-buffer}}.
1951+
1952+
1. If |resource| is for a storage buffer:
1953+
1954+
1. If |resource| is read-only:
1955+
1956+
1. Set |binding|.{{GPUBindGroupLayoutBinding/type}} to
1957+
{{GPUBindingType/readonly-storage-buffer}}.
1958+
1959+
1. Else:
1960+
1961+
1. Set |binding|.{{GPUBindGroupLayoutBinding/type}} to
1962+
{{GPUBindingType/storage-buffer}}.
1963+
1. Set |binding|.{{GPUBindGroupLayoutBinding/visibility}} to
1964+
{{GPUShaderStage/FRAGMENT}} | {{GPUShaderStage/COMPUTE}}.
1965+
1966+
1. If |resource| is for a texture binding:
1967+
1968+
1. Set |binding|.{{GPUBindGroupLayoutBinding/textureComponentType}} to
1969+
|resource|'s component type.
1970+
1. Set |binding|.{{GPUBindGroupLayoutBinding/textureDimension}} to
1971+
|resource|'s dimension.
1972+
1. If |resource| is multisampled:
1973+
1974+
1. Set |binding|.{{GPUBindGroupLayoutBinding/multisampled}} to true.
1975+
1976+
1. If |resource| is for a sampled texture:
1977+
1978+
1. Set |binding|.{{GPUBindGroupLayoutBinding/type}} to
1979+
{{GPUBindingType/sampled-texture}}.
1980+
1981+
1. If |resource| is for a storage texture:
1982+
1983+
1. Set |binding|.{{GPUBindGroupLayoutBinding/type}} to
1984+
{{GPUBindingType/storage-texture}}.
1985+
1. Set |binding|.{{GPUBindGroupLayoutBinding/visibility}} to
1986+
{{GPUShaderStage/FRAGMENT}} | {{GPUShaderStage/COMPUTE}}.
1987+
1988+
1. Append |binding| to |bindings|
1989+
1990+
1. For each |b1| in |bindings|:
1991+
1992+
1. For each |b2| in |bindings| with |b2|.{{GPUBindGroupLayoutBinding/binding}}
1993+
equal to |b1|.{{GPUBindGroupLayoutBinding/binding}}:
1994+
1995+
1. If |b1| is not equal to |b2| by value:
1996+
1997+
1. Return an error {{GPUBindGroupLayout}}.
1998+
1999+
1. Let |descriptor| be a new {{GPUBindGroupLayoutDescriptor}}.
2000+
1. Set |descriptor|.{{GPUBindGroupLayoutDescriptor/bindings}} to |bindings|.
2001+
1. Let |device| be |this|'s {{GPUDevice}}.
2002+
1. Let |layout| be the return value of calling |device|.{{GPUDevice/createBindGroupLayout()|createBindGroupLayout}}(|descriptor|).
2003+
1. Return |layout|.
2004+
2005+
</div>
2006+
</dl>
2007+
18972008
Command Buffers {#command-buffers}
18982009
==================================
18992010

0 commit comments

Comments
 (0)