@@ -1590,6 +1590,10 @@ Pipelines {#pipelines}
1590
1590
dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase {
1591
1591
required GPUPipelineLayout layout;
1592
1592
};
1593
+
1594
+ interface mixin GPUPipelineBase {
1595
+ GPUBindGroupLayout getBindGroupLayout(unsigned long index);
1596
+ };
1593
1597
</script>
1594
1598
1595
1599
<script type=idl>
@@ -1607,6 +1611,7 @@ dictionary GPUProgrammableStageDescriptor {
1607
1611
interface GPUComputePipeline {
1608
1612
};
1609
1613
GPUComputePipeline includes GPUObjectBase;
1614
+ GPUComputePipeline includes GPUPipelineBase;
1610
1615
</script>
1611
1616
1612
1617
### Creation ### {#compute-pipeline-creation}
@@ -1624,6 +1629,7 @@ dictionary GPUComputePipelineDescriptor : GPUPipelineDescriptorBase {
1624
1629
interface GPURenderPipeline {
1625
1630
};
1626
1631
GPURenderPipeline includes GPUObjectBase;
1632
+ GPURenderPipeline includes GPUPipelineBase;
1627
1633
</script>
1628
1634
1629
1635
### Creation ### {#render-pipeline-creation}
@@ -1894,6 +1900,111 @@ dictionary GPUVertexAttributeDescriptor {
1894
1900
};
1895
1901
</script>
1896
1902
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
+
1897
2008
Command Buffers {#command-buffers}
1898
2009
==================================
1899
2010
0 commit comments