Skip to content

Commit

Permalink
Merge pull request #367 from DMotorygin/dev/dmotor/upd_3.1.00
Browse files Browse the repository at this point in the history
Core Update to version 3.1.00
  • Loading branch information
radeonprorender authored May 1, 2023
2 parents 1688d1d + 47e77b9 commit b560ebc
Show file tree
Hide file tree
Showing 27 changed files with 316 additions and 146 deletions.
3 changes: 2 additions & 1 deletion FireRender.Maya.OSX/frMayaPluginMac/postbuild_debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ cp -r "$PROJECT_DIR/../../../FireRender.Maya.Src/renderDesc" "/Users/Shared/Rade
cp -r "$PROJECT_DIR/../../../FireRender.Maya.Src/scripts" "/Users/Shared/RadeonProRender/"
cp -r "$PROJECT_DIR/../../../FireRender.Maya.Src/python/" "/Users/Shared/RadeonProRender/scripts/"
cp -r "$PROJECT_DIR/../../../FireRender.Maya.Src/shelfs/" "/Users/Shared/RadeonProRender/shelves/"
cp -r "$PROJECT_DIR/../../../RadeonProRenderSDK/hipbin/" "/Users/Shared/RadeonProRender/hipbin/"

cp -r "$PROJECT_DIR/../../../RadeonProRenderSDK/RadeonProRender/binMacOS/" "/Users/Shared/RadeonProRender/lib/"

Expand Down Expand Up @@ -55,7 +56,7 @@ fi
if [ -d "/Users/Shared/Autodesk/modules/maya/2022/" ]; then
cp "$PROJECT_DIR/../rpr2022.mod" "/Users/Shared/Autodesk/modules/maya/2022/rpr.mod"
fi
if [ -d "/Users/Shared/Autodesk/modules/maya/2022/" ]; then
if [ -d "/Users/Shared/Autodesk/modules/maya/2023/" ]; then
cp "$PROJECT_DIR/../rpr2023.mod" "/Users/Shared/Autodesk/modules/maya/2023/rpr.mod"
fi

Expand Down
1 change: 1 addition & 0 deletions FireRender.Maya.OSX/frMayaPluginMac/postbuild_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ cp -r "$PROJECT_DIR/../../../FireRender.Maya.Src/renderDesc" "/Users/Shared/Rade
cp -r "$PROJECT_DIR/../../../FireRender.Maya.Src/scripts" "/Users/Shared/RadeonProRender/"
cp -r "$PROJECT_DIR/../../../FireRender.Maya.Src/python/" "/Users/Shared/RadeonProRender/scripts/"
cp -r "$PROJECT_DIR/../../../FireRender.Maya.Src/shelfs/" "/Users/Shared/RadeonProRender/shelves/"
cp -r "$PROJECT_DIR/../../../RadeonProRenderSDK/hipbin/" "/Users/Shared/RadeonProRender/hipbin/"

cp -r "$PROJECT_DIR/../../../RadeonProRenderSDK/RadeonProRender/binMacOS/" "/Users/Shared/RadeonProRender/lib/"

Expand Down
42 changes: 40 additions & 2 deletions FireRender.Maya.Src/Context/FireRenderContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void FireRenderContext::resize(unsigned int w, unsigned int h, bool renderView,
setResolution(w, h, renderView, glTexture);
}

int FireRenderContext::GetAOVMaxValue()
int FireRenderContext::GetAOVMaxValue() const
{
return 0x20;
}
Expand Down Expand Up @@ -3021,14 +3021,20 @@ bool FireRenderContext::keepRenderRunning()
return secondsSpentRendering < m_completionCriteriaParams.getTotalSecondsCount();
}

bool FireRenderContext::isFirstIterationAndShadersNOTCached()
bool FireRenderContext::ShouldShowShaderCacheWarningWindow()
{
if (isMetalOn())
{
// Metal does not cache shaders the way OCL does
return false;
}

if (!HasRPRCachePathSet())
{
// Path to cache not set => Core will not be caching shaders
return false;
}

if (m_currentIteration == 0)
{
return !areShadersCached();
Expand Down Expand Up @@ -3742,3 +3748,35 @@ frw::Light FireRenderContext::GetLightSceneObjectFromMObject(const MObject& node
return frw::Light();
}

bool FireRenderContext::HasRPRCachePathSet() const
{
if (!scope.IsValid() || !scope.Context())
return false; // context not created yet

rpr_context pContext = scope.Context().Handle();
assert(pContext != nullptr);
if (!pContext)
return false;

size_t length;
rpr_status rprStatus = rprContextGetInfo(pContext, RPR_CONTEXT_CACHE_PATH, sizeof(size_t), nullptr, &length);
assert(RPR_SUCCESS == rprStatus);
if (RPR_SUCCESS != rprStatus)
return false;

std::string path;
path.resize(length);
rprStatus = rprContextGetInfo(pContext, RPR_CONTEXT_CACHE_PATH, path.size(), path.data(), nullptr);
assert(RPR_SUCCESS == rprStatus);
if (RPR_SUCCESS != rprStatus)
return false;

if (path.empty())
return false;

if ((path.length()) == 1 && (path[0] == '\0'))
return false;

return true;
}

15 changes: 10 additions & 5 deletions FireRender.Maya.Src/Context/FireRenderContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ struct ContextWorkProgressData
size_t currentIndex = 0;
size_t totalCount = 0;
std::string objectName;
long long currentTimeInMiliseconds = 0;
long long elapsedTotal = 0;
long long elapsedPostRenderTonemap = 0; // for extra data
unsigned long long currentTimeInMiliseconds = 0;
unsigned long long elapsedTotal = 0;
unsigned long long elapsedPostRenderTonemap = 0; // for extra data

unsigned int GetPercentProgress() const { return (unsigned int)(100 * currentIndex / totalCount); }
};
Expand Down Expand Up @@ -657,6 +657,7 @@ class FireRenderContext : public IFireRenderContextInfo
virtual bool IsVolumeSupported() const override { return true; }
virtual bool IsNorthstarVolumeSupported() const { return false; }
virtual bool ShouldForceRAMDenoiser() const override { return false; }
virtual bool ShouldUseNoSubdivDisplacement() const override { return false; }

virtual bool IsPhysicalLightTypeSupported(PLType lightType) const { return true; }

Expand Down Expand Up @@ -725,7 +726,7 @@ class FireRenderContext : public IFireRenderContextInfo

virtual void OnPreRender() {}

virtual int GetAOVMaxValue();
virtual int GetAOVMaxValue() const;

void ReadDenoiserFrameBuffersIntoRAM(ReadFrameBufferRequestParams& params);

Expand Down Expand Up @@ -988,11 +989,15 @@ class FireRenderContext : public IFireRenderContextInfo
bool isUnlimited();
void setStartedRendering();
bool keepRenderRunning();
bool isFirstIterationAndShadersNOTCached();
bool ShouldShowShaderCacheWarningWindow();
void updateProgress();
int getProgress();
void setProgress(int percents);

// returns true if context have path to rpr context set
// - false if path is not set (this would be the case if precompiled kernels are used)
bool HasRPRCachePathSet() const;

void setSamplesPerUpdate(int samplesPerUpdate);

AOVPixelBuffers& PixelBuffers(void) { return m_pixelBuffers; }
Expand Down
1 change: 1 addition & 0 deletions FireRender.Maya.Src/Context/FireRenderContextIFace.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class IFireRenderContextInfo
virtual bool IsHairSupported() const = 0;
virtual bool IsVolumeSupported() const = 0;
virtual bool ShouldForceRAMDenoiser() const = 0;
virtual bool ShouldUseNoSubdivDisplacement() const = 0;

virtual bool IsShaderSupported(frw::ShaderType) const = 0;
virtual bool IsShaderNodeSupported(FireMaya::ShaderNode* shaderNode) const = 0;
Expand Down
19 changes: 18 additions & 1 deletion FireRender.Maya.Src/Context/HybridProContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.
#include "../FireRenderStandardMaterial.h"
#include "../FireRenderDoublesided.h"
#include "../FireRenderPBRMaterial.h"
#include "../FireRenderShadowCatcherMaterial.h"

rpr_int HybridProContext::m_gHybridProPluginID = INCORRECT_PLUGIN_ID;

Expand Down Expand Up @@ -114,7 +115,11 @@ bool HybridProContext::IsAOVSupported(int aov) const
RPR_AOV_BACKGROUND,
RPR_AOV_EMISSION,
RPR_AOV_DIFFUSE_ALBEDO,
RPR_AOV_VIEW_SHADING_NORMAL };
RPR_AOV_VIEW_SHADING_NORMAL,
RPR_AOV_SHADOW_CATCHER,
RPR_AOV_MATTE_PASS,
RPR_AOV_OPACITY,
};

return supportedAOVs.find(aov) != supportedAOVs.end();
}
Expand All @@ -136,6 +141,18 @@ bool HybridProContext::IsShaderNodeSupported(FireMaya::ShaderNode* shaderNode) c
return true;
}

FireMaya::ShadowCatcherMaterial* pShadowMaterial = dynamic_cast<FireMaya::ShadowCatcherMaterial*> (shaderNode);
if (pShadowMaterial != nullptr)
{
return true;
}

return false;
}

int HybridProContext::GetAOVMaxValue() const
{
return RPR_AOV_MAX;
}


30 changes: 17 additions & 13 deletions FireRender.Maya.Src/Context/HybridProContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class HybridProContext : public HybridContext
bool IsRenderRegionSupported() const override { return false; }

bool IsDenoiserSupported() const override { return false; }
bool IsDisplacementSupported() const override { return false; }
bool IsDisplacementSupported() const override { return true; }

bool IsHairSupported() const override { return true; }
bool IsVolumeSupported() const override { return true; }
Expand All @@ -38,18 +38,22 @@ class HybridProContext : public HybridContext
virtual bool IsCameraSetExposureSupported() const { return false; }
virtual bool IsShadowColorSupported() const { return false; }

virtual bool IsUberReflectionDielectricSupported() const { return false; }
virtual bool IsUberRefractionAbsorbtionColorSupported() const { return false; }
virtual bool IsUberRefractionAbsorbtionDistanceSupported() const { return false; }
virtual bool IsUberRefractionCausticsSupported() const { return false; }
virtual bool IsUberSSSWeightSupported() const { return false; }
virtual bool IsUberSheenWeightSupported() const { return false; }
virtual bool IsUberBackscatterWeightSupported() const { return false; }
virtual bool IsUberShlickApproximationSupported() const { return false; }
virtual bool IsUberCoatingThicknessSupported() const { return false; }
virtual bool IsUberCoatingTransmissionColorSupported() const { return false; }
virtual bool IsUberReflectionNormalSupported() const { return false; }
virtual bool IsUberScaleSupported() const { return false; }
virtual bool ShouldUseNoSubdivDisplacement() const override { return true; }

virtual bool IsUberReflectionDielectricSupported() const { return true; }
virtual bool IsUberRefractionAbsorbtionColorSupported() const { return true; }
virtual bool IsUberRefractionAbsorbtionDistanceSupported() const { return true; }
virtual bool IsUberRefractionCausticsSupported() const { return true; }
virtual bool IsUberSSSWeightSupported() const { return true; }
virtual bool IsUberSheenWeightSupported() const { return true; }
virtual bool IsUberBackscatterWeightSupported() const { return true; }
virtual bool IsUberShlickApproximationSupported() const { return true; }
virtual bool IsUberCoatingThicknessSupported() const { return true; }
virtual bool IsUberCoatingTransmissionColorSupported() const { return true; }
virtual bool IsUberReflectionNormalSupported() const { return true; }
virtual bool IsUberScaleSupported() const { return true; }

virtual int GetAOVMaxValue() const override;

void setupContextPostSceneCreation(const FireRenderGlobalsData& fireRenderGlobalsData, bool disableWhiteBalance = false) override;

Expand Down
18 changes: 15 additions & 3 deletions FireRender.Maya.Src/Context/TahoeContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,24 @@ rpr_int NorthStarContext::CreateContextInternal(rpr_creation_flags createFlags,
ctxProperties.push_back((void*)(size_t)threadCountToOverride);
}

ctxProperties.push_back((rpr_context_properties)RPR_CONTEXT_PRECOMPILED_BINARY_PATH);
std::string hipbinPath = GetPathToHipbinFolder();
ctxProperties.push_back((rpr_context_properties)hipbinPath.c_str());

ctxProperties.push_back((rpr_context_properties)0);

int res;
#ifdef RPR_VERSION_MAJOR_MINOR_REVISION
int res = rprCreateContext(RPR_VERSION_MAJOR_MINOR_REVISION, plugins, pluginCount, createFlags, ctxProperties.data(), cachePath.asUTF8(), pContext);
if (!Globals().useOpenCLContext)
{
res = rprCreateContext(RPR_VERSION_MAJOR_MINOR_REVISION, plugins, pluginCount, createFlags, ctxProperties.data(), nullptr, pContext);
}
else
{
res = rprCreateContext(RPR_VERSION_MAJOR_MINOR_REVISION, plugins, pluginCount, createFlags, ctxProperties.data(), cachePath.asUTF8(), pContext);
}
#else
int res = rprCreateContext(RPR_API_VERSION, plugins, pluginCount, createFlags, ctxProperties.data(), cachePath.asUTF8(), pContext);
res = rprCreateContext(RPR_API_VERSION, plugins, pluginCount, createFlags, ctxProperties.data(), cachePath.asUTF8(), pContext);
#endif
return res;
}
Expand Down Expand Up @@ -609,7 +621,7 @@ void NorthStarContext::OnPreRender()
}
}

int NorthStarContext::GetAOVMaxValue()
int NorthStarContext::GetAOVMaxValue() const
{
assert(NorthStarContext::IsGivenContextNorthStar(this));

Expand Down
2 changes: 1 addition & 1 deletion FireRender.Maya.Src/Context/TahoeContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class NorthStarContext : public FireRenderContext

virtual void OnPreRender() override;

virtual int GetAOVMaxValue() override;
virtual int GetAOVMaxValue() const override;

private:
static rpr_int m_gTahoePluginID;
Expand Down
1 change: 1 addition & 0 deletions FireRender.Maya.Src/FireMaya.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ namespace FireMaya
void Reset();
void Init(rpr_context handle, bool destroyMaterialSystemOnDelete = true, bool createScene = true);
void CreateScene(void);
bool IsValid(void) const { return m != nullptr; }

void SetContextInfo (IFireRenderContextInfo* pCtxInfo);
const IFireRenderContextInfo* GetIContextInfo() const;
Expand Down
1 change: 1 addition & 0 deletions FireRender.Maya.Src/FireRender.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,7 @@
<AdditionalDependencies>OpenMayaFX.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent />
<PostBuildEvent />
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug2023|x64'">
<ClCompile>
Expand Down
8 changes: 8 additions & 0 deletions FireRender.Maya.Src/FireRenderGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ namespace
// Cryptomatte
MObject cryptomatteExtendedMode;
MObject cryptomatteSplitIndirect;

// Use legacy OpenCL context
MObject useOpenCLContext;
}

struct RenderingDeviceAttributes
Expand Down Expand Up @@ -512,6 +515,9 @@ MStatus FireRenderGlobals::initialize()
MAKE_INPUT_CONST(eAttr);
CHECK_MSTATUS(addAttribute(Attribute::tahoeVersion));

Attribute::useOpenCLContext = nAttr.create("useOpenCLContext", "uoclc", MFnNumericData::kBoolean, false, &status);
MAKE_INPUT(nAttr);

int isCachePathExists = 0;
MGlobal::executeCommand(MString("optionVar -ex \"RPR_textureCachePath\""), isCachePathExists);
if (!isCachePathExists) {
Expand Down Expand Up @@ -596,6 +602,8 @@ MStatus FireRenderGlobals::initialize()
CHECK_MSTATUS(addAttribute(Attribute::renderQuality));
CHECK_MSTATUS(addAttribute(ViewportRenderAttributes::renderQuality));

CHECK_MSTATUS(addAttribute(Attribute::useOpenCLContext));

createDenoiserAttributes();

createAirVolumeAttributes();
Expand Down
2 changes: 1 addition & 1 deletion FireRender.Maya.Src/FireRenderIpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ bool FireRenderIpr::start()
m_contextPtr->setStartedRendering();
m_contextPtr->setUseRegion(m_isRegion);

if (m_contextPtr->isFirstIterationAndShadersNOTCached())
if (m_contextPtr->ShouldShowShaderCacheWarningWindow())
showWarningDialog = true; //first iteration and shaders are _NOT_ cached

if (m_isRegion)
Expand Down
2 changes: 2 additions & 0 deletions FireRender.Maya.Src/FireRenderMaya.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ md $(SolutionDir)dist\images
md $(SolutionDir)dist\icons
md $(SolutionDir)dist\shaders
md $(SolutionDir)dist\renderDesc
md $(SolutionDir)dist\hipbin

XCOPY /E /Y $(ProjectDir)\scripts\* $(SolutionDir)dist\scripts\
XCOPY /E /Y $(ProjectDir)\python $(SolutionDir)dist\scripts\
Expand All @@ -36,6 +37,7 @@ XCOPY /E /Y $(ProjectDir)\icons\* $(SolutionDir)dist\icons\
COPY $(ProjectDir)\shaders\* $(SolutionDir)dist\shaders\ /Y

COPY $(ProjectDir)\renderDesc\* $(SolutionDir)dist\renderDesc\ /Y
COPY $(SolutionDir)RadeonProRenderSDK\hipbin\* $(SolutionDir)dist\hipbin\ /Y

COPY "$(SolutionDir)RadeonProRenderSDK\RadeonProRender\binWin64\*.dll" $(SolutionDir)dist\bin\ /Y
COPY "$(SolutionDir)RadeonProImageProcessingSDK\Windows\Dynamic\*.dll" $(SolutionDir)dist\bin\ /Y
Expand Down
Loading

0 comments on commit b560ebc

Please sign in to comment.