/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright: * 2016-2017, Danny Robson */ #include "./shader_module.hpp" #include "./device.hpp" #include using cruft::vk::shader_module; /////////////////////////////////////////////////////////////////////////////// struct cruft::vk::shader_module::cookie : public create_t { public: cookie (const std::experimental::filesystem::path &src): create_t {}, m_bytes (util::slurp (src)) { CHECK_MOD (m_bytes.size (), 4); sType = cruft::vk::structure_type_v; codeSize = m_bytes.size (); pCode = reinterpret_cast (m_bytes.data ()); } private: std::vector m_bytes; }; /////////////////////////////////////////////////////////////////////////////// shader_module::shader_module (device &owner, const std::experimental::filesystem::path &src): shader_module (owner, cookie (src)) { ; } //----------------------------------------------------------------------------- shader_module::shader_module (device &owner, const cookie &info): owned (owner, &info, nullptr) { ; }