code
stringlengths
0
56.1M
repo_name
stringlengths
3
57
path
stringlengths
2
176
language
stringclasses
672 values
license
stringclasses
8 values
size
int64
0
56.8M
#include "indexed_model.hpp" #include <glm/glm.hpp> using namespace ZN; void IndexedModel::add_position(glm::vec3 pos) { m_positions.emplace_back(std::move(pos)); } void IndexedModel::add_normal(glm::vec3 norm) { m_normals.emplace_back(std::move(norm)); } void IndexedModel::add_tangent(glm::vec3 tan) { m_tangen...
whupdup/frame
real/asset/indexed_model.cpp
C++
gpl-3.0
1,842
#pragma once #include <glm/vec2.hpp> #include <glm/vec3.hpp> #include <cstdint> #include <vector> namespace ZN { class IndexedModel final { public: explicit IndexedModel() = default; IndexedModel(IndexedModel&&) = default; IndexedModel& operator=(IndexedModel&&) = default; IndexedModel(const IndexedMode...
whupdup/frame
real/asset/indexed_model.hpp
C++
gpl-3.0
1,042
#include "obj_loader.hpp" #include <asset/indexed_model.hpp> #include <file/file_system.hpp> #include <charconv> #include <unordered_map> #include <cctype> #include <cstdio> using namespace ZN; namespace ZN::OBJ { struct VertexIndices { uint32_t values[3]; bool operator==(const VertexIndices& other) const { ...
whupdup/frame
real/asset/obj_loader.cpp
C++
gpl-3.0
6,006
#pragma once #include <string_view> namespace ZN { class IndexedModel; } namespace ZN::OBJ { using LoadCallback = void(const std::string_view&, IndexedModel&&); void load(const char* fileName, LoadCallback* callback); }
whupdup/frame
real/asset/obj_loader.hpp
C++
gpl-3.0
227
target_sources(LibCommon PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/logging.cpp" #"${CMAKE_CURRENT_SOURCE_DIR}/profiler.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/system_info.cpp" ) if (CMAKE_USE_WIN32_THREADS_INIT) target_sources(LibCommon PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/threading_win32.cpp" ) elseif (CMAKE_USE_PTHREADS...
whupdup/frame
real/core/CMakeLists.txt
Text
gpl-3.0
427
#pragma once #include <initializer_list> namespace ZN { template <typename T> constexpr T max(std::initializer_list<T> iList) { auto largest = iList.begin(); for (auto it = largest + 1, end = iList.end(); it != end; ++it) { if (*it > *largest) { largest = it; } } return *largest; } }
whupdup/frame
real/core/algorithms.hpp
C++
gpl-3.0
303
#pragma once #include <core/common.hpp> namespace ZN { // https://awesomekling.github.io/Serenity-C++-patterns-The-Badge/ template <typename T> class Badge { public: using type = T; private: friend T; constexpr Badge() = default; NULL_COPY_AND_ASSIGN(Badge); }; }
whupdup/frame
real/core/badge.hpp
C++
gpl-3.0
281
#pragma once #include <cstddef> namespace ZN { class OutputStream { public: virtual size_t write(const void* buffer, size_t size) = 0; virtual ~OutputStream() = default; }; class InputStream { public: virtual int get() = 0; virtual size_t read(void* buffer, size_t size) = 0; virtual const void* get_bu...
whupdup/frame
real/core/base_stream.hpp
C++
gpl-3.0
458
#pragma once #include <cstdint> #include <cstddef> namespace ZN { enum class IterationDecision { CONTINUE, BREAK }; } #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WIN64) #define OPERATING_SYSTEM_WINDOWS #elif defined(__linux__) #define OPERATING_SYSTEM_LINUX #elif d...
whupdup/frame
real/core/common.hpp
C++
gpl-3.0
1,605
#pragma once #include <cstdint> #include <functional> namespace ZN::Event { template <typename... Args> class Dispatcher { public: using function_type = void(Args...); Dispatcher() = default; Dispatcher(Dispatcher&& other) noexcept : m_head(other.m_head) { other.m_head = nullptr; } Dispatcher& o...
whupdup/frame
real/core/events.hpp
C++
gpl-3.0
1,774
#pragma once #include <cstddef> #include <iterator> namespace ZN { template <typename T, size_t N> struct FixedArray { using value_type = T; using size_type = size_t; using difference_type = ptrdiff_t; using reference = value_type&; using const_reference = const value_type&; using pointer = value_type*; usin...
whupdup/frame
real/core/fixed_array.hpp
C++
gpl-3.0
1,956
#pragma once #include <cstddef> namespace ZN { template <typename T, size_t N> struct BasicFixedString { constexpr BasicFixedString(const T (&src)[N]) { for (size_t i = 0; i < N; ++i) { m_data[i] = src[i]; } } T m_data[N] = {}; constexpr operator const T*() const { return m_data; } }; template <size...
whupdup/frame
real/core/fixed_string.hpp
C++
gpl-3.0
377
#pragma once #include <core/memory.hpp> #include <iterator> #include <type_traits> namespace ZN { template <typename T, size_t Capacity> class FixedVector { public: using value_type = T; using size_type = size_t; using difference_type = ptrdiff_t; using reference = value_type&; using const_reference = co...
whupdup/frame
real/core/fixed_vector.hpp
C++
gpl-3.0
4,186
#pragma once #include <cstdint> namespace ZN { class HashBuilder { public: using Hash_T = uint64_t; constexpr HashBuilder& add_uint32(uint32_t value) { m_hash = static_cast<Hash_T>(m_hash * 0x100000001B3ull) ^ static_cast<Hash_T>(value); return *this; } constexpr HashBuilder& add_int32(int32_t value...
whupdup/frame
real/core/hash_builder.hpp
C++
gpl-3.0
1,806
#pragma once #include <core/common.hpp> #include <atomic> #include <memory> #include <utility> namespace ZN::Memory { class SingleThreadCounter { public: void add_ref() { ++m_count; } bool release() { --m_count; return m_count == 0; } private: size_t m_count = 1; }; class MultiThreadCounter {...
whupdup/frame
real/core/intrusive_ptr.hpp
C++
gpl-3.0
5,721
#pragma once #include <cassert> #include <cstdint> #include <new> #include <utility> namespace ZN { template <typename T> class Local { public: Local() noexcept = default; Local(const Local&) = delete; void operator=(const Local&) = delete; Local(Local&&) = delete; void operator=(Local&&) = delete; ...
whupdup/frame
real/core/local.hpp
C++
gpl-3.0
1,110
#include "logging.hpp" #include <core/threading.hpp> #include <cstdarg> #include <cstdio> using namespace ZN; static const char* LOG_LEVEL_STRING[] = { "ERROR", "WARNING", "DEBUG", "TEMP" }; /*#ifdef NDEBUG static LogLevel g_logLevel = LOG_LEVEL_ERROR; #else static LogLevel g_logLevel = LOG_LEVEL_TEMP; #endif*...
whupdup/frame
real/core/logging.cpp
C++
gpl-3.0
878
#pragma once namespace ZN { enum class LogLevel { ERROR = 0, WARNING, DEBUG, TEMP, COUNT }; } #define LOG(level, category, fmt, ...) \ ZN::log_format(level, category, __FILE__, __LINE__, fmt, ##__VA_ARGS__) #define LOG_ERROR(category, fmt, ...) \ LOG(ZN::LogLevel::ERROR, category, fmt, ##__VA_ARGS__) #defi...
whupdup/frame
real/core/logging.hpp
C++
gpl-3.0
1,012
#pragma once #include <memory> namespace ZN::Memory { using std::construct_at; using std::uninitialized_move; using std::uninitialized_move_n; using std::uninitialized_copy; using std::uninitialized_copy_n; using std::uninitialized_default_construct; using std::uninitialized_default_construct_n; using std::destroy; ...
whupdup/frame
real/core/memory.hpp
C++
gpl-3.0
524
#pragma once namespace ZN { template <typename K, typename V> struct Pair { K first; V second; }; template <typename K, typename V> Pair(K, V) -> Pair<K, V>; }
whupdup/frame
real/core/pair.hpp
C++
gpl-3.0
167
#pragma once #include <core/memory.hpp> #include <cassert> #include <cstdlib> namespace ZN { template <typename T> class Queue; template <typename T> struct QueueIterator { using container_type = Queue<T>; using value_type = T; using reference = T&; using size_type = size_t; using difference_type = ptrdiff_t;...
whupdup/frame
real/core/queue.hpp
C++
gpl-3.0
4,666
#pragma once #include <core/intrusive_ptr.hpp> namespace ZN { template <typename MutexType> class ScopedLock final { public: explicit ScopedLock(MutexType& mutex) : m_mutex(mutex.reference_from_this()) , m_locked(false) { lock(); } ~ScopedLock() { unlock(); } NULL_COPY_AND_ASSIGN(ScopedLoc...
whupdup/frame
real/core/scoped_lock.hpp
C++
gpl-3.0
804
#pragma once #include <cstddef> #include <iterator> namespace ZN { template <typename T> class Span { public: using value_type = T; using size_type = size_t; using difference_type = ptrdiff_t; using reference = value_type&; using const_reference = const value_type&; using pointer = value_type*; using...
whupdup/frame
real/core/span.hpp
C++
gpl-3.0
2,296
#include "system_info.hpp" #include <core/common.hpp> using namespace ZN; #if defined(OPERATING_SYSTEM_WINDOWS) #define WIN32_LEAN_AND_MEAN #include <windows.h> static SYSTEM_INFO g_systemInfo; static bool g_initialized = false; static void try_init_system_info(); uint32_t SystemInfo::get_num_processors() { try...
whupdup/frame
real/core/system_info.cpp
C++
gpl-3.0
993
#pragma once #include <cstddef> #include <cstdint> namespace ZN::SystemInfo { uint32_t get_num_processors(); size_t get_page_size(); }
whupdup/frame
real/core/system_info.hpp
C++
gpl-3.0
140
#pragma once #include <core/scoped_lock.hpp> namespace ZN::OS { using ThreadProc = void(void*); class Thread; class Mutex; class ConditionVariable; struct ThreadDeletor { void operator()(Thread*) const noexcept; }; class Thread : public Memory::IntrusivePtrEnabled<Thread, ThreadDeletor, Memory::MultiThreadCoun...
whupdup/frame
real/core/threading.hpp
C++
gpl-3.0
1,583
#include "threading.hpp" #include <pthread.h> #include <sched.h> #include <unistd.h> using namespace ZN; using namespace ZN::OS; namespace ZN::OS { struct ThreadImpl final : public Thread { pthread_t handle; ThreadProc* proc; void* userData; }; struct MutexImpl final : public Mutex { pthread_mutex_t handle; };...
whupdup/frame
real/core/threading_pthread.cpp
C++
gpl-3.0
4,249
#include "threading.hpp" #define WIN32_LEAN_AND_MEAN #ifdef _WIN32_WINNT #undef _WIN32_WINNT #endif #define _WIN32_WINNT 0x0600 // Vista #include <windows.h> #include <synchapi.h> using namespace ZN; using namespace ZN::OS; namespace ZN::OS { struct ThreadImpl final : public Thread { HANDLE handle; DWORD thread...
whupdup/frame
real/core/threading_win32.cpp
C++
gpl-3.0
3,432
#pragma once #include <core/algorithms.hpp> #include <core/common.hpp> #include <cassert> #include <new> #include <type_traits> #include <utility> namespace ZN { template <typename... Types> class Variant { public: static_assert(sizeof...(Types) < 255, "Cannot have more than 255 types in one variant"); using...
whupdup/frame
real/core/variant.hpp
C++
gpl-3.0
7,299
target_sources(LibCommon PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/file_system.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/os_file.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/os_file_system.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/passthrough_file_system.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/path_utils.cpp" )
whupdup/frame
real/file/CMakeLists.txt
Text
gpl-3.0
281
#pragma once #include <core/base_stream.hpp> namespace ZN { class InputFile : public InputStream {}; class OutputFile : public OutputStream {}; }
whupdup/frame
real/file/file.hpp
C++
gpl-3.0
152
#include "file_system.hpp" #include <file/file.hpp> #include <file/os_file_system.hpp> #include <file/passthrough_file_system.hpp> #include <file/path_utils.hpp> using namespace ZN; static std::unique_ptr<OSFileSystem> create_resource_directory_backend( const std::string_view& execFolder, const std::string_view& t...
whupdup/frame
real/file/file_system.cpp
C++
gpl-3.0
5,660
#pragma once #include <core/common.hpp> #include <core/local.hpp> #include <core/memory.hpp> #include <unordered_map> #include <string> #include <string_view> #include <vector> namespace ZN { enum class PathType : uint8_t { FILE, DIRECTORY, SPECIAL }; struct Path { std::string name; PathType type; }; struct ...
whupdup/frame
real/file/file_system.hpp
C++
gpl-3.0
2,179
#include "os_file.hpp" #include <cassert> #include <cstdio> using namespace ZN; #if defined(OPERATING_SYSTEM_WINDOWS) static FILE* open_file(const char* path, const char* mode) { FILE* result; if (fopen_s(&result, path, mode) == 0) { return result; } return nullptr; } #else #define open_file fopen #endif ...
whupdup/frame
real/file/os_file.cpp
C++
gpl-3.0
2,187
#pragma once #include <core/common.hpp> #include <file/file.hpp> namespace ZN { class OSInputFile final : public InputFile { public: OSInputFile(); ~OSInputFile(); NULL_COPY_AND_ASSIGN(OSInputFile); [[nodiscard]] bool open(const char* path); void close(); bool is_open() const; int get() override; ...
whupdup/frame
real/file/os_file.hpp
C++
gpl-3.0
961
#include "os_file_system.hpp" #include <file/os_file.hpp> #include <file/path_utils.hpp> using namespace ZN; bool OSFileSystem::get_file_stats(const std::string_view& path, FileStats& fileStats) { auto joinedPath = PathUtils::join(m_base, path); return global_get_file_stats(joinedPath.c_str(), fileStats); } bool ...
whupdup/frame
real/file/os_file_system.cpp
C++
gpl-3.0
5,262
#pragma once #include <file/file_system.hpp> namespace ZN { class OSFileSystem final : public FileSystemBackend { public: static bool global_get_file_stats(const char* path, FileStats& fileStats); static bool global_file_exists(const char* path); static bool global_create_directory(const char* path); OSFil...
whupdup/frame
real/file/os_file_system.hpp
C++
gpl-3.0
980
#include "passthrough_file_system.hpp" #include <file/file.hpp> #include <file/path_utils.hpp> using namespace ZN; PassthroughFileSystem::PassthroughFileSystem(FileSystemBackend& parent, const std::string_view& base) : m_parent(&parent) , m_base(base) {} std::vector<Path> PassthroughFileSystem::list(const st...
whupdup/frame
real/file/passthrough_file_system.cpp
C++
gpl-3.0
1,228
#pragma once #include <file/file_system.hpp> namespace ZN { class PassthroughFileSystem final : public FileSystemBackend { public: explicit PassthroughFileSystem(FileSystemBackend& parent, const std::string_view& base); virtual ~PassthroughFileSystem() = default; NULL_COPY_AND_ASSIGN(PassthroughFileSystem); ...
whupdup/frame
real/file/passthrough_file_system.hpp
C++
gpl-3.0
868
#include "path_utils.hpp" #include <core/common.hpp> #include <algorithm> #include <sstream> using namespace ZN; #ifdef OPERATING_SYSTEM_WINDOWS static constexpr const bool HAS_BACKSLASH = true; #define WIN32_LEAN_AND_MEAN #include <windows.h> #else #include <array> static constexpr const bool HAS_BACKSLASH ...
whupdup/frame
real/file/path_utils.cpp
C++
gpl-3.0
4,683
#pragma once #include <core/pair.hpp> #include <string> #include <string_view> #include <vector> namespace ZN::PathUtils { std::string join(const std::string_view& base, const std::string_view& path); std::string make_relative_path(const std::string_view& base, const std::string_view& path); std::string canonicaliz...
whupdup/frame
real/file/path_utils.hpp
C++
gpl-3.0
957
target_sources(LibCommon PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/barrier_info_collection.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/base_frame_graph_pass.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/buffer.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/buffer_resource_tracker.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.cpp" "${CMAKE_CURRENT_SO...
whupdup/frame
real/graphics/CMakeLists.txt
Text
gpl-3.0
1,722
#include "barrier_info_collection.hpp" #include <core/hash_builder.hpp> #include <graphics/command_buffer.hpp> using namespace ZN; using namespace ZN::GFX; static bool image_barrier_equals(const VkImageMemoryBarrier& a, const VkImageMemoryBarrier& b); static bool image_subresource_range_equals(const VkImageSubresou...
whupdup/frame
real/graphics/barrier_info_collection.cpp
C++
gpl-3.0
3,827
#pragma once #include <volk.h> #include <unordered_map> #include <vector> namespace ZN::GFX { class CommandBuffer; class BarrierInfoCollection final { public: void add_pipeline_barrier(VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask); void add_image_memory_barrier(VkPipelineStageFlags...
whupdup/frame
real/graphics/barrier_info_collection.hpp
C++
gpl-3.0
1,561
#include "graphics/base_frame_graph_pass.hpp" using namespace ZN; using namespace ZN::GFX; void BaseFrameGraphPass::write_commands(CommandBuffer& cmd) { if (m_commandCallback) { m_commandCallback(cmd); } } void BaseFrameGraphPass::add_texture_internal(ImageView& res, ResourceAccess::Enum access, VkPipelineStag...
whupdup/frame
real/graphics/base_frame_graph_pass.cpp
C++
gpl-3.0
1,357
#pragma once #include <graphics/buffer.hpp> #include <graphics/image_view.hpp> #include <functional> #include <unordered_map> namespace ZN::GFX { class BarrierInfoCollection; class CommandBuffer; struct ResourceAccess { enum Enum : uint8_t { READ = 0b01, WRITE = 0b10, READ_WRITE = READ | WRITE }; }; struc...
whupdup/frame
real/graphics/base_frame_graph_pass.hpp
C++
gpl-3.0
3,267
#include "buffer.hpp" #include <graphics/render_context.hpp> #include <graphics/vk_common.hpp> #include <cassert> #include <Tracy.hpp> using namespace ZN; using namespace ZN::GFX; static int64_t g_counter = 0; Memory::IntrusivePtr<Buffer> Buffer::create(VkDeviceSize size, VkBufferUsageFlags usageFlags, VmaMemor...
whupdup/frame
real/graphics/buffer.cpp
C++
gpl-3.0
2,795
#pragma once #include <core/intrusive_ptr.hpp> #include <graphics/buffer_resource_tracker.hpp> #include <vk_mem_alloc.h> namespace ZN::GFX { class Buffer final : public Memory::ThreadSafeIntrusivePtrEnabled<Buffer> { public: static Memory::IntrusivePtr<Buffer> create(VkDeviceSize size, VkBufferUsageFlags, V...
whupdup/frame
real/graphics/buffer.hpp
C++
gpl-3.0
1,144
#include "buffer_resource_tracker.hpp" #include <graphics/barrier_info_collection.hpp> #include <algorithm> using namespace ZN; using namespace ZN::GFX; static bool test_range_start(const BufferResourceTracker::ResourceInfo& a, const BufferResourceTracker::ResourceInfo& b); static bool test_range_end(const Buffer...
whupdup/frame
real/graphics/buffer_resource_tracker.cpp
C++
gpl-3.0
9,895
#pragma once #include <volk.h> #include <vector> namespace ZN::GFX { class BarrierInfoCollection; class BufferResourceTracker final { public: struct ResourceInfo { VkPipelineStageFlags stageFlags; VkAccessFlags accessMask; VkDeviceSize offset; VkDeviceSize size; uint32_t queueFamilyIndex; boo...
whupdup/frame
real/graphics/buffer_resource_tracker.hpp
C++
gpl-3.0
2,000
#pragma once #include <core/memory.hpp> #include <graphics/buffer.hpp> #include <cassert> namespace ZN::GFX { template <typename T, VkBufferUsageFlags UsageFlags, size_t InitialCapacity = 256, VmaMemoryUsage MemoryUsage = VMA_MEMORY_USAGE_CPU_ONLY, VkMemoryPropertyFlags RequiredFlags = 0> class BufferVect...
whupdup/frame
real/graphics/buffer_vector.hpp
C++
gpl-3.0
5,309
#include "command_buffer.hpp" #include <core/scoped_lock.hpp> #include <graphics/compute_pipeline.hpp> #include <graphics/graphics_pipeline.hpp> #include <graphics/render_context.hpp> #include <graphics/vk_common.hpp> #include <graphics/vk_initializers.hpp> #include <TracyVulkan.hpp> using namespace ZN; using names...
whupdup/frame
real/graphics/command_buffer.cpp
C++
gpl-3.0
7,248
#pragma once #include <graphics/buffer.hpp> #include <graphics/command_pool.hpp> #include <graphics/framebuffer.hpp> #include <graphics/render_pass.hpp> #include <scheduler/task_scheduler.hpp> #include <vector> namespace ZN::GFX { class ComputePipeline; class GraphicsPipeline; class CommandBuffer final : public M...
whupdup/frame
real/graphics/command_buffer.hpp
C++
gpl-3.0
3,217
#include "command_pool.hpp" #include <graphics/render_context.hpp> #include <graphics/vk_common.hpp> using namespace ZN; using namespace ZN::GFX; Memory::IntrusivePtr<CommandPool> CommandPool::create(VkDevice device, uint32_t queueFamilyIndex, VkCommandPoolCreateFlags createFlags) { VkCommandPoolCreateInfo create...
whupdup/frame
real/graphics/command_pool.cpp
C++
gpl-3.0
1,801
#pragma once #include <core/intrusive_ptr.hpp> #include <volk.h> namespace ZN::GFX { class CommandPool final : public Memory::IntrusivePtrEnabled<CommandPool> { public: static Memory::IntrusivePtr<CommandPool> create(VkDevice device, uint32_t queueFamilyIndex, VkCommandPoolCreateFlags createFlags = 0); ~C...
whupdup/frame
real/graphics/command_pool.hpp
C++
gpl-3.0
678
#include "compute_pipeline.hpp" #include <graphics/render_context.hpp> using namespace ZN; using namespace ZN::GFX; // ComputePipeline Memory::IntrusivePtr<ComputePipeline> ComputePipeline::create(VkPipeline pipeline, VkPipelineLayout layout) { return Memory::IntrusivePtr(new ComputePipeline(pipeline, layout)); ...
whupdup/frame
real/graphics/compute_pipeline.cpp
C++
gpl-3.0
1,666
#pragma once #include <graphics/shader_program.hpp> namespace ZN::GFX { class ComputePipeline final : public Memory::ThreadSafeIntrusivePtrEnabled<ComputePipeline> { public: static Memory::IntrusivePtr<ComputePipeline> create(VkPipeline, VkPipelineLayout); ~ComputePipeline(); NULL_COPY_AND_ASSIGN(ComputePip...
whupdup/frame
real/graphics/compute_pipeline.hpp
C++
gpl-3.0
858
#include "dds_texture.hpp" #include <cstring> #define MAKEFOURCC(a, b, c, d) \ ((uint32_t)(uint8_t)(a) | ((uint32_t)(uint8_t)(b) << 8) | \ ((uint32_t)(uint8_t)(c) << 16) | ((uint32_t)(uint8_t)(d) << 24 )) #define MAKEFOURCCDXT(a) MAKEFOURCC('D', 'X', 'T', a) #define FOURCC_DXT1 MAKEFOURCCDXT(...
whupdup/frame
real/graphics/dds_texture.cpp
C++
gpl-3.0
4,866
#pragma once #include <core/common.hpp> #include <volk.h> namespace ZN::GFX::DDS { struct DDSTextureInfo { uint32_t width; uint32_t height; uint32_t size; VkFormat format; uint32_t mipMapCount; const uint8_t* dataStart; bool isCubeMap; bool hasMipMaps; bool isCompressed; bool hasAlpha; }; bool get_textur...
whupdup/frame
real/graphics/dds_texture.hpp
C++
gpl-3.0
407
#include "descriptors.hpp" #include <core/fixed_array.hpp> #include <core/pair.hpp> #include <graphics/vk_common.hpp> #include <algorithm> #include <cassert> #include <cstring> using namespace ZN; using namespace ZN::GFX; static constexpr FixedArray g_poolCreateRatios = { Pair{VK_DESCRIPTOR_TYPE_SAMPLER, 0.5f}, ...
whupdup/frame
real/graphics/descriptors.cpp
C++
gpl-3.0
10,387
#pragma once #include <core/common.hpp> #include <volk.h> #include <unordered_map> #include <vector> namespace ZN::GFX { class DescriptorAllocator final { public: explicit DescriptorAllocator(VkDevice, VkDescriptorPoolCreateFlags flags = 0); ~DescriptorAllocator(); NULL_COPY_AND_ASSIGN(DescriptorAllocator)...
whupdup/frame
real/graphics/descriptors.hpp
C++
gpl-3.0
2,469
#include "fence.hpp" #include <graphics/render_context.hpp> using namespace ZN; using namespace ZN::GFX; Memory::IntrusivePtr<Fence> Fence::create(VkFenceCreateFlags flags) { return create(g_renderContext->get_device(), flags); } Memory::IntrusivePtr<Fence> Fence::create(VkDevice device, VkFenceCreateFlags flags) ...
whupdup/frame
real/graphics/fence.cpp
C++
gpl-3.0
1,166
#pragma once #include <core/intrusive_ptr.hpp> #include <volk.h> namespace ZN::GFX { class Fence final : public Memory::IntrusivePtrEnabled<Fence> { public: static Memory::IntrusivePtr<Fence> create(VkFenceCreateFlags flags = 0); static Memory::IntrusivePtr<Fence> create(VkDevice, VkFenceCreateFlags flags = 0)...
whupdup/frame
real/graphics/fence.hpp
C++
gpl-3.0
582
#include "frame_graph.hpp" #include <graphics/barrier_info_collection.hpp> #include <graphics/command_buffer.hpp> #include <graphics/render_context.hpp> #include <graphics/vk_common.hpp> #include <Tracy.hpp> #include <TracyVulkan.hpp> #include <algorithm> using namespace ZN; using namespace ZN::GFX; static bool ha...
whupdup/frame
real/graphics/frame_graph.cpp
C++
gpl-3.0
20,520
#pragma once #include <graphics/framebuffer.hpp> #include <graphics/frame_graph_pass.hpp> #include <graphics/render_pass.hpp> #include <graphics/transfer_pass.hpp> #include <memory> namespace ZN::GFX { class BarrierInfoCollection; class CommandBuffer; class FrameGraph final { public: class AccessTracker; str...
whupdup/frame
real/graphics/frame_graph.hpp
C++
gpl-3.0
2,931
#include "graphics/frame_graph_pass.hpp" #include <graphics/frame_graph.hpp> using namespace ZN; using namespace ZN::GFX; // FrameGraphPass FrameGraphPass& FrameGraphPass::add_color_attachment(ImageView& imageView, ResourceAccess::Enum access) { m_colorAttachments.emplace(std::make_pair(imageView.reference_from_...
whupdup/frame
real/graphics/frame_graph_pass.cpp
C++
gpl-3.0
4,805
#pragma once #include <graphics/base_frame_graph_pass.hpp> #include <vector> #include <unordered_set> namespace ZN::GFX { class FrameGraphPass final : public FrameGraphPassMixin<FrameGraphPass> { public: static constexpr const uint32_t INVALID_RENDER_PASS_INDEX = ~0u; explicit FrameGraphPass() = default; N...
whupdup/frame
real/graphics/frame_graph_pass.hpp
C++
gpl-3.0
2,625
#include "framebuffer.hpp" #include <core/hash_builder.hpp> #include <core/scoped_lock.hpp> #include <graphics/render_context.hpp> #include <graphics/render_pass.hpp> #include <Tracy.hpp> #include <unordered_map> using namespace ZN; using namespace ZN::GFX; namespace ZN::GFX { struct FramebufferKey { uint64_t r...
whupdup/frame
real/graphics/framebuffer.cpp
C++
gpl-3.0
4,663
#pragma once #include <graphics/image_view.hpp> #include <vector> namespace ZN::GFX { class RenderPass; class Framebuffer final : public Memory::ThreadSafeIntrusivePtrEnabled<Framebuffer> { public: static Memory::IntrusivePtr<Framebuffer> create(RenderPass&, std::vector<Memory::IntrusivePtr<ImageView>> atta...
whupdup/frame
real/graphics/framebuffer.hpp
C++
gpl-3.0
966
#pragma once #include <cstddef> namespace ZN::GFX { class Buffer; class CommandBuffer; class CubeMap; class Font; class FontFamily; class Framebuffer; class Image; class ImageView; class RenderContext; class RenderPass; class Texture; constexpr const size_t FRAMES_IN_FLIGHT = 2; }
whupdup/frame
real/graphics/graphics_fwd.hpp
C++
gpl-3.0
288
#include "graphics_pipeline.hpp" #include <core/hash_builder.hpp> #include <graphics/render_context.hpp> #include <graphics/render_pass.hpp> #include <Tracy.hpp> using namespace ZN; using namespace ZN::GFX; static int64_t g_counter = 0; static VkPipeline create_pipeline(const GraphicsPipelineTemplate& tmpl, con...
whupdup/frame
real/graphics/graphics_pipeline.cpp
C++
gpl-3.0
6,034
#pragma once #include <core/pair.hpp> #include <graphics/shader_program.hpp> #include <graphics/specialization_info.hpp> #include <memory> #include <unordered_map> #include <vector> namespace ZN::GFX { class RenderPass; struct GraphicsPipelineTemplate { enum Flags : uint32_t { FLAG_BLEND_ENABLED = 0b0001, ...
whupdup/frame
real/graphics/graphics_pipeline.hpp
C++
gpl-3.0
3,824
#include "graphics_pipeline.hpp" #include <graphics/shader_program.hpp> #include <cstring> using namespace ZN; using namespace ZN::GFX; GraphicsPipelineBuilder& GraphicsPipelineBuilder::add_program(ShaderProgram& program) { m_template.program = program.reference_from_this(); return *this; } GraphicsPipelineBuild...
whupdup/frame
real/graphics/graphics_pipeline_builder.cpp
C++
gpl-3.0
3,656
#include "image.hpp" #include <graphics/render_context.hpp> #include <Tracy.hpp> using namespace ZN; using namespace ZN::GFX; static int64_t g_counter = 0; Memory::IntrusivePtr<Image> Image::create(const VkImageCreateInfo& createInfo, VmaMemoryUsage memoryUsage, VkMemoryPropertyFlags requiredFlags) { VmaAllocat...
whupdup/frame
real/graphics/image.cpp
C++
gpl-3.0
2,830
#pragma once #include <core/badge.hpp> #include <core/intrusive_ptr.hpp> #include <graphics/image_resource_tracker.hpp> #include <graphics/unique_graphics_object.hpp> #include <volk.h> #include <vk_mem_alloc.h> namespace ZN::GFX { class CommandBuffer; class RenderContext; class Image final : public Memory::Thread...
whupdup/frame
real/graphics/image.hpp
C++
gpl-3.0
1,544
#include "image_resource_tracker.hpp" #include <graphics/barrier_info_collection.hpp> using namespace ZN; using namespace ZN::GFX; static bool ranges_intersect(const VkImageSubresourceRange& a, const VkImageSubresourceRange& b); // A fully covers B static bool range_fully_covers(const VkImageSubresourceRange& a, con...
whupdup/frame
real/graphics/image_resource_tracker.cpp
C++
gpl-3.0
12,566
#pragma once #include <volk.h> #include <vector> namespace ZN::GFX { class BarrierInfoCollection; class ImageResourceTracker final { public: struct ResourceInfo { VkPipelineStageFlags stageFlags; VkImageLayout layout; VkAccessFlags accessMask; uint32_t queueFamilyIndex; VkImageSubresourceRange ra...
whupdup/frame
real/graphics/image_resource_tracker.hpp
C++
gpl-3.0
2,150
#include "image_view.hpp" #include <graphics/image.hpp> #include <graphics/render_context.hpp> #include <graphics/vk_initializers.hpp> #include <Tracy.hpp> using namespace ZN; using namespace ZN::GFX; static int64_t g_counter = 0; Memory::IntrusivePtr<ImageView> ImageView::create(Image& image, VkImageViewType view...
whupdup/frame
real/graphics/image_view.cpp
C++
gpl-3.0
2,566
#pragma once #include <core/badge.hpp> #include <graphics/image.hpp> namespace ZN::GFX { class RenderContext; class ImageView final : public Memory::ThreadSafeIntrusivePtrEnabled<ImageView>, public UniqueGraphicsObject { public: static Memory::IntrusivePtr<ImageView> create(Image&, VkImageViewType, VkFormat, ...
whupdup/frame
real/graphics/image_view.hpp
C++
gpl-3.0
1,037
#include "material.hpp" #include <graphics/command_buffer.hpp> #include <graphics/mesh_pool.hpp> #include <graphics/render_context.hpp> using namespace ZN; using namespace ZN::GFX; Material::Material(MeshPool& pool) : m_meshPool(pool) , m_instanceIndexOutputBuffer(GFX::Buffer::create(INSTANCE_BUFFER_INITIAL_CAPA...
whupdup/frame
real/graphics/material.cpp
C++
gpl-3.0
3,426
#pragma once #include <core/scoped_lock.hpp> #include <graphics/buffer_vector.hpp> #include <graphics/mesh_pool.hpp> #include <scheduler/task_scheduler.hpp> namespace ZN::GFX { class CommandBuffer; struct InstanceHandle { uint32_t value; }; struct InstanceIndices { uint32_t objectIndex; uint32_t meshIndex; };...
whupdup/frame
real/graphics/material.hpp
C++
gpl-3.0
3,091
#include "mesh_pool.hpp" #include <core/scoped_lock.hpp> using namespace ZN; using namespace ZN::GFX; // MeshPool MeshPool::MeshPool() : m_gpuIndirectCommandBuffer(Buffer::create(INDIRECT_COMMAND_BUFFER_INITIAL_CAPACITY * sizeof(VkDrawIndexedIndirectCommand), VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_U...
whupdup/frame
real/graphics/mesh_pool.cpp
C++
gpl-3.0
3,584
#pragma once #include <graphics/buffer_vector.hpp> #include <scheduler/task_scheduler.hpp> #include <vector> namespace ZN::GFX { constexpr const size_t INDIRECT_COMMAND_BUFFER_INITIAL_CAPACITY = 128ull; class MeshPool; class Mesh final : public Memory::ThreadSafeIntrusivePtrEnabled<Mesh> { public: explicit Me...
whupdup/frame
real/graphics/mesh_pool.hpp
C++
gpl-3.0
2,178
#include "non_owning_mesh_pool.hpp" #include <core/scoped_lock.hpp> using namespace ZN; using namespace ZN::GFX; // NonOwningMeshPool NonOwningMeshPool::NonOwningMeshPool(MeshPool& parentPool) : m_parentPool(&parentPool) {} IntrusivePtr<Mesh> NonOwningMeshPool::create_mesh(Mesh& parentMesh, uint32_t indexCount, ...
whupdup/frame
real/graphics/non_owning_mesh_pool.cpp
C++
gpl-3.0
1,001
#pragma once #include <graphics/mesh_pool.hpp> namespace ZN::GFX { class NonOwningMeshPool : public MeshPool { public: explicit NonOwningMeshPool(MeshPool&); [[nodiscard]] Memory::IntrusivePtr<Mesh> create_mesh(Mesh& parentMesh, uint32_t indexCount, uint32_t indexOffset); void free_mesh(Mesh&) override;...
whupdup/frame
real/graphics/non_owning_mesh_pool.hpp
C++
gpl-3.0
547
#include "owning_mesh_pool.hpp" #include <core/scoped_lock.hpp> #include <graphics/render_context.hpp> #include <graphics/vk_initializers.hpp> #include <Tracy.hpp> using namespace ZN; using namespace ZN::GFX; static constexpr const size_t INITIAL_CAPACITY_BYTES = 16384; // OwningMeshPool OwningMeshPool::OwningMe...
whupdup/frame
real/graphics/owning_mesh_pool.cpp
C++
gpl-3.0
4,904
#pragma once #include <graphics/mesh_pool.hpp> namespace ZN::GFX { class CommandBuffer; class FrameGraphPass; class OwningMeshPool : public MeshPool { public: void update(); void free_mesh(Mesh&) override; Buffer& get_vertex_buffer() const override; Buffer& get_index_buffer() const override; uint32_t g...
whupdup/frame
real/graphics/owning_mesh_pool.hpp
C++
gpl-3.0
1,616
#include "pipeline_layout.hpp" #include <graphics/vk_common.hpp> #include <algorithm> #include <cassert> #include <cstring> using namespace ZN; using namespace ZN::GFX; PipelineLayoutCache::PipelineLayoutCache(VkDevice device) : m_device(device) {} PipelineLayoutCache::~PipelineLayoutCache() { for (auto& [_, l...
whupdup/frame
real/graphics/pipeline_layout.cpp
C++
gpl-3.0
2,643
#pragma once #include <core/common.hpp> #include <volk.h> #include <unordered_map> namespace ZN::GFX { class PipelineLayoutCache final { public: explicit PipelineLayoutCache(VkDevice); ~PipelineLayoutCache(); NULL_COPY_AND_ASSIGN(PipelineLayoutCache); struct LayoutInfo { VkDescriptorSetLayout setLayo...
whupdup/frame
real/graphics/pipeline_layout.hpp
C++
gpl-3.0
785
#include "queue.hpp" #include <core/scoped_lock.hpp> #include <graphics/fence.hpp> #include <graphics/vk_common.hpp> using namespace ZN; using namespace ZN::GFX; Queue::Queue(VkQueue queue) : m_queue(queue) , m_mutex(Scheduler::Mutex::create()) {} void Queue::submit(const VkSubmitInfo& submitInfo, Fence* fence...
whupdup/frame
real/graphics/queue.cpp
C++
gpl-3.0
704
#pragma once #include <scheduler/task_scheduler.hpp> #include <volk.h> namespace ZN::GFX { class Fence; class RenderContext; class Queue final { public: explicit Queue(VkQueue); NULL_COPY_AND_ASSIGN(Queue); void submit(const VkSubmitInfo&, Fence*); VkResult present(const VkPresentInfoKHR&); VkQueue g...
whupdup/frame
real/graphics/queue.hpp
C++
gpl-3.0
445
#include "render_context.hpp" #include <VkBootstrap.h> #include <core/scoped_lock.hpp> #include <graphics/vk_common.hpp> #include <graphics/vk_initializers.hpp> //#include <graphics/vk_profiler.hpp> #include <services/application.hpp> #include <TracyVulkan.hpp> #include <TracyC.h> using namespace ZN; using namesp...
whupdup/frame
real/graphics/render_context.cpp
C++
gpl-3.0
20,028
#pragma once #include <core/events.hpp> #include <core/local.hpp> #include <graphics/command_buffer.hpp> #include <graphics/descriptors.hpp> #include <graphics/frame_graph.hpp> #include <graphics/graphics_fwd.hpp> #include <graphics/image_view.hpp> #include <graphics/pipeline_layout.hpp> #include <graphics/queue.hpp>...
whupdup/frame
real/graphics/render_context.hpp
C++
gpl-3.0
5,553
#include "render_pass.hpp" #include <core/hash_builder.hpp> #include <core/logging.hpp> #include <core/memory.hpp> #include <core/scoped_lock.hpp> #include <graphics/render_context.hpp> #include <Tracy.hpp> #include <cassert> #include <vector> #include <unordered_map> using namespace ZN; using namespace ZN::GFX; ...
whupdup/frame
real/graphics/render_pass.cpp
C++
gpl-3.0
19,139
#pragma once #include <core/intrusive_ptr.hpp> #include <graphics/unique_graphics_object.hpp> #include <volk.h> namespace ZN::GFX { class RenderPass final : public Memory::ThreadSafeIntrusivePtrEnabled<RenderPass>, public UniqueGraphicsObject { public: using AttachmentCount_T = uint8_t; using AttachmentBitM...
whupdup/frame
real/graphics/render_pass.hpp
C++
gpl-3.0
2,220
#pragma once #include <cstdint> namespace ZN::GFX { constexpr uint32_t previous_power_of_2(uint32_t value) { uint32_t r = 1; while (2 * r < value) { r *= 2; } return r; } constexpr uint32_t get_image_mip_levels(uint32_t width, uint32_t height) { uint32_t result = 1; while (width > 1 || height > 1) { ++...
whupdup/frame
real/graphics/render_utils.hpp
C++
gpl-3.0
884
#include "sampler.hpp" #include <graphics/render_context.hpp> using namespace ZN; using namespace ZN::GFX; Memory::IntrusivePtr<Sampler> Sampler::create(const VkSamplerCreateInfo& createInfo) { VkSampler sampler; if (vkCreateSampler(g_renderContext->get_device(), &createInfo, nullptr, &sampler) == VK_SUCCESS) {...
whupdup/frame
real/graphics/sampler.cpp
C++
gpl-3.0
788
#pragma once #include <core/intrusive_ptr.hpp> #include <volk.h> namespace ZN::GFX { class Sampler final : public Memory::IntrusivePtrEnabled<Sampler> { public: static Memory::IntrusivePtr<Sampler> create(const VkSamplerCreateInfo&); ~Sampler(); NULL_COPY_AND_ASSIGN(Sampler); operator VkSampler() const;...
whupdup/frame
real/graphics/sampler.hpp
C++
gpl-3.0
427
#pragma once #include <cstdint> namespace ZN::GFX { enum class SamplerIndex : uint32_t { LINEAR = 0, NEAREST = 1 }; }
whupdup/frame
real/graphics/sampler_index.hpp
C++
gpl-3.0
125
#include "semaphore_pool.hpp" #include <graphics/render_context.hpp> using namespace ZN; using namespace ZN::GFX; SemaphorePool::~SemaphorePool() { for (auto sem : m_semaphores) { vkDestroySemaphore(g_renderContext->get_device(), sem, nullptr); } } VkSemaphore SemaphorePool::acquire_semaphore() { if (!m_freeSe...
whupdup/frame
real/graphics/semaphore_pool.cpp
C++
gpl-3.0
887