From e004dc3dc0587909c3650371793a33e25ba0fafd Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Thu, 22 Oct 2020 23:55:29 +0100 Subject: [PATCH] s/OUTPUT_ATTACHMENT/RENDER_ATTACHMENT/g (#1168) --- design/UsageValidationRules.md | 10 +++++----- samples/hello-cube.html | 2 +- spec/index.bs | 20 ++++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/design/UsageValidationRules.md b/design/UsageValidationRules.md index be3bbac550..d649a8f4c4 100644 --- a/design/UsageValidationRules.md +++ b/design/UsageValidationRules.md @@ -12,7 +12,7 @@ Buffers have the following usages (and commands inducing that usage): - (Maybe `STORAGE_TEXEL` and `UNIFORM_TEXEL`?) Textures have the following usages: - - `OUTPUT_ATTACHMENT` for the subresources referenced by `WebGPURenderPassDescriptor` + - `RENDER_ATTACHMENT` for the subresources referenced by `WebGPURenderPassDescriptor` - `SAMPLED` and `STORAGE` for subresources corresponding to the image views referenced by bindgroups passed to `setBindGroup`, with the usage corresponding to the binding's type. - `COPY_SRC` for textures used as the copy source of various commands. - `COPY_DST` for textures used as the copy destination of various commands. @@ -21,14 +21,14 @@ Read only usages are `VERTEX`, `INDEX`, `INDIRECT`, `UBO`, `COPY_SRC` and `SAMPL ## Render passes -In render passes the only writable resources are textures used as `OUTPUT_ATTACHMENT` and resources used as `STORAGE`. +In render passes the only writable resources are textures used as `RENDER_ATTACHMENT` and resources used as `STORAGE`. To avoid data hazards the simplest validation rules would be to check for every subresource that it is used as either: - - `OUTPUT_ATTACHMENT` + - `RENDER_ATTACHMENT` - A combination of read-only usages - `STORAGE` -If there is no usage of `STORAGE` then there are no data-races as everything is read-only, except `OUTPUT_ATTACHMENT` which is well-ordered. +If there is no usage of `STORAGE` then there are no data-races as everything is read-only, except `RENDER_ATTACHMENT` which is well-ordered. For `STORAGE` resources, the order of reads and writes to the same memory location is undefined and it is up to the application to ensure data-race freeness. ## Compute passes @@ -70,7 +70,7 @@ For example D3D12 assumes UAV is always writeable and disallows transitioning to ### More constrained texture usage validation Each layer and mip-level of textures can have an independent usage which means implementations might need to track usage per mip-level per layer of a resource. -If this is deemed too costly, we could only have two sub-resources tracked in textures: the part as `OUTPUT_ATTACHMENT` and the rest. +If this is deemed too costly, we could only have two sub-resources tracked in textures: the part as `RENDER_ATTACHMENT` and the rest. This would mean for example that a texture couldn't be used as both `STORAGE` and a read-only usage inside a render pass. The state tracking required in implementation would become significantly simpler at the cost of flexibility for the applications. When using the more constrained version of usage validation for textures, the cost of validation is O(commands). diff --git a/samples/hello-cube.html b/samples/hello-cube.html index 50cdb6cfc7..e3fbf42751 100644 --- a/samples/hello-cube.html +++ b/samples/hello-cube.html @@ -217,7 +217,7 @@ sampleCount: 1, dimension: "2d", format: "depth32float-stencil8", - usage: GPUTextureUsage.OUTPUT_ATTACHMENT + usage: GPUTextureUsage.RENDER_ATTACHMENT }; const depthTexture = device.createTexture(depthTextureDescriptor); diff --git a/spec/index.bs b/spec/index.bs index d1701d95c0..7362454e5b 100644 --- a/spec/index.bs +++ b/spec/index.bs @@ -709,10 +709,10 @@ A [=physical resource=] can be used on GPU in one of the following inte Allowed by {{GPUTextureUsage/STORAGE}}. : attachment :: Texture used as an output attachment in a render pass. - Allowed by {{GPUTextureUsage/OUTPUT_ATTACHMENT}}. + Allowed by {{GPUTextureUsage/RENDER_ATTACHMENT}}. : attachment-read :: Texture used as a read-only attachment in a render pass. Preserves the contents. - Allowed by {{GPUTextureUsage/OUTPUT_ATTACHMENT}}. + Allowed by {{GPUTextureUsage/RENDER_ATTACHMENT}}. Textures may consist of separate [=mipmap levels=] and [=array layers=], @@ -1937,7 +1937,7 @@ interface GPUTextureUsage { const GPUFlagsConstant COPY_DST = 0x02; const GPUFlagsConstant SAMPLED = 0x04; const GPUFlagsConstant STORAGE = 0x08; - const GPUFlagsConstant OUTPUT_ATTACHMENT = 0x10; + const GPUFlagsConstant RENDER_ATTACHMENT = 0x10; }; @@ -3877,7 +3877,7 @@ enum GPUBlendOperation { Return `true`, if and only if, all of the following conditions are satisfied: 1. |descriptor|.{{GPUColorStateDescriptor/format}} is listed in {#plain-color-formats} - with {{GPUTextureUsage/OUTPUT_ATTACHMENT}} capability. + with {{GPUTextureUsage/RENDER_ATTACHMENT}} capability. 1. |descriptor|.{{GPUColorStateDescriptor/alphaBlend}} and |descriptor|.{{GPUColorStateDescriptor/colorBlend}} are either both defaults, or |descriptor|.{{GPUColorStateDescriptor/format}} has {{GPUTextureComponentType/"float"}} component type. @@ -5610,14 +5610,14 @@ dictionary GPURenderPassColorAttachmentDescriptor { 1. |this|.{{GPURenderPassColorAttachmentDescriptor/attachment}} must have a renderable color format. 1. |this|.{{GPURenderPassColorAttachmentDescriptor/attachment}}.{{GPUTextureView/[[texture]]}}.{{GPUTexture/[[textureUsage]]}} - must contain {{GPUTextureUsage/OUTPUT_ATTACHMENT}}. + must contain {{GPUTextureUsage/RENDER_ATTACHMENT}}. 1. |this|.{{GPURenderPassColorAttachmentDescriptor/attachment}} must be a view of a single [=subresource=]. 1. If |this|.{{GPURenderPassColorAttachmentDescriptor/resolveTarget}} is not `null`: 1. |this|.{{GPURenderPassColorAttachmentDescriptor/attachment}} must be multisampled. 1. |this|.{{GPURenderPassColorAttachmentDescriptor/resolveTarget}} must not be multisampled. 1. |this|.{{GPURenderPassColorAttachmentDescriptor/resolveTarget}}.{{GPUTextureView/[[texture]]}}.{{GPUTexture/[[textureUsage]]}} - must contain {{GPUTextureUsage/OUTPUT_ATTACHMENT}}. + must contain {{GPUTextureUsage/RENDER_ATTACHMENT}}. 1. |this|.{{GPURenderPassColorAttachmentDescriptor/resolveTarget}} must be a view of a single [=subresource=]. 1. The dimensions of the [=subresource=]s seen by |this|.{{GPURenderPassColorAttachmentDescriptor/resolveTarget}} @@ -5700,7 +5700,7 @@ dictionary GPURenderPassDepthStencilAttachmentDescriptor { 1. |this|.{{GPURenderPassDepthStencilAttachmentDescriptor/attachment}} must be a view of a single [=texture subresource=]. 1. |this|.{{GPURenderPassDepthStencilAttachmentDescriptor/attachment}}.{{GPUTexture/[[textureUsage]]}} - must contain {{GPUTextureUsage/OUTPUT_ATTACHMENT}}. + must contain {{GPUTextureUsage/RENDER_ATTACHMENT}}. 1. |this|.{{GPURenderPassDepthStencilAttachmentDescriptor/depthReadOnly}} is `true`, |this|.{{GPURenderPassDepthStencilAttachmentDescriptor/depthLoadValue}} must be {{GPULoadOp/"load"}} and |this|.{{GPURenderPassDepthStencilAttachmentDescriptor/depthStoreOp}} @@ -6783,7 +6783,7 @@ interface GPUCanvasContext { dictionary GPUSwapChainDescriptor : GPUObjectDescriptorBase { required GPUDevice device; required GPUTextureFormat format; - GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.OUTPUT_ATTACHMENT + GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT }; @@ -7140,7 +7140,7 @@ The "Filter" column specifies whether textures of this format can be sampled in Format {{GPUTextureComponentType|Component Type}} - {{GPUTextureUsage/OUTPUT_ATTACHMENT}} + {{GPUTextureUsage/RENDER_ATTACHMENT}} {{GPUTextureUsage/STORAGE}} Filter @@ -7363,7 +7363,7 @@ The "Filter" column specifies whether textures of this format can be sampled in ### Depth/stencil formats ### {#depth-formats} -All depth formats support {{GPUTextureUsage/COPY_SRC}}, {{GPUTextureUsage/COPY_DST}}, {{GPUTextureUsage/SAMPLED}}, and {{GPUTextureUsage/OUTPUT_ATTACHMENT}} usage. However, the source/destination is restricted based on the format. +All depth formats support {{GPUTextureUsage/COPY_SRC}}, {{GPUTextureUsage/COPY_DST}}, {{GPUTextureUsage/SAMPLED}}, and {{GPUTextureUsage/RENDER_ATTACHMENT}} usage. However, the source/destination is restricted based on the format. None of the depth formats can be filtered.