From fbe653608dd970a108ac01b9a97f03bad12dccb0 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Tue, 5 Sep 2017 19:09:04 -0700 Subject: [PATCH] change project name to Kazan and reformat code --- CMakeLists.txt | 2 +- README.md | 14 +- docs/gsoc-2017-landing-page.md | 2 +- docs/util.md | 4 +- src/demo/CMakeLists.txt | 2 +- src/demo/demo.cpp | 4 +- src/generate_spirv_parser/CMakeLists.txt | 2 +- src/generate_spirv_parser/ast.cpp | 2 +- src/generate_spirv_parser/ast.h | 36 ++-- src/generate_spirv_parser/generate.cpp | 70 +++---- src/generate_spirv_parser/generate.h | 6 +- .../generate_spirv_parser.cpp | 6 +- .../instruction_properties.cpp | 2 +- .../instruction_properties.h | 2 +- src/generate_spirv_parser/parser.cpp | 8 +- src/generate_spirv_parser/parser.h | 5 +- src/generate_spirv_parser/patch.cpp | 2 +- src/generate_spirv_parser/patch.h | 3 +- src/generate_spirv_parser/word_iterator.h | 2 +- src/image/CMakeLists.txt | 4 +- src/image/image.h | 2 +- src/json/CMakeLists.txt | 4 +- src/json/json.cpp | 2 +- src/json/json.h | 2 +- src/json/location.cpp | 2 +- src/json/location.h | 2 +- src/json/parser.cpp | 2 +- src/json/parser.h | 4 +- src/json/source.cpp | 2 +- src/json/source.h | 2 +- src/llvm_wrapper/CMakeLists.txt | 4 +- src/llvm_wrapper/llvm_wrapper.cpp | 2 +- src/llvm_wrapper/llvm_wrapper.h | 2 +- src/llvm_wrapper/orc_compile_stack.cpp | 21 +- src/llvm_wrapper/orc_compile_stack.h | 2 +- src/pipeline/CMakeLists.txt | 16 +- src/pipeline/pipeline.cpp | 5 +- src/pipeline/pipeline.h | 2 +- src/spirv/CMakeLists.txt | 6 +- src/spirv/literal_string.cpp | 2 +- src/spirv/literal_string.h | 2 +- src/spirv/word.h | 2 +- src/spirv_to_llvm/CMakeLists.txt | 4 +- src/spirv_to_llvm/core_instructions.cpp | 2 +- src/spirv_to_llvm/fragment_entry_point.cpp | 39 ++-- src/spirv_to_llvm/glsl_instructions.cpp | 3 +- src/spirv_to_llvm/opencl_instructions.cpp | 2 +- src/spirv_to_llvm/spirv_to_llvm.cpp | 2 +- src/spirv_to_llvm/spirv_to_llvm.h | 2 +- .../spirv_to_llvm_implementation.h | 4 +- src/spirv_to_llvm/vertex_entry_point.cpp | 2 +- src/util/CMakeLists.txt | 8 +- src/util/bit_intrinsics.h | 38 ++-- src/util/bitset.cpp | 2 +- src/util/bitset.h | 6 +- src/util/constexpr_array.h | 2 +- src/util/copy_cv_ref.h | 2 +- src/util/endian.h | 4 +- src/util/endian_config.h.in | 3 +- src/util/enum.h | 8 +- src/util/filesystem.cpp | 4 +- src/util/filesystem.h | 2 +- src/util/in_place.h | 2 +- src/util/invoke.h | 2 +- src/util/is_referenceable.h | 2 +- src/util/is_swappable.h | 8 +- src/util/memory.h | 2 +- src/util/optional.h | 4 +- src/util/soft_float.cpp | 2 +- src/util/soft_float.h | 5 +- src/util/string_view.h | 182 ++++++++--------- src/util/system_memory_info.cpp | 4 +- src/util/system_memory_info.h | 2 +- src/util/text.h | 2 +- src/util/variant.cpp | 2 +- src/util/variant.h | 186 +++++++++--------- src/util/void_t.h | 2 +- src/vulkan/CMakeLists.txt | 4 +- src/vulkan/api_objects.cpp | 2 +- src/vulkan/api_objects.h | 6 +- src/vulkan/util.h | 2 +- src/vulkan_icd/CMakeLists.txt | 12 +- ...n_icd.json.in => kazan_vulkan_icd.json.in} | 2 +- src/vulkan_icd/vulkan_icd.cpp | 4 +- src/vulkan_icd/vulkan_icd.h | 2 +- 85 files changed, 423 insertions(+), 425 deletions(-) rename src/vulkan_icd/{vulkan_cpu_vulkan_icd.json.in => kazan_vulkan_icd.json.in} (58%) diff --git a/CMakeLists.txt b/CMakeLists.txt index f809bf7..b697454 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -project(vulkan-cpu CXX C) +project(kazan CXX C) if(NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") message(FATAL_ERROR "compiler is not clang") endif() diff --git a/README.md b/README.md index 0b43613..2db8e19 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Vulkan-cpu +# Kazan -[![Build Status](https://travis-ci.org/programmerjake/vulkan-cpu.svg?branch=master)](https://travis-ci.org/programmerjake/vulkan-cpu) +[![Build Status](https://travis-ci.org/kazan-3d/kazan.svg?branch=master)](https://travis-ci.org/kazan-3d/kazan) Work-in-progress for Vulkan implementation on cpu @@ -10,14 +10,18 @@ Work-in-progress for Vulkan implementation on cpu ## Build in Docker - docker build -t vulkan-cpu . + docker build -t kazan . ## Build under Ubuntu 16.04 (xenial) sudo apt install build-essential git clang-4.0 llvm-4.0-dev cmake zlib1g-dev libsdl2-dev - git clone https://github.com/programmerjake/vulkan-cpu.git - cd vulkan-cpu + git clone https://github.com/kazan-3d/kazan.git + cd kazan mkdir build cd build cmake .. -DCMAKE_CXX_COMPILER="`which clang++-4.0`" -DCMAKE_C_COMPILER="`which clang-4.0`" -DCMAKE_BUILD_TYPE=Debug make + +## Naming + +Kazan used to be named vulkan-cpu. Kazan is a Japanese word that means "volcano". diff --git a/docs/gsoc-2017-landing-page.md b/docs/gsoc-2017-landing-page.md index 9d29cfb..e667a2c 100644 --- a/docs/gsoc-2017-landing-page.md +++ b/docs/gsoc-2017-landing-page.md @@ -1,7 +1,7 @@ # GSOC 2017 Landing Page The code produced as part of GSOC is available here: [gsoc-2017 tag](https://github.com/programmerjake/vulkan-cpu/tree/gsoc-2017) -I've probably done more work on the code since GSOC, available here: [master branch](https://github.com/programmerjake/vulkan-cpu/tree/master) +I've probably done more work on the code since GSOC, available here: [master branch](https://github.com/kazan-3d/kazan/tree/master) ## State of code at end of GSOC diff --git a/docs/util.md b/docs/util.md index 39c2f86..5cba68b 100644 --- a/docs/util.md +++ b/docs/util.md @@ -26,7 +26,7 @@ Get machine [endianness](https://en.wikipedia.org/wiki/Endianness). Utility functions and types for `enum`s. -To use, you need to call the `vulkan_cpu_util_generate_enum_traits` macro at namespace scope after the definition of the `enum`: +To use, you need to call the `kazan_util_generate_enum_traits` macro at namespace scope after the definition of the `enum`: enum class My_enum // class keyword is optional { @@ -35,7 +35,7 @@ To use, you need to call the `vulkan_cpu_util_generate_enum_traits` macro at nam Value_3 = Value_1, // allows duplicate values }; - vulkan_cpu_util_generate_enum_traits(My_enum, + kazan_util_generate_enum_traits(My_enum, My_enum::Value_1, My_enum::Value_2, My_enum::Value_3); diff --git a/src/demo/CMakeLists.txt b/src/demo/CMakeLists.txt index 0bb3086..29b7ce0 100644 --- a/src/demo/CMakeLists.txt +++ b/src/demo/CMakeLists.txt @@ -24,7 +24,7 @@ string(STRIP ${SDL2_LIBRARIES} libraries) # workaround SDL2 automake bug set(sources demo.cpp) add_executable(demo ${sources}) target_include_directories(demo PRIVATE ${SDL2_INCLUDE_DIRS}) -target_link_libraries(demo ${libraries} vulkan_cpu_spirv vulkan_cpu_util vulkan_cpu_pipeline vulkan_cpu_vulkan) +target_link_libraries(demo ${libraries} kazan_spirv kazan_util kazan_pipeline kazan_vulkan) set_target_properties(demo PROPERTIES C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden) diff --git a/src/demo/demo.cpp b/src/demo/demo.cpp index 8db8ea6..151e9cd 100644 --- a/src/demo/demo.cpp +++ b/src/demo/demo.cpp @@ -41,7 +41,7 @@ #error wrong SDL varsion #endif -namespace vulkan_cpu +namespace kazan { namespace test { @@ -921,5 +921,5 @@ int test_main(int argc, char **argv) int main(int argc, char **argv) { - return vulkan_cpu::test::test_main(argc, argv); + return kazan::test::test_main(argc, argv); } diff --git a/src/generate_spirv_parser/CMakeLists.txt b/src/generate_spirv_parser/CMakeLists.txt index 4b9c979..cdb9a83 100644 --- a/src/generate_spirv_parser/CMakeLists.txt +++ b/src/generate_spirv_parser/CMakeLists.txt @@ -26,4 +26,4 @@ set(sources ast.cpp parser.cpp patch.cpp) add_executable(generate_spirv_parser ${sources}) -target_link_libraries(generate_spirv_parser vulkan_cpu_util vulkan_cpu_json) +target_link_libraries(generate_spirv_parser kazan_util kazan_json) diff --git a/src/generate_spirv_parser/ast.cpp b/src/generate_spirv_parser/ast.cpp index 5619228..c2c39cf 100644 --- a/src/generate_spirv_parser/ast.cpp +++ b/src/generate_spirv_parser/ast.cpp @@ -22,7 +22,7 @@ */ #include "ast.h" -namespace vulkan_cpu +namespace kazan { namespace generate_spirv_parser { diff --git a/src/generate_spirv_parser/ast.h b/src/generate_spirv_parser/ast.h index 331eba4..caf1cbb 100644 --- a/src/generate_spirv_parser/ast.h +++ b/src/generate_spirv_parser/ast.h @@ -32,7 +32,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace generate_spirv_parser { @@ -106,11 +106,10 @@ enum class Instructions_Instruction_Operands_Operand_Quantifier variable, }; -vulkan_cpu_util_generate_enum_traits( - Instructions_Instruction_Operands_Operand_Quantifier, - Instructions_Instruction_Operands_Operand_Quantifier::none, - Instructions_Instruction_Operands_Operand_Quantifier::optional, - Instructions_Instruction_Operands_Operand_Quantifier::variable); +kazan_util_generate_enum_traits(Instructions_Instruction_Operands_Operand_Quantifier, + Instructions_Instruction_Operands_Operand_Quantifier::none, + Instructions_Instruction_Operands_Operand_Quantifier::optional, + Instructions_Instruction_Operands_Operand_Quantifier::variable); struct Instructions { @@ -180,12 +179,11 @@ struct Instructions std::uint32_t opcode, Operands operands, Capabilities capabilities, - Extensions extensions) noexcept - : opname(std::move(opname)), - opcode(opcode), - operands(std::move(operands)), - capabilities(std::move(capabilities)), - extensions(std::move(extensions)) + Extensions extensions) noexcept : opname(std::move(opname)), + opcode(opcode), + operands(std::move(operands)), + capabilities(std::move(capabilities)), + extensions(std::move(extensions)) { } json::ast::Value to_json() const; @@ -222,12 +220,12 @@ enum class Operand_kinds_Operand_kind_Category composite, }; -vulkan_cpu_util_generate_enum_traits(Operand_kinds_Operand_kind_Category, - Operand_kinds_Operand_kind_Category::bit_enum, - Operand_kinds_Operand_kind_Category::value_enum, - Operand_kinds_Operand_kind_Category::id, - Operand_kinds_Operand_kind_Category::literal, - Operand_kinds_Operand_kind_Category::composite); +kazan_util_generate_enum_traits(Operand_kinds_Operand_kind_Category, + Operand_kinds_Operand_kind_Category::bit_enum, + Operand_kinds_Operand_kind_Category::value_enum, + Operand_kinds_Operand_kind_Category::id, + Operand_kinds_Operand_kind_Category::literal, + Operand_kinds_Operand_kind_Category::composite); enum class Operand_kinds_Operand_kind_Literal_kind { @@ -238,7 +236,7 @@ enum class Operand_kinds_Operand_kind_Literal_kind literal_spec_constant_op_integer, }; -vulkan_cpu_util_generate_enum_traits( +kazan_util_generate_enum_traits( Operand_kinds_Operand_kind_Literal_kind, Operand_kinds_Operand_kind_Literal_kind::literal_integer, Operand_kinds_Operand_kind_Literal_kind::literal_string, diff --git a/src/generate_spirv_parser/generate.cpp b/src/generate_spirv_parser/generate.cpp index b59076a..405a60e 100644 --- a/src/generate_spirv_parser/generate.cpp +++ b/src/generate_spirv_parser/generate.cpp @@ -33,7 +33,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace generate_spirv_parser { @@ -382,38 +382,38 @@ enum class Output_part struct_closing, }; -vulkan_cpu_util_generate_enum_traits(Output_part, - Output_part::file_comments, - Output_part::include_guard_start, - Output_part::includes, - Output_part::namespaces_start, - Output_part::basic_types, - Output_part::basic_constants, - Output_part::id_types, - Output_part::enum_definitions, - Output_part::enum_properties_definitions, - Output_part::literal_types, - Output_part::enum_structs, - Output_part::composite_types, - Output_part::instruction_structs, - Output_part::instruction_variant, - Output_part::parse_error_class, - Output_part::parser_callbacks_class, - Output_part::dump_callbacks_class, - Output_part::parser_class, - Output_part::namespaces_end, - Output_part::include_guard_end, - Output_part::struct_opening, - Output_part::struct_members, - Output_part::struct_default_constructor, - Output_part::struct_default_constructor_initializers, - Output_part::struct_default_constructor_body, - Output_part::struct_fill_constructor_start, - Output_part::struct_fill_constructor_args, - Output_part::struct_fill_constructor_args_end, - Output_part::struct_fill_constructor_initializers, - Output_part::struct_fill_constructor_body, - Output_part::struct_closing); +kazan_util_generate_enum_traits(Output_part, + Output_part::file_comments, + Output_part::include_guard_start, + Output_part::includes, + Output_part::namespaces_start, + Output_part::basic_types, + Output_part::basic_constants, + Output_part::id_types, + Output_part::enum_definitions, + Output_part::enum_properties_definitions, + Output_part::literal_types, + Output_part::enum_structs, + Output_part::composite_types, + Output_part::instruction_structs, + Output_part::instruction_variant, + Output_part::parse_error_class, + Output_part::parser_callbacks_class, + Output_part::dump_callbacks_class, + Output_part::parser_class, + Output_part::namespaces_end, + Output_part::include_guard_end, + Output_part::struct_opening, + Output_part::struct_members, + Output_part::struct_default_constructor, + Output_part::struct_default_constructor_initializers, + Output_part::struct_default_constructor_body, + Output_part::struct_fill_constructor_start, + Output_part::struct_fill_constructor_args, + Output_part::struct_fill_constructor_args_end, + Output_part::struct_fill_constructor_initializers, + Output_part::struct_fill_constructor_body, + Output_part::struct_closing); static_assert(util::Enum_traits::is_compact, "mismatch between declaration and generate enum traits"); @@ -671,7 +671,7 @@ private: file_comments << automatically_generated_file_warning_comment << state.top_level.copyright; namespaces_start << R"( -namespace vulkan_cpu +namespace kazan { namespace spirv { @@ -891,7 +891,7 @@ constexpr util::string_view get_enumerant_name()" } enum_definitions << R"(@-}; -vulkan_cpu_util_generate_enum_traits()" +kazan_util_generate_enum_traits()" << enumeration.cpp_name; std::unordered_set values; for(auto &enumerant : enumeration.enumerants) diff --git a/src/generate_spirv_parser/generate.h b/src/generate_spirv_parser/generate.h index 97febc0..da3305d 100644 --- a/src/generate_spirv_parser/generate.h +++ b/src/generate_spirv_parser/generate.h @@ -36,7 +36,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace generate_spirv_parser { @@ -206,8 +206,8 @@ private: void write_signed_integer(std::int64_t value, unsigned base = 10); void write_literal(util::string_view value) { - *this << escape_char << literal_command << static_cast(value.size()) << escape_char << value - << escape_char; + *this << escape_char << literal_command << static_cast(value.size()) + << escape_char << value << escape_char; } public: diff --git a/src/generate_spirv_parser/generate_spirv_parser.cpp b/src/generate_spirv_parser/generate_spirv_parser.cpp index e065e8f..f5a17e8 100644 --- a/src/generate_spirv_parser/generate_spirv_parser.cpp +++ b/src/generate_spirv_parser/generate_spirv_parser.cpp @@ -28,7 +28,7 @@ #include "generate.h" #include "patch.h" -namespace vulkan_cpu +namespace kazan { namespace generate_spirv_parser { @@ -48,7 +48,7 @@ int generate_spirv_parser_main(int argc, char **argv) } try { - std::shared_ptr> required_files; // outside of try so + std::shared_ptr> required_files; // outside of try so try { required_files = parser::read_required_files(std::move(input_directory)); @@ -84,5 +84,5 @@ int generate_spirv_parser_main(int argc, char **argv) int main(int argc, char **argv) { - return vulkan_cpu::generate_spirv_parser::generate_spirv_parser_main(argc, argv); + return kazan::generate_spirv_parser::generate_spirv_parser_main(argc, argv); } diff --git a/src/generate_spirv_parser/instruction_properties.cpp b/src/generate_spirv_parser/instruction_properties.cpp index 0e296a4..878a081 100644 --- a/src/generate_spirv_parser/instruction_properties.cpp +++ b/src/generate_spirv_parser/instruction_properties.cpp @@ -22,7 +22,7 @@ */ #include "instruction_properties.h" -namespace vulkan_cpu +namespace kazan { namespace generate_spirv_parser { diff --git a/src/generate_spirv_parser/instruction_properties.h b/src/generate_spirv_parser/instruction_properties.h index ca97a4a..622ce4d 100644 --- a/src/generate_spirv_parser/instruction_properties.h +++ b/src/generate_spirv_parser/instruction_properties.h @@ -28,7 +28,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace generate_spirv_parser { diff --git a/src/generate_spirv_parser/parser.cpp b/src/generate_spirv_parser/parser.cpp index 3a928b4..1850779 100644 --- a/src/generate_spirv_parser/parser.cpp +++ b/src/generate_spirv_parser/parser.cpp @@ -29,7 +29,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace generate_spirv_parser { @@ -751,7 +751,8 @@ ast::Extension_instruction_set parse_extension_instruction_set(json::ast::Value != 0) throw Parse_error(top_level_value.location, {}, "file name is unrecognizable"); auto instruction_set_name = file_name; - instruction_set_name.erase(instruction_set_name.size() - file_name_suffix.size(), file_name_suffix.size()); + instruction_set_name.erase(instruction_set_name.size() - file_name_suffix.size(), + file_name_suffix.size()); instruction_set_name.erase(0, file_name_prefix.size()); if(top_level_value.get_value_kind() != json::ast::Value_kind::object) throw Parse_error(top_level_value.location, {}, "top level value is not an object"); @@ -797,7 +798,8 @@ ast::Extension_instruction_set parse_extension_instruction_set(json::ast::Value revision, top_level_value.location, nullptr, "missing revision"), get_value_or_throw_parse_error( std::move(instructions), top_level_value.location, nullptr, "missing instructions")); - std::cerr << "Parsed extension instruction set: " << import_name << " from " << file_name << std::endl; + std::cerr << "Parsed extension instruction set: " << import_name << " from " << file_name + << std::endl; return retval; } } diff --git a/src/generate_spirv_parser/parser.h b/src/generate_spirv_parser/parser.h index dd2a21e..e4b2d76 100644 --- a/src/generate_spirv_parser/parser.h +++ b/src/generate_spirv_parser/parser.h @@ -34,7 +34,7 @@ #include "json/parser.h" #include "util/filesystem.h" -namespace vulkan_cpu +namespace kazan { namespace generate_spirv_parser { @@ -111,7 +111,8 @@ public: } }; -std::shared_ptr> read_required_files(const util::filesystem::path &dir_path); +std::shared_ptr> read_required_files( + const util::filesystem::path &dir_path); ast::Top_level parse(std::vector &&json_files); } diff --git a/src/generate_spirv_parser/patch.cpp b/src/generate_spirv_parser/patch.cpp index 8eb062e..84f85a1 100644 --- a/src/generate_spirv_parser/patch.cpp +++ b/src/generate_spirv_parser/patch.cpp @@ -22,7 +22,7 @@ */ #include "patch.h" -namespace vulkan_cpu +namespace kazan { namespace generate_spirv_parser { diff --git a/src/generate_spirv_parser/patch.h b/src/generate_spirv_parser/patch.h index eb253ae..cb84dce 100644 --- a/src/generate_spirv_parser/patch.h +++ b/src/generate_spirv_parser/patch.h @@ -28,7 +28,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace generate_spirv_parser { @@ -52,6 +52,7 @@ struct Ast_patches struct Add_image_operands_grad_parameter_names final : public Ast_patch { using Ast_patch::Ast_patch; + protected: virtual bool apply(ast::Top_level &top_level) const override; diff --git a/src/generate_spirv_parser/word_iterator.h b/src/generate_spirv_parser/word_iterator.h index 0e98c0d..efecb0e 100644 --- a/src/generate_spirv_parser/word_iterator.h +++ b/src/generate_spirv_parser/word_iterator.h @@ -28,7 +28,7 @@ #include "util/optional.h" #include -namespace vulkan_cpu +namespace kazan { namespace generate_spirv_parser { diff --git a/src/image/CMakeLists.txt b/src/image/CMakeLists.txt index f4af74a..d8c7931 100644 --- a/src/image/CMakeLists.txt +++ b/src/image/CMakeLists.txt @@ -20,5 +20,5 @@ # cmake_minimum_required(VERSION 3.3 FATAL_ERROR) set(sources image.cpp) -add_library(vulkan_cpu_image STATIC ${sources}) -target_link_libraries(vulkan_cpu_image vulkan_cpu_util vulkan_cpu_llvm_wrapper vulkan_cpu_vulkan) +add_library(kazan_image STATIC ${sources}) +target_link_libraries(kazan_image kazan_util kazan_llvm_wrapper kazan_vulkan) diff --git a/src/image/image.h b/src/image/image.h index 3ed1667..f0504e0 100644 --- a/src/image/image.h +++ b/src/image/image.h @@ -29,7 +29,7 @@ #include #include "util/enum.h" -namespace vulkan_cpu +namespace kazan { namespace image { diff --git a/src/json/CMakeLists.txt b/src/json/CMakeLists.txt index d0ac3dc..ee8f4ad 100644 --- a/src/json/CMakeLists.txt +++ b/src/json/CMakeLists.txt @@ -23,5 +23,5 @@ set(sources json.cpp location.cpp parser.cpp source.cpp) -add_library(vulkan_cpu_json STATIC ${sources}) -target_link_libraries(vulkan_cpu_json vulkan_cpu_util) +add_library(kazan_json STATIC ${sources}) +target_link_libraries(kazan_json kazan_util) diff --git a/src/json/json.cpp b/src/json/json.cpp index 28f4ae5..08ab61e 100644 --- a/src/json/json.cpp +++ b/src/json/json.cpp @@ -30,7 +30,7 @@ #include #include "util/soft_float.h" -namespace vulkan_cpu +namespace kazan { namespace json { diff --git a/src/json/json.h b/src/json/json.h index 15cbe05..31ca657 100644 --- a/src/json/json.h +++ b/src/json/json.h @@ -39,7 +39,7 @@ #include "util/optional.h" #include "location.h" -namespace vulkan_cpu +namespace kazan { namespace json { diff --git a/src/json/location.cpp b/src/json/location.cpp index ea9916a..c1ebaeb 100644 --- a/src/json/location.cpp +++ b/src/json/location.cpp @@ -22,7 +22,7 @@ */ #include "location.h" -namespace vulkan_cpu +namespace kazan { namespace json { diff --git a/src/json/location.h b/src/json/location.h index 2ffecb7..7856647 100644 --- a/src/json/location.h +++ b/src/json/location.h @@ -28,7 +28,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace json { diff --git a/src/json/parser.cpp b/src/json/parser.cpp index 1481c92..3e2fafb 100644 --- a/src/json/parser.cpp +++ b/src/json/parser.cpp @@ -28,7 +28,7 @@ #include #include "util/soft_float.h" -namespace vulkan_cpu +namespace kazan { namespace json { diff --git a/src/json/parser.h b/src/json/parser.h index 31adb3e..dcd3f46 100644 --- a/src/json/parser.h +++ b/src/json/parser.h @@ -34,7 +34,7 @@ #include "location.h" #include "util/optional.h" -namespace vulkan_cpu +namespace kazan { namespace json { @@ -88,4 +88,4 @@ ast::Value parse(const Source *source, Parse_options options = Parse_options::de } } -#endif /* JSON_PARSER_H_ */ \ No newline at end of file +#endif /* JSON_PARSER_H_ */ diff --git a/src/json/source.cpp b/src/json/source.cpp index 93e7eba..569cf0a 100644 --- a/src/json/source.cpp +++ b/src/json/source.cpp @@ -27,7 +27,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace json { diff --git a/src/json/source.h b/src/json/source.h index cad2790..c259636 100644 --- a/src/json/source.h +++ b/src/json/source.h @@ -30,7 +30,7 @@ #include #include "util/filesystem.h" -namespace vulkan_cpu +namespace kazan { namespace json { diff --git a/src/llvm_wrapper/CMakeLists.txt b/src/llvm_wrapper/CMakeLists.txt index ad40191..8b7ddf5 100644 --- a/src/llvm_wrapper/CMakeLists.txt +++ b/src/llvm_wrapper/CMakeLists.txt @@ -22,11 +22,11 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) set(sources llvm_wrapper.cpp orc_compile_stack.cpp) -add_library(vulkan_cpu_llvm_wrapper STATIC ${sources}) +add_library(kazan_llvm_wrapper STATIC ${sources}) if(0) llvm_map_components_to_libnames(llvm_libraries core native analysis orcjit mcjit nativecodegen ipo scalaropts vectorize) else() set(llvm_libraries LLVM) endif() -target_link_libraries(vulkan_cpu_llvm_wrapper util ${llvm_libraries}) +target_link_libraries(kazan_llvm_wrapper util ${llvm_libraries}) set_source_files_properties(orc_compile_stack.cpp PROPERTIES COMPILE_FLAGS -fno-rtti) # prevent link errors with missing type info diff --git a/src/llvm_wrapper/llvm_wrapper.cpp b/src/llvm_wrapper/llvm_wrapper.cpp index 7473d00..b4faf66 100644 --- a/src/llvm_wrapper/llvm_wrapper.cpp +++ b/src/llvm_wrapper/llvm_wrapper.cpp @@ -31,7 +31,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace llvm_wrapper { diff --git a/src/llvm_wrapper/llvm_wrapper.h b/src/llvm_wrapper/llvm_wrapper.h index 8d12f05..9ac2d07 100644 --- a/src/llvm_wrapper/llvm_wrapper.h +++ b/src/llvm_wrapper/llvm_wrapper.h @@ -40,7 +40,7 @@ #include "util/string_view.h" #include "util/variant.h" -namespace vulkan_cpu +namespace kazan { namespace llvm_wrapper { diff --git a/src/llvm_wrapper/orc_compile_stack.cpp b/src/llvm_wrapper/orc_compile_stack.cpp index 86f0ef3..8b56a10 100644 --- a/src/llvm_wrapper/orc_compile_stack.cpp +++ b/src/llvm_wrapper/orc_compile_stack.cpp @@ -39,7 +39,7 @@ #error Orc compile stack is not yet implemented for this version of LLVM #endif -namespace vulkan_cpu +namespace kazan { namespace llvm_wrapper { @@ -115,12 +115,10 @@ private: } public: - void operator()( - llvm::orc::ObjectLinkingLayerBase::ObjSetHandleT, - const Object_set_wrapper - &object_set, - const std::vector> - &load_result) + void operator()(llvm::orc::ObjectLinkingLayerBase::ObjSetHandleT, + const Object_set_wrapper &object_set, + const std::vector> + &load_result) { assert(object_set.size() == load_result.size()); for(std::size_t i = 0; i < object_set.size(); i++) @@ -193,8 +191,9 @@ private: auto retval = create_module_handle(); auto &handle = handle_map[retval]; auto object_set_iter = object_sets.insert(object_sets.end(), std::move(object_set)); - handle = object_linking_layer.addObjectSet( - Object_set_wrapper(*object_set_iter), std::move(memory_manager), std::move(symbol_resolver)); + handle = object_linking_layer.addObjectSet(Object_set_wrapper(*object_set_iter), + std::move(memory_manager), + std::move(symbol_resolver)); return retval; } @@ -203,7 +202,9 @@ private: std::vector> jit_event_listener_list; llvm::orc::ObjectLinkingLayer object_linking_layer; std::unordered_map handle_map; - std::list>>> object_sets; + std:: + list>>> + object_sets; std::unordered_multiset loaded_object_set; }; typedef std::function(std::unique_ptr)> diff --git a/src/llvm_wrapper/orc_compile_stack.h b/src/llvm_wrapper/orc_compile_stack.h index 80042c8..2e78e73 100644 --- a/src/llvm_wrapper/orc_compile_stack.h +++ b/src/llvm_wrapper/orc_compile_stack.h @@ -28,7 +28,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace llvm_wrapper { diff --git a/src/pipeline/CMakeLists.txt b/src/pipeline/CMakeLists.txt index 127767c..149f665 100644 --- a/src/pipeline/CMakeLists.txt +++ b/src/pipeline/CMakeLists.txt @@ -21,11 +21,11 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) set(sources pipeline.cpp) -add_library(vulkan_cpu_pipeline STATIC ${sources}) -target_link_libraries(vulkan_cpu_pipeline vulkan_cpu_spirv_to_llvm - vulkan_cpu_json - vulkan_cpu_util - vulkan_cpu_spirv - vulkan_cpu_llvm_wrapper - vulkan_cpu_vulkan - vulkan_cpu_image) +add_library(kazan_pipeline STATIC ${sources}) +target_link_libraries(kazan_pipeline kazan_spirv_to_llvm + kazan_json + kazan_util + kazan_spirv + kazan_llvm_wrapper + kazan_vulkan + kazan_image) diff --git a/src/pipeline/pipeline.cpp b/src/pipeline/pipeline.cpp index c0fc697..a0b9771 100644 --- a/src/pipeline/pipeline.cpp +++ b/src/pipeline/pipeline.cpp @@ -32,7 +32,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace pipeline { @@ -925,7 +925,8 @@ std::unique_ptr Graphics_pipeline::make( std::cerr << dump_callbacks.ss.str() << std::endl; } assert(create_info.pVertexInputState); - assert(create_info.pVertexInputState->sType == VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO); + assert(create_info.pVertexInputState->sType + == VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO); auto compiled_shader = spirv_to_llvm::spirv_to_llvm(implementation->llvm_context.get(), llvm_target_machine.get(), shader_module->words(), diff --git a/src/pipeline/pipeline.h b/src/pipeline/pipeline.h index b125377..e17d933 100644 --- a/src/pipeline/pipeline.h +++ b/src/pipeline/pipeline.h @@ -33,7 +33,7 @@ #include "spirv/spirv.h" #include "image/image.h" -namespace vulkan_cpu +namespace kazan { namespace pipeline { diff --git a/src/spirv/CMakeLists.txt b/src/spirv/CMakeLists.txt index 12ed97f..4e65cfe 100644 --- a/src/spirv/CMakeLists.txt +++ b/src/spirv/CMakeLists.txt @@ -42,6 +42,6 @@ add_custom_command(OUTPUT ${spirv_parser_sources} ${spirv_parser_headers} VERBATIM COMMENT "Generating SPIR-V Parser") set(sources ${sources} ${spirv_parser_sources}) -add_library(vulkan_cpu_spirv STATIC ${sources}) -target_link_libraries(vulkan_cpu_spirv vulkan_cpu_util vulkan_cpu_json) -target_include_directories(vulkan_cpu_spirv PUBLIC ${spirv_parser_generated_include_dir}) +add_library(kazan_spirv STATIC ${sources}) +target_link_libraries(kazan_spirv kazan_util kazan_json) +target_include_directories(kazan_spirv PUBLIC ${spirv_parser_generated_include_dir}) diff --git a/src/spirv/literal_string.cpp b/src/spirv/literal_string.cpp index edf7c52..56eddf8 100644 --- a/src/spirv/literal_string.cpp +++ b/src/spirv/literal_string.cpp @@ -22,7 +22,7 @@ */ #include "literal_string.h" -namespace vulkan_cpu +namespace kazan { namespace spirv { diff --git a/src/spirv/literal_string.h b/src/spirv/literal_string.h index d21529b..45b306b 100644 --- a/src/spirv/literal_string.h +++ b/src/spirv/literal_string.h @@ -34,7 +34,7 @@ #include "util/endian.h" #include "util/string_view.h" -namespace vulkan_cpu +namespace kazan { namespace spirv { diff --git a/src/spirv/word.h b/src/spirv/word.h index 35bbea3..01ea0e6 100644 --- a/src/spirv/word.h +++ b/src/spirv/word.h @@ -25,7 +25,7 @@ #include -namespace vulkan_cpu +namespace kazan { namespace spirv { diff --git a/src/spirv_to_llvm/CMakeLists.txt b/src/spirv_to_llvm/CMakeLists.txt index 43274e7..df1072a 100644 --- a/src/spirv_to_llvm/CMakeLists.txt +++ b/src/spirv_to_llvm/CMakeLists.txt @@ -26,5 +26,5 @@ set(sources core_instructions.cpp opencl_instructions.cpp spirv_to_llvm.cpp vertex_entry_point.cpp) -add_library(vulkan_cpu_spirv_to_llvm STATIC ${sources}) -target_link_libraries(vulkan_cpu_spirv_to_llvm vulkan_cpu_util vulkan_cpu_spirv vulkan_cpu_llvm_wrapper vulkan_cpu_pipeline) +add_library(kazan_spirv_to_llvm STATIC ${sources}) +target_link_libraries(kazan_spirv_to_llvm kazan_util kazan_spirv kazan_llvm_wrapper kazan_pipeline) diff --git a/src/spirv_to_llvm/core_instructions.cpp b/src/spirv_to_llvm/core_instructions.cpp index 586b6f7..0c23e0c 100644 --- a/src/spirv_to_llvm/core_instructions.cpp +++ b/src/spirv_to_llvm/core_instructions.cpp @@ -22,7 +22,7 @@ */ #include "spirv_to_llvm_implementation.h" -namespace vulkan_cpu +namespace kazan { namespace spirv_to_llvm { diff --git a/src/spirv_to_llvm/fragment_entry_point.cpp b/src/spirv_to_llvm/fragment_entry_point.cpp index 3ab4aba..5a5b868 100644 --- a/src/spirv_to_llvm/fragment_entry_point.cpp +++ b/src/spirv_to_llvm/fragment_entry_point.cpp @@ -22,7 +22,7 @@ */ #include "spirv_to_llvm_implementation.h" -namespace vulkan_cpu +namespace kazan { namespace spirv_to_llvm { @@ -129,9 +129,8 @@ using namespace spirv; if(built_in) throw Parser_error( 0, 0, "multiple BuiltIn decorations on the same variable"); - built_in = - util::get(decoration.parameters) - .built_in; + built_in = util::get(decoration.parameters) + .built_in; continue; case Decoration::no_perspective: #warning finish implementing Decoration::no_perspective @@ -248,11 +247,10 @@ using namespace spirv; #warning finish implementing Decoration::secondary_viewport_relative_nv break; } - throw Parser_error( - 0, - 0, - "unimplemented member decoration on shader input variable: " - + std::string(get_enumerant_name(decoration.value))); + throw Parser_error(0, + 0, + "unimplemented member decoration on shader input variable: " + + std::string(get_enumerant_name(decoration.value))); } if(!built_in) throw Parser_error( @@ -431,9 +429,9 @@ using namespace spirv; break; } throw Parser_error(0, - 0, - "unimplemented built in shader input variable: " - + std::string(get_enumerant_name(*built_in))); + 0, + "unimplemented built in shader input variable: " + + std::string(get_enumerant_name(*built_in))); } while(false); } } @@ -539,9 +537,8 @@ using namespace spirv; if(location) throw Parser_error( 0, 0, "multiple Location decorations on the same variable"); - location = - util::get(decoration.parameters) - .location; + location = util::get(decoration.parameters) + .location; continue; case Decoration::component: #warning finish implementing Decoration::component @@ -607,11 +604,10 @@ using namespace spirv; #warning finish implementing Decoration::secondary_viewport_relative_nv break; } - throw Parser_error( - 0, - 0, - "unimplemented member decoration on shader output variable: " - + std::string(get_enumerant_name(decoration.value))); + throw Parser_error(0, + 0, + "unimplemented member decoration on shader output variable: " + + std::string(get_enumerant_name(decoration.value))); } if(!location) throw Parser_error( @@ -628,8 +624,7 @@ using namespace spirv; auto callback = [llvm_output_member_type, &output_color, this, output_pointer]() { if(output_color) - throw Parser_error( - 0, 0, "duplicate fragment shader output variable"); + throw Parser_error(0, 0, "duplicate fragment shader output variable"); output_color = ::LLVMBuildLoad(builder.get(), output_pointer, "output_color"); ::LLVMSetAlignment(output_color, llvm_output_member_type.alignment); }; diff --git a/src/spirv_to_llvm/glsl_instructions.cpp b/src/spirv_to_llvm/glsl_instructions.cpp index 3ec637f..52343e0 100644 --- a/src/spirv_to_llvm/glsl_instructions.cpp +++ b/src/spirv_to_llvm/glsl_instructions.cpp @@ -22,7 +22,7 @@ */ #include "spirv_to_llvm_implementation.h" -namespace vulkan_cpu +namespace kazan { namespace spirv_to_llvm { @@ -839,4 +839,3 @@ void Spirv_to_llvm::handle_instruction_glsl_std_450_op_n_clamp(Glsl_std_450_op_n } } } - diff --git a/src/spirv_to_llvm/opencl_instructions.cpp b/src/spirv_to_llvm/opencl_instructions.cpp index 285969c..d404639 100644 --- a/src/spirv_to_llvm/opencl_instructions.cpp +++ b/src/spirv_to_llvm/opencl_instructions.cpp @@ -22,7 +22,7 @@ */ #include "spirv_to_llvm_implementation.h" -namespace vulkan_cpu +namespace kazan { namespace spirv_to_llvm { diff --git a/src/spirv_to_llvm/spirv_to_llvm.cpp b/src/spirv_to_llvm/spirv_to_llvm.cpp index 3ba5cbb..aae4b04 100644 --- a/src/spirv_to_llvm/spirv_to_llvm.cpp +++ b/src/spirv_to_llvm/spirv_to_llvm.cpp @@ -22,7 +22,7 @@ */ #include "spirv_to_llvm_implementation.h" -namespace vulkan_cpu +namespace kazan { namespace spirv_to_llvm { diff --git a/src/spirv_to_llvm/spirv_to_llvm.h b/src/spirv_to_llvm/spirv_to_llvm.h index adabced..d7e312a 100644 --- a/src/spirv_to_llvm/spirv_to_llvm.h +++ b/src/spirv_to_llvm/spirv_to_llvm.h @@ -36,7 +36,7 @@ #include "util/string_view.h" #include "vulkan/vulkan.h" -namespace vulkan_cpu +namespace kazan { namespace spirv_to_llvm { diff --git a/src/spirv_to_llvm/spirv_to_llvm_implementation.h b/src/spirv_to_llvm/spirv_to_llvm_implementation.h index dad8879..cc4f6bf 100644 --- a/src/spirv_to_llvm/spirv_to_llvm_implementation.h +++ b/src/spirv_to_llvm/spirv_to_llvm_implementation.h @@ -32,7 +32,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace spirv_to_llvm { @@ -42,7 +42,7 @@ enum class Stage generate_code, }; -vulkan_cpu_util_generate_enum_traits(Stage, Stage::calculate_types, Stage::generate_code); +kazan_util_generate_enum_traits(Stage, Stage::calculate_types, Stage::generate_code); static_assert(util::Enum_traits::is_compact, ""); diff --git a/src/spirv_to_llvm/vertex_entry_point.cpp b/src/spirv_to_llvm/vertex_entry_point.cpp index 1b73100..7ed6f05 100644 --- a/src/spirv_to_llvm/vertex_entry_point.cpp +++ b/src/spirv_to_llvm/vertex_entry_point.cpp @@ -23,7 +23,7 @@ #include "spirv_to_llvm_implementation.h" #include -namespace vulkan_cpu +namespace kazan { namespace spirv_to_llvm { diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt index 649e2d3..ad4a084 100644 --- a/src/util/CMakeLists.txt +++ b/src/util/CMakeLists.txt @@ -41,7 +41,7 @@ set(sources bit_intrinsics.cpp system_memory_info.cpp variant.cpp void_t.cpp) -add_library(vulkan_cpu_util STATIC ${sources}) -target_include_directories(vulkan_cpu_util PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/..) -add_executable(vulkan_cpu_util_test EXCLUDE_FROM_ALL ${sources} util_test.cpp) -target_include_directories(vulkan_cpu_util_test PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/..) +add_library(kazan_util STATIC ${sources}) +target_include_directories(kazan_util PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/..) +add_executable(kazan_util_test EXCLUDE_FROM_ALL ${sources} util_test.cpp) +target_include_directories(kazan_util_test PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/..) diff --git a/src/util/bit_intrinsics.h b/src/util/bit_intrinsics.h index 3ffd6a7..10dfbc5 100644 --- a/src/util/bit_intrinsics.h +++ b/src/util/bit_intrinsics.h @@ -30,33 +30,33 @@ #if defined(__clang__) #if defined(__apple_build_version__) #if __clang_major__ > 5 || (__clang_major__ == 5 && __clang_minor__ >= 1) -#define VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED 1 +#define KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED 1 #endif #else #if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4) -#define VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED 1 +#define KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED 1 #endif #endif #elif defined(__INTEL_COMPILER) #warning figure out icc version numbers for constexpr __builtin_clz and __builtin_ctz #elif defined(__GNUC__) // gcc supports constexpr __builtin_clz and __builtin_ctz before it supports c++14 -#define VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED 1 +#define KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED 1 #endif #if 1 -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED -#undef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#undef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED #endif #endif -namespace vulkan_cpu +namespace kazan { namespace util { constexpr std::uint32_t clz4(std::uint8_t v) noexcept { -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED return v == 0 ? 4 : __builtin_clz(v) - __builtin_clz(0x8U); #else typedef const std::uint_fast8_t LookupTableType[0x10]; @@ -70,7 +70,7 @@ constexpr std::uint32_t clz4(std::uint8_t v) noexcept constexpr std::uint32_t clz8(std::uint8_t v) noexcept { -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED return v == 0 ? 8 : __builtin_clz(v) - __builtin_clz(0x80U); #else return ((v & 0xF0) == 0) ? 4 + clz4(v) : clz4(v >> 4); @@ -79,7 +79,7 @@ constexpr std::uint32_t clz8(std::uint8_t v) noexcept constexpr std::uint32_t clz16(std::uint16_t v) noexcept { -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED return v == 0 ? 16 : __builtin_clz(v) - (std::numeric_limits::digits - 16); #else return ((v & 0xFF00U) == 0) ? 8 + clz8(v) : clz8(v >> 8); @@ -88,7 +88,7 @@ constexpr std::uint32_t clz16(std::uint16_t v) noexcept constexpr std::uint32_t clz32(std::uint32_t v) noexcept { -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED return v == 0 ? 32 : __builtin_clzl(v) - (std::numeric_limits::digits - 32); #else return ((v & 0xFFFF0000UL) == 0) ? 16 + clz16(v) : clz16(v >> 16); @@ -97,7 +97,7 @@ constexpr std::uint32_t clz32(std::uint32_t v) noexcept constexpr std::uint32_t clz64(std::uint64_t v) noexcept { -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED return v == 0 ? 64 : __builtin_clzll(v) - (std::numeric_limits::digits - 64); #else return ((v & 0xFFFFFFFF00000000ULL) == 0) ? 32 + clz32(v) : clz32(v >> 32); @@ -106,7 +106,7 @@ constexpr std::uint32_t clz64(std::uint64_t v) noexcept constexpr std::uint32_t ctz4(std::uint8_t v) noexcept { -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED return v == 0 ? 4 : __builtin_ctz(v); #else typedef const std::uint_fast8_t LookupTableType[0x10]; @@ -120,7 +120,7 @@ constexpr std::uint32_t ctz4(std::uint8_t v) noexcept constexpr std::uint32_t ctz8(std::uint8_t v) noexcept { -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED return v == 0 ? 8 : __builtin_ctz(v); #else return ((v & 0xF0) == 0) ? ctz4(v) : 4 + ctz4(v >> 4); @@ -129,7 +129,7 @@ constexpr std::uint32_t ctz8(std::uint8_t v) noexcept constexpr std::uint32_t ctz16(std::uint16_t v) noexcept { -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED return v == 0 ? 16 : __builtin_ctz(v); #else return ((v & 0xFF00U) == 0) ? ctz8(v) : 8 + ctz8(v >> 8); @@ -138,7 +138,7 @@ constexpr std::uint32_t ctz16(std::uint16_t v) noexcept constexpr std::uint32_t ctz32(std::uint32_t v) noexcept { -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED return v == 0 ? 32 : __builtin_ctzl(v); #else return ((v & 0xFFFF0000UL) == 0) ? ctz16(v) : 16 + ctz16(v >> 16); @@ -147,7 +147,7 @@ constexpr std::uint32_t ctz32(std::uint32_t v) noexcept constexpr std::uint32_t ctz64(std::uint64_t v) noexcept { -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED return v == 0 ? 64 : __builtin_ctzll(v); #else return ((v & 0xFFFFFFFF00000000ULL) == 0) ? ctz32(v) : 32 + ctz32(v >> 32); @@ -156,7 +156,7 @@ constexpr std::uint32_t ctz64(std::uint64_t v) noexcept constexpr std::uint32_t popcount8(std::uint8_t v) noexcept { -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED return __builtin_popcount(v); #else constexpr std::uint8_t lookup_table[0x10] = { @@ -168,7 +168,7 @@ constexpr std::uint32_t popcount8(std::uint8_t v) noexcept constexpr std::uint32_t popcount32(std::uint32_t v) noexcept { -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED return __builtin_popcountl(v); #else constexpr std::uint32_t m1 = 0x5555'5555UL; @@ -188,7 +188,7 @@ constexpr std::uint32_t popcount16(std::uint16_t v) noexcept constexpr std::uint32_t popcount64(std::uint64_t v) noexcept { -#ifdef VULKAN_CPU_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED +#ifdef KAZAN_UTIL_CONSTEXPR_BUILTIN_CLZ_CTZ_POPCOUNT_SUPPORTED return __builtin_popcountll(v); #else constexpr std::uint64_t m1 = 0x5555'5555'5555'5555ULL; diff --git a/src/util/bitset.cpp b/src/util/bitset.cpp index 73f9405..09f5dec 100644 --- a/src/util/bitset.cpp +++ b/src/util/bitset.cpp @@ -32,7 +32,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/util/bitset.h b/src/util/bitset.h index f61b5c3..14b825b 100644 --- a/src/util/bitset.h +++ b/src/util/bitset.h @@ -38,7 +38,7 @@ // derived from // https://github.com/programmerjake/hashlife-voxels/blob/0dd91021a5b9caeffb7849b2114dca89204876bd/util/bitset.h -namespace vulkan_cpu +namespace kazan { namespace util { @@ -605,9 +605,9 @@ constexpr std::size_t bitset::npos; namespace std { template -struct hash> +struct hash> { - constexpr std::size_t operator()(const vulkan_cpu::util::bitset &v) const noexcept + constexpr std::size_t operator()(const kazan::util::bitset &v) const noexcept { return v.hash(); } diff --git a/src/util/constexpr_array.h b/src/util/constexpr_array.h index 5182c1e..31edd77 100644 --- a/src/util/constexpr_array.h +++ b/src/util/constexpr_array.h @@ -30,7 +30,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/util/copy_cv_ref.h b/src/util/copy_cv_ref.h index c01e06e..e78a8ad 100644 --- a/src/util/copy_cv_ref.h +++ b/src/util/copy_cv_ref.h @@ -24,7 +24,7 @@ #ifndef UTIL_COPY_CV_REF_H_ #define UTIL_COPY_CV_REF_H_ -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/util/endian.h b/src/util/endian.h index 20a801c..c031ced 100644 --- a/src/util/endian.h +++ b/src/util/endian.h @@ -25,7 +25,7 @@ #include "util/endian_config.h" -namespace vulkan_cpu +namespace kazan { namespace util { @@ -33,7 +33,7 @@ enum class Endian { Little, Big, - Native = vulkan_cpu_util_endian_endian, + Native = kazan_util_endian_endian, }; constexpr Endian endian = Endian::Native; diff --git a/src/util/endian_config.h.in b/src/util/endian_config.h.in index 1b5a3a7..2a17163 100644 --- a/src/util/endian_config.h.in +++ b/src/util/endian_config.h.in @@ -23,7 +23,6 @@ #ifndef UTIL_ENDIAN_CONFIG_H_ #define UTIL_ENDIAN_CONFIG_H_ -#define vulkan_cpu_util_endian_endian @UTIL_ENDIAN@ +#define kazan_util_endian_endian @UTIL_ENDIAN@ #endif /* UTIL_ENDIAN_CONFIG_H_ */ - diff --git a/src/util/enum.h b/src/util/enum.h index 697b334..f40bec2 100644 --- a/src/util/enum.h +++ b/src/util/enum.h @@ -35,7 +35,7 @@ #include "bitset.h" #include "is_swappable.h" -namespace vulkan_cpu +namespace kazan { namespace util { @@ -207,10 +207,10 @@ struct Default_enum_traits template constexpr Constexpr_array Default_enum_traits::values; /** generate code for Enum_traits instantiation; use like - * vulkan_cpu_util_generate_enum_traits(Enum, Enum::Value1, Enum::Value2, Enum::Value3, + * kazan_util_generate_enum_traits(Enum, Enum::Value1, Enum::Value2, Enum::Value3, * <...>); */ -#define vulkan_cpu_util_generate_enum_traits(Enum, ...) \ - [[gnu::unused]] ::vulkan_cpu::util::detail::Default_enum_traits \ +#define kazan_util_generate_enum_traits(Enum, ...) \ + [[gnu::unused]] ::kazan::util::detail::Default_enum_traits \ enum_traits_resolve_function(Enum) } diff --git a/src/util/filesystem.cpp b/src/util/filesystem.cpp index f2271d7..3fa59ef 100644 --- a/src/util/filesystem.cpp +++ b/src/util/filesystem.cpp @@ -45,7 +45,7 @@ #error filesystem is not implemented for your operating system #endif -namespace vulkan_cpu +namespace kazan { namespace util { @@ -432,7 +432,7 @@ void directory_iterator::increment(std::shared_ptr &implementati } #if 0 // change to 1 to test filesystem::path -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/util/filesystem.h b/src/util/filesystem.h index db7a7dc..eb4766b 100644 --- a/src/util/filesystem.h +++ b/src/util/filesystem.h @@ -45,7 +45,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/util/in_place.h b/src/util/in_place.h index d95ca1b..9a6dd6f 100644 --- a/src/util/in_place.h +++ b/src/util/in_place.h @@ -26,7 +26,7 @@ #include -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/util/invoke.h b/src/util/invoke.h index 1a2b801..f261637 100644 --- a/src/util/invoke.h +++ b/src/util/invoke.h @@ -29,7 +29,7 @@ #include #include "void_t.h" -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/util/is_referenceable.h b/src/util/is_referenceable.h index 9b0c0ea..9d6808e 100644 --- a/src/util/is_referenceable.h +++ b/src/util/is_referenceable.h @@ -26,7 +26,7 @@ #include -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/util/is_swappable.h b/src/util/is_swappable.h index a6cb631..fefa9eb 100644 --- a/src/util/is_swappable.h +++ b/src/util/is_swappable.h @@ -28,7 +28,7 @@ #include #include "is_referenceable.h" -namespace vulkan_cpu_util_is_swappable_unrelated_namespace +namespace kazan_util_is_swappable_unrelated_namespace { using std::swap; template ::value || std::is_void::value> @@ -68,14 +68,14 @@ struct Is_nothrow_swappable_with }; } -namespace vulkan_cpu +namespace kazan { namespace util { template struct is_swappable_with : public std::integral_constant::value> { }; @@ -86,7 +86,7 @@ constexpr bool is_swappable_with_v = is_swappable_with::value; template struct is_nothrow_swappable_with : public std::integral_constant::value> { }; diff --git a/src/util/memory.h b/src/util/memory.h index 08081a6..45127e2 100644 --- a/src/util/memory.h +++ b/src/util/memory.h @@ -27,7 +27,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/util/optional.h b/src/util/optional.h index c11ba78..fed1046 100644 --- a/src/util/optional.h +++ b/src/util/optional.h @@ -35,7 +35,7 @@ #include "in_place.h" #include "is_swappable.h" -namespace vulkan_cpu +namespace kazan { namespace util { @@ -916,7 +916,7 @@ struct optional_hash namespace std { template -struct hash> : public vulkan_cpu::util::detail::optional_hash +struct hash> : public kazan::util::detail::optional_hash { }; } diff --git a/src/util/soft_float.cpp b/src/util/soft_float.cpp index 0a581f3..414ce0d 100644 --- a/src/util/soft_float.cpp +++ b/src/util/soft_float.cpp @@ -34,7 +34,7 @@ #include namespace { -using namespace vulkan_cpu::util::soft_float; +using namespace kazan::util::soft_float; [[gnu::unused]] std::string hexValue(const ExtendedFloat &v) { if(v.isNaN()) diff --git a/src/util/soft_float.h b/src/util/soft_float.h index b0ca4de..1afb741 100644 --- a/src/util/soft_float.h +++ b/src/util/soft_float.h @@ -32,7 +32,7 @@ #include #include "bit_intrinsics.h" -namespace vulkan_cpu +namespace kazan { namespace util { @@ -576,7 +576,8 @@ struct ExtendedFloat final // modeled after IEEE754 standard mantissaField |= 0x400U; // add in implicit 1 else exponentField = 1; - return ExtendedFloat(mantissaField, static_cast(exponentField) - 15 - 10 + exponentBias() + 63, sign); + return ExtendedFloat( + mantissaField, static_cast(exponentField) - 15 - 10 + exponentBias() + 63, sign); } explicit operator long double() const noexcept { diff --git a/src/util/string_view.h b/src/util/string_view.h index 9bb5e17..2fec55f 100644 --- a/src/util/string_view.h +++ b/src/util/string_view.h @@ -32,7 +32,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace util { @@ -460,104 +460,104 @@ constexpr bool operator>(basic_string_view a, return a.compare(b) > 0; } -#define VULKAN_CPU_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_NO_ALLOCATOR(...) \ - template \ - bool operator==(__VA_ARGS__) noexcept \ - { \ - return operator==(static_cast>(a), \ - static_cast>(b)); \ - } \ - \ - template \ - bool operator!=(__VA_ARGS__) noexcept \ - { \ - return operator!=(static_cast>(a), \ - static_cast>(b)); \ - } \ - \ - template \ - bool operator<=(__VA_ARGS__) noexcept \ - { \ - return operator<=(static_cast>(a), \ - static_cast>(b)); \ - } \ - \ - template \ - bool operator>=(__VA_ARGS__) noexcept \ - { \ - return operator>=(static_cast>(a), \ - static_cast>(b)); \ - } \ - \ - template \ - bool operator<(__VA_ARGS__) noexcept \ - { \ - return operator<(static_cast>(a), \ - static_cast>(b)); \ - } \ - \ - template \ - bool operator>(__VA_ARGS__) noexcept \ - { \ - return operator>(static_cast>(a), \ - static_cast>(b)); \ +#define KAZAN_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_NO_ALLOCATOR(...) \ + template \ + bool operator==(__VA_ARGS__) noexcept \ + { \ + return operator==(static_cast>(a), \ + static_cast>(b)); \ + } \ + \ + template \ + bool operator!=(__VA_ARGS__) noexcept \ + { \ + return operator!=(static_cast>(a), \ + static_cast>(b)); \ + } \ + \ + template \ + bool operator<=(__VA_ARGS__) noexcept \ + { \ + return operator<=(static_cast>(a), \ + static_cast>(b)); \ + } \ + \ + template \ + bool operator>=(__VA_ARGS__) noexcept \ + { \ + return operator>=(static_cast>(a), \ + static_cast>(b)); \ + } \ + \ + template \ + bool operator<(__VA_ARGS__) noexcept \ + { \ + return operator<(static_cast>(a), \ + static_cast>(b)); \ + } \ + \ + template \ + bool operator>(__VA_ARGS__) noexcept \ + { \ + return operator>(static_cast>(a), \ + static_cast>(b)); \ } -#define VULKAN_CPU_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_WITH_ALLOCATOR(...) \ - template \ - bool operator==(__VA_ARGS__) noexcept \ - { \ - return operator==(static_cast>(a), \ - static_cast>(b)); \ - } \ - \ - template \ - bool operator!=(__VA_ARGS__) noexcept \ - { \ - return operator!=(static_cast>(a), \ - static_cast>(b)); \ - } \ - \ - template \ - bool operator<=(__VA_ARGS__) noexcept \ - { \ - return operator<=(static_cast>(a), \ - static_cast>(b)); \ - } \ - \ - template \ - bool operator>=(__VA_ARGS__) noexcept \ - { \ - return operator>=(static_cast>(a), \ - static_cast>(b)); \ - } \ - \ - template \ - bool operator<(__VA_ARGS__) noexcept \ - { \ - return operator<(static_cast>(a), \ - static_cast>(b)); \ - } \ - \ - template \ - bool operator>(__VA_ARGS__) noexcept \ - { \ - return operator>(static_cast>(a), \ - static_cast>(b)); \ +#define KAZAN_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_WITH_ALLOCATOR(...) \ + template \ + bool operator==(__VA_ARGS__) noexcept \ + { \ + return operator==(static_cast>(a), \ + static_cast>(b)); \ + } \ + \ + template \ + bool operator!=(__VA_ARGS__) noexcept \ + { \ + return operator!=(static_cast>(a), \ + static_cast>(b)); \ + } \ + \ + template \ + bool operator<=(__VA_ARGS__) noexcept \ + { \ + return operator<=(static_cast>(a), \ + static_cast>(b)); \ + } \ + \ + template \ + bool operator>=(__VA_ARGS__) noexcept \ + { \ + return operator>=(static_cast>(a), \ + static_cast>(b)); \ + } \ + \ + template \ + bool operator<(__VA_ARGS__) noexcept \ + { \ + return operator<(static_cast>(a), \ + static_cast>(b)); \ + } \ + \ + template \ + bool operator>(__VA_ARGS__) noexcept \ + { \ + return operator>(static_cast>(a), \ + static_cast>(b)); \ } -VULKAN_CPU_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_NO_ALLOCATOR( +KAZAN_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_NO_ALLOCATOR( const Char_type *a, basic_string_view b) -VULKAN_CPU_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_NO_ALLOCATOR( +KAZAN_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_NO_ALLOCATOR( basic_string_view a, const Char_type *b) -VULKAN_CPU_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_WITH_ALLOCATOR( +KAZAN_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_WITH_ALLOCATOR( basic_string_view a, std::basic_string b) -VULKAN_CPU_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_WITH_ALLOCATOR( +KAZAN_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_WITH_ALLOCATOR( std::basic_string a, basic_string_view b) -#undef VULKAN_CPU_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_NO_ALLOCATOR -#undef VULKAN_CPU_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_WITH_ALLOCATOR +#undef KAZAN_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_NO_ALLOCATOR +#undef KAZAN_UTIL_STRING_VIEW_GENERATE_EXTRA_COMPARE_OPERATORS_WITH_ALLOCATOR template std::basic_ostream &operator<<( @@ -600,9 +600,9 @@ constexpr u32string_view operator"" _sv(const char32_t *str, std::size_t length) namespace std { template -struct hash> +struct hash> { - std::size_t operator()(vulkan_cpu::util::basic_string_view v) const + std::size_t operator()(kazan::util::basic_string_view v) const { typedef std::basic_string stringType; return std::hash(static_cast(v)); diff --git a/src/util/system_memory_info.cpp b/src/util/system_memory_info.cpp index 0c68572..212cc42 100644 --- a/src/util/system_memory_info.cpp +++ b/src/util/system_memory_info.cpp @@ -24,7 +24,7 @@ #ifdef __linux__ #include -namespace vulkan_cpu +namespace kazan { namespace util { @@ -43,7 +43,7 @@ System_memory_info System_memory_info::get() #elif defined(_WIN32) #include -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/util/system_memory_info.h b/src/util/system_memory_info.h index 051a70c..c64d9ba 100644 --- a/src/util/system_memory_info.h +++ b/src/util/system_memory_info.h @@ -25,7 +25,7 @@ #include -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/util/text.h b/src/util/text.h index 70f04c1..312a090 100644 --- a/src/util/text.h +++ b/src/util/text.h @@ -36,7 +36,7 @@ #include #include "string_view.h" -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/util/variant.cpp b/src/util/variant.cpp index eb5d0c7..219264f 100644 --- a/src/util/variant.cpp +++ b/src/util/variant.cpp @@ -26,7 +26,7 @@ #include #include #include -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/util/variant.h b/src/util/variant.h index 0ef2e1c..751c5b0 100644 --- a/src/util/variant.h +++ b/src/util/variant.h @@ -36,7 +36,7 @@ #include "is_swappable.h" #include "invoke.h" -namespace vulkan_cpu +namespace kazan { namespace util { @@ -312,7 +312,7 @@ template using Variant_values = Variant_values_implementation(), Types...>; -#define VULKAN_CPU_UTIL_VARIANT_VALUES(Is_Trivially_Destructible, Destructor) \ +#define KAZAN_UTIL_VARIANT_VALUES(Is_Trivially_Destructible, Destructor) \ template \ union Variant_values_implementation \ { \ @@ -490,9 +490,9 @@ using Variant_values = Destructor \ }; -VULKAN_CPU_UTIL_VARIANT_VALUES(true, ~Variant_values_implementation() = default;) -VULKAN_CPU_UTIL_VARIANT_VALUES(false, ~Variant_values_implementation(){}) -#undef VULKAN_CPU_UTIL_VARIANT_VALUES +KAZAN_UTIL_VARIANT_VALUES(true, ~Variant_values_implementation() = default;) +KAZAN_UTIL_VARIANT_VALUES(false, ~Variant_values_implementation(){}) +#undef KAZAN_UTIL_VARIANT_VALUES template struct Variant_get; @@ -543,7 +543,7 @@ struct Variant_get } }; -#define VULKAN_CPU_UTIL_VARIANT_DISPATCH(Const, Ref) \ +#define KAZAN_UTIL_VARIANT_DISPATCH(Const, Ref) \ template std::forward(args)...); \ } -VULKAN_CPU_UTIL_VARIANT_DISPATCH(, &) -VULKAN_CPU_UTIL_VARIANT_DISPATCH(const, &) -VULKAN_CPU_UTIL_VARIANT_DISPATCH(, &&) -VULKAN_CPU_UTIL_VARIANT_DISPATCH(const, &&) -#undef VULKAN_CPU_UTIL_VARIANT_DISPATCH +KAZAN_UTIL_VARIANT_DISPATCH(, &) +KAZAN_UTIL_VARIANT_DISPATCH(const, &) +KAZAN_UTIL_VARIANT_DISPATCH(, &&) +KAZAN_UTIL_VARIANT_DISPATCH(const, &&) +#undef KAZAN_UTIL_VARIANT_DISPATCH template struct Variant_index_type @@ -705,15 +705,15 @@ template struct Variant_base; -#define VULKAN_CPU_UTIL_VARIANT_BASE_DESTRUCTOR_false \ - ~Variant_base() \ - { \ - values.destruct(index_value.get()); \ +#define KAZAN_UTIL_VARIANT_BASE_DESTRUCTOR_false \ + ~Variant_base() \ + { \ + values.destruct(index_value.get()); \ } -#define VULKAN_CPU_UTIL_VARIANT_BASE_DESTRUCTOR_true ~Variant_base() = default; +#define KAZAN_UTIL_VARIANT_BASE_DESTRUCTOR_true ~Variant_base() = default; -#define VULKAN_CPU_UTIL_VARIANT_BASE_COPY_CONSTRUCTOR_true \ +#define KAZAN_UTIL_VARIANT_BASE_COPY_CONSTRUCTOR_true \ Variant_base(const Variant_base &rt) noexcept( \ Variant_values::is_nothrow_copy_constructible) \ : values(in_place_index), index_value(variant_npos) \ @@ -722,10 +722,10 @@ struct Variant_base; index_value = rt.index_value; \ } -#define VULKAN_CPU_UTIL_VARIANT_BASE_COPY_CONSTRUCTOR_false \ +#define KAZAN_UTIL_VARIANT_BASE_COPY_CONSTRUCTOR_false \ Variant_base(const Variant_base &rt) = delete; -#define VULKAN_CPU_UTIL_VARIANT_BASE_MOVE_CONSTRUCTOR_true \ +#define KAZAN_UTIL_VARIANT_BASE_MOVE_CONSTRUCTOR_true \ Variant_base(Variant_base &&rt) noexcept( \ Variant_values::is_nothrow_move_constructible) \ : values(in_place_index), index_value(variant_npos) \ @@ -734,10 +734,9 @@ struct Variant_base; index_value = rt.index_value; \ } -#define VULKAN_CPU_UTIL_VARIANT_BASE_MOVE_CONSTRUCTOR_false \ - Variant_base(Variant_base &&rt) = delete; +#define KAZAN_UTIL_VARIANT_BASE_MOVE_CONSTRUCTOR_false Variant_base(Variant_base &&rt) = delete; -#define VULKAN_CPU_UTIL_VARIANT_BASE_COPY_ASSIGN_OP_true \ +#define KAZAN_UTIL_VARIANT_BASE_COPY_ASSIGN_OP_true \ Variant_base &operator=(const Variant_base &rt) noexcept( \ Variant_values::is_nothrow_copy_assignable) \ { \ @@ -755,10 +754,10 @@ struct Variant_base; return *this; \ } -#define VULKAN_CPU_UTIL_VARIANT_BASE_COPY_ASSIGN_OP_false \ +#define KAZAN_UTIL_VARIANT_BASE_COPY_ASSIGN_OP_false \ Variant_base &operator=(const Variant_base &rt) = delete; -#define VULKAN_CPU_UTIL_VARIANT_BASE_MOVE_ASSIGN_OP_true \ +#define KAZAN_UTIL_VARIANT_BASE_MOVE_ASSIGN_OP_true \ Variant_base &operator=(Variant_base &&rt) noexcept( \ Variant_values::is_nothrow_move_assignable) \ { \ @@ -776,71 +775,68 @@ struct Variant_base; return *this; \ } -#define VULKAN_CPU_UTIL_VARIANT_BASE_MOVE_ASSIGN_OP_false \ +#define KAZAN_UTIL_VARIANT_BASE_MOVE_ASSIGN_OP_false \ Variant_base &operator=(Variant_base &&rt) = delete; -#define VULKAN_CPU_UTIL_VARIANT_BASE0(Is_Trivially_Destructible, \ - Is_Copy_Constructible, \ - Is_Move_Constructible, \ - Is_Copy_Assignable, \ - Is_Move_Assignable) \ - template \ - struct Variant_base \ - { \ - Variant_values values; \ - Variant_index_type index_value; \ - template \ - constexpr Variant_base( \ - Variant_base_construct_tag, \ - std::size_t index_value, \ - Args &&... args) noexcept(noexcept(new(std::declval()) \ - Variant_values( \ - std::declval()...))) \ - : values(std::forward(args)...), index_value(index_value) \ - { \ - } \ - VULKAN_CPU_UTIL_VARIANT_BASE_DESTRUCTOR_##Is_Trivially_Destructible \ - VULKAN_CPU_UTIL_VARIANT_BASE_COPY_CONSTRUCTOR_##Is_Copy_Constructible \ - VULKAN_CPU_UTIL_VARIANT_BASE_MOVE_CONSTRUCTOR_##Is_Move_Constructible \ - VULKAN_CPU_UTIL_VARIANT_BASE_COPY_ASSIGN_OP_##Is_Copy_Assignable \ - VULKAN_CPU_UTIL_VARIANT_BASE_MOVE_ASSIGN_OP_##Is_Move_Assignable \ +#define KAZAN_UTIL_VARIANT_BASE0(Is_Trivially_Destructible, \ + Is_Copy_Constructible, \ + Is_Move_Constructible, \ + Is_Copy_Assignable, \ + Is_Move_Assignable) \ + template \ + struct Variant_base \ + { \ + Variant_values values; \ + Variant_index_type index_value; \ + template \ + constexpr Variant_base( \ + Variant_base_construct_tag, \ + std::size_t index_value, \ + Args &&... args) noexcept(noexcept(new(std::declval()) \ + Variant_values( \ + std::declval()...))) \ + : values(std::forward(args)...), index_value(index_value) \ + { \ + } \ + KAZAN_UTIL_VARIANT_BASE_DESTRUCTOR_##Is_Trivially_Destructible \ + KAZAN_UTIL_VARIANT_BASE_COPY_CONSTRUCTOR_##Is_Copy_Constructible \ + KAZAN_UTIL_VARIANT_BASE_MOVE_CONSTRUCTOR_##Is_Move_Constructible \ + KAZAN_UTIL_VARIANT_BASE_COPY_ASSIGN_OP_##Is_Copy_Assignable \ + KAZAN_UTIL_VARIANT_BASE_MOVE_ASSIGN_OP_##Is_Move_Assignable \ }; -#define VULKAN_CPU_UTIL_VARIANT_BASE1( \ +#define KAZAN_UTIL_VARIANT_BASE1( \ Is_Copy_Constructible, Is_Move_Constructible, Is_Copy_Assignable, Is_Move_Assignable) \ - VULKAN_CPU_UTIL_VARIANT_BASE0(false, \ - Is_Copy_Constructible, \ - Is_Move_Constructible, \ - Is_Copy_Assignable, \ - Is_Move_Assignable) \ - VULKAN_CPU_UTIL_VARIANT_BASE0(true, \ - Is_Copy_Constructible, \ - Is_Move_Constructible, \ - Is_Copy_Assignable, \ - Is_Move_Assignable) - -#define VULKAN_CPU_UTIL_VARIANT_BASE2( \ - Is_Move_Constructible, Is_Copy_Assignable, Is_Move_Assignable) \ - VULKAN_CPU_UTIL_VARIANT_BASE1( \ - false, Is_Move_Constructible, Is_Copy_Assignable, Is_Move_Assignable) \ - VULKAN_CPU_UTIL_VARIANT_BASE1( \ - true, Is_Move_Constructible, Is_Copy_Assignable, Is_Move_Assignable) - -#define VULKAN_CPU_UTIL_VARIANT_BASE3(Is_Copy_Assignable, Is_Move_Assignable) \ - VULKAN_CPU_UTIL_VARIANT_BASE2(false, Is_Copy_Assignable, Is_Move_Assignable) \ - VULKAN_CPU_UTIL_VARIANT_BASE2(true, Is_Copy_Assignable, Is_Move_Assignable) - -#define VULKAN_CPU_UTIL_VARIANT_BASE4(Is_Move_Assignable) \ - VULKAN_CPU_UTIL_VARIANT_BASE3(false, Is_Move_Assignable) \ - VULKAN_CPU_UTIL_VARIANT_BASE3(true, Is_Move_Assignable) - -VULKAN_CPU_UTIL_VARIANT_BASE4(false) -VULKAN_CPU_UTIL_VARIANT_BASE4(true) + KAZAN_UTIL_VARIANT_BASE0(false, \ + Is_Copy_Constructible, \ + Is_Move_Constructible, \ + Is_Copy_Assignable, \ + Is_Move_Assignable) \ + KAZAN_UTIL_VARIANT_BASE0(true, \ + Is_Copy_Constructible, \ + Is_Move_Constructible, \ + Is_Copy_Assignable, \ + Is_Move_Assignable) + +#define KAZAN_UTIL_VARIANT_BASE2(Is_Move_Constructible, Is_Copy_Assignable, Is_Move_Assignable) \ + KAZAN_UTIL_VARIANT_BASE1(false, Is_Move_Constructible, Is_Copy_Assignable, Is_Move_Assignable) \ + KAZAN_UTIL_VARIANT_BASE1(true, Is_Move_Constructible, Is_Copy_Assignable, Is_Move_Assignable) + +#define KAZAN_UTIL_VARIANT_BASE3(Is_Copy_Assignable, Is_Move_Assignable) \ + KAZAN_UTIL_VARIANT_BASE2(false, Is_Copy_Assignable, Is_Move_Assignable) \ + KAZAN_UTIL_VARIANT_BASE2(true, Is_Copy_Assignable, Is_Move_Assignable) + +#define KAZAN_UTIL_VARIANT_BASE4(Is_Move_Assignable) \ + KAZAN_UTIL_VARIANT_BASE3(false, Is_Move_Assignable) \ + KAZAN_UTIL_VARIANT_BASE3(true, Is_Move_Assignable) + +KAZAN_UTIL_VARIANT_BASE4(false) +KAZAN_UTIL_VARIANT_BASE4(true) template struct Variant_is_in_place_index @@ -1393,23 +1389,23 @@ auto visit(Fn &&fn, Variants &&... variants) namespace std { template <> -struct hash +struct hash { - constexpr std::size_t operator()(vulkan_cpu::util::monostate) const noexcept + constexpr std::size_t operator()(kazan::util::monostate) const noexcept { return 5546275UL; } }; template -struct hash> +struct hash> { - constexpr std::size_t operator()(const vulkan_cpu::util::variant &v) const + constexpr std::size_t operator()(const kazan::util::variant &v) const { if(v.valueless_by_exception()) return 10285473UL; return v.index() * 1414729UL - + vulkan_cpu::util::visit( + + kazan::util::visit( [](const auto &v) -> std::size_t { return std::hash::type>()(v); @@ -1418,12 +1414,12 @@ struct hash> } }; -template ::is_swappable>::type> -inline void - swap(vulkan_cpu::util::variant &l, vulkan_cpu::util::variant &r) noexcept( - vulkan_cpu::util::detail::Variant_values::is_nothrow_swappable) +template < + typename... Types, + typename = + typename std::enable_if::is_swappable>::type> +inline void swap(kazan::util::variant &l, kazan::util::variant &r) noexcept( + kazan::util::detail::Variant_values::is_nothrow_swappable) { l.swap(r); } diff --git a/src/util/void_t.h b/src/util/void_t.h index 5aed59e..43c4723 100644 --- a/src/util/void_t.h +++ b/src/util/void_t.h @@ -24,7 +24,7 @@ #ifndef UTIL_VOID_T_H_ #define UTIL_VOID_T_H_ -namespace vulkan_cpu +namespace kazan { namespace util { diff --git a/src/vulkan/CMakeLists.txt b/src/vulkan/CMakeLists.txt index 1d232c1..3ef1a80 100644 --- a/src/vulkan/CMakeLists.txt +++ b/src/vulkan/CMakeLists.txt @@ -21,5 +21,5 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) set(sources vulkan.cpp api_objects.cpp) -add_library(vulkan_cpu_vulkan STATIC ${sources}) -target_compile_definitions(vulkan_cpu_vulkan PUBLIC VK_NO_PROTOTYPES) +add_library(kazan_vulkan STATIC ${sources}) +target_compile_definitions(kazan_vulkan PUBLIC VK_NO_PROTOTYPES) diff --git a/src/vulkan/api_objects.cpp b/src/vulkan/api_objects.cpp index 557bd64..1c140d7 100644 --- a/src/vulkan/api_objects.cpp +++ b/src/vulkan/api_objects.cpp @@ -24,7 +24,7 @@ #include "util/optional.h" #include -namespace vulkan_cpu +namespace kazan { namespace vulkan { diff --git a/src/vulkan/api_objects.h b/src/vulkan/api_objects.h index d3c5e03..151307b 100644 --- a/src/vulkan/api_objects.h +++ b/src/vulkan/api_objects.h @@ -32,7 +32,7 @@ #include #include -namespace vulkan_cpu +namespace kazan { namespace vulkan { @@ -41,7 +41,7 @@ enum class Supported_extension Not_supported, }; -vulkan_cpu_util_generate_enum_traits(Supported_extension, Supported_extension::Not_supported); +kazan_util_generate_enum_traits(Supported_extension, Supported_extension::Not_supported); typedef util::Enum_set Supported_extensions; @@ -152,7 +152,7 @@ struct Vulkan_physical_device .vendorID = 0x12345678UL, .deviceID = 0, .deviceType = VK_PHYSICAL_DEVICE_TYPE_CPU, - .deviceName = "Vulkan-CPU Device", + .deviceName = "Kazan Software Renderer", #warning calculate the correct value of pipelineCacheUUID as the hash of the target cpu info and the hashed source code .pipelineCacheUUID = {}, .limits = diff --git a/src/vulkan/util.h b/src/vulkan/util.h index 98edf17..3095e2c 100644 --- a/src/vulkan/util.h +++ b/src/vulkan/util.h @@ -27,7 +27,7 @@ #include "spirv/spirv.h" #include "util/enum.h" -namespace vulkan_cpu +namespace kazan { namespace vulkan { diff --git a/src/vulkan_icd/CMakeLists.txt b/src/vulkan_icd/CMakeLists.txt index 97d3826..35fecad 100644 --- a/src/vulkan_icd/CMakeLists.txt +++ b/src/vulkan_icd/CMakeLists.txt @@ -20,11 +20,11 @@ # cmake_minimum_required(VERSION 3.3 FATAL_ERROR) set(sources vulkan_icd.cpp) -add_library(vulkan_cpu_vulkan_icd MODULE ${sources}) -target_link_libraries(vulkan_cpu_vulkan_icd - vulkan_cpu_vulkan - vulkan_cpu_util) -file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vulkan_cpu_vulkan_icd.json INPUT ${CMAKE_CURRENT_SOURCE_DIR}/vulkan_cpu_vulkan_icd.json.in) +add_library(kazan_vulkan_icd MODULE ${sources}) +target_link_libraries(kazan_vulkan_icd + kazan_vulkan + kazan_util) +file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/kazan_vulkan_icd.json INPUT ${CMAKE_CURRENT_SOURCE_DIR}/kazan_vulkan_icd.json.in) if(UNIX AND NOT CYGWIN) - target_link_libraries(vulkan_cpu_vulkan_icd -Wl,--no-undefined) + target_link_libraries(kazan_vulkan_icd -Wl,--no-undefined) endif() diff --git a/src/vulkan_icd/vulkan_cpu_vulkan_icd.json.in b/src/vulkan_icd/kazan_vulkan_icd.json.in similarity index 58% rename from src/vulkan_icd/vulkan_cpu_vulkan_icd.json.in rename to src/vulkan_icd/kazan_vulkan_icd.json.in index 3dc5840..5b5e9bc 100644 --- a/src/vulkan_icd/vulkan_cpu_vulkan_icd.json.in +++ b/src/vulkan_icd/kazan_vulkan_icd.json.in @@ -1,7 +1,7 @@ { "file_format_version": "1.0.0", "ICD": { - "library_path": "$", + "library_path": "$", "api_version": "1.0.58" } } diff --git a/src/vulkan_icd/vulkan_icd.cpp b/src/vulkan_icd/vulkan_icd.cpp index 70ae76f..3393dfb 100644 --- a/src/vulkan_icd/vulkan_icd.cpp +++ b/src/vulkan_icd/vulkan_icd.cpp @@ -25,7 +25,7 @@ #include #include -using namespace vulkan_cpu; +using namespace kazan; #ifdef __ELF__ #define DLLEXPORT_ATTR(original_attributes) \ @@ -1319,7 +1319,7 @@ extern "C" VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer comma #warning finish implementing vkCmdExecuteCommands assert(!"vkCmdExecuteCommands is not implemented"); } -namespace vulkan_cpu +namespace kazan { namespace vulkan_icd { diff --git a/src/vulkan_icd/vulkan_icd.h b/src/vulkan_icd/vulkan_icd.h index 8f63728..df28c8e 100644 --- a/src/vulkan_icd/vulkan_icd.h +++ b/src/vulkan_icd/vulkan_icd.h @@ -40,7 +40,7 @@ extern "C" VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(Vk typedef PFN_vkVoidFunction (*VKAPI_PTR PFN_vk_icdGetInstanceProcAddr)(VkInstance instance, const char *pName); -namespace vulkan_cpu +namespace kazan { namespace vulkan_icd { -- 2.30.2