From 9b3e4da589c03bab471593bf9669644b5aade7ca Mon Sep 17 00:00:00 2001 From: ydog01 <1917927623@qq.com> Date: Tue, 4 Aug 2026 18:23:18 +0800 Subject: [PATCH] fixed Object reference --- include/gkit/core/object.hpp | 9 ++- {src => include/gkit}/core/object_pool.hpp | 1 + include/gkit/core/processer.hpp | 9 ++- include/gkit/core/unique_object.hpp | 6 +- include/gkit/core/value.hpp | 2 +- include/gkit/scene/unit.hpp | 55 ++++++++--------- src/core/object_pool.cpp | 2 +- src/core/processer.cpp | 14 +++-- src/core/reflect/registry.cpp | 1 - src/core/reflect/seralize.cpp | 2 +- src/core/unique_object.cpp | 21 ++++--- src/scene/unit.cpp | 68 +++++++++++++--------- test/core/test_value.cpp | 35 ++++++----- ~/gkit/log.txt | 20 +++++++ 14 files changed, 148 insertions(+), 97 deletions(-) rename {src => include/gkit}/core/object_pool.hpp (97%) create mode 100644 ~/gkit/log.txt diff --git a/include/gkit/core/object.hpp b/include/gkit/core/object.hpp index 87ec03e..0f2b77d 100644 --- a/include/gkit/core/object.hpp +++ b/include/gkit/core/object.hpp @@ -1,9 +1,9 @@ #pragma once +#include "gkit/core/object_id.hpp" + #include -#include #include -#include namespace gkit::core { class Object; @@ -39,5 +39,10 @@ namespace gkit::core { static auto create(Args&&...) noexcept -> UniqueObject; */ virtual auto class_name() const -> std::string final; + + [[nodiscard]] auto get_object_id() const noexcept -> const ObjectId& { return this->obj_id; } + + protected: + ObjectId obj_id; }; } // namespace gkit::core \ No newline at end of file diff --git a/src/core/object_pool.hpp b/include/gkit/core/object_pool.hpp similarity index 97% rename from src/core/object_pool.hpp rename to include/gkit/core/object_pool.hpp index 54815ea..2fba56e 100644 --- a/src/core/object_pool.hpp +++ b/include/gkit/core/object_pool.hpp @@ -28,6 +28,7 @@ namespace gkit::core { try { auto* obj_ptr = new T(std::forward(args)...); auto obj_id = ObjectIdAllocator::instance().new_one(); + obj_ptr->obj_id = obj_id; this->id_instance_map.emplace(obj_id, obj_ptr); return std::make_pair(std::move(obj_id), std::move(obj_ptr)); } catch (...) { diff --git a/include/gkit/core/processer.hpp b/include/gkit/core/processer.hpp index 79917e4..3eca6f8 100644 --- a/include/gkit/core/processer.hpp +++ b/include/gkit/core/processer.hpp @@ -3,7 +3,6 @@ #include "gkit/scene/unit.hpp" #include -#include #include #include @@ -17,12 +16,12 @@ namespace gkit { auto run() -> void; auto stop() -> void; - auto add_service_unit(std::string name, std::unique_ptr&& unit_ptr) noexcept -> void; - auto set_root(std::unique_ptr&& root_ptr) noexcept -> void; + auto add_service_unit(std::string name,core::UniqueObject&& unit_ptr) noexcept -> void; + auto set_root(core::UniqueObject&& root_ptr) noexcept -> void; private: - std::unique_ptr root; - std::unordered_map> service_units{}; + core::UniqueObject root; + std::unordered_map service_units{}; std::atomic running = false; }; // class Processer } // namespace gkit \ No newline at end of file diff --git a/include/gkit/core/unique_object.hpp b/include/gkit/core/unique_object.hpp index 5253a1b..9b33856 100644 --- a/include/gkit/core/unique_object.hpp +++ b/include/gkit/core/unique_object.hpp @@ -1,6 +1,6 @@ #pragma once -#include "core/object_pool.hpp" +#include "gkit/core/object_pool.hpp" #include "gkit/core/object.hpp" #include "object_id.hpp" @@ -10,7 +10,6 @@ namespace gkit::core { class UniqueObject final { Object* obj = nullptr; - ObjectId id; UniqueObject() = default; @@ -23,7 +22,7 @@ namespace gkit::core { [[nodiscard]] auto get() -> Object* { return this->obj; } [[nodiscard]] auto get() const -> const Object* { return this->obj; } - [[nodiscard]] inline auto get_id() const -> const ObjectId& { return this->id; } + [[nodiscard]] auto get_id() const noexcept -> const ObjectId&; template static auto create(Args&&... args) noexcept -> UniqueObject; @@ -36,7 +35,6 @@ namespace gkit::core { auto& obj_pool = ObjectPool::instance(); auto obj_opt = obj_pool.create(std::forward(args)...); if (obj_opt.has_value()) { - uobj.id = obj_opt->first; uobj.obj = obj_opt->second; } diff --git a/include/gkit/core/value.hpp b/include/gkit/core/value.hpp index d0e48ff..ad27aaf 100644 --- a/include/gkit/core/value.hpp +++ b/include/gkit/core/value.hpp @@ -80,7 +80,7 @@ namespace gkit::core { class Value final { public: /** - * @brief Variant storage backing the Value. Object is held via std::unique_ptr + * @brief Variant storage backing the Value. Object is held via gkit::core::UniqueObject * for exclusive ownership and automatic lifetime management. */ using Storage = std::variant; diff --git a/include/gkit/scene/unit.hpp b/include/gkit/scene/unit.hpp index 3ab5e5a..4f4f976 100644 --- a/include/gkit/scene/unit.hpp +++ b/include/gkit/scene/unit.hpp @@ -1,12 +1,14 @@ #pragma once #include "gkit/core/object.hpp" +#include "gkit/core/object_id.hpp" #include "gkit/core/reflect/registry.hpp" +#include "gkit/core/unique_object.hpp" #include #include #include -#include +#include #include #include #include @@ -32,9 +34,9 @@ namespace gkit::scene { * class Unit * @brief This is the gkit application unit. It is the basic unit of program composition. * @note This class cannot be copied and constructed externally. If you want to create a unit, - * you should use the function @ref gkit::core::scene::Unit::create(). + * you should use the function @ref gkit::core::UniqueObject::create(). * - * If you want to move an Unit instance, you should move with the std::unique_ptr by std::move(). + * If you want to move an Unit instance, you should move with the gkit::core::UniqueObject by std::move(). */ class Unit : public gkit::core::Object { static gkit::core::reflect::RegistHolder register_holder; @@ -103,7 +105,7 @@ namespace gkit::scene { * be available after call @ref update_index_cache(), which will be happened when * @ref process_handler() is called. */ - auto add_child(std::unique_ptr&& child_ptr) -> void; + auto add_child(core::UniqueObject&& child_ptr) -> void; /** * @brief Remove a child unit by index @@ -130,7 +132,7 @@ namespace gkit::scene { /** * It is not use in the current version. */ - // auto remove_child(std::unique_ptr& child_ptr) noexcept -> void; + // auto remove_child(core::UniqueObject& child_ptr) noexcept -> void; /** * @brief Get the number of children @@ -188,28 +190,28 @@ namespace gkit::scene { protected: // propertries std::string name; - Unit* parent = nullptr; + core::ObjectId parent; private: // children management mutable std::mutex children_mutex{}; - std::unordered_map name_map_cache{}; - std::vector> children{}; + std::unordered_map name_map_cache{}; + std::vector children{}; /** - * @brief Get child pointer by index. + * @brief Get child id by index. * @param index The index of the child. - * @return Unit* - * If the index is valid, return the pointer to the child; otherwise return nullptr. + * @return core::ObjectId + * If the index is valid, return the id of the child; otherwise return invalid ObjectId. */ - auto get_child(uint32_t index) noexcept -> Unit*; + auto get_child(uint32_t index) noexcept -> core::ObjectId; /** - * @brief Get child pointer by name. + * @brief Get child id by name. * @param child_name The name of the child. - * @return Unit* - * If the child exists in name cache, return the pointer; otherwise return nullptr. + * @return core::ObjectId + * If the child exists in name cache, return the id; otherwise return invalid ObjectId. */ - auto get_child(const std::string& child_name) noexcept -> Unit*; + auto get_child(const std::string& child_name) noexcept -> core::ObjectId; /** * @brief Drop all children which are marked ready to drop. @@ -226,19 +228,20 @@ namespace gkit::scene { class UnitIterator { public: // NOLINTBEGIN(readability-identifier-naming) - using value_type = Unit; - using difference_type = std::ptrdiff_t; - using pointer = std::conditional_t; - using reference = std::conditional_t; + using iterator_category = std::bidirectional_iterator_tag; + using value_type = Unit; + using difference_type = std::ptrdiff_t; + using pointer = std::conditional_t; + using reference = std::conditional_t; // NOLINTEND(readability-identifier-naming) private: - const Unit* m_owner; + const core::ObjectId m_owner; size_t m_pos; public: UnitIterator() = default; - UnitIterator(const Unit* owner, size_t pos); + UnitIterator(const core::ObjectId owner, size_t pos); auto operator*() const -> reference; auto operator->() const -> pointer; auto operator++() -> UnitIterator&; @@ -278,7 +281,7 @@ namespace gkit::scene { template auto Unit::with_child(uint32_t index, const F& func, Args&&... args) -> std::invoke_result_t { - auto* child_ptr = get_child(index); + auto child_ptr = core::ObjectPool::instance().deref_from(get_child(index)); if (child_ptr == nullptr) { throw std::out_of_range("Child index is out of range"); } @@ -293,7 +296,7 @@ namespace gkit::scene { template auto Unit::with_child(const std::string& child_name, const F& func, Args&&... args) -> std::invoke_result_t { - auto child_ptr = get_child(child_name); + auto child_ptr = core::ObjectPool::instance().deref_from(get_child(child_name)); if (child_ptr == nullptr) { throw std::out_of_range("Child name is not found"); } @@ -308,8 +311,8 @@ namespace gkit::scene { template auto Unit::get_parent() noexcept -> std::optional> { static_assert(std::is_base_of_v, "T is not derived from Unit"); - if (parent == nullptr) return std::nullopt; - auto cast_parent = dynamic_cast(parent); + if (parent == core::ObjectId{}) return std::nullopt; + auto cast_parent = dynamic_cast(core::ObjectPool::instance().deref_from(parent)); return cast_parent == nullptr ? std::nullopt : *cast_parent; } // Unit::get_parent } // namespace gkit::scene diff --git a/src/core/object_pool.cpp b/src/core/object_pool.cpp index 8ff736b..b87a7da 100644 --- a/src/core/object_pool.cpp +++ b/src/core/object_pool.cpp @@ -1,4 +1,4 @@ -#include "core/object_pool.hpp" +#include "gkit/core/object_pool.hpp" #include "gkit/core/object.hpp" #include "gkit/core/object_id.hpp" diff --git a/src/core/processer.cpp b/src/core/processer.cpp index d5f8293..66c9dae 100644 --- a/src/core/processer.cpp +++ b/src/core/processer.cpp @@ -6,7 +6,7 @@ #include #include -gkit::Processer::Processer() noexcept : root() { +gkit::Processer::Processer() noexcept : root(gkit::core::UniqueObject::create()) { SDL_InitFlags flags = SDL_INIT_AUDIO | SDL_INIT_EVENTS | SDL_INIT_GAMEPAD | SDL_INIT_JOYSTICK | SDL_INIT_VIDEO; if (!SDL_Init(flags)) { @@ -19,16 +19,18 @@ gkit::Processer::~Processer() noexcept { SDL_Quit(); } -auto gkit::Processer::set_root(std::unique_ptr&& root_ptr) noexcept -> void { - if (root_ptr == nullptr) return; - this->root = std::move(root_ptr); +auto gkit::Processer::set_root(core::UniqueObject&& root_p) noexcept -> void { + auto root_ptr = root_p.get(); + if (!root_ptr) return; + this->root = std::move(root_p); } auto gkit::Processer::run() -> void { - this->root->ready_handler(); + auto root_ptr = dynamic_cast(this->root.get()); + root_ptr->ready_handler(); this->running.store(true); while (this->running.load()) { - this->root->process_handler(); + root_ptr->process_handler(); } } diff --git a/src/core/reflect/registry.cpp b/src/core/reflect/registry.cpp index d7e4ae4..a1acc6d 100644 --- a/src/core/reflect/registry.cpp +++ b/src/core/reflect/registry.cpp @@ -3,7 +3,6 @@ #include "gkit/core/unique_object.hpp" #include -#include namespace gkit::core::reflect { diff --git a/src/core/reflect/seralize.cpp b/src/core/reflect/seralize.cpp index 2a7c40a..fdbba8a 100644 --- a/src/core/reflect/seralize.cpp +++ b/src/core/reflect/seralize.cpp @@ -1,7 +1,7 @@ #include "core/reflect/seralize.hpp" -#include "core/object_pool.hpp" #include "gkit/core/object_id.hpp" +#include "gkit/core/object_pool.hpp" #include "gkit/core/reflect/registry.hpp" #include "gkit/core/value.hpp" diff --git a/src/core/unique_object.cpp b/src/core/unique_object.cpp index e7d3252..5a91ac3 100644 --- a/src/core/unique_object.cpp +++ b/src/core/unique_object.cpp @@ -1,8 +1,8 @@ #include "gkit/core/unique_object.hpp" #include "gkit/core/object_id.hpp" +#include "gkit/core/object_pool.hpp" #include "gkit/core/reflect/registry.hpp" -#include "object_pool.hpp" #include #include @@ -12,24 +12,31 @@ namespace gkit::core { return reflect::ClassDB::instance().create(class_name); } - UniqueObject::UniqueObject(UniqueObject&& other) noexcept : id(std::move(other.id)) { + auto UniqueObject::get_id() const noexcept -> const ObjectId& { + static const ObjectId invalid_id{}; + return this->obj == nullptr ? invalid_id : this->obj->get_object_id(); + } + + UniqueObject::UniqueObject(UniqueObject&& other) noexcept { this->obj = other.obj; other.obj = nullptr; } UniqueObject::~UniqueObject() noexcept { + if (this->obj == nullptr) return; auto& obj_pool = ObjectPool::instance(); - obj_pool.release(this->id); + obj_pool.release(this->obj->get_object_id()); } auto UniqueObject::operator=(UniqueObject&& other) noexcept -> UniqueObject& { if (this != &other) { - auto& obj_pool = ObjectPool::instance(); - obj_pool.release(this->id); - this->id = std::move(other.id); + if (this->obj != nullptr) { + auto& obj_pool = ObjectPool::instance(); + obj_pool.release(this->obj->get_object_id()); + } this->obj = other.obj; other.obj = nullptr; } return *this; } -} // namespace gkit::core \ No newline at end of file +} // namespace gkit::core diff --git a/src/scene/unit.cpp b/src/scene/unit.cpp index 5f5d69a..148db6b 100644 --- a/src/scene/unit.cpp +++ b/src/scene/unit.cpp @@ -1,8 +1,8 @@ #include "gkit/scene/unit.hpp" +#include "gkit/core/object_id.hpp" #include #include -#include #include #include #include @@ -30,7 +30,8 @@ namespace gkit::scene { auto Unit::ready_handler() noexcept -> void { std::unique_lock lock(this->children_mutex); - for (auto& child_ptr : this->children) { + for (auto& child_p : this->children) { + auto child_ptr =dynamic_cast(child_p.get()); if (child_ptr == nullptr) continue; child_ptr->ready_handler(); } @@ -39,7 +40,8 @@ namespace gkit::scene { auto Unit::process_handler() noexcept -> void { std::unique_lock lock(this->children_mutex); - for (auto& child_ptr : this->children) { + for (auto& child_p : this->children) { + auto child_ptr =dynamic_cast(child_p.get()); if (child_ptr == nullptr || !child_ptr->process_enabled) continue; child_ptr->process_handler(); } @@ -51,14 +53,16 @@ namespace gkit::scene { auto Unit::exit_handler() noexcept -> void { std::unique_lock lock(this->children_mutex); - for (auto& child_ptr : this->children) { + for (auto& child_p : this->children) { + auto child_ptr =dynamic_cast(child_p.get()); if (child_ptr == nullptr) continue; child_ptr->exit_handler(); } this->exit(); } - auto Unit::add_child(std::unique_ptr&& child_ptr) -> void { + auto Unit::add_child(core::UniqueObject&& child_p) -> void { + auto child_ptr = dynamic_cast(child_p.get()); if (child_ptr == nullptr) { throw std::invalid_argument("child_ptr is nullptr"); } @@ -70,85 +74,91 @@ namespace gkit::scene { child_ptr->ready(); { std::unique_lock lock(this->children_mutex); - auto& child_name = this->children.back()->name; - auto& new_child_ptr = this->children.back(); - if (this->name_map_cache.contains(child_name)) { + if (this->name_map_cache.contains(child_ptr->name)) { throw std::invalid_argument("child_ptr name is already exist"); } - this->name_map_cache.emplace(std::make_pair(child_name, new_child_ptr.get())); + child_ptr->parent = this->get_object_id(); + this->children.push_back(std::move(child_p)); + this->name_map_cache.emplace(child_ptr->name, this->children.back().get_id()); } } auto Unit::remove_child(uint32_t index) noexcept -> void { - auto child_ptr = this->get_child(index); + auto child_ptr = dynamic_cast(core::ObjectPool::instance().deref_from(this->get_child(index))); if (child_ptr == nullptr) return; child_ptr->ready_to_drop(); } auto Unit::remove_child(const std::string& child_name) noexcept -> void { - auto child_ptr = this->get_child(child_name); + auto child_ptr = dynamic_cast(core::ObjectPool::instance().deref_from(this->get_child(child_name))); if (child_ptr == nullptr) return; child_ptr->ready_to_drop(); } - auto Unit::get_child(uint32_t index) noexcept -> Unit* { + auto Unit::get_child(uint32_t index) noexcept -> core::ObjectId { std::unique_lock lock(this->children_mutex); if (index >= this->children.size()) { - return nullptr; + return core::ObjectId{}; } - return this->children[index].get(); + return this->children[index].get_id(); } - auto Unit::get_child(const std::string& child_name) noexcept -> Unit* { + auto Unit::get_child(const std::string& child_name) noexcept -> core::ObjectId { std::unique_lock lock(this->children_mutex); auto iter = this->name_map_cache.find(child_name); if (iter == this->name_map_cache.end()) { - return nullptr; + return core::ObjectId{}; } return iter->second; } auto Unit::drop_children() -> void { - std::vector> to_exit; + std::vector to_exit; to_exit.reserve(this->children.size() / 2); - std::erase_if(this->children, [&](std::unique_ptr& p) -> bool { + std::erase_if(this->children, [&](core::UniqueObject& p_origin) -> bool { + auto p = dynamic_cast(p_origin.get()); if (p && p->drop_flag.load() == true) { { std::unique_lock lock(this->children_mutex); this->name_map_cache.erase(p->name); } - to_exit.push_back(std::move(p)); + to_exit.push_back(std::move(p_origin)); return true; } return false; }); - for (auto& child : to_exit) { + for (auto& ch : to_exit) { + auto child = dynamic_cast(ch.get()); child->exit_handler(); } } template<> auto Unit::get_parent() noexcept -> std::optional> { - if (parent == nullptr) return std::nullopt; - return std::ref(*parent); + if (parent == core::ObjectId{}) return std::nullopt; + auto* parent_ptr = dynamic_cast(core::ObjectPool::instance().deref_from(parent)); + if (parent_ptr == nullptr) return std::nullopt; + return std::ref(*parent_ptr); } // UnitIterator template - Unit::UnitIterator::UnitIterator(const Unit* owner, size_t pos) : m_owner(owner), m_pos(pos) {} + Unit::UnitIterator::UnitIterator(const core::ObjectId owner, size_t pos) : m_owner(owner), m_pos(pos) {} template auto Unit::UnitIterator::operator*() const -> reference { - return *const_cast(m_owner)->get_child(static_cast(m_pos)); + auto* owner = dynamic_cast(core::ObjectPool::instance().deref_from(m_owner)); + return owner->get_child(static_cast(m_pos)); } template auto Unit::UnitIterator::operator->() const -> pointer { - return const_cast(m_owner)->get_child(static_cast(m_pos)); + auto* owner = dynamic_cast(core::ObjectPool::instance().deref_from(m_owner)); + return owner->get_child(static_cast(m_pos)); } template @@ -186,16 +196,16 @@ namespace gkit::scene { template class Unit::UnitIterator; auto Unit::begin() -> iterator { - return iterator(this, 0); + return iterator(this->get_object_id(), 0); } auto Unit::end() -> iterator { - return iterator(this, children.size()); + return iterator(this->get_object_id(), children.size()); } auto Unit::begin() const -> const_iterator { - return const_iterator(this, 0); + return const_iterator(this->get_object_id(), 0); } auto Unit::end() const -> const_iterator { - return const_iterator(this, children.size()); + return const_iterator(this->get_object_id(), children.size()); } auto Unit::cbegin() const -> const_iterator { return begin(); diff --git a/test/core/test_value.cpp b/test/core/test_value.cpp index 714d5a8..621f71b 100644 --- a/test/core/test_value.cpp +++ b/test/core/test_value.cpp @@ -1,5 +1,6 @@ -/* // NOLINTBEGIN(google-readability-avoid-underscore-in-googletest-name) -#include "core/object_pool.hpp" + // NOLINTBEGIN(google-readability-avoid-underscore-in-googletest-name) +#include "gkit/core/object_pool.hpp" +#include "gkit/core/reflect/registry.hpp" #include "gkit/core/value.hpp" #include @@ -190,7 +191,7 @@ auto test_safe_object_handling() -> bool { std::cout << "\n=== test_safe_object_handling ===\n"; // UniqueObject via string constructor → is_object_owner - Value v_owner{UniqueObject(std::string("TestObject"))}; + Value v_owner{*UniqueObject::create_with_classname(std::string("TestObject"))}; TEST(v_owner.is_object(), "UniqueObject: is_object"); TEST(v_owner.is_object_owner(), "UniqueObject: is_object_owner"); TEST(!v_owner.is_object_ref(), "UniqueObject: !is_object_ref"); @@ -199,12 +200,12 @@ auto test_safe_object_handling() -> bool { ObjectId owned_id = v_owner.as_object(); TEST(owned_id.available(), "as_object → valid ObjectId"); - // as_object_ptr → nullptr (no actual object in pool for string-constructed UniqueObject) - TEST(v_owner.as_object_ptr() == nullptr, "as_object_ptr with empty pool → nullptr"); + // as_object_ptr → non-null (backed by a real pool object) + TEST(v_owner.as_object_ptr() != nullptr, "as_object_ptr with registered class → non-null"); - // try_as on UniqueObject with no backing object → nullptr - auto* empty_try = v_owner.try_as(); - TEST(empty_try == nullptr, "try_as on UniqueObject with no backing ptr → nullptr"); + // try_as on UniqueObject backed by real object → valid pointer + auto* owned_ptr = v_owner.try_as(); + TEST(owned_ptr != nullptr, "try_as on UniqueObject with backing ptr → non-null"); // Create a real object via ObjectPool for valid pointer tests { @@ -396,7 +397,7 @@ auto test_lifetime_safety() -> bool { // Copy Value with UniqueObject → logic_error { - UniqueObject uo(std::string("CopyTest")); + UniqueObject uo{*UniqueObject::create_with_classname(std::string("CopyTest"))}; Value vo(std::move(uo)); bool caught_logic_copy = false; try { @@ -410,7 +411,7 @@ auto test_lifetime_safety() -> bool { // Copy assign Value with UniqueObject → logic_error { - UniqueObject uo(std::string("CopyAssignTest")); + UniqueObject uo{*UniqueObject::create_with_classname(std::string("CopyAssignTest"))}; Value vo(std::move(uo)); Value dest; bool caught_logic_assign = false; @@ -424,7 +425,7 @@ auto test_lifetime_safety() -> bool { // Move Value with UniqueObject → succeeds { - UniqueObject uo(std::string("MoveTest")); + UniqueObject uo{*UniqueObject::create_with_classname(std::string("MoveTest"))}; Value vo(std::move(uo)); TEST(vo.is_object_owner(), "Move: source is_object_owner"); @@ -457,10 +458,16 @@ auto test_lifetime_safety() -> bool { TEST(v_map_insert["new_key"].as_int64() == 99, "Map operator[]: inserted value == 99"); return true; -} */ +} auto main() -> int { - /* bool all_passed = true; + auto& db = gkit::core::reflect::ClassDB::instance(); + db.regist("TestObject"); + db.regist("CopyTest"); + db.regist("CopyAssignTest"); + db.regist("MoveTest"); + + bool all_passed = true; all_passed &= test_store_values(); all_passed &= test_set_values(); @@ -474,7 +481,7 @@ auto main() -> int { return 0; } - std::cerr << "\nSome tests failed.\n"; */ + std::cerr << "\nSome tests failed.\n"; return 1; } // NOLINTEND(google-readability-avoid-underscore-in-googletest-name) diff --git a/~/gkit/log.txt b/~/gkit/log.txt new file mode 100644 index 0000000..7bb9332 --- /dev/null +++ b/~/gkit/log.txt @@ -0,0 +1,20 @@ +[INFO] Parsing shader: E:/code/github/libgkit/test/graphic\graphic\color_triangle.shader +[ERROR] No vertex shader found in: E:/code/github/libgkit/test/graphic\graphic\color_triangle.shader +[ERROR] No fragment shader found in: E:/code/github/libgkit/test/graphic\graphic\color_triangle.shader +[INFO] +[INFO] +[ERROR] Failed to link shader program: Vertex info +----------- +(0) : error C5145: must write to gl_Position + +[INFO] Parsing shader: E:/code/github/libgkit/test/graphic\graphic\post_process.shader +[ERROR] No vertex shader found in: E:/code/github/libgkit/test/graphic\graphic\post_process.shader +[ERROR] No fragment shader found in: E:/code/github/libgkit/test/graphic\graphic\post_process.shader +[INFO] +[INFO] +[ERROR] Failed to link shader program: Vertex info +----------- +(0) : error C5145: must write to gl_Position + +[INFO] FRAMEBUFFER:: Framebuffer is complete! +[WARNING] Warning: uniform 'screenTexture' doesn't exist!