-
Notifications
You must be signed in to change notification settings - Fork 123
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
cast a float result back to uint32_t #1241
cast a float result back to uint32_t #1241
Conversation
CI gfxreconstruct build queued with queue ID 33175. |
CI gfxreconstruct build # 3150 running. |
CI gfxreconstruct build # 3150 failed. |
9a0e188
to
436853c
Compare
CI gfxreconstruct build queued with queue ID 33188. |
CI gfxreconstruct build # 3151 running. |
CI gfxreconstruct build # 3151 passed. |
CI gfxreconstruct build queued with queue ID 33276. |
CI gfxreconstruct build # 3153 running. |
CI gfxreconstruct build # 3153 passed. |
@@ -2147,12 +2147,12 @@ void VulkanReplayConsumerBase::WriteScreenshots(const Decoded_VkPresentInfoKHR* | |||
// If both copy_scale and copy_width are provided, use copy_scale. | |||
const uint32_t screenshot_width = | |||
options_.screenshot_scale | |||
? (options_.screenshot_scale * swapchain_info->width) | |||
? static_cast<uint32_t>(options_.screenshot_scale * swapchain_info->width) |
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.
constexpr uint32_t truncate_to_uint32(const float f)
{
GFXRECON_ASSERT_DEBUG(f >= 0.0f);
return static_cast<uint32_t>(f);
}
somewhere in a util
header to name what we are doing here and add the sanity precondition check on the param?
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.
I read static_cast<uint32>
on float
as truncating so for my taste there's not much reason to have a function that has that name. (To me it would be like a function called "copy_string" that calls "strcpy".)
This PR is just to fix warnings in /W3 build in Visual C++, but -
It does seem like a good idea to check the range of the scale but that should probably be validated in input. Want to add that in a PR?
* cast a float result back to uint32_t * fix some strict warnings
No description provided.