Skip to content

Conversation

@keptsecret
Copy link
Contributor

No description provided.

Comment on lines +57 to +68
if(NBL_BUILD_DEBUG_DRAW)
add_subdirectory(DebugDraw)
set(NBL_EXT_DEBUG_DRAW_INCLUDE_DIRS
${NBL_EXT_DEBUG_DRAW_INCLUDE_DIRS}
PARENT_SCOPE
)
set(NBL_EXT_DEBUG_DRAW_LIB
${NBL_EXT_DEBUG_DRAW_LIB}
PARENT_SCOPE
)
endif()

Copy link
Member

@AnastaZIuk AnastaZIuk Dec 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved,

although this snippet which is copied for each ext requires rewrite at some point (dirty), the rewrite shall not be part of this PR

Copy link
Member

@AnastaZIuk AnastaZIuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some comments, please address

@AnastaZIuk AnastaZIuk merged commit f4ae878 into master Dec 23, 2025
9 of 10 checks passed
@AnastaZIuk AnastaZIuk deleted the new_debug_draw branch December 23, 2025 21:59
static core::smart_refctd_ptr<video::IGPUPipelineLayout> createPipelineLayoutFromPCRange(video::ILogicalDevice* device, const asset::SPushConstantRange& pcRange);

// creates default pipeline layout for pipeline specified by draw mode (note: if mode==BOTH, returns layout for BATCH mode)
static core::smart_refctd_ptr<video::IGPUPipelineLayout> createDefaultPipelineLayout(video::ILogicalDevice* device, DrawMode mode = ADM_DRAW_BATCH);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the last argument should not be defaulted!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +27 to +28
${NBL_DEBUG_DRAW_HLSL_MOUNT_POINT}/common.hlsl
${NBL_DEBUG_DRAW_HLSL_MOUNT_POINT}/draw_aabb.unified.hlsl

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AnastaZIuk IMHO these should still be embedded and finable in the archive

I'm not saying the SPV precompute needs to add its DEPENDS to the archive, but these files need to be explicitly listed out here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure we will keep the source too in post PR

main reason we didn't is build system tooling needs an upgrade to do so (dc thread)

constexpr std::string_view NBL_EXT_MOUNT_ENTRY = "nbl/ext/DebugDraw";

const smart_refctd_ptr<IFileArchive> DrawAABB::mount(smart_refctd_ptr<ILogger> logger, ISystem* system, const std::string_view archiveAlias)
const smart_refctd_ptr<IFileArchive> DrawAABB::mount(smart_refctd_ptr<ILogger> logger, ISystem* system, video::ILogicalDevice* device, const std::string_view archiveAlias)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function deals with archives and file system, why is ILogicalDevice taken?

Copy link
Member

@AnastaZIuk AnastaZIuk Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorakrit put core::string with key name to validate required file presence, I replaced it with device to use the getter instead

We could also hardcode key name inside since in this case there are no permutations, then we remove ILogicalDevice. Our auto-gen API could actually be smarter and with no permutations have constexpr getters with no args

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constexpr auto MdiSizes = std::to_array<offset_t>({ sizeof(hlsl::float32_t3), sizeof(InstanceData) });
// shared nPoT alignment needs to be divisible by all smaller ones to satisfy an allocation from all
constexpr offset_t MaxAlignment = std::reduce(MdiSizes.begin(), MdiSizes.end(), 1, [](const offset_t a, const offset_t b)->offset_t {return std::lcm(a, b); });
constexpr offset_t MaxAlignment = sizeof(InstanceData);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignof not sizeof

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should also assert that the alignment is <= sizeof(InstanceData) due to the roundups and divisions you do later in the loop

Comment on lines +141 to +142
if (srcIt == aabbInstances.end())
break;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should never happen, assert srcIt<=end() before the ++ or srcIt<end()

GDBobby pushed a commit to GDBobby/Nabla that referenced this pull request Dec 26, 2025
Signed-off-by: Corey <corey.w108@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants