Skip to content

Commit 6ec88ee

Browse files
author
Dominik Witczak
committed
Renderpasses: Two getters should return more info than they currently do
1 parent 021b15b commit 6ec88ee

2 files changed

Lines changed: 43 additions & 16 deletions

File tree

include/misc/render_pass_create_info.h

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ namespace Anvil
262262
/** Retrieves properties of the render pass color attachment with the user-specified ID
263263
*
264264
* @param in_attachment_id ID of the attachment to retrieve properties of.
265+
* @param out_opt_format_ptr If not nullptr, deref will be set to the format, specified
266+
* at attachment creation time. May be nullptr.
265267
* @param out_opt_sample_count_ptr If not nullptr, deref will be set to the sample count, specified
266268
* at attachment creation time. May be nullptr.
267269
* @param out_opt_load_op_ptr If not nullptr, deref will be set to the load op, specified at
@@ -279,6 +281,7 @@ namespace Anvil
279281
* @return true if successful, false otherwise.
280282
**/
281283
bool get_color_attachment_properties(RenderPassAttachmentID in_attachment_id,
284+
Anvil::Format* out_opt_format_ptr = nullptr,
282285
Anvil::SampleCountFlagBits* out_opt_sample_count_ptr = nullptr,
283286
Anvil::AttachmentLoadOp* out_opt_load_op_ptr = nullptr,
284287
Anvil::AttachmentStoreOp* out_opt_store_op_ptr = nullptr,
@@ -332,6 +335,10 @@ namespace Anvil
332335
/** Retrieves properties of the render pass color attachment with the user-specified ID
333336
*
334337
* @param in_attachment_id ID of the attachment to retrieve properties of.
338+
* @param out_opt_format_ptr If not nullptr, deref will be set to the format, specified
339+
* at attachment creation time. May be nullptr.
340+
* @param out_opt_sample_count_ptr If not nullptr, deref will be set to the sample count, specified
341+
* at attachment creation time. May be nullptr.
335342
* @param out_opt_depth_load_op_ptr If not nullptr, deref will be set to the depth-specific load op, specified at
336343
* attachment creation time. May be nullptr.
337344
* @param out_opt_depth_store_op_ptr If not nullptr, deref will be set to the depth-specific store op, specified at
@@ -350,14 +357,16 @@ namespace Anvil
350357
*
351358
* @return true if successful, false otherwise.
352359
**/
353-
bool get_depth_stencil_attachment_properties(RenderPassAttachmentID in_attachment_id,
354-
Anvil::AttachmentLoadOp* out_opt_depth_load_op_ptr = nullptr,
355-
Anvil::AttachmentStoreOp* out_opt_depth_store_op_ptr = nullptr,
356-
Anvil::AttachmentLoadOp* out_opt_stencil_load_op_ptr = nullptr,
357-
Anvil::AttachmentStoreOp* out_opt_stencil_store_op_ptr = nullptr,
358-
Anvil::ImageLayout* out_opt_initial_layout_ptr = nullptr,
359-
Anvil::ImageLayout* out_opt_final_layout_ptr = nullptr,
360-
bool* out_opt_may_alias_ptr = nullptr) const;
360+
bool get_depth_stencil_attachment_properties(RenderPassAttachmentID in_attachment_id,
361+
Anvil::Format* out_opt_format_ptr = nullptr,
362+
Anvil::SampleCountFlagBits* out_opt_sample_count_ptr = nullptr,
363+
Anvil::AttachmentLoadOp* out_opt_depth_load_op_ptr = nullptr,
364+
Anvil::AttachmentStoreOp* out_opt_depth_store_op_ptr = nullptr,
365+
Anvil::AttachmentLoadOp* out_opt_stencil_load_op_ptr = nullptr,
366+
Anvil::AttachmentStoreOp* out_opt_stencil_store_op_ptr = nullptr,
367+
Anvil::ImageLayout* out_opt_initial_layout_ptr = nullptr,
368+
Anvil::ImageLayout* out_opt_final_layout_ptr = nullptr,
369+
bool* out_opt_may_alias_ptr = nullptr) const;
361370

362371
const Anvil::BaseDevice* get_device() const
363372
{

src/misc/render_pass_create_info.cpp

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ bool Anvil::RenderPassCreateInfo::get_attachment_type(RenderPassAttachmentID in_
581581

582582
/* Please see header for specification */
583583
bool Anvil::RenderPassCreateInfo::get_color_attachment_properties(RenderPassAttachmentID in_attachment_id,
584+
Anvil::Format* out_opt_format_ptr,
584585
Anvil::SampleCountFlagBits* out_opt_sample_count_ptr,
585586
Anvil::AttachmentLoadOp* out_opt_load_op_ptr,
586587
Anvil::AttachmentStoreOp* out_opt_store_op_ptr,
@@ -595,6 +596,11 @@ bool Anvil::RenderPassCreateInfo::get_color_attachment_properties(RenderPassAtta
595596
goto end;
596597
}
597598

599+
if (out_opt_format_ptr != nullptr)
600+
{
601+
*out_opt_format_ptr = m_attachments[in_attachment_id].format;
602+
}
603+
598604
if (out_opt_sample_count_ptr != nullptr)
599605
{
600606
*out_opt_sample_count_ptr = m_attachments[in_attachment_id].sample_count;
@@ -695,14 +701,16 @@ bool Anvil::RenderPassCreateInfo::get_dependency_multiview_properties(uint32_t i
695701
}
696702

697703
/** Please see header for specification */
698-
bool Anvil::RenderPassCreateInfo::get_depth_stencil_attachment_properties(RenderPassAttachmentID in_attachment_id,
699-
Anvil::AttachmentLoadOp* out_opt_depth_load_op_ptr,
700-
Anvil::AttachmentStoreOp* out_opt_depth_store_op_ptr,
701-
Anvil::AttachmentLoadOp* out_opt_stencil_load_op_ptr,
702-
Anvil::AttachmentStoreOp* out_opt_stencil_store_op_ptr,
703-
Anvil::ImageLayout* out_opt_initial_layout_ptr,
704-
Anvil::ImageLayout* out_opt_final_layout_ptr,
705-
bool* out_opt_may_alias_ptr) const
704+
bool Anvil::RenderPassCreateInfo::get_depth_stencil_attachment_properties(RenderPassAttachmentID in_attachment_id,
705+
Anvil::Format* out_opt_format_ptr,
706+
Anvil::SampleCountFlagBits* out_opt_sample_count_ptr,
707+
Anvil::AttachmentLoadOp* out_opt_depth_load_op_ptr,
708+
Anvil::AttachmentStoreOp* out_opt_depth_store_op_ptr,
709+
Anvil::AttachmentLoadOp* out_opt_stencil_load_op_ptr,
710+
Anvil::AttachmentStoreOp* out_opt_stencil_store_op_ptr,
711+
Anvil::ImageLayout* out_opt_initial_layout_ptr,
712+
Anvil::ImageLayout* out_opt_final_layout_ptr,
713+
bool* out_opt_may_alias_ptr) const
706714
{
707715
bool result = false;
708716

@@ -711,6 +719,16 @@ bool Anvil::RenderPassCreateInfo::get_depth_stencil_attachment_properties(Render
711719
goto end;
712720
}
713721

722+
if (out_opt_format_ptr != nullptr)
723+
{
724+
*out_opt_format_ptr = m_attachments[in_attachment_id].format;
725+
}
726+
727+
if (out_opt_sample_count_ptr != nullptr)
728+
{
729+
*out_opt_sample_count_ptr = m_attachments[in_attachment_id].sample_count;
730+
}
731+
714732
if (out_opt_depth_load_op_ptr != nullptr)
715733
{
716734
*out_opt_depth_load_op_ptr = m_attachments[in_attachment_id].color_depth_load_op;

0 commit comments

Comments
 (0)