Skip to content

Commit

Permalink
Add sampler and sampler image support (google#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
asuonpaa authored and dj2 committed Nov 15, 2019
1 parent 956d9bb commit 0a4dd57
Show file tree
Hide file tree
Showing 40 changed files with 2,254 additions and 242 deletions.
3 changes: 3 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ LOCAL_SRC_FILES:= \
src/pipeline_data.cc \
src/recipe.cc \
src/result.cc \
src/sampler.cc \
src/script.cc \
src/shader.cc \
src/shader_compiler.cc \
Expand All @@ -49,6 +50,7 @@ LOCAL_SRC_FILES:= \
src/vkscript/parser.cc \
src/vkscript/section_parser.cc \
src/vulkan/buffer_descriptor.cc \
src/vulkan/buffer_backed_descriptor.cc \
src/vulkan/command_buffer.cc \
src/vulkan/command_pool.cc \
src/vulkan/compute_pipeline.cc \
Expand All @@ -62,6 +64,7 @@ LOCAL_SRC_FILES:= \
src/vulkan/pipeline.cc \
src/vulkan/push_constant.cc \
src/vulkan/resource.cc \
src/vulkan/sampler_descriptor.cc \
src/vulkan/transfer_buffer.cc \
src/vulkan/transfer_image.cc \
src/vulkan/vertex_buffer.cc \
Expand Down
14 changes: 11 additions & 3 deletions docs/amber_script.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ The following commands are all specified within the `PIPELINE` command.

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.
A `pipeline` can have buffers or samplers bound. This includes buffers to
contain image attachment content, depth/stencil content, uniform buffers, etc.

```groovy
# Attach |buffer_name| as an output color attachment at location |idx|.
Expand All @@ -255,13 +255,21 @@ attachment content, depth/stencil content, uniform buffers, etc.
# Attach |buffer_name| as the push_constant buffer. There can be only one
# push constant buffer attached to a pipeline.
BIND BUFFER <buffer_name> AS push_constant
BIND BUFFER {buffer_name} AS push_constant
# 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_
# Attach |buffer_name| as a storage image. The provided buffer must
# be a `FORMAT` buffer.
BIND BUFFER {buffer_name} AS storage_image
# Attach |buffer_name| as a sampled image. The provided buffer must
# be a `FORMAT` buffer.
BIND BUFFER {buffer_name} AS sampled_image
# Bind the sampler at the given descriptor set and binding.
BIND SAMPLER {sampler_name} DESCRIPTOR_SET _id_ BINDING _id_
Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ set(AMBER_SOURCES
pipeline_data.cc
recipe.cc
result.cc
sleep.cc
sampler.cc
script.cc
shader.cc
shader_compiler.cc
sleep.cc
tokenizer.cc
type.cc
type_parser.cc
Expand Down Expand Up @@ -127,6 +128,7 @@ if (${AMBER_ENABLE_TESTS})
amberscript/parser_pipeline_set_test.cc
amberscript/parser_repeat_test.cc
amberscript/parser_run_test.cc
amberscript/parser_sampler_test.cc
amberscript/parser_set_test.cc
amberscript/parser_shader_opt_test.cc
amberscript/parser_shader_test.cc
Expand Down
Loading

0 comments on commit 0a4dd57

Please sign in to comment.