Skip to content

Commit

Permalink
[cmake] minor packaging fix
Browse files Browse the repository at this point in the history
  • Loading branch information
harrand committed Nov 2, 2024
1 parent 6950328 commit 0966bc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cmake/package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function(topaz_define_package)

get_target_property(bundle_deps ${TOPAZ_DEFINE_PACKAGE_TARGET} TOPAZ_BUNDLE_DEPENDENCIES)
# Create commands to copy all the bundled files to the package dir.
if(NOT ${bundle_deps} STREQUAL "bundle_deps-NOTFOUND")
if(NOT "${bundle_deps}" STREQUAL "bundle_deps-NOTFOUND")
foreach(bundle_file IN LISTS bundle_deps)
set(bundle_file_path $<TARGET_FILE_DIR:${TOPAZ_DEFINE_PACKAGE_TARGET}>/${bundle_file})
add_custom_command(
Expand Down
19 changes: 7 additions & 12 deletions src/tz/gpu/rhi_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ namespace tz::gpu
pass_info info;
std::vector<resource_handle> colour_targets;
std::vector<resource_handle> resources;
std::size_t image_count = 0;
VkPipelineLayout layout = VK_NULL_HANDLE;
VkPipeline pipeline = VK_NULL_HANDLE;
VkBuffer meta_buffer = VK_NULL_HANDLE;
Expand Down Expand Up @@ -1151,6 +1152,10 @@ namespace tz::gpu
{
buffer_count++;
}
else if(res.is_image())
{
pass.image_count++;
}
pass.resources.push_back(resh);
}
pass.info.resources = pass.resources;
Expand Down Expand Up @@ -1496,26 +1501,16 @@ namespace tz::gpu
RETERR(tz::error_code::invalid_value, "buffer resource passed to pass_add_image_resource. you can only add image resources to a pass, the buffer resources can never change unless you create a new pass.");
}

std::size_t image_count = 0;
auto& passdata = passes[pass.peek()];

for(resource_handle existing_res : passdata.info.resources)
{
if(existing_res != tz::gpu::window_resource && existing_res != tz::nullhand)
{
if(resources[existing_res.peek()].is_image())
{
image_count++;
}
}
}
if(image_count >= max_image_count_per_pass)
if(passdata.image_count >= max_image_count_per_pass)
{
RETERR(tz::error_code::driver_hazard, "attempted to add a new image resource to pass {}, but that pass already has the maximum number of image resources possible ({})", pass.peek(), max_image_count_per_pass);
}

passdata.resources.push_back(res);
passdata.info.resources = passdata.resources;
passdata.image_count++;

// need to write a new descriptor image as it's there now.
impl_write_single_resource(res);
Expand Down

0 comments on commit 0966bc1

Please sign in to comment.