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
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/cycles/hydra
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/cycles/hydra')
-rw-r--r--intern/cycles/hydra/camera.cpp9
-rw-r--r--intern/cycles/hydra/material.cpp13
2 files changed, 12 insertions, 10 deletions
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;