Path: blob/21.2-virgl/src/gallium/frontends/clover/core/printf.hpp
4572 views
//1// Copyright 2020 Serge Martin2//3// Permission is hereby granted, free of charge, to any person obtaining a4// copy of this software and associated documentation files (the "Software"),5// to deal in the Software without restriction, including without limitation6// the rights to use, copy, modify, merge, publish, distribute, sublicense,7// and/or sell copies of the Software, and to permit persons to whom the8// Software is furnished to do so, subject to the following conditions:9//10// The above copyright notice and this permission notice shall be included in11// all copies or substantial portions of the Software.12//13// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL16// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR17// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR19// OTHER DEALINGS IN THE SOFTWARE.20//2122#ifndef CLOVER_CORE_PRINTF_HANDLER_HPP23#define CLOVER_CORE_PRINTF_HANDLER_HPP2425#include <memory>2627#include "core/memory.hpp"2829namespace clover {30class printf_handler {31public:32static std::unique_ptr<printf_handler>33create(const intrusive_ptr<command_queue> &q,34const std::vector<module::printf_info> &info,35bool strings_in_buffer, cl_uint size);3637printf_handler(const printf_handler &arg) = delete;38printf_handler &39operator=(const printf_handler &arg) = delete;4041~printf_handler() {};4243cl_mem get_mem();44void print();4546private:47printf_handler(const intrusive_ptr<command_queue> &q,48const std::vector<module::printf_info> &infos,49bool strings_in_buffer, cl_uint size);5051intrusive_ptr<command_queue> _q;52std::vector<module::printf_info> _formatters;53bool _strings_in_buffer;54cl_uint _size;55std::unique_ptr<root_buffer> _buffer;56};57}5859#endif606162