From 18cb1d2003da987166f8d18d7f00a02930cd282f Mon Sep 17 00:00:00 2001 From: George Shakula Date: Wed, 27 Nov 2019 16:58:00 +0200 Subject: [PATCH] Update to RPR 1.34.4 (#153) --- cmake/modules/FindRpr.cmake | 1 - pxr/imaging/plugin/hdRpr/materialAdapter.cpp | 78 ++++++++++---------- pxr/imaging/plugin/hdRpr/materialFactory.cpp | 12 +-- pxr/imaging/plugin/hdRpr/rprApi.cpp | 2 +- 4 files changed, 46 insertions(+), 47 deletions(-) diff --git a/cmake/modules/FindRpr.cmake b/cmake/modules/FindRpr.cmake index fd3d10b72..1c0944210 100644 --- a/cmake/modules/FindRpr.cmake +++ b/cmake/modules/FindRpr.cmake @@ -45,7 +45,6 @@ if(WIN32) set(RPR_BINARIES ${RPR_BIN_LOCATION}/RadeonProRender64.dll - ${RPR_BIN_LOCATION}/RprLoadStore64.dll ${RPR_TAHOE_BINARY} ${RPR_HYBRID_BINARY}) else() diff --git a/pxr/imaging/plugin/hdRpr/materialAdapter.cpp b/pxr/imaging/plugin/hdRpr/materialAdapter.cpp index 4a0e9e498..b6568b3ce 100644 --- a/pxr/imaging/plugin/hdRpr/materialAdapter.cpp +++ b/pxr/imaging/plugin/hdRpr/materialAdapter.cpp @@ -172,14 +172,14 @@ void GetTextures(const HdMaterialNetwork& materialNetwork, MaterialTextures& ou MaterialAdapter::MaterialAdapter(EMaterialType type, const MaterialParams& params) : m_type(type) { switch (type) { case EMaterialType::COLOR: { - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_COLOR] = GfVec4f(0.18f); - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_WEIGHT] = GfVec4f(1.0f); - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_WEIGHT] = GfVec4f(0.0f); - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFRACTION_WEIGHT] = GfVec4f(0.0f); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_COLOR] = GfVec4f(0.18f); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_WEIGHT] = GfVec4f(1.0f); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_WEIGHT] = GfVec4f(0.0f); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFRACTION_WEIGHT] = GfVec4f(0.0f); for (auto& entry : params) { if (entry.first == HdRprMaterialTokens->color) { - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_COLOR] = VtValToVec4f(entry.second); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_COLOR] = VtValToVec4f(entry.second); } } break; @@ -258,8 +258,8 @@ void MaterialAdapter::PopulateTransparent(const MaterialParams& params) { void MaterialAdapter::PopulateUsdPreviewSurface(const MaterialParams& params, const MaterialTextures& textures) { // initial params - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_WEIGHT] = GfVec4f(1.0f); - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFRACTION_COLOR] = GfVec4f(1.0f); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_WEIGHT] = GfVec4f(1.0f); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFRACTION_COLOR] = GfVec4f(1.0f); int useSpecular = 0; GfVec4f albedoColor = GfVec4f(1.0f); @@ -276,32 +276,32 @@ void MaterialAdapter::PopulateUsdPreviewSurface(const MaterialParams& params, co if (paramName == HdRprMaterialTokens->diffuseColor) { albedoColor = VtValToVec4f(paramValue); - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_COLOR] = albedoColor; + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_COLOR] = albedoColor; } else if (paramName == HdRprMaterialTokens->emissiveColor) { GfVec4f emmisionColor = VtValToVec4f(paramValue); if (!IsColorBlack(emmisionColor)) { - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_EMISSION_WEIGHT] = GfVec4f(1.0f); - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_EMISSION_COLOR] = emmisionColor; + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_EMISSION_WEIGHT] = GfVec4f(1.0f); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_EMISSION_COLOR] = emmisionColor; } } else if (paramName == HdRprMaterialTokens->useSpecularWorkflow) { useSpecular = paramValue.Get(); } else if (paramName == HdRprMaterialTokens->specularColor) { reflectionColor = VtValToVec4f(paramValue); } else if (paramName == HdRprMaterialTokens->metallic) { - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_METALNESS] = VtValToVec4f(paramValue); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_METALNESS] = VtValToVec4f(paramValue); } else if (paramName == HdRprMaterialTokens->roughness) { - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_ROUGHNESS] = VtValToVec4f(paramValue); - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_ROUGHNESS] = VtValToVec4f(paramValue); - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFRACTION_ROUGHNESS] = VtValToVec4f(paramValue); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_ROUGHNESS] = VtValToVec4f(paramValue); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_ROUGHNESS] = VtValToVec4f(paramValue); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFRACTION_ROUGHNESS] = VtValToVec4f(paramValue); } else if (paramName == HdRprMaterialTokens->clearcoat) { - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_COATING_WEIGHT] = VtValToVec4f(paramValue); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_COATING_WEIGHT] = VtValToVec4f(paramValue); } else if (paramName == HdRprMaterialTokens->clearcoatRoughness) { - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_COATING_ROUGHNESS] = VtValToVec4f(paramValue); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_COATING_ROUGHNESS] = VtValToVec4f(paramValue); } else if (paramName == HdRprMaterialTokens->ior) { - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFRACTION_IOR] = VtValToVec4f(paramValue); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFRACTION_IOR] = VtValToVec4f(paramValue); } else if (paramName == HdRprMaterialTokens->opacity) { - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_WEIGHT] = VtValToVec4f(paramValue); - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFRACTION_WEIGHT] = GfVec4f(1.0f) - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_DIFFUSE_WEIGHT]; + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_WEIGHT] = VtValToVec4f(paramValue); + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFRACTION_WEIGHT] = GfVec4f(1.0f) - m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_DIFFUSE_WEIGHT]; } } @@ -311,32 +311,32 @@ void MaterialAdapter::PopulateUsdPreviewSurface(const MaterialParams& params, co if (paramName == HdRprMaterialTokens->diffuseColor) { isAlbedoTexture = true; albedoTex = materialTexture; - m_texRpr[RPR_UBER_MATERIAL_INPUT_DIFFUSE_COLOR] = materialTexture; + m_texRpr[RPR_MATERIAL_INPUT_UBER_DIFFUSE_COLOR] = materialTexture; } else if (paramName == HdRprMaterialTokens->emissiveColor) { - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_EMISSION_WEIGHT] = GfVec4f(1.0f); - m_texRpr[RPR_UBER_MATERIAL_INPUT_EMISSION_COLOR] = materialTexture; + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_EMISSION_WEIGHT] = GfVec4f(1.0f); + m_texRpr[RPR_MATERIAL_INPUT_UBER_EMISSION_COLOR] = materialTexture; } else if (paramName == HdRprMaterialTokens->specularColor) { isReflectionTexture = true; reflectionTex = materialTexture; } else if (paramName == HdRprMaterialTokens->metallic) { - m_texRpr[RPR_UBER_MATERIAL_INPUT_REFLECTION_METALNESS] = materialTexture; + m_texRpr[RPR_MATERIAL_INPUT_UBER_REFLECTION_METALNESS] = materialTexture; } else if (paramName == HdRprMaterialTokens->roughness) { - m_texRpr[RPR_UBER_MATERIAL_INPUT_DIFFUSE_ROUGHNESS] = materialTexture; - m_texRpr[RPR_UBER_MATERIAL_INPUT_REFLECTION_ROUGHNESS] = materialTexture; - m_texRpr[RPR_UBER_MATERIAL_INPUT_REFRACTION_ROUGHNESS] = materialTexture; + m_texRpr[RPR_MATERIAL_INPUT_UBER_DIFFUSE_ROUGHNESS] = materialTexture; + m_texRpr[RPR_MATERIAL_INPUT_UBER_REFLECTION_ROUGHNESS] = materialTexture; + m_texRpr[RPR_MATERIAL_INPUT_UBER_REFRACTION_ROUGHNESS] = materialTexture; } else if (paramName == HdRprMaterialTokens->clearcoat) { - m_texRpr[RPR_UBER_MATERIAL_INPUT_COATING_WEIGHT] = materialTexture; + m_texRpr[RPR_MATERIAL_INPUT_UBER_COATING_WEIGHT] = materialTexture; } else if (paramName == HdRprMaterialTokens->clearcoatRoughness) { - m_texRpr[RPR_UBER_MATERIAL_INPUT_COATING_ROUGHNESS] = materialTexture; + m_texRpr[RPR_MATERIAL_INPUT_UBER_COATING_ROUGHNESS] = materialTexture; } else if (paramName == HdRprMaterialTokens->ior) { - m_texRpr[RPR_UBER_MATERIAL_INPUT_REFRACTION_IOR] = materialTexture; + m_texRpr[RPR_MATERIAL_INPUT_UBER_REFRACTION_IOR] = materialTexture; } else if (paramName == HdRprMaterialTokens->opacity) { - m_texRpr[RPR_UBER_MATERIAL_INPUT_DIFFUSE_WEIGHT] = materialTexture; + m_texRpr[RPR_MATERIAL_INPUT_UBER_DIFFUSE_WEIGHT] = materialTexture; materialTexture.isOneMinusSrcColor = true; - m_texRpr[RPR_UBER_MATERIAL_INPUT_REFRACTION_WEIGHT] = materialTexture; + m_texRpr[RPR_MATERIAL_INPUT_UBER_REFRACTION_WEIGHT] = materialTexture; } else if (paramName == HdRprMaterialTokens->normal) { - m_texRpr[RPR_UBER_MATERIAL_INPUT_DIFFUSE_NORMAL] = materialTexture; - m_texRpr[RPR_UBER_MATERIAL_INPUT_REFLECTION_NORMAL] = materialTexture; + m_texRpr[RPR_MATERIAL_INPUT_UBER_DIFFUSE_NORMAL] = materialTexture; + m_texRpr[RPR_MATERIAL_INPUT_UBER_REFLECTION_NORMAL] = materialTexture; } else if (paramName == HdRprMaterialTokens->displacement) { m_displacementTexture = materialTexture; } @@ -344,21 +344,21 @@ void MaterialAdapter::PopulateUsdPreviewSurface(const MaterialParams& params, co } if (useSpecular) { - m_uRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_MODE] = RPR_UBER_MATERIAL_IOR_MODE_PBR; + m_uRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_MODE] = RPR_UBER_MATERIAL_IOR_MODE_PBR; if (isReflectionTexture) { - m_texRpr[RPR_UBER_MATERIAL_INPUT_REFLECTION_COLOR] = reflectionTex; + m_texRpr[RPR_MATERIAL_INPUT_UBER_REFLECTION_COLOR] = reflectionTex; } else { - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_COLOR] = reflectionColor; + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_COLOR] = reflectionColor; } } else { - m_uRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_MODE] = RPR_UBER_MATERIAL_IOR_MODE_METALNESS; + m_uRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_MODE] = RPR_UBER_MATERIAL_IOR_MODE_METALNESS; if (isAlbedoTexture) { - m_texRpr[RPR_UBER_MATERIAL_INPUT_REFLECTION_COLOR] = albedoTex; + m_texRpr[RPR_MATERIAL_INPUT_UBER_REFLECTION_COLOR] = albedoTex; } else { - m_vec4fRprParams[RPR_UBER_MATERIAL_INPUT_REFLECTION_COLOR] = albedoColor; + m_vec4fRprParams[RPR_MATERIAL_INPUT_UBER_REFLECTION_COLOR] = albedoColor; } } diff --git a/pxr/imaging/plugin/hdRpr/materialFactory.cpp b/pxr/imaging/plugin/hdRpr/materialFactory.cpp index 87ba27e4c..9646d3f6d 100644 --- a/pxr/imaging/plugin/hdRpr/materialFactory.cpp +++ b/pxr/imaging/plugin/hdRpr/materialFactory.cpp @@ -230,22 +230,22 @@ RprApiMaterial* RprMaterialFactory::CreateMaterial(EMaterialType type, const Mat continue; } - if (paramId == RPR_UBER_MATERIAL_INPUT_EMISSION_COLOR) { + if (paramId == RPR_MATERIAL_INPUT_UBER_EMISSION_COLOR) { emissionColorNode = outNode; } // SIGGRAPH HACK: Fix for models from Apple AR quick look gallery. // Of all the available ways to load images, none of them gives the opportunity to // get the gamma of the image and does not convert the image to linear space - if ((paramId == RPR_UBER_MATERIAL_INPUT_DIFFUSE_COLOR || - paramId == RPR_UBER_MATERIAL_INPUT_REFLECTION_COLOR) && + if ((paramId == RPR_MATERIAL_INPUT_UBER_DIFFUSE_COLOR || + paramId == RPR_MATERIAL_INPUT_UBER_REFLECTION_COLOR) && ArGetResolver().GetExtension(matTex.path) == "png") { rprImageSetGamma(material->materialImages.back()->GetHandle(), 2.2f); } // normal map textures need to be passed through the normal map node - if (paramId == RPR_UBER_MATERIAL_INPUT_DIFFUSE_NORMAL || - paramId == RPR_UBER_MATERIAL_INPUT_REFLECTION_NORMAL) { + if (paramId == RPR_MATERIAL_INPUT_UBER_DIFFUSE_NORMAL || + paramId == RPR_MATERIAL_INPUT_UBER_REFLECTION_NORMAL) { rpr_material_node textureNode = outNode; int status = rprMaterialSystemCreateNode(m_matSys, RPR_MATERIAL_NODE_NORMAL_MAP, &outNode); if (status == RPR_SUCCESS) { @@ -273,7 +273,7 @@ RprApiMaterial* RprMaterialFactory::CreateMaterial(EMaterialType type, const Mat rprMaterialNodeSetInputNByKey(isBlackColorNode, RPR_MATERIAL_INPUT_COLOR0, averageNode); rprMaterialNodeSetInputFByKey(isBlackColorNode, RPR_MATERIAL_INPUT_COLOR1, 0.0f, 0.0f, 0.0f, 0.0f); - rprMaterialNodeSetInputNByKey(material->rootMaterial, RPR_UBER_MATERIAL_INPUT_EMISSION_WEIGHT, isBlackColorNode); + rprMaterialNodeSetInputNByKey(material->rootMaterial, RPR_MATERIAL_INPUT_UBER_EMISSION_WEIGHT, isBlackColorNode); } else { rprObjectDelete(averageNode); } diff --git a/pxr/imaging/plugin/hdRpr/rprApi.cpp b/pxr/imaging/plugin/hdRpr/rprApi.cpp index 808cdb78d..3d9b9a8ee 100644 --- a/pxr/imaging/plugin/hdRpr/rprApi.cpp +++ b/pxr/imaging/plugin/hdRpr/rprApi.cpp @@ -471,7 +471,7 @@ class HdRprApiImpl { m_rprContext->GetHandle(), &curve , newPoints.size(), (float*)newPoints.data(), sizeof(GfVec3f) , newIndexes.size(), 1, (const rpr_uint*)newIndexes.data() - , &width, nullptr, segmentsPerCurve.data()), "Fail to create curve")) { + , &width, nullptr, segmentsPerCurve.data(), 0), "Fail to create curve")) { return nullptr; } auto curveObject = RprApiObject::Wrap(curve);