aboutsummaryrefslogtreecommitdiff
path: root/src/descriptor_set_and_binding_parser.h
diff options
context:
space:
mode:
authorJaebaek Seo <duke.acacia@gmail.com>2019-02-19 23:29:08 +0900
committerdan sinclair <dj2@everburning.com>2019-02-19 09:29:08 -0500
commitb3a778d1a66f34025878576b0be5e6a5c18c8b94 (patch)
tree13338d962c0fdf4c7bbcc16614bab51f3b9a10af /src/descriptor_set_and_binding_parser.h
parent146a323c493ef0ec5705b66724f2a3636a4f1748 (diff)
downloadamber-b3a778d1a66f34025878576b0be5e6a5c18c8b94.tar.gz
Vulkan: support buffer dump (#269)
This CL adds support to dump the contents of compute buffers to a file. Fixes #36
Diffstat (limited to 'src/descriptor_set_and_binding_parser.h')
-rw-r--r--src/descriptor_set_and_binding_parser.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/descriptor_set_and_binding_parser.h b/src/descriptor_set_and_binding_parser.h
new file mode 100644
index 0000000..44a412a
--- /dev/null
+++ b/src/descriptor_set_and_binding_parser.h
@@ -0,0 +1,51 @@
+// Copyright 2019 The Amber Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef SRC_DESCRIPTOR_SET_AND_BINDING_PARSER_H_
+#define SRC_DESCRIPTOR_SET_AND_BINDING_PARSER_H_
+
+#include <string>
+
+#include "amber/result.h"
+
+namespace amber {
+
+/// Class for descriptor set and binding parser.
+class DescriptorSetAndBindingParser {
+ public:
+ DescriptorSetAndBindingParser();
+ ~DescriptorSetAndBindingParser();
+
+ /// Run the parser against |buffer_id|. The result is success if the parse
+ /// completes correctly. |buffer_id| must be non-empty string. It must
+ /// be a single non-negative integer or two those integers separated by
+ /// ':'. For example, ":0", "1", and "2:3" are valid strings for |buffer_id|,
+ /// but "", "-4", ":-5", ":", "a", and "b:c" are invalid strings for
+ /// |buffer_id|.
+ Result Parse(const std::string& buffer_id);
+
+ /// Return descriptor set that is the result of Parse().
+ uint32_t GetDescriptorSet() const { return descriptor_set_; }
+
+ /// Return binding that is the result of Parse().
+ uint32_t GetBinding() const { return binding_; }
+
+ private:
+ uint32_t descriptor_set_ = 0;
+ uint32_t binding_ = 0;
+};
+
+} // namespace amber
+
+#endif // SRC_DESCRIPTOR_SET_AND_BINDING_PARSER_H_