提交 51d23be1 编写于 作者: M Matt Pharr

Fix some MSVC warnings

上级 fdcaa3a8
...@@ -860,7 +860,7 @@ add_executable (pbrt::pspec ALIAS pspec) ...@@ -860,7 +860,7 @@ add_executable (pbrt::pspec ALIAS pspec)
target_compile_definitions (pspec PRIVATE ${PBRT_DEFINITIONS}) target_compile_definitions (pspec PRIVATE ${PBRT_DEFINITIONS})
target_compile_options (pspec PRIVATE ${PBRT_CXX_FLAGS}) target_compile_options (pspec PRIVATE ${PBRT_CXX_FLAGS})
target_include_directories (pspec PRIVATE src src/ext) target_include_directories (pspec PRIVATE src src/ext)
target_link_libraries (pspec PRIVATE ${ALL_PBRT_LIBS}) target_link_libraries (pspec PRIVATE ${ALL_PBRT_LIBS} pbrt_warnings)
add_sanitizers (pspec) add_sanitizers (pspec)
......
...@@ -76,7 +76,7 @@ static void checkElementary(const char *name, std::vector<Point2f> samples, ...@@ -76,7 +76,7 @@ static void checkElementary(const char *name, std::vector<Point2f> samples,
// in each dimension. // in each dimension.
int nx = 1 << i, ny = 1 << (logSamples - i); int nx = 1 << i, ny = 1 << (logSamples - i);
std::vector<int> count(1 << logSamples, 0); std::vector<int> count(size_t(1 << logSamples), 0);
for (const Point2f &s : samples) { for (const Point2f &s : samples) {
// Map the sample to an interval // Map the sample to an interval
Float x = nx * s.x, y = ny * s.y; Float x = nx * s.x, y = ny * s.y;
......
...@@ -240,7 +240,7 @@ struct OwenScrambler { ...@@ -240,7 +240,7 @@ struct OwenScrambler {
for (int b = 1; b < 32; ++b) { for (int b = 1; b < 32; ++b) {
// Apply Owen scrambling to binary digit _b_ in _v_ // Apply Owen scrambling to binary digit _b_ in _v_
uint32_t mask = (~0u) << (32 - b); uint32_t mask = (~0u) << (32 - b);
if (MixBits((v & mask) ^ seed) & (1u << b)) if ((uint32_t)MixBits((v & mask) ^ seed) & (1u << b))
v ^= 1u << (31 - b); v ^= 1u << (31 - b);
} }
return v; return v;
......
...@@ -243,9 +243,9 @@ PBRT_CPU_GPU inline Float Lerp(Float x, Float a, Float b) { ...@@ -243,9 +243,9 @@ PBRT_CPU_GPU inline Float Lerp(Float x, Float a, Float b) {
template <typename T, typename U, typename V> template <typename T, typename U, typename V>
PBRT_CPU_GPU inline constexpr T Clamp(T val, U low, V high) { PBRT_CPU_GPU inline constexpr T Clamp(T val, U low, V high) {
if (val < low) if (val < low)
return low; return T(low);
else if (val > high) else if (val > high)
return high; return T(high);
else else
return val; return val;
} }
......
...@@ -71,7 +71,7 @@ class ProgressReporter { ...@@ -71,7 +71,7 @@ class ProgressReporter {
#ifdef PBRT_BUILD_GPU_RENDERER #ifdef PBRT_BUILD_GPU_RENDERER
std::vector<cudaEvent_t> gpuEvents; std::vector<cudaEvent_t> gpuEvents;
std::atomic<int> gpuEventsLaunchedOffset; std::atomic<size_t> gpuEventsLaunchedOffset;
int gpuEventsFinishedOffset; int gpuEventsFinishedOffset;
#endif #endif
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册