From 32601cae7b6d56af99a2f5910f1991cf064c60b3 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Fri, 21 Feb 2020 11:19:47 -0800 Subject: [PATCH 1/3] Add `size` to setIndexBuffer/setVertexBuffer. If `size` is zero, the size of the {{GPUBuffer}} is used. (Binding a subset instead of the whole buffer allows for concurrent use of other parts of the buffer) This potentially includes mapping subsets of otherwise in-use buffers. --- spec/index.bs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index 3a9e2b7c61..2d79f5bd35 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -2338,8 +2338,8 @@ Render Passes {#render-passes} interface mixin GPURenderEncoderBase { void setPipeline(GPURenderPipeline pipeline); - void setIndexBuffer(GPUBuffer buffer, optional GPUSize64 offset = 0); - void setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0); + void setIndexBuffer(GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size = 0); + void setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size = 0); void draw(GPUSize32 vertexCount, GPUSize32 instanceCount, GPUSize32 firstVertex, GPUSize32 firstInstance); @@ -2369,6 +2369,11 @@ GPURenderPassEncoder includes GPUProgrammablePassEncoder; GPURenderPassEncoder includes GPURenderEncoderBase; + * {{GPURenderEncoderBase/setIndexBuffer()}}/{{GPURenderEncoderBase/setVertexBuffer()}}: + * If `size` is zero, the size of the {{GPUBuffer}} is used. (Binding a subset instead of the + whole buffer allows for concurrent use of other parts of the buffer) + + * In indirect draw calls, the base instance field (inside the indirect buffer data) must be set to zero. From 78a236cf3439ceb282fd5e6550433c13c36bcab9 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Tue, 10 Mar 2020 00:53:13 -0700 Subject: [PATCH 2/3] Remove comment speculating on sub-range validation. --- spec/index.bs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/index.bs b/spec/index.bs index 2d79f5bd35..c83c0c06f1 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -2370,9 +2370,7 @@ GPURenderPassEncoder includes GPURenderEncoderBase; * {{GPURenderEncoderBase/setIndexBuffer()}}/{{GPURenderEncoderBase/setVertexBuffer()}}: - * If `size` is zero, the size of the {{GPUBuffer}} is used. (Binding a subset instead of the - whole buffer allows for concurrent use of other parts of the buffer) - + * If `size` is zero, the size of the {{GPUBuffer}} is used. * In indirect draw calls, the base instance field (inside the indirect buffer data) must be set to zero. From dad528a8eaf83c2880802cdf80438c25833ef462 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Tue, 10 Mar 2020 11:03:18 -0700 Subject: [PATCH 3/3] `size=0` => remaining size *after offset*. --- spec/index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/index.bs b/spec/index.bs index c83c0c06f1..1dade534fc 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -2370,7 +2370,7 @@ GPURenderPassEncoder includes GPURenderEncoderBase; * {{GPURenderEncoderBase/setIndexBuffer()}}/{{GPURenderEncoderBase/setVertexBuffer()}}: - * If `size` is zero, the size of the {{GPUBuffer}} is used. + * If `size` is zero, the remaining size (after `offset`) of the {{GPUBuffer}} is used. * In indirect draw calls, the base instance field (inside the indirect buffer data) must be set to zero.