Repository navigation
v2: jvk rebuild - #1
Draft
codethinki wants to merge 135 commits into
Draft
codethinki wants to merge 135 commits into
codethinki wants to merge 135 commits into
Conversation
…test - jvk, jolly, demo and tests moved to legacy/ as reference, not built anymore - presets like cth (msvc, clang, gcc), cth_ROOT points at the sibling cth install - CMakeUserPresets.json is not tracked anymore - vcpkg: current baseline, only gtest and volk for now - cth_cmake updated to main - tests/: loader smoke test (vulkan 1.3 loader and device)
- AGENTS.md: code and doc style guide (STE100), CLAUDE.md links it - cvk: Instance, DebugMessenger, Cvk (volk loader), utility types, constants, format, exceptions - cvk tests: instance and debug messenger unit tests - vcpkg: vulkan-utility-libraries for the enum names
…ions are snake_case
The messenger kept an Instance const*. Instance is movable, so after a move the messenger destroyed itself through the moved-from instance (VK_NULL_HANDLE).
- physical device features as one pNext chain for vulkan 1.0 to 1.3 - surface without the destruction queue, formats keep the allowed order - physical device takes surfaces, a family presents only if it presents to every surface - device enables swapchainMaintenance1 with the present extensions - queues hold the function table, not the device, so a device can move - core takes the instance and the surfaces, no hidden windows - core: empty queue sets use the default set - tests for each type, present tests use VK_EXT_headless_surface
Defaulted move assignment leaked the old handle, cth::move_ptr does not destroy on assignment. Instance, DebugMessenger, Surface and Device now move assign with cth::reconstruct_at (needs cth with cth/utility.hpp). Tests count validation errors: a leaked child object shows as VUID-vkDestroyInstance-instance-00629.
- objects store core.deviceTable(), not the core: the core can move - no virtuals: TimelineSemaphore is a private Semaphore, it does not pass as a binary semaphore - timeline semaphore: core vulkan 1.2 functions, wait copies the counter (legacy read a dead temporary), wait and gpuValue check the result - fence: no os handle export (legacy stub was broken), FenceAwaiter goes to jvk - PipelineWaitStage is replaced by VkSemaphoreSubmitInfo - test::Context fails a test on validation errors, leaks included
VkDevice vkDevice -> VkDevice, Core const& core -> Core const&. Definitions keep the names. Also: the create_t constructors of Semaphore and TimelineSemaphore are explicit.
- all four on the cvk lifecycle (legacy was pinned, //TEMP modernize) - shader: SPIR-V as uint32_t words (alignment, size), load() checks the file, no runtime glslc (windows only), stageInfo() replaces ShaderSpecialization - descriptor set layout: bindings by number, sorted, gaps allowed (legacy used the number as index: holes and remove duplicated binding 0) - pipeline layout: set layouts by set number, push constant ranges, copies the handles (legacy kept dangling pointers and wrote out of bounds for gaps) - pipeline: dynamic rendering (VkPipelineRenderingCreateInfo), value config in pipeline_config.hpp, pointers set at create(), no derivative pipelines (legacy never set the layout for them), bind() waits for the cmd layer - tests use SPIR-V generated from cvk/tests/shaders
- cvk lifecycle (legacy only had a creating constructor and no release) - maxAnisotropy clamped to maxSamplerAnisotropy - compareOp is optional: legacy used NEVER for no comparison, so a NEVER compare could not be expressed - named fields instead of filter and address mode arrays, sampler_config.hpp - moved to data/img, texture goes to jvk
The port had dropped Fence::extractOsHandle(). Restored and fixed: - create() takes export handle types, chains VkExportFenceCreateInfo (legacy never made the fence exportable) - the get info carries the real fence (legacy: VK_NULL_HANDLE from a consteval function) - the handle is written to a local and returned (legacy passed static_cast<HANDLE*>(nullptr) as output pointer) - linux sType is VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR (legacy used the win32 one) - returns cth::os::unique_native_handle, the caller owned handle is closed (legacy leaked it) - linux exports a sync fd (pollable, the export resets the fence), windows the opaque win32 handle - windows loads vkGetFenceWin32HandleKHR with vkGetDeviceProcAddr: volk from vcpkg is built without platform defines - constants::OS_FENCE_HANDLE_TYPE and OS_FENCE_DEVICE_EXTENSIONS, cvk links cth::os - tested on linux (Mesa ANV and llvmpipe), the windows path is not compiled here
The port had dropped both. Restored and fixed: - Shader::compile() and the compiling constructor run any glslc compatible compiler, linux and windows (legacy: windows only through cth::win::cmd::hidden) - a failed compile throws with the compiler output, other compiler output is a warning (legacy aborted the process on any output, warnings included) - the log goes to the temp directory (legacy: shader_compile_log.txt in the working directory), no npos substr parsing - derivative pipelines take the layout of the parent and add VK_PIPELINE_CREATE_DERIVATIVE_BIT (legacy left the layout null and never set the flag), PipelineConfig::flags for ALLOW_DERIVATIVES
Rule in AGENTS.md: a parent does not move and is not destroyed while objects depend on it. Fence, Semaphore, TimelineSemaphore, Shader, DescriptorSetLayout, PipelineLayout, Pipeline and Sampler store not_null<Core const*> like legacy (they stored core.deviceTable() for core moves), core() replaces deviceTable(), base constructors check Core::debug_check.
- core_deleter (stores the core), instance_deleter (stores the instance), handle_deleter (no context) - default_deleter_t picks the deleter from the signature of T::destroy - custom deleters derive from them, Deleter::pointer for handles that are not pointers - unique_handle exposes get(), core(), instance(), deleter()
One class per destroy shape: - Fence: default core_deleter - Surface: default instance_deleter - Instance: default handle_deleter, the messenger is declared before the handle - DebugMessenger: custom deleter, the instance comes with create(), not with the base constructor - Device: custom deleter, vkDestroyDevice comes from the function table All five move assign with = default. The instance move test counts validation errors now.
- constructors and reset(handle, context...) construct the deleter, a missing context does not compile - reset() only destroys, no mutable deleter() anymore - instance_deleter stores the VkInstance: the instance owns its messenger and can move - DebugMessenger takes the instance in the base constructor, create() has no parameter, State without the instance - Device::destroy(VkDevice) gets vkDestroyDevice through vkGetDeviceProcAddr, no custom deleter
reset keeps its std meaning (unique_ptr::reset destroys) and names Vulkan operations (vkResetFences). The private lifecycle reset() and Fence::resetState() are invalidate(), docs say invalidates.
- unique_handle<Handle, Deleter>, no deleter detection - Semaphore, Shader, DescriptorSetLayout, PipelineLayout, Pipeline, Sampler converted, move assignment = default - TimelineSemaphore: move assignment = base + atomic counter - reconstruct_at is gone from cvk, AGENTS.md describes unique_handle instead - Instance::release() (the lifecycle function was missing)
core_handle<Handle, T> = unique_handle<Handle, core_deleter<T>>, used by every device object. AGENTS.md: an alias that names a type of its own is snake_case without _t.
invalidate names the Vulkan operation on mapped memory (vkInvalidateMappedMemoryRanges). Fence::waitReset() brief back to 'waits and resets', the last rename changed it by mistake.
The test segfaulted when it ran alone (ctest runs one test per process): volk had no vkDestroyInstance. Instance::destroy(VkInstance) documents the precondition.
…reate(extent, config), surface without config
…prefers discrete GPUs
…E and shrinks to the returned count
…no COMPILATION_MODE
…osing namespace comments
…ate config, constexpr createInfo
…r leak tests, shared test helpers, per-process shader temp dir
… to the spv, style fixes
… build time, five fixes on the fork branch
…s that skip without a display
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work branch of the rebuild (cvk, cgfw, jvk). Draft: it runs the CI on every push to the branch and is not merged step by step.