You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
: <dfn>\[[bindingsMap]]</dfn> of a Map of `unsigned long` {{GPUBindGroupLayoutBinding/binding}} keys to <dfn dfn for ="layout binding">layout binding</dfn> values.
785
-
::
786
-
The [=layout binding=] objects this {{GPUBindGroupLayout}} describes.
787
-
788
-
</dl>
789
-
790
-
An internal [=layout binding=] object has the following slots:
791
-
792
-
<dl dfn-type=attribute dfn-for="layout binding">
793
-
: <dfn>\[[binding]]</dfn> of type unsigned long.
794
-
::
795
-
The unique identifier for this [=layout binding=] in shader stages.
796
-
797
-
: <dfn>\[[visibility]]</dfn> of type {{GPUShaderStageFlags}}.
798
-
::
799
-
The bitset representing from which shader stages this [=layout binding=]'s resource will be accessible.
800
-
801
-
: <dfn>\[[type]]</dfn> of type {{GPUBindingType}}.
802
-
::
803
-
The type of shader resource this [=layout binding=] describes.
804
-
805
-
: <dfn>\[[hasDynamicOffsets]]</dfn> of type boolean.
806
-
::
807
-
If `true`, indicates that this [=layout binding=] has dynamic offsets.
808
-
809
-
Ignored if {{layout binding/[[type]]}} is not {{GPUBindingType/uniform-buffer}}, {{GPUBindingType/storage-buffer}}, or {{GPUBindingType/readonly-storage-buffer}}.
810
-
811
-
: <dfn>\[[textureDimension]]</dfn> of type {{GPUTextureViewDimension}}.
812
-
::
813
-
The dimensionality of the texture resource described by this [=layout binding=].
814
-
815
-
Ignored if {{layout binding/[[type]]}} is not {{GPUBindingType/sampled-texture}} or {{GPUBindingType/storage-texture}}.
816
-
817
-
: <dfn>\[[textureComponentType]]</dfn> of type {{GPUTextureComponentType}}.
818
-
::
819
-
The data type of the texture resource described by this [=layout binding=].
820
-
821
-
Ignored if {{layout binding/[[type]]}} is not {{GPUBindingType/sampled-texture}} or {{GPUBindingType/storage-texture}}.
822
-
823
-
: <dfn>\[[multisampled]]</dfn> of type boolean.
824
-
::
825
-
If `true`, indicates that the texture resource described by this [=layout binding=] will be multisampled.
826
-
</dl>
827
-
828
781
### Creation ### {#bind-group-layout-creation}
829
782
830
783
A {{GPUBindGroupLayout}} is created via {{GPUDevice/createBindGroupLayout()|GPUDevice.createBindGroupLayout()}}.
The <dfn-type="method" dfn-for="GPUDevice">createBindGroupLayout(|descriptor|)</dfn> method is used to create {{GPUBindGroupLayout}}s.
901
864
865
+
1. If the device is lost, [=return an invalid GPUBindGroupLayout=].
902
866
1. Let |layout| be a new valid {{GPUBindGroupLayout}} object.
903
867
1. For each {{GPUBindGroupLayoutBinding}} |bindingDescriptor| in |descriptor|.{{GPUBindGroupLayoutDescriptor/bindings}}:
904
-
1. Let |layoutBinding| be a new internal [=layout binding=] object.
868
+
1. Ensure |bindingDescriptor|.{{GPUBindGroupLayoutBinding/binding}} does not violate [=binding validation=].
905
869
1. If |bindingDescriptor|.{{GPUBindGroupLayoutBinding/type}} is {{GPUBindingType/uniform-buffer}}:
906
-
1. Set |layoutBinding|.{{layout binding/[[hasDynamicOffsets]]}} to the value of |bindingDescriptor|.{{GPUBindGroupLayoutBinding/hasDynamicOffsets}}.
870
+
1. Ensure [=uniform buffer validation=] is not violated.
871
+
1. If |bindingDescriptor|.{{GPUBindGroupLayoutBinding/dynamic}} is `true`, ensure [=dynamic uniform buffer validation=] is not violated.
907
872
1. If |bindingDescriptor|.{{GPUBindGroupLayoutBinding/type}} is {{GPUBindingType/storage-buffer}} or {{GPUBindingType/readonly-storage-buffer}}:
908
-
1. Set |layoutBinding|.{{layout binding/[[hasDynamicOffsets]]}} to the value of |bindingDescriptor|.{{GPUBindGroupLayoutBinding/hasDynamicOffsets}}.
909
-
1. If |bindingDescriptor|.{{GPUBindGroupLayoutBinding/type}} is {{GPUBindingType/sampled-texture}} or {{GPUBindingType/storage-texture}}:
910
-
1. Set |layoutBinding|.{{layout binding/[[textureDimension]]}}to the value of |bindingDescriptor|.{{GPUBindGroupLayoutBinding/textureDimension}}.
911
-
1. Set |layoutBinding|.{{layout binding/[[textureComponentType]]}} to the value of |bindingDescriptor|.{{GPUBindGroupLayoutBinding/textureComponentType}}.
912
-
1. Set |layoutBinding|.{{layout binding/[[multisampled]]}}to the value of |bindingDescriptor|.{{GPUBindGroupLayoutBinding/multisampled}}.
913
-
1. Set |layoutBinding|.{{layout binding/[[binding]]}} to the value of |bindingDescriptor|.{{GPUBindGroupLayoutBinding/binding}}.
914
-
1. Set |layoutBinding|.{{layout binding/[[visibility]]}}to the value of |bindingDescriptor|.{{GPUBindGroupLayoutBinding/visibility}}.
915
-
1. Set |layoutBinding|.{{layout binding/[[type]]}} to the value of |bindingDescriptor|.{{GPUBindGroupLayoutBinding/type}}.
916
-
1. Insert |layoutBinding| into |layout|.{{GPUBindGroupLayout/[[bindingsMap]]}} with a key of |layoutBinding|.{{layout binding/[[binding]]}}.
873
+
1. Ensure [=storage buffer validation=] is not violated.
874
+
1. If |bindingDescriptor|.{{GPUBindGroupLayoutBinding/dynamic}} is `true`, ensure [=dynamic storage buffer validation=] is not violated.
875
+
1. If |bindingDescriptor|.{{GPUBindGroupLayoutBinding/type}}is {{GPUBindingType/sampled-texture}}
876
+
, ensure [=sampled texture validation=] is not violated.
877
+
1. If |bindingDescriptor|.{{GPUBindGroupLayoutBinding/type}}is {{GPUBindingType/storage-texture}}
878
+
, ensure [=storage texture validation=] is not violated.
879
+
1. If |bindingDescriptor|.{{GPUBindGroupLayoutBinding/type}}is {{GPUBindingType/sampler}}
880
+
, ensure [=sampler validation=] is not violated.
881
+
1. Insert |bindingDescriptor| into |layout|.{{GPUBindGroupLayout/[[bindings]]}}.
917
882
1. Return |layout|.
918
883
919
-
<b>Validation</b>
920
-
* The device must not be lost.
921
-
* Each |bindingDescriptor|.{{GPUBindGroupLayoutBinding/binding}} in |descriptor| must be unique.
922
-
* There must be {{GPULimits/maxUniformBuffersPerShaderStage|GPULimits.maxUniformBuffersPerShaderStage}} or
884
+
<b>Validation Conditions</b>
885
+
886
+
<dl dfn-for="createBindGroupLayout(descriptor)">
887
+
If any of the following conditions are violated:
888
+
1. Generate a {{GPUValidationError}} in the current scope with appropriate error message.
889
+
1. Create a new invalid {{GPUBindGroupLayout}} and return the result.
890
+
891
+
<dfn>binding validation</dfn>: Each |bindingDescriptor|.{{GPUBindGroupLayoutBinding/binding}} in |descriptor| must be unique.
892
+
893
+
<dfn>uniform buffer validation</dfn>: There must be {{GPULimits/maxUniformBuffersPerShaderStage|GPULimits.maxUniformBuffersPerShaderStage}} or
923
894
fewer |bindingDescriptor|s of type {{GPUBindingType/uniform-buffer}} visible on each shader stage in |descriptor|.
924
-
* There must be {{GPULimits/maxDynamicUniformBuffersPerPipelineLayout|GPULimits.maxDynamicUniformBuffersPerPipelineLayout}} or
925
-
fewer |bindingDescriptor|s of type {{GPUBindingType/uniform-buffer}} with {{GPUBindGroupLayoutBinding/hasDynamicOffsets}} set to `true`
926
-
visible across <b>all</b> shader stages in |descriptor|.
927
-
* There must be {{GPULimits/maxStorageBuffersPerPipelineLayout|GPULimits.maxStorageBuffersPerPipelineLayout}} or
928
-
fewer |bindingDescriptor|s of type {{GPUBindingType/storage-buffer}} visible across <b>all</b> shader stages in |descriptor|.
929
-
* There must be {{GPULimits/maxDynamicStorageBuffersPerPipelineLayout|GPULimits.maxDynamicStorageBuffersPerPipelineLayout}} or
930
-
fewer |bindingDescriptor|s of type {{GPUBindingType/storage-buffer}} with {{GPUBindGroupLayoutBinding/hasDynamicOffsets}} set to `true`
931
-
visible across <b>all</b> shader stages in |descriptor|.
932
-
* There must be {{GPULimits/maxSampledTexturesPerShaderStage|GPULimits.maxSampledTexturesPerShaderStage}} or
895
+
896
+
<dfn>dynamic uniform buffer validation</dfn>: There must be {{GPULimits/maxDynamicUniformBuffersPerPipelineLayout|GPULimits.maxDynamicUniformBuffersPerPipelineLayout}} or
897
+
fewer |bindingDescriptor|s of type {{GPUBindingType/uniform-buffer}} with {{GPUBindGroupLayoutBinding/hasDynamicOffset}} set to `true` in
898
+
|descriptor| that are visible to any shader stage.
899
+
900
+
<dfn>storage buffer validation</dfn>: There must be {{GPULimits/maxStorageBuffersPerPipelineLayout|GPULimits.maxStorageBuffersPerPipelineLayout}} or
901
+
fewer |bindingDescriptor|s of type {{GPUBindingType/storage-buffer}} in |descriptor| that are visible to any shader stage.
902
+
903
+
<dfn>dynamic storage buffer validation</dfn>: There must be {{GPULimits/maxDynamicStorageBuffersPerPipelineLayout|GPULimits.maxDynamicStorageBuffersPerPipelineLayout}} or
904
+
fewer |bindingDescriptor|s of type {{GPUBindingType/storage-buffer}} with {{GPUBindGroupLayoutBinding/hasDynamicOffset}} set to `true`
905
+
in |descriptor| that are visible to any shader stage.
906
+
907
+
<dfn>sampled texture validation</dfn>: There must be {{GPULimits/maxSampledTexturesPerShaderStage|GPULimits.maxSampledTexturesPerShaderStage}} or
933
908
fewer |bindingDescriptor|s of type {{GPUBindingType/sampled-texture}} visible on each shader stage in |descriptor|.
934
-
* There must be {{GPULimits/maxStorageTexturesPerShaderStage|GPULimits.maxStorageTexturesPerShaderStage}} or
909
+
910
+
<dfn>storage texture validation</dfn>: There must be {{GPULimits/maxStorageTexturesPerShaderStage|GPULimits.maxStorageTexturesPerShaderStage}} or
935
911
fewer |bindingDescriptor|s of type {{GPUBindingType/storage-texture}} visible on each shader stage in |descriptor|.
936
-
* There must be {{GPULimits/maxSamplersPerShaderStage|GPULimits.maxSamplersPerShaderStage}} or
912
+
913
+
<dfn>sampler validation</dfn>: There must be {{GPULimits/maxSamplersPerShaderStage|GPULimits.maxSamplersPerShaderStage}} or
937
914
fewer |bindingDescriptor|s of type {{GPUBindingType/sampler}} visible on each shader stage in |descriptor|.
938
915
939
-
At any point in the algorithm, if any of the above conditions are violated, run the following steps:
940
-
1. Generate a {{GPUValidationError}} in the current scope with appropriate error message.
941
-
1. Create a new invalid {{GPUBindGroupLayout}} and return the result.
0 commit comments