aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authordan sinclair <dj2@everburning.com>2018-11-22 16:03:37 -0500
committerDavid Neto <dneto@google.com>2018-11-22 16:03:37 -0500
commitdf5530e7cfa3e47680e94dcff8a9332d5b45d193 (patch)
tree32ed2f68df8279ab8cf4315337c34e11ef121527 /docs
parentd7bda5c52d2360c7f33a76604cea4e070da7a72e (diff)
downloadamber-df5530e7cfa3e47680e94dcff8a9332d5b45d193.tar.gz
Framebuffer updates (#89)
Framebuffer updates This Cl removes the FRAMEBUFFER commands from AmberScript and converts them into more generic buffer commands.
Diffstat (limited to 'docs')
-rw-r--r--docs/amber_script.md48
1 files changed, 30 insertions, 18 deletions
diff --git a/docs/amber_script.md b/docs/amber_script.md
index e934f80..fe98d81 100644
--- a/docs/amber_script.md
+++ b/docs/amber_script.md
@@ -159,32 +159,41 @@ The following commands are all specified within the `PIPELINE` command.
END
```
-#### Bindings
-
-Bind a provided framebuffer. The third example `FRAMEBUFFER <name>` requires
-that `<name>` was declared in a previous `PIPELINE` and provided with the
-needed `DIMS`. If the `FORMAT` is missing it is defaulted to
-`R32G32B32A32_UINT`.
-
```
- FRAMEBUFFER <name> DIMS <width> <height>
- FRAMEBUFFER <name> DIMS <width> <height> FORMAT <fb_format>
- FRAMEBUFFER <name>
+ # Set the size of the render buffers. |width| and |height| are integers and
+ # default to 250x250.
+ FRAMEBUFFER_SIZE _width_ _height_
```
+### Pipeline Buffers
+
#### Buffer Types
* uniform
* storage
* sampled
* color
- * depth
+ * depth_stencil
+
+TODO(dsinclair): Reserve `input` as a buffer type for input attachments.
TODO(dsinclair): Sync the BufferTypes with the list of Vulkan Descriptor types.
+A `pipeline` can have buffers bound. This includes buffers to contain image
+attachment content, depth/stencil content, uniform buffers, etc.
```
- # Bind the buffer of the given |buffer_type| at the given descritor set
- # and binding. The buffer will use a index of 0.
+ # Attach |buffer_name| as an output colour attachment at location |idx|.
+ # The provided buffer must be a `FORMAT` buffer. If no colour attachments are
+ # provided a single attachment with format `R8G8B8A8_UINT` will be created.
+ BIND BUFFER <buffer_name> AS color LOCATION <idx>
+
+ # Attach |buffer_name| as the depth/stencil buffer. The provided buffer must
+ # be a `FORMAT` buffer. If no depth/stencil buffer is specified a default
+ # buffer of format `D32_SFLOAT_S8_UINT` will be created.
+ BIND BUFFER <buffer_name> AS depth_stencil
+
+ # Bind the buffer of the given |buffer_type| at the given descriptor set
+ # and binding. The buffer will use a start index of 0.
BIND BUFFER <buffer_name> AS <buffer_type> DESCRIPTOR_SET <id> \
BINDING <id>
# Bind the buffer of the given |buffer_type| at the given descriptor set
@@ -404,6 +413,8 @@ SHADER fragment kFragmentShader SPIRV-ASM
               OpFunctionEnd
END  # shader
+BUFFER kImgBuffer FORMAT R8G8B8A8_UINT
+
PIPELINE graphics kRedPipeline
ATTACH kVertexShader ENTRY_POINT main
SHADER_OPTIMIZATION kVertexShader
@@ -411,24 +422,25 @@ PIPELINE graphics kRedPipeline
merge-return
eliminate-dead-code-aggressive
END
-
ATTACH kFragmentShader ENTRY_POINT red
- FRAMEBUFFER kFramebuffer DIMS 256 256
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER kImgBuffer AS image IDX 0
END  # pipeline
PIPELINE graphics kGreenPipeline
ATTACH kVertexShader
ATTACH kFragmentShader ENTRY_POINT green
- FRAMEBUFFER kFramebuffer
+ FRAMEBUFFER_SIZE 256 256
+ BIND BUFFER kImgBuffer AS image IDX 0
END  # pipeline
RUN kRedPipeline DRAW_RECT POS 0 0 SIZE 256 256
RUN kGreenPipeline DRAW_RECT POS 128 128 SIZE 256 256
-EXPECT kFrameBuffer IDX 0 0 SIZE 127 127 EQ_RGB 255 0 0
-EXPECT kFrameBuffer IDX 128 128 SIZE 128 128 EQ_RGB 0 255 0
+EXPECT kImgBuffer IDX 0 0 SIZE 127 127 EQ_RGB 255 0 0
+EXPECT kImgBuffer IDX 128 128 SIZE 128 128 EQ_RGB 0 255 0
```
### Buffers