Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/DynamicBuffers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ endif()

add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")

target_include_directories(Anvil PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/anvil/include")

include_directories(${Anvil_SOURCE_DIR}/include
${DynamicBuffers_SOURCE_DIR}/include)

Expand Down
2 changes: 2 additions & 0 deletions examples/MultiViewport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ endif()

add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")

target_include_directories(Anvil PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/anvil/include")

include_directories(${Anvil_SOURCE_DIR}/include
${MultiViewport_SOURCE_DIR}/include)

Expand Down
2 changes: 2 additions & 0 deletions examples/OcclusionQuery/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ endif()

add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")

target_include_directories(Anvil PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/anvil/include")

include_directories(${Anvil_SOURCE_DIR}/include
${OcclusionQuery_SOURCE_DIR}/include)

Expand Down
2 changes: 2 additions & 0 deletions examples/OutOfOrderRasterization/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ endif()

add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")

target_include_directories(Anvil PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/anvil/include")

include_directories(${Anvil_SOURCE_DIR}/include
${OutOfOrderRasterization_SOURCE_DIR}/include)

Expand Down
2 changes: 2 additions & 0 deletions examples/PushConstants/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ endif()

add_subdirectory (../.. "${CMAKE_CURRENT_BINARY_DIR}/anvil")

target_include_directories(Anvil PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/anvil/include")

include_directories(${Anvil_SOURCE_DIR}/include
${PushConstants_SOURCE_DIR}/include)

Expand Down
52 changes: 26 additions & 26 deletions include/misc/render_pass_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,42 +544,42 @@ namespace Anvil
/* Holds properties of a sub-pass attachment */
typedef struct SubPassAttachment
{
RenderPassAttachment* attachment_ptr;
uint32_t highest_subpass_index;
VkImageLayout layout;
uint32_t lowest_subpass_index;
RenderPassAttachment* resolve_attachment_ptr;
uint32_t attachment_index;
uint32_t highest_subpass_index;
VkImageLayout layout;
uint32_t lowest_subpass_index;
uint32_t resolve_attachment_index;

/* Dummy constructor. Should only be used by STL containers */
SubPassAttachment()
{
attachment_ptr = nullptr;
highest_subpass_index = UINT32_MAX;
layout = VK_IMAGE_LAYOUT_MAX_ENUM;
lowest_subpass_index = UINT32_MAX;
resolve_attachment_ptr = nullptr;
attachment_index = UINT32_MAX;
highest_subpass_index = UINT32_MAX;
layout = VK_IMAGE_LAYOUT_MAX_ENUM;
lowest_subpass_index = UINT32_MAX;
resolve_attachment_index = UINT32_MAX;
}

/** Constructor.
*
* @param in_attachment_ptr Render-pass attachment that this sub-pass attachment should reference.
* Must not be nullptr.
* @param in_layout Layout to use for the attachment when executing the subpass.
* Driver takes care of transforming the attachment to the requested layout
* before subpass commands starts executing.
* @param in_resolve_attachment_ptr If not nullptr, this should point to the render-pass attachment, to which
* MS data of @param in_attachment_ptr should be resolved. If nullptr, it is
* assumed the sub-pass should not resolve the MS data.
* @param in_attachment_index Index of render-pass attachment that this sub-pass attachment should reference.
* Must not be UINT32_MAX.
* @param in_layout Layout to use for the attachment when executing the subpass.
* Driver takes care of transforming the attachment to the requested layout
* before subpass commands starts executing.
* @param in_opt_resolve_attachment_index If not UINT32_MAX, this should point to the render-pass attachment, to which
* MS data of @param in_attachment_ptr should be resolved. If UINT32_MAX, it is
* assumed the sub-pass should not resolve the MS data.
**/
SubPassAttachment(RenderPassAttachment* in_attachment_ptr,
VkImageLayout in_layout,
RenderPassAttachment* in_opt_resolve_attachment_ptr)
SubPassAttachment(const uint32_t& in_attachment_index,
VkImageLayout in_layout,
const uint32_t& in_opt_resolve_attachment_index)
{
attachment_ptr = in_attachment_ptr;
highest_subpass_index = UINT32_MAX;
layout = in_layout;
lowest_subpass_index = UINT32_MAX;
resolve_attachment_ptr = in_opt_resolve_attachment_ptr;
attachment_index = in_attachment_index;
highest_subpass_index = UINT32_MAX;
layout = in_layout;
lowest_subpass_index = UINT32_MAX;
resolve_attachment_index = in_opt_resolve_attachment_index;
}
} SubPassAttachment;

Expand Down
2 changes: 2 additions & 0 deletions include/misc/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,8 @@ namespace Anvil

KHR16BitStorageFeatures(const VkPhysicalDevice16BitStorageFeaturesKHR& in_features);

VkPhysicalDevice16BitStorageFeaturesKHR get_vk_physical_device_16_bit_storage_features() const;

bool operator==(const KHR16BitStorageFeatures& in_features) const;
} KHR16BitStorageFeatures;

Expand Down
21 changes: 12 additions & 9 deletions include/wrappers/descriptor_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -689,9 +689,12 @@ namespace Anvil
current_element_index < last_element_index;
++current_element_index)
{
m_dirty |= !(binding_items[current_element_index] == in_elements_ptr[current_element_index - in_element_range.first]);
if (!(binding_items[current_element_index] == in_elements_ptr[current_element_index - in_element_range.first]) )
{
m_dirty = true;

binding_items[current_element_index] = in_elements_ptr[current_element_index - in_element_range.first];
binding_items[current_element_index] = in_elements_ptr[current_element_index - in_element_range.first];
}
}

return true;
Expand Down Expand Up @@ -882,13 +885,13 @@ namespace Anvil
bool update_using_template_method () const;

/* Private variables */
BindingIndexToBindingItemsMap m_bindings;
VkDescriptorSet m_descriptor_set;
const Anvil::BaseDevice* m_device_ptr;
mutable bool m_dirty;
const Anvil::DescriptorSetLayout* m_layout_ptr;
Anvil::DescriptorPool* m_parent_pool_ptr;
bool m_unusable;
mutable BindingIndexToBindingItemsMap m_bindings;
VkDescriptorSet m_descriptor_set;
const Anvil::BaseDevice* m_device_ptr;
mutable bool m_dirty;
const Anvil::DescriptorSetLayout* m_layout_ptr;
Anvil::DescriptorPool* m_parent_pool_ptr;
bool m_unusable;

mutable std::vector<VkDescriptorBufferInfo> m_cached_ds_info_buffer_info_items_vk;
mutable std::vector<VkDescriptorImageInfo> m_cached_ds_info_image_info_items_vk;
Expand Down
4 changes: 4 additions & 0 deletions include/wrappers/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "misc/debug.h"
#include "misc/mt_safety.h"
#include "misc/struct_chainer.h"
#include "misc/types.h"
#include <algorithm>

Expand Down Expand Up @@ -664,6 +665,9 @@ namespace Anvil
} DeviceQueueFamilyInfo;

/* Protected functions */

std::unique_ptr<Anvil::StructChain<VkPhysicalDeviceFeatures2KHR > > get_physical_device_features_chain() const;

std::vector<float> get_queue_priorities(const QueueFamilyInfo* in_queue_family_info_ptr) const;
void init (const DeviceExtensionConfiguration& in_extensions,
const std::vector<std::string>& in_layers,
Expand Down
56 changes: 19 additions & 37 deletions src/misc/render_pass_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,6 @@ bool Anvil::RenderPassInfo::add_subpass_attachment(SubPassID in_sub
bool in_should_resolve,
RenderPassAttachmentID in_resolve_attachment_id)
{
RenderPassAttachment* renderpass_attachment_ptr = nullptr;
RenderPassAttachment* resolve_attachment_ptr = nullptr;
bool result = false;
LocationToSubPassAttachmentMap* subpass_attachments_ptr = nullptr;
SubPass* subpass_ptr = nullptr;
Expand All @@ -307,10 +305,6 @@ bool Anvil::RenderPassInfo::add_subpass_attachment(SubPassID in_sub

goto end;
}
else
{
renderpass_attachment_ptr = &m_attachments.at(in_attachment_id);
}

/* Retrieve the resolve attachment descriptor, if one was requested */
if (in_should_resolve)
Expand All @@ -321,10 +315,6 @@ bool Anvil::RenderPassInfo::add_subpass_attachment(SubPassID in_sub

goto end;
}
else
{
resolve_attachment_ptr = &m_attachments.at(in_resolve_attachment_id);
}
}

/* Make sure the attachment location is not already assigned an attachment */
Expand All @@ -339,17 +329,15 @@ bool Anvil::RenderPassInfo::add_subpass_attachment(SubPassID in_sub
}

/* Add the attachment */
(*subpass_attachments_ptr)[in_attachment_location] = SubPassAttachment(renderpass_attachment_ptr,
(*subpass_attachments_ptr)[in_attachment_location] = SubPassAttachment(in_attachment_id,
in_layout,
resolve_attachment_ptr);
in_resolve_attachment_id);

if (in_should_resolve)
{
anvil_assert(resolve_attachment_ptr != nullptr);

subpass_ptr->resolved_attachments_map[in_attachment_location] = SubPassAttachment(resolve_attachment_ptr,
subpass_ptr->resolved_attachments_map[in_attachment_location] = SubPassAttachment(in_resolve_attachment_id,
in_layout,
nullptr);
UINT32_MAX);
}

m_update_preserved_attachments = true;
Expand Down Expand Up @@ -381,10 +369,8 @@ bool Anvil::RenderPassInfo::add_subpass_depth_stencil_attachment(SubPassID
RenderPassAttachmentID in_attachment_id,
VkImageLayout in_layout)
{
RenderPassAttachment* ds_attachment_ptr = nullptr;
RenderPassAttachment* resolve_attachment_ptr = nullptr;
bool result = false;
SubPass* subpass_ptr = nullptr;
bool result = false;
SubPass* subpass_ptr = nullptr;

/* Retrieve the subpass descriptor */
if (m_subpasses.size() <= in_subpass_id)
Expand All @@ -405,22 +391,18 @@ bool Anvil::RenderPassInfo::add_subpass_depth_stencil_attachment(SubPassID

goto end;
}
else
{
ds_attachment_ptr = &m_attachments.at(in_attachment_id);
}

/* Update the depth/stencil attachment for the subpass */
if (subpass_ptr->depth_stencil_attachment.attachment_ptr != nullptr)
if (subpass_ptr->depth_stencil_attachment.attachment_index != UINT32_MAX)
{
anvil_assert(!(subpass_ptr->depth_stencil_attachment.attachment_ptr != nullptr) );
anvil_assert(!(subpass_ptr->depth_stencil_attachment.attachment_index != UINT32_MAX) );

goto end;
}

subpass_ptr->depth_stencil_attachment = SubPassAttachment(ds_attachment_ptr,
subpass_ptr->depth_stencil_attachment = SubPassAttachment(in_attachment_id,
in_layout,
resolve_attachment_ptr);
UINT32_MAX);

m_update_preserved_attachments = true;
result = true;
Expand Down Expand Up @@ -541,7 +523,7 @@ VkAttachmentReference Anvil::RenderPassInfo::get_attachment_reference_from_subpa
{
VkAttachmentReference attachment_vk;

attachment_vk.attachment = in_subpass_attachment.attachment_ptr->index;
attachment_vk.attachment = m_attachments.at(in_subpass_attachment.attachment_index).index;
attachment_vk.layout = in_subpass_attachment.layout;

return attachment_vk;
Expand All @@ -561,7 +543,7 @@ VkAttachmentReference Anvil::RenderPassInfo::get_attachment_reference_for_resolv

anvil_assert((*in_subpass_iterator)->resolved_attachments_map.find(in_location_to_subpass_att_map_iterator->first) != (*in_subpass_iterator)->resolved_attachments_map.end() );

result.attachment = in_location_to_subpass_att_map_iterator->second.resolve_attachment_ptr->index;
result.attachment = m_attachments.at(in_location_to_subpass_att_map_iterator->second.resolve_attachment_index).index;
result.layout = (*in_subpass_iterator)->resolved_attachments_map.at(in_location_to_subpass_att_map_iterator->first).layout;

return result;
Expand Down Expand Up @@ -768,7 +750,7 @@ bool Anvil::RenderPassInfo::get_subpass_n_attachments(SubPassID in_subpass_

case ATTACHMENT_TYPE_DEPTH_STENCIL:
{
*out_n_attachments_ptr = (m_subpasses[in_subpass_id]->depth_stencil_attachment.attachment_ptr != nullptr) ? 1u : 0u;
*out_n_attachments_ptr = (m_subpasses[in_subpass_id]->depth_stencil_attachment.attachment_index != UINT32_MAX) ? 1u : 0u;

break;
}
Expand Down Expand Up @@ -838,7 +820,7 @@ bool Anvil::RenderPassInfo::get_subpass_attachment_properties(SubPassID
}

*out_layout_ptr = iterator->second.layout;
*out_renderpass_attachment_id_ptr = iterator->second.attachment_ptr->index;
*out_renderpass_attachment_id_ptr = m_attachments.at(iterator->second.attachment_index).index;

break;
}
Expand All @@ -853,7 +835,7 @@ bool Anvil::RenderPassInfo::get_subpass_attachment_properties(SubPassID
}

*out_layout_ptr = subpass_ptr->depth_stencil_attachment.layout;
*out_renderpass_attachment_id_ptr = subpass_ptr->depth_stencil_attachment.attachment_ptr->index;
*out_renderpass_attachment_id_ptr = m_attachments.at(subpass_ptr->depth_stencil_attachment.attachment_index).index;

break;
}
Expand All @@ -869,7 +851,7 @@ bool Anvil::RenderPassInfo::get_subpass_attachment_properties(SubPassID

const auto& attachment_props = subpass_ptr->preserved_attachments[in_n_subpass_attachment];

*out_renderpass_attachment_id_ptr = attachment_props.attachment_ptr->index;
*out_renderpass_attachment_id_ptr = m_attachments.at(attachment_props.attachment_index).index;
break;
}

Expand Down Expand Up @@ -920,7 +902,7 @@ void Anvil::RenderPassInfo::update_preserved_attachments() const
++n_attachment_type)
{
const uint32_t n_attachments = (n_attachment_type == 0) ? static_cast<uint32_t>(current_subpass_ptr->color_attachments_map.size() )
: (n_attachment_type == 1) ? ((current_subpass_ptr->depth_stencil_attachment.attachment_ptr != nullptr) ? 1 : 0)
: (n_attachment_type == 1) ? ((current_subpass_ptr->depth_stencil_attachment.attachment_index != UINT32_MAX) ? 1 : 0)
: static_cast<uint32_t>(current_subpass_ptr->resolved_attachments_map.size() );

for (uint32_t n_attachment = 0;
Expand Down Expand Up @@ -966,7 +948,7 @@ void Anvil::RenderPassInfo::update_preserved_attachments() const
++n_attachment_type)
{
const uint32_t n_attachments = (n_attachment_type == 0) ? static_cast<uint32_t>(current_subpass_ptr->color_attachments_map.size() )
: (n_attachment_type == 1) ? ((current_subpass_ptr->depth_stencil_attachment.attachment_ptr != nullptr) ? 1 : 0)
: (n_attachment_type == 1) ? ((current_subpass_ptr->depth_stencil_attachment.attachment_index != UINT32_MAX) ? 1 : 0)
: static_cast<uint32_t>(current_subpass_ptr->resolved_attachments_map.size() );

for (uint32_t n_attachment = 0;
Expand Down Expand Up @@ -1023,7 +1005,7 @@ void Anvil::RenderPassInfo::update_preserved_attachments() const
++n_attachment_type)
{
const uint32_t n_attachments = (n_attachment_type == 0) ? static_cast<uint32_t>(current_subpass_ptr->color_attachments_map.size() )
: (n_attachment_type == 1) ? ((current_subpass_ptr->depth_stencil_attachment.attachment_ptr != nullptr) ? 1 : 0)
: (n_attachment_type == 1) ? ((current_subpass_ptr->depth_stencil_attachment.attachment_index != UINT32_MAX) ? 1 : 0)
: static_cast<uint32_t>(current_subpass_ptr->resolved_attachments_map.size() );

for (uint32_t n_attachment = 0;
Expand Down
15 changes: 15 additions & 0 deletions src/misc/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,21 @@ bool Anvil::KHR16BitStorageFeatures::operator==(const KHR16BitStorageFeatures& i
in_features.is_uniform_and_storage_buffer_16_bit_access_supported == is_uniform_and_storage_buffer_16_bit_access_supported);
}

VkPhysicalDevice16BitStorageFeaturesKHR Anvil::KHR16BitStorageFeatures::get_vk_physical_device_16_bit_storage_features() const
{
VkPhysicalDevice16BitStorageFeaturesKHR result;

result.pNext = nullptr;
result.storageBuffer16BitAccess = BOOL_TO_VK_BOOL32(is_storage_buffer_16_bit_access_supported);
result.storageInputOutput16 = BOOL_TO_VK_BOOL32(is_input_output_storage_supported);
result.storagePushConstant16 = BOOL_TO_VK_BOOL32(is_push_constant_16_bit_storage_supported);
result.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR;
result.uniformAndStorageBuffer16BitAccess = BOOL_TO_VK_BOOL32(is_uniform_and_storage_buffer_16_bit_access_supported);

return result;

}

Anvil::KHRMaintenance3Properties::KHRMaintenance3Properties()
:max_memory_allocation_size(std::numeric_limits<VkDeviceSize>::max() ),
max_per_set_descriptors (UINT32_MAX)
Expand Down
Loading