-
-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed a crash caused by Vulkan requesting a swapchain image count > 3… #173
Conversation
…hing the swapchain. Resolves #172.
} | ||
u32 length_0 = string_length(str_0); | ||
u32 length_1 = string_length(str_1); | ||
if (length_0 > 0 && length_1 > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically speaking an empty string is present in any other string. The value of 0
should be returned in such a case. The rationale goes as follows:
If a string A is a substring of string B then dropping any trailing character from S1 should preserve inclusion.
u32 start = i; | ||
for (u32 j = 0; j < length_1; ++j) { | ||
if (str_0[i + j] != str_1[j]) { | ||
return -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't it returning to early. Does in mean that "ab" is not included in "aab" ?
// Create attachments array if it doesn't exist. Base it off the first target which should be valid. | ||
if(!target->attachment_count || !target->attachments) { | ||
target->attachment_count = source_target->attachment_count; | ||
target->attachments = kallocate(sizeof(render_target_attachment) * target->attachment_count, MEMORY_TAG_ARRAY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider using sizeof *target->attachments
. It will automatically adjust if type of render_target::attachments
is ever changed. Otherwise a wrong number of bytes will be allocated.
attachment->type = source_attachment->type; | ||
attachment->load_operation = source_attachment->load_operation; | ||
attachment->store_operation = source_attachment->store_operation; | ||
attachment->present_after = source_attachment->present_after; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*attachment = *source_attachement;
?
|
||
// Update the count. TODO: This will leave dangling attachments on a shrink. | ||
pass->render_target_count = attachment_count; | ||
} | ||
|
||
for (u8 i = 0; i < pass->render_target_count; ++i) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u8
is likely too small, consider good old int
@@ -283,9 +305,11 @@ static void create(vulkan_context* context, u32 width, u32 height, renderer_conf | |||
formatted_name, | |||
image); | |||
|
|||
char image_name[32] = "__kohi_default_depth_texture_0_"; | |||
image_name[30] = '0' + i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fail for more than 9 images. Consider sprintf(image_name, "__kohi_default_depth_texture_%u_", (unsigned)i)
Closing due to inactivity. |
…. Resolves #172