Skip to content

Commit 15a2bff

Browse files
tgvarikpixar-oss
authored andcommitted
[usdImaging][rmanpkg] Move usdRiPxrImaging to third_party/renderman/plugin
(Internal change: 2403858)
1 parent aa09078 commit 15a2bff

40 files changed

Lines changed: 329 additions & 257 deletions

pxr/usdImaging/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ set(DIRS
22
usdImaging
33
usdImagingGL
44
usdProcImaging
5-
usdRiPxrImaging
65
usdSkelImaging
76
usdVolImaging
87
usdAppUtils

pxr/usdImaging/usdImaging/dataSourceMaterial.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "pxr/usd/usd/prim.h"
1313

14+
#include "pxr/usdImaging/usdImaging/api.h"
1415
#include "pxr/usdImaging/usdImaging/dataSourcePrim.h"
1516
#include "pxr/usdImaging/usdImaging/dataSourceStageGlobals.h"
1617

@@ -41,6 +42,7 @@ class UsdImagingDataSourceMaterial : public HdContainerDataSource
4142
/// treated as the terminal shader node in the graph rather than as a
4243
/// material (with relationships to the prims serving as terminal shader
4344
/// nodes). This is relevant for light and light filter cases.
45+
USDIMAGING_API
4446
UsdImagingDataSourceMaterial(
4547
const UsdPrim &usdPrim,
4648
const UsdImagingDataSourceStageGlobals &stageGlobals,

pxr/usdImaging/usdImaging/version.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ PXR_NAMESPACE_OPEN_SCOPE
1818
// Version 5 -- GetPathForInstanceIndex returns absoluteInstanceIndex.
1919
// Version 6 -- PrimAdater::GetDependPaths.
2020
// Version 7 -- GetPathForInstanceIndex returns instanceContext.
21-
// Version 8 -- GetPathForInstanceIndex returns instanceContext (as
21+
// Version 8 -- GetPathForInstanceIndex returns instanceContext (as
2222
// SdfPathVector) and rprimPath separately.
2323
// Version 9 -- Rework UsdImagingEngineGL::RenderParams API to conform to
2424
// updated purpose tokens and make proxy imaging optional.
@@ -34,19 +34,20 @@ PXR_NAMESPACE_OPEN_SCOPE
3434
// Version 17 - RequestTrackVariability/RequestUpdateForTime, and UpdateForTime
3535
// no longer automatically called.
3636
// Version 18 - Geom subsets accessed via UsdImagingDelegate::GetMeshTopology()
37-
// will now have correctly prefixed index paths for id and
37+
// will now have correctly prefixed index paths for id and
3838
// materialId.
3939
// Version 19 - UsdImagingPrimAdapter::InvalidateImagingSubprim takes
4040
// invalidationType as argument.
4141
// Version 20 - Adding UsdImagingCreateSceneIndices.
42-
// Version 21 - Removes UsdImagingDirectMaterialBindingsSchema and
42+
// Version 21 - Removes UsdImagingDirectMaterialBindingsSchema and
4343
// UsdImagingCollectionMaterial BindingsSchema in favor of
44-
// UsdImagingMaterialBindingsSchema and
44+
// UsdImagingMaterialBindingsSchema and
4545
// UsdImagingMaterialBindingSchema.
4646
// Version 22 - Deprecates UsdImagingPrimAdapter::_GetShaderSourceTypes
4747
// in favor of added UsdImagingPrimAdapter::_GetShadingSystems
48+
// Version 23 - UsdImagingDataSourceMaterial constructor gets USDIMAGING_API
4849

49-
#define USD_IMAGING_API_VERSION 22
50+
#define USD_IMAGING_API_VERSION 23
5051

5152

5253
PXR_NAMESPACE_CLOSE_SCOPE

pxr/usdImaging/usdRiPxrImaging/version.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

third_party/renderman/plugin/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ add_subdirectory(hdPrmanLoader)
55
add_subdirectory(hdPrmanXpuLoader)
66
add_subdirectory(rtx_hioImage)
77
add_subdirectory(usdRiPxr)
8+
add_subdirectory(usdRiPxrImaging)
89
add_subdirectory(rmanUsdValidators)
910
# Only build rmanOslParser when sdrOsl is disabled
1011
# This allows hdPrman to render OSL files without OSL pre-installed

third_party/renderman/plugin/hdPrman/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ pxr_plugin(${PXR_PACKAGE}
8080
hio
8181
TBB::tbb
8282
usdRi
83-
usdRiPxrImaging
8483
usdVol
8584
usdVolImaging
8685
${optionalLibs}
@@ -250,7 +249,6 @@ else()
250249
usd
251250
usdImaging
252251
usdRender
253-
usdRiPxrImaging
254252
${PXRCORE_LIBRARY}
255253
${PRMAN_LIBRARY}
256254
CPPFILES

third_party/renderman/plugin/hdPrman/debugUtil.cpp

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
#include "pxr/base/tf/stringUtils.h"
1212
#include "pxr/usd/sdf/path.h"
1313

14+
#include <prmanapi.h>
15+
1416
PXR_NAMESPACE_OPEN_SCOPE
1517

1618
namespace HdPrmanDebugUtil {
1719

1820
static const int cw = 3; // length of "─"
1921
static const char empty[] = "";
2022
static const char line[] = "────────────────────";
21-
static const char fmt[] =
23+
static const char fmt[] =
2224
"%01$+*20$.*17$f %02$+*21$.*17$f %03$+*22$.*17$f │ %04$+*23$.*17$f\n"
2325
"%19$*18$s%05$+*20$.*17$f %06$+*21$.*17$f %07$+*22$.*17$f │ %08$+*23$.*17$f\n"
2426
"%19$*18$s%09$+*20$.*17$f %10$+*21$.*17$f %11$+*22$.*17$f │ %12$+*23$.*17$f\n"
@@ -40,8 +42,8 @@ MatrixToString(const GfMatrix4d& mat, const int indent, const int precision)
4042
mat[0][0], mat[1][0], mat[2][0], mat[3][0],
4143
mat[0][1], mat[1][1], mat[2][1], mat[3][1],
4244
mat[0][2], mat[1][2], mat[2][2], mat[3][2],
43-
mat[0][3], mat[1][3], mat[2][3], mat[3][3],
44-
precision, indent, empty,
45+
mat[0][3], mat[1][3], mat[2][3], mat[3][3],
46+
precision, indent, empty,
4547
width[0], width[1], width[2], width[3],
4648
cw * width[0], cw * width[1], cw * width[2], cw * width[3],
4749
line);
@@ -62,8 +64,8 @@ MatrixToString(const RtMatrix4x4& mat, const int indent, const int precision)
6264
mat.m[0][0], mat.m[1][0], mat.m[2][0], mat.m[3][0],
6365
mat.m[0][1], mat.m[1][1], mat.m[2][1], mat.m[3][1],
6466
mat.m[0][2], mat.m[1][2], mat.m[2][2], mat.m[3][2],
65-
mat.m[0][3], mat.m[1][3], mat.m[2][3], mat.m[3][3],
66-
precision, indent, empty,
67+
mat.m[0][3], mat.m[1][3], mat.m[2][3], mat.m[3][3],
68+
precision, indent, empty,
6769
width[0], width[1], width[2], width[3],
6870
cw * width[0], cw * width[1], cw * width[2], cw * width[3],
6971
line);
@@ -98,6 +100,9 @@ _GetParamPrefix(const RtParamList::ParamInfo& info)
98100
case RtDataType::k_samplefilter: out += "samplefilter"; break;
99101
case RtDataType::k_displayfilter: out += "displayfilter"; break;
100102
case RtDataType::k_struct: out += "struct"; break;
103+
#if _PRMANAPI_VERSION_MAJOR_ >= 27
104+
case RtDataType::k_volumefilter: out += "volumefilter"; break;
105+
#endif
101106
default:
102107
TF_WARN("Unknown type %d", static_cast<int>(info.type));
103108
}
@@ -115,15 +120,15 @@ _GetParamPrefix(const RtParamList::ParamInfo& info)
115120
return out;
116121
}
117122

118-
std::string
123+
std::string
119124
_FormatParam(
120125
const RtParamList::ParamInfo& info,
121126
const RtParamList& _params,
122127
const int indent = 0) {
123128

124129
static const char* Vec3Fmt = "(%f, %f, %f)";
125130
static const char* Vec4Fmt = "(%f, %f, %f, %f)";
126-
131+
127132
const std::string prefix = _GetParamPrefix(info);
128133
const int fullIndent = indent + (int)prefix.size();
129134
RtParamList& params = const_cast<RtParamList&>(_params);
@@ -562,7 +567,7 @@ _FormatParam(
562567
}
563568
break;
564569
}
565-
case RtDataType::k_struct:
570+
case RtDataType::k_struct:
566571
{
567572
if (info.detail == RtDetailType::k_reference) {
568573
RtUString value;
@@ -572,6 +577,29 @@ _FormatParam(
572577
}
573578
break;
574579
}
580+
#if _PRMANAPI_VERSION_MAJOR_ >= 27
581+
case RtDataType::k_volumefilter: {
582+
if (info.array && info.detail == RtDetailType::k_reference) {
583+
const RtUString* value = params.GetVolumeFilterReferenceArray(
584+
info.name, info.length);
585+
for (uint32_t i = 0; i < info.length; ++i) {
586+
if (!val.empty()) {
587+
val += ", ";
588+
} else {
589+
val += "[";
590+
}
591+
val += TfStringPrintf("<%s>", (*(value+i)).CStr());
592+
}
593+
val += "]";
594+
} else if (info.detail == RtDetailType::k_reference) {
595+
RtUString value;
596+
if (params.GetVolumeFilterReference(info.name, value)) {
597+
val = TfStringPrintf("<%s>", value.CStr());
598+
}
599+
}
600+
break;
601+
}
602+
#endif
575603
default:
576604
{
577605
TF_WARN("Unknown type %d", static_cast<int>(info.type));
@@ -596,7 +624,7 @@ RtParamListToString(const RtParamList& params, const int indent)
596624
out += "\n";
597625
}
598626
out += TfStringPrintf(
599-
"%*s%s", (pi == 0 ? 0 : indent), "",
627+
"%*s%s", (pi == 0 ? 0 : indent), "",
600628
_FormatParam(info, params, indent).c_str());
601629
}
602630
}
@@ -615,7 +643,7 @@ GetCallerAsString(const TfCallContext& ctx)
615643
}
616644
if (i < 9) {
617645
const std::string& line = lines[i+1];
618-
return line.substr(28, line.find_first_of("(") - 28) + " at " +
646+
return line.substr(28, line.find_first_of("(") - 28) + " at " +
619647
line.substr(line.find_last_of("/") + 1);
620648
}
621649
return "*** couldn't find caller ***";

third_party/renderman/plugin/hdPrman/renderDelegate.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
#include "pxr/usd/sdf/path.h"
4141
#include "pxr/usd/sdr/registry.h"
4242

43-
#include "pxr/usdImaging/usdRiPxrImaging/tokens.h"
44-
#include "pxr/usdImaging/usdRiPxrImaging/version.h"
45-
4643
#include "pxr/base/gf/vec3f.h"
4744
#include "pxr/base/gf/vec4f.h"
4845
#include "pxr/base/tf/diagnostic.h"
@@ -209,6 +206,7 @@ TF_DEFINE_PRIVATE_TOKENS(
209206
(__FnKat_bbox)
210207
(viewerMouseClick)
211208
((houdiniInteractive, "houdini:interactive"))
209+
(volumeFilter)
212210
);
213211

214212
TF_DEFINE_PUBLIC_TOKENS(HdPrmanRenderSettingsTokens,
@@ -263,8 +261,8 @@ const TfTokenVector HdPrmanRenderDelegate::SUPPORTED_SPRIM_TYPES =
263261
HdPrimTypeTokens->diskLight,
264262
HdPrimTypeTokens->cylinderLight,
265263
HdPrimTypeTokens->sphereLight,
266-
#if USD_RI_PXR_IMAGING_API_VERSION >= 3 && _PRMANAPI_VERSION_MAJOR_ >= 27
267-
UsdRiPxrImagingPrimTypeTokens->volumeFilter,
264+
#if _PRMANAPI_VERSION_MAJOR_ >= 27
265+
_tokens->volumeFilter,
268266
#endif
269267
#if PXR_VERSION <= 2211
270268
HdPrmanTokens->meshLight,
@@ -568,8 +566,8 @@ HdPrmanRenderDelegate::CreateSprim(TfToken const& typeId,
568566
sprim = new HdPrmanMaterial(sprimId);
569567
} else if (typeId == HdPrimTypeTokens->coordSys) {
570568
sprim = new HdPrmanCoordSys(sprimId);
571-
#if USD_RI_PXR_IMAGING_API_VERSION >= 3
572-
} else if (typeId == UsdRiPxrImagingPrimTypeTokens->volumeFilter) {
569+
#if _PRMANAPI_VERSION_MAJOR_ >= 27
570+
} else if (typeId == _tokens->volumeFilter) {
573571
sprim = new HdPrman_VolumeFilter(sprimId);
574572
#endif
575573
} else if (typeId == HdPrimTypeTokens->lightFilter) {
@@ -630,8 +628,8 @@ HdPrmanRenderDelegate::CreateFallbackSprim(TfToken const& typeId)
630628
return new HdPrmanCoordSys(SdfPath::EmptyPath());
631629
} else if (typeId == HdPrimTypeTokens->lightFilter) {
632630
return new HdPrmanLightFilter(SdfPath::EmptyPath(), typeId);
633-
#if USD_RI_PXR_IMAGING_API_VERSION >= 3
634-
} else if (typeId == UsdRiPxrImagingPrimTypeTokens->volumeFilter) {
631+
#if _PRMANAPI_VERSION_MAJOR_ >= 27
632+
} else if (typeId == _tokens->volumeFilter) {
635633
return new HdPrman_VolumeFilter(SdfPath::EmptyPath());
636634
#endif
637635
} else if (typeId == HdPrimTypeTokens->light ||

third_party/renderman/plugin/hdPrman/volume.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
#include "pxr/imaging/hd/version.h"
1515

16-
#include "pxr/usdImaging/usdRiPxrImaging/tokens.h"
17-
#include "pxr/usdImaging/usdRiPxrImaging/version.h"
1816
#include "pxr/usdImaging/usdVolImaging/tokens.h"
1917

2018
#include "pxr/usd/sdf/types.h"
@@ -135,11 +133,7 @@ _PopulateVolumeFilterNodes(
135133

136134
// Look up volume filter ID
137135
if (HdSprim* sprim = sceneDelegate->GetRenderIndex().GetSprim(
138-
#if USD_RI_PXR_IMAGING_API_VERSION >= 3
139-
UsdRiPxrImagingPrimTypeTokens->volumeFilter, filterPath)) {
140-
#else
141136
_tokens->volumeFilter, filterPath)) {
142-
#endif
143137
if (auto* volumeFilter = dynamic_cast<HdPrman_VolumeFilter*>(sprim)) {
144138
volumeFilter->SyncToRiley(sceneDelegate, param, riley);
145139
coordsysIds->push_back(volumeFilter->GetCoordSysId());

pxr/usdImaging/usdRiPxrImaging/CMakeLists.txt renamed to third_party/renderman/plugin/usdRiPxrImaging/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(PXR_PREFIX pxr/usdImaging)
1+
set(PXR_PREFIX pxr/imaging)
22
set(PXR_PACKAGE usdRiPxrImaging)
33

44
pxr_library(usdRiPxrImaging
@@ -29,7 +29,9 @@ pxr_library(usdRiPxrImaging
2929
pxrCameraProjectionAPIAdapter
3030
pxrDisplayFilterAdapter
3131
pxrIntegratorAdapter
32+
pxrVolumeAPIAdapter
3233
pxrSampleFilterAdapter
34+
pxrVolumeFilterPluginBaseAdapter
3335
tokens
3436

3537
PRIVATE_CLASSES
@@ -46,3 +48,10 @@ pxr_library(usdRiPxrImaging
4648
plugInfo.json
4749
)
4850

51+
if(TARGET usdRiPxrImaging)
52+
target_include_directories(${PXR_PACKAGE}
53+
PRIVATE
54+
"${PROJECT_BINARY_DIR}/include/pxr/imaging"
55+
)
56+
endif()
57+

0 commit comments

Comments
 (0)