Skip to content
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

Fix unsigned/signed mismatch errors on clang-cl #204

Merged
merged 1 commit into from
Mar 10, 2024
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: 1 addition & 1 deletion source/ngf-common/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ const char* ngf_util_get_error_name(const ngf_error err) {
"NGF_ERROR_INVALID_SIZE",
"NGF_ERROR_INVALID_ENUM",
"NGF_ERROR_INVALID_OPERATION"};
if (err > NGFI_ARRAYSIZE(ngf_error_names)) { return "invalid error code"; }
if ((size_t)err > NGFI_ARRAYSIZE(ngf_error_names)) { return "invalid error code"; }
return ngf_error_names[err];
}
10 changes: 5 additions & 5 deletions source/ngf-vk/impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ static ngf_error ngfvk_create_swapchain(
ngfvk_create_image(&wrapper_image_info, &wrapper_alloc, false, &swapchain->wrapper_imgs[i]);
}

const bool is_multisampled = swapchain_info->sample_count > 1u;
const bool is_multisampled = (unsigned int)swapchain_info->sample_count > 1u;

// Create multisampled images, if necessary.
if (is_multisampled) {
Expand Down Expand Up @@ -1279,7 +1279,7 @@ static ngf_error ngfvk_create_swapchain(
err = NGF_ERROR_OUT_OF_MEM;
goto ngfvk_create_swapchain_cleanup;
}
const bool have_resolve_attachment = swapchain_info->sample_count > 1u;
const bool have_resolve_attachment = (unsigned int)swapchain_info->sample_count > 1u;
const uint32_t depth_stencil_attachment_idx = swapchain->depth_img ? 1u : VK_ATTACHMENT_UNUSED;
const uint32_t resolve_attachment_idx =
have_resolve_attachment ? (swapchain->depth_img ? 2u : 1u) : VK_ATTACHMENT_UNUSED;
Expand Down Expand Up @@ -2241,9 +2241,9 @@ ngf_error ngfvk_create_pipeline_layout(
ngfvk_desc_set_layout set_layout;
memset(&set_layout, 0, sizeof(set_layout));
const uint32_t current_set_id = bindings[cur].binding_data.set;
if (last_set_id == ~0 || current_set_id - last_set_id > 1u) {
if (last_set_id == ~0u || current_set_id - last_set_id > 1u) {
// there is a gap in descriptor sets, fill it in with empty layouts;
for (uint32_t i = last_set_id == ~0 ? 0u : last_set_id + 1; i < current_set_id; ++i) {
for (uint32_t i = last_set_id == ~0u ? 0u : last_set_id + 1; i < current_set_id; ++i) {
const VkDescriptorSetLayoutCreateInfo vk_ds_info = {
.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO,
.pNext = NULL,
Expand Down Expand Up @@ -3897,7 +3897,7 @@ ngf_error ngf_create_context(const ngf_context_info* info, ngf_context* result)

// Create the default rendertarget object.
const bool default_rt_has_depth = swapchain_info->depth_format != NGF_IMAGE_FORMAT_UNDEFINED;
const bool default_rt_is_multisampled = swapchain_info->sample_count > 1u;
const bool default_rt_is_multisampled = (unsigned int)swapchain_info->sample_count > 1u;
const bool default_rt_no_stencil = swapchain_info->depth_format == NGF_IMAGE_FORMAT_DEPTH32 ||
swapchain_info->depth_format == NGF_IMAGE_FORMAT_DEPTH16;

Expand Down
Loading