Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-04-29 18:26:56 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-04-29 18:39:04 +0300
commit0c317e23bff87e5ea2d908e480ae04eac1b7e2f8 (patch)
treed5ef1eddce932de167d7f9e8cb5dc5fce2432ce4 /intern
parent5d84d9b0d6ad114109d60cf3d0ddcd9bb1a5de13 (diff)
Cleanup: fix various Cycles build warnings with non-default options
* Float/double promotion warnings were mainly meant for avoiding slow operatiosn in the kernel. Limit it to that to avoid hard to fix warnings in Hydra. * Const warnings in Hydra iterators. * Unused variable warnings when building without glog. * Wrong camera enum comparisons in assert. * PASS_UNUSED is not a pass type, only for pass offsets.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/CMakeLists.txt4
-rw-r--r--intern/cycles/hydra/camera.cpp9
-rw-r--r--intern/cycles/hydra/material.cpp13
-rw-r--r--intern/cycles/integrator/path_trace.cpp24
-rw-r--r--intern/cycles/kernel/CMakeLists.txt8
-rw-r--r--intern/cycles/session/buffers.cpp2
6 files changed, 32 insertions, 28 deletions
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index 911e1cf214c..003f75267ce 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -323,11 +323,7 @@ endif()
# Warnings
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang")
- ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_float_conversion "-Werror=float-conversion")
- ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_double_promotion "-Werror=double-promotion")
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_no_error_unused_macros "-Wno-error=unused-macros")
- unset(_has_cxxflag_float_conversion)
- unset(_has_cxxflag_double_promotion)
unset(_has_no_error_unused_macros)
endif()
diff --git a/intern/cycles/hydra/camera.cpp b/intern/cycles/hydra/camera.cpp
index 62042cbbcd2..8b76afb2e44 100644
--- a/intern/cycles/hydra/camera.cpp
+++ b/intern/cycles/hydra/camera.cpp
@@ -281,9 +281,12 @@ void HdCyclesCamera::ApplyCameraSettings(HdRenderParam *renderParam,
auto data = dataUnconformedWindow;
CameraUtilConformWindow(&data, windowPolicy, width / height);
- static_assert(GfCamera::Perspective == CAMERA_PERSPECTIVE &&
- GfCamera::Orthographic == CAMERA_ORTHOGRAPHIC);
- cam->set_camera_type(static_cast<CameraType>(data.GetProjection()));
+ if (data.GetProjection() == GfCamera::Orthographic) {
+ cam->set_camera_type(CAMERA_ORTHOGRAPHIC);
+ }
+ else {
+ cam->set_camera_type(CAMERA_PERSPECTIVE);
+ }
const float metersPerUnit = static_cast<HdCyclesSession *>(renderParam)->GetStageMetersPerUnit();
diff --git a/intern/cycles/hydra/material.cpp b/intern/cycles/hydra/material.cpp
index b296d9f3751..a20f6578270 100644
--- a/intern/cycles/hydra/material.cpp
+++ b/intern/cycles/hydra/material.cpp
@@ -266,7 +266,7 @@ void HdCyclesMaterial::UpdateParameters(NodeDesc &nodeDesc,
const std::map<TfToken, VtValue> &parameters,
const SdfPath &nodePath)
{
- for (const std::pair<TfToken, VtValue> &param : parameters) {
+ for (const auto &param : parameters) {
VtValue value = param.second;
// See if the parameter name is in USDPreviewSurface terms, and needs to be converted
@@ -313,7 +313,7 @@ void HdCyclesMaterial::UpdateParameters(const HdMaterialNetwork &network)
void HdCyclesMaterial::UpdateParameters(const HdMaterialNetwork2 &network)
{
- for (const std::pair<SdfPath, HdMaterialNode2> &nodeEntry : network.nodes) {
+ for (const auto &nodeEntry : network.nodes) {
const SdfPath &nodePath = nodeEntry.first;
const auto nodeIt = _nodes.find(nodePath);
@@ -331,8 +331,7 @@ void HdCyclesMaterial::UpdateConnections(NodeDesc &nodeDesc,
const SdfPath &nodePath,
ShaderGraph *shaderGraph)
{
- for (const std::pair<TfToken, std::vector<HdMaterialConnection2>> &connection :
- matNode.inputConnections) {
+ for (const auto &connection : matNode.inputConnections) {
const TfToken &dstSocketName = connection.first;
const UsdToCyclesMapping *inputMapping = nodeDesc.mapping;
@@ -418,7 +417,7 @@ void HdCyclesMaterial::PopulateShaderGraph(const HdMaterialNetwork2 &networkMap)
auto graph = new ShaderGraph();
// Iterate all the nodes first and build a complete but unconnected graph with parameters set
- for (const std::pair<SdfPath, HdMaterialNode2> &nodeEntry : networkMap.nodes) {
+ for (const auto &nodeEntry : networkMap.nodes) {
NodeDesc nodeDesc = {};
const SdfPath &nodePath = nodeEntry.first;
@@ -465,7 +464,7 @@ void HdCyclesMaterial::PopulateShaderGraph(const HdMaterialNetwork2 &networkMap)
// Now that all nodes have been constructed, iterate the network again and build up any
// connections between nodes
- for (const std::pair<SdfPath, HdMaterialNode2> &nodeEntry : networkMap.nodes) {
+ for (const auto &nodeEntry : networkMap.nodes) {
const SdfPath &nodePath = nodeEntry.first;
const auto nodeIt = _nodes.find(nodePath);
@@ -478,7 +477,7 @@ void HdCyclesMaterial::PopulateShaderGraph(const HdMaterialNetwork2 &networkMap)
}
// Finally connect the terminals to the graph output (Surface, Volume, Displacement)
- for (const std::pair<TfToken, HdMaterialConnection2> &terminalEntry : networkMap.terminals) {
+ for (const auto &terminalEntry : networkMap.terminals) {
const TfToken &terminalName = terminalEntry.first;
const HdMaterialConnection2 &connection = terminalEntry.second;
diff --git a/intern/cycles/integrator/path_trace.cpp b/intern/cycles/integrator/path_trace.cpp
index 4ecd3b829e8..36a0326e405 100644
--- a/intern/cycles/integrator/path_trace.cpp
+++ b/intern/cycles/integrator/path_trace.cpp
@@ -647,8 +647,6 @@ void PathTrace::update_display(const RenderWork &render_work)
void PathTrace::rebalance(const RenderWork &render_work)
{
- static const int kLogLevel = 3;
-
if (!render_work.rebalance) {
return;
}
@@ -656,33 +654,33 @@ void PathTrace::rebalance(const RenderWork &render_work)
const int num_works = path_trace_works_.size();
if (num_works == 1) {
- VLOG(kLogLevel) << "Ignoring rebalance work due to single device render.";
+ VLOG(3) << "Ignoring rebalance work due to single device render.";
return;
}
const double start_time = time_dt();
- if (VLOG_IS_ON(kLogLevel)) {
- VLOG(kLogLevel) << "Perform rebalance work.";
- VLOG(kLogLevel) << "Per-device path tracing time (seconds):";
+ if (VLOG_IS_ON(3)) {
+ VLOG(3) << "Perform rebalance work.";
+ VLOG(3) << "Per-device path tracing time (seconds):";
for (int i = 0; i < num_works; ++i) {
- VLOG(kLogLevel) << path_trace_works_[i]->get_device()->info.description << ": "
- << work_balance_infos_[i].time_spent;
+ VLOG(3) << path_trace_works_[i]->get_device()->info.description << ": "
+ << work_balance_infos_[i].time_spent;
}
}
const bool did_rebalance = work_balance_do_rebalance(work_balance_infos_);
- if (VLOG_IS_ON(kLogLevel)) {
- VLOG(kLogLevel) << "Calculated per-device weights for works:";
+ if (VLOG_IS_ON(3)) {
+ VLOG(3) << "Calculated per-device weights for works:";
for (int i = 0; i < num_works; ++i) {
- VLOG(kLogLevel) << path_trace_works_[i]->get_device()->info.description << ": "
- << work_balance_infos_[i].weight;
+ VLOG(3) << path_trace_works_[i]->get_device()->info.description << ": "
+ << work_balance_infos_[i].weight;
}
}
if (!did_rebalance) {
- VLOG(kLogLevel) << "Balance in path trace works did not change.";
+ VLOG(3) << "Balance in path trace works did not change.";
render_scheduler_.report_rebalance_time(render_work, time_dt() - start_time, false);
return;
}
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index d660289ed17..c6ac280633b 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -733,6 +733,14 @@ if(CXX_HAS_AVX2)
set_source_files_properties(device/cpu/kernel_avx2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX2_KERNEL_FLAGS}")
endif()
+# Warnings to avoid using doubles in the kernel.
+if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+ ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_float_conversion "-Werror=float-conversion")
+ ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_double_promotion "-Werror=double-promotion")
+ unset(_has_cxxflag_float_conversion)
+ unset(_has_cxxflag_double_promotion)
+endif()
+
cycles_add_library(cycles_kernel "${LIB}"
${SRC_KERNEL_DEVICE_CPU}
${SRC_KERNEL_DEVICE_CUDA}
diff --git a/intern/cycles/session/buffers.cpp b/intern/cycles/session/buffers.cpp
index 3bbc205ca7a..b74074765fe 100644
--- a/intern/cycles/session/buffers.cpp
+++ b/intern/cycles/session/buffers.cpp
@@ -167,7 +167,7 @@ void BufferParams::reset_pass_offset()
int BufferParams::get_pass_offset(PassType pass_type, PassMode mode) const
{
- if (pass_type == PASS_NONE || pass_type == PASS_UNUSED) {
+ if (pass_type == PASS_NONE) {
return PASS_UNUSED;
}