12f18b292ff155af7df35930474857b507dbf18feTony Barbour/* 22f18b292ff155af7df35930474857b507dbf18feTony Barbour * Copyright (C) 2016 Google, Inc. 32f18b292ff155af7df35930474857b507dbf18feTony Barbour * 443b53e83705f02245da6ae61e31273866a35b833Jon Ashburn * Licensed under the Apache License, Version 2.0 (the "License"); 543b53e83705f02245da6ae61e31273866a35b833Jon Ashburn * you may not use this file except in compliance with the License. 643b53e83705f02245da6ae61e31273866a35b833Jon Ashburn * You may obtain a copy of the License at 72f18b292ff155af7df35930474857b507dbf18feTony Barbour * 843b53e83705f02245da6ae61e31273866a35b833Jon Ashburn * http://www.apache.org/licenses/LICENSE-2.0 92f18b292ff155af7df35930474857b507dbf18feTony Barbour * 1043b53e83705f02245da6ae61e31273866a35b833Jon Ashburn * Unless required by applicable law or agreed to in writing, software 1143b53e83705f02245da6ae61e31273866a35b833Jon Ashburn * distributed under the License is distributed on an "AS IS" BASIS, 1243b53e83705f02245da6ae61e31273866a35b833Jon Ashburn * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1343b53e83705f02245da6ae61e31273866a35b833Jon Ashburn * See the License for the specific language governing permissions and 1443b53e83705f02245da6ae61e31273866a35b833Jon Ashburn * limitations under the License. 152f18b292ff155af7df35930474857b507dbf18feTony Barbour */ 162f18b292ff155af7df35930474857b507dbf18feTony Barbour 172f18b292ff155af7df35930474857b507dbf18feTony Barbour#ifndef MESHES_H 182f18b292ff155af7df35930474857b507dbf18feTony Barbour#define MESHES_H 192f18b292ff155af7df35930474857b507dbf18feTony Barbour 202f18b292ff155af7df35930474857b507dbf18feTony Barbour#include <vulkan/vulkan.h> 212f18b292ff155af7df35930474857b507dbf18feTony Barbour#include <vector> 222f18b292ff155af7df35930474857b507dbf18feTony Barbour 232f18b292ff155af7df35930474857b507dbf18feTony Barbourclass Meshes { 242f18b292ff155af7df35930474857b507dbf18feTony Barbourpublic: 252f18b292ff155af7df35930474857b507dbf18feTony Barbour Meshes(VkDevice dev, const std::vector<VkMemoryPropertyFlags> &mem_flags); 262f18b292ff155af7df35930474857b507dbf18feTony Barbour ~Meshes(); 272f18b292ff155af7df35930474857b507dbf18feTony Barbour 282f18b292ff155af7df35930474857b507dbf18feTony Barbour const VkPipelineVertexInputStateCreateInfo &vertex_input_state() const { return vertex_input_state_; } 292f18b292ff155af7df35930474857b507dbf18feTony Barbour const VkPipelineInputAssemblyStateCreateInfo &input_assembly_state() const { return input_assembly_state_; } 302f18b292ff155af7df35930474857b507dbf18feTony Barbour 312f18b292ff155af7df35930474857b507dbf18feTony Barbour enum Type { 322f18b292ff155af7df35930474857b507dbf18feTony Barbour MESH_PYRAMID, 332f18b292ff155af7df35930474857b507dbf18feTony Barbour MESH_ICOSPHERE, 342f18b292ff155af7df35930474857b507dbf18feTony Barbour MESH_TEAPOT, 352f18b292ff155af7df35930474857b507dbf18feTony Barbour 362f18b292ff155af7df35930474857b507dbf18feTony Barbour MESH_COUNT, 372f18b292ff155af7df35930474857b507dbf18feTony Barbour }; 382f18b292ff155af7df35930474857b507dbf18feTony Barbour 392f18b292ff155af7df35930474857b507dbf18feTony Barbour void cmd_bind_buffers(VkCommandBuffer cmd) const; 402f18b292ff155af7df35930474857b507dbf18feTony Barbour void cmd_draw(VkCommandBuffer cmd, Type type) const; 412f18b292ff155af7df35930474857b507dbf18feTony Barbour 422f18b292ff155af7df35930474857b507dbf18feTony Barbourprivate: 432f18b292ff155af7df35930474857b507dbf18feTony Barbour void allocate_resources(VkDeviceSize vb_size, VkDeviceSize ib_size, const std::vector<VkMemoryPropertyFlags> &mem_flags); 442f18b292ff155af7df35930474857b507dbf18feTony Barbour 452f18b292ff155af7df35930474857b507dbf18feTony Barbour VkDevice dev_; 462f18b292ff155af7df35930474857b507dbf18feTony Barbour 472f18b292ff155af7df35930474857b507dbf18feTony Barbour VkVertexInputBindingDescription vertex_input_binding_; 482f18b292ff155af7df35930474857b507dbf18feTony Barbour std::vector<VkVertexInputAttributeDescription> vertex_input_attrs_; 492f18b292ff155af7df35930474857b507dbf18feTony Barbour VkPipelineVertexInputStateCreateInfo vertex_input_state_; 502f18b292ff155af7df35930474857b507dbf18feTony Barbour VkPipelineInputAssemblyStateCreateInfo input_assembly_state_; 512f18b292ff155af7df35930474857b507dbf18feTony Barbour VkIndexType index_type_; 522f18b292ff155af7df35930474857b507dbf18feTony Barbour 532f18b292ff155af7df35930474857b507dbf18feTony Barbour std::vector<VkDrawIndexedIndirectCommand> draw_commands_; 542f18b292ff155af7df35930474857b507dbf18feTony Barbour 552f18b292ff155af7df35930474857b507dbf18feTony Barbour VkBuffer vb_; 562f18b292ff155af7df35930474857b507dbf18feTony Barbour VkBuffer ib_; 572f18b292ff155af7df35930474857b507dbf18feTony Barbour VkDeviceMemory mem_; 582f18b292ff155af7df35930474857b507dbf18feTony Barbour VkDeviceSize ib_mem_offset_; 592f18b292ff155af7df35930474857b507dbf18feTony Barbour}; 602f18b292ff155af7df35930474857b507dbf18feTony Barbour 612f18b292ff155af7df35930474857b507dbf18feTony Barbour#endif // MESHES_H 62