Skip to content

Commit

Permalink
Moving rendertags to their own namespace in hd/tokens for easy discov…
Browse files Browse the repository at this point in the history
…erability

(Internal change: 1987149)
  • Loading branch information
poljere authored and pixar-oss committed Jul 12, 2019
1 parent cc9f46c commit 889cf15
Show file tree
Hide file tree
Showing 18 changed files with 46 additions and 39 deletions.
2 changes: 1 addition & 1 deletion pxr/imaging/lib/hd/renderIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ HdRenderIndex::GetRenderTag(SdfPath const& id) const
{
_RprimInfo const* info = TfMapLookupPtr(_rprimMap, id);
if (info == nullptr) {
return HdTokens->hidden;
return HdRenderTagTokens->hidden;
}

return info->rprim->GetRenderTag(info->sceneDelegate);
Expand Down
2 changes: 1 addition & 1 deletion pxr/imaging/lib/hd/sceneDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ HdSceneDelegate::IsEnabled(TfToken const& option) const
TfToken
HdSceneDelegate::GetRenderTag(SdfPath const& id)
{
return HdTokens->geometry;
return HdRenderTagTokens->geometry;
}

// -----------------------------------------------------------------------//
Expand Down
2 changes: 2 additions & 0 deletions pxr/imaging/lib/hd/tokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ TF_DEFINE_PUBLIC_TOKENS(HdPerfTokens, HD_PERF_TOKENS);

TF_DEFINE_PUBLIC_TOKENS(HdShaderTokens, HD_SHADER_TOKENS);

TF_DEFINE_PUBLIC_TOKENS(HdRenderTagTokens, HD_RENDERTAG_TOKENS);

TF_DEFINE_PUBLIC_TOKENS(HdMaterialTagTokens, HD_MATERIALTAG_TOKENS);

TF_DEFINE_PUBLIC_TOKENS(HdOptionTokens, HD_OPTION_TOKENS);
Expand Down
12 changes: 8 additions & 4 deletions pxr/imaging/lib/hd/tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ PXR_NAMESPACE_OPEN_SCOPE
(faceColors) \
(full) \
(geometry) \
(guide) \
(hermite) \
(hidden) \
(hullIndices) \
(indices) \
(instancer) \
Expand Down Expand Up @@ -95,7 +93,6 @@ PXR_NAMESPACE_OPEN_SCOPE
(primvar) \
(primID) \
(primitiveParam) \
(proxy) \
(quadInfo) \
(renderTags) \
(rightHanded) \
Expand Down Expand Up @@ -199,6 +196,13 @@ PXR_NAMESPACE_OPEN_SCOPE
#define HD_MATERIALTAG_TOKENS \
(defaultMaterialTag)

#define HD_RENDERTAG_TOKENS \
(geometry) \
(guide) \
(hidden) \
(proxy) \
(render)

#define HD_OPTION_TOKENS \
(parallelRprimSync)

Expand Down Expand Up @@ -322,12 +326,12 @@ TfToken HdAovTokensMakeShader(TfToken const& shader);
(convergedVariance) \
(convergedSamplesPerPixel)


TF_DECLARE_PUBLIC_TOKENS(HdTokens, HD_API, HD_TOKENS);
TF_DECLARE_PUBLIC_TOKENS(HdReprTokens, HD_API, HD_REPR_TOKENS);
TF_DECLARE_PUBLIC_TOKENS(HdPerfTokens, HD_API, HD_PERF_TOKENS);
TF_DECLARE_PUBLIC_TOKENS(HdShaderTokens, HD_API, HD_SHADER_TOKENS);
TF_DECLARE_PUBLIC_TOKENS(HdMaterialTagTokens, HD_API, HD_MATERIALTAG_TOKENS);
TF_DECLARE_PUBLIC_TOKENS(HdRenderTagTokens, HD_API, HD_RENDERTAG_TOKENS);
TF_DECLARE_PUBLIC_TOKENS(HdOptionTokens, HD_API, HD_OPTION_TOKENS);
TF_DECLARE_PUBLIC_TOKENS(HdPrimTypeTokens, HD_API, HD_PRIMTYPE_TOKENS);
TF_DECLARE_PUBLIC_TOKENS(HdPrimvarRoleTokens, HD_API, HD_PRIMVAR_ROLE_TOKENS);
Expand Down
12 changes: 6 additions & 6 deletions pxr/imaging/lib/hd/unitTestDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,22 +560,22 @@ HdUnitTestDelegate::GetRenderTag(SdfPath const& id)
HD_TRACE_FUNCTION();

if (_hiddenRprims.find(id) != _hiddenRprims.end()) {
return HdTokens->hidden;
return HdRenderTagTokens->hidden;
}

if (_Mesh *mesh = TfMapLookupPtr(_meshes, id)) {
if (mesh->guide) {
return HdTokens->guide;
return HdRenderTagTokens->guide;
} else {
return HdTokens->geometry;
return HdRenderTagTokens->geometry;
}
} else if (_curves.count(id) > 0) {
return HdTokens->geometry;
return HdRenderTagTokens->geometry;
} else if (_points.count(id) > 0) {
return HdTokens->geometry;
return HdRenderTagTokens->geometry;
}

return HdTokens->hidden;
return HdRenderTagTokens->hidden;
}

/*virtual*/
Expand Down
4 changes: 2 additions & 2 deletions pxr/imaging/lib/hd/unitTestHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ class Hd_DrawTask final : public HdTask
, _renderTags()
{
_renderTags.reserve(2);
_renderTags.push_back(HdTokens->geometry);
_renderTags.push_back(HdRenderTagTokens->geometry);

if (withGuides) {
_renderTags.push_back(HdTokens->guide);
_renderTags.push_back(HdRenderTagTokens->guide);
}
}

Expand Down
4 changes: 2 additions & 2 deletions pxr/imaging/lib/hdSt/unitTestHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ class HdSt_DrawTask final : public HdTask
, _renderTags()
{
_renderTags.reserve(2);
_renderTags.push_back(HdTokens->geometry);
_renderTags.push_back(HdRenderTagTokens->geometry);

if (withGuides) {
_renderTags.push_back(HdTokens->guide);
_renderTags.push_back(HdRenderTagTokens->guide);
}
}
virtual void Sync(HdSceneDelegate*,
Expand Down
4 changes: 2 additions & 2 deletions pxr/imaging/lib/hdx/taskController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ HdxTaskController::_CreateRenderTask(TfToken const& materialTag)
}

// Create an initial set of render tags in case the user doesn't set any
TfTokenVector renderTags = { HdTokens->geometry };
TfTokenVector renderTags = { HdRenderTagTokens->geometry };

_delegate.SetParameter(taskId, HdTokens->params, renderParams);
_delegate.SetParameter(taskId, HdTokens->collection, collection);
Expand Down Expand Up @@ -411,7 +411,7 @@ HdxTaskController::_CreateShadowTask()

GetRenderIndex()->InsertTask<HdxShadowTask>(&_delegate, _shadowTaskId);

TfTokenVector renderTags = { HdTokens->geometry };
TfTokenVector renderTags = { HdRenderTagTokens->geometry };

_delegate.SetParameter(_shadowTaskId, HdTokens->params, shadowParams);
_delegate.SetParameter(_shadowTaskId, _tokens->renderTags, renderTags);
Expand Down
3 changes: 2 additions & 1 deletion pxr/imaging/lib/hdx/testenv/testHdxPickAndHighlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ My_TestGLDrawing::InitTest()
_delegate->SetTaskParam(renderSetupTask, HdTokens->params,
VtValue(param));
_delegate->SetTaskParam(renderTask, HdTokens->collection,
VtValue(HdRprimCollection(HdTokens->geometry, HdReprSelector(_reprName))));
VtValue(HdRprimCollection(HdTokens->geometry,
HdReprSelector(_reprName))));
HdxSelectionTaskParams selParam;
selParam.enableSelection = true;
selParam.selectionColor = GfVec4f(1, 1, 0, 1);
Expand Down
2 changes: 1 addition & 1 deletion pxr/imaging/lib/hdx/tokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ PXR_NAMESPACE_OPEN_SCOPE
TF_DEFINE_PUBLIC_TOKENS(HdxTokens, HDX_TOKENS);
TF_DEFINE_PUBLIC_TOKENS(HdxPrimitiveTokens, HDX_PRIMITIVE_TOKENS);
TF_DEFINE_PUBLIC_TOKENS(HdxOptionTokens, HDX_OPTION_TOKENS);
TF_DEFINE_PUBLIC_TOKENS(HdxRenderTagsTokens, HDX_RENDERTAGS_TOKENS);
TF_DEFINE_PUBLIC_TOKENS(HdxRenderTagTokens, HDX_RENDERTAG_TOKENS);
TF_DEFINE_PUBLIC_TOKENS(HdxMaterialTagTokens, HDX_MATERIALTAG_TOKENS);
TF_DEFINE_PUBLIC_TOKENS(HdxColorCorrectionTokens, HDX_COLOR_CORRECTION_TOKENS);

Expand Down
5 changes: 2 additions & 3 deletions pxr/imaging/lib/hdx/tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,15 @@ TF_DECLARE_PUBLIC_TOKENS(HdxPrimitiveTokens, HDX_API, HDX_PRIMITIVE_TOKENS);

TF_DECLARE_PUBLIC_TOKENS(HdxOptionTokens, HDX_API, HDX_OPTION_TOKENS);

#define HDX_RENDERTAGS_TOKENS \
(guide) \
#define HDX_RENDERTAG_TOKENS \
(renderingGuide) \
(label) \
(cameraGuide) \
(streamline) \
(interactiveOnlyGeom) \
(path)

TF_DECLARE_PUBLIC_TOKENS(HdxRenderTagsTokens, HDX_API, HDX_RENDERTAGS_TOKENS);
TF_DECLARE_PUBLIC_TOKENS(HdxRenderTagTokens, HDX_API, HDX_RENDERTAG_TOKENS);

#define HDX_MATERIALTAG_TOKENS \
(additive) \
Expand Down
4 changes: 2 additions & 2 deletions pxr/usdImaging/lib/usdImaging/delegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1575,11 +1575,11 @@ UsdImagingDelegate::GetRenderTag(SdfPath const& id)

if (purpose == UsdGeomTokens->default_) {
// Simple mapping so all render tags in multiple delegates match
purpose = HdTokens->geometry;
purpose = HdRenderTagTokens->geometry;
} else if (purpose == UsdGeomTokens->guide && !_displayGuides) {
// When guides are disabled on the delegate we move the
// guide prims to the hidden command buffer
purpose = HdTokens->hidden;
purpose = HdRenderTagTokens->hidden;
}

TF_DEBUG(USDIMAGING_COLLECTIONS).Msg("GetRenderTag %s -> %s \n",
Expand Down
4 changes: 2 additions & 2 deletions pxr/usdImaging/lib/usdImaging/unitTestHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class UsdImaging_TestDriver final {
HdReprSelector(HdReprTokens->hull));

TfTokenVector renderTags;
renderTags.push_back(HdTokens->geometry);
renderTags.push_back(HdRenderTagTokens->geometry);

_Init(UsdStage::Open(usdFilePath),
collection,
Expand Down Expand Up @@ -148,7 +148,7 @@ class UsdImaging_TestDriver final {
HdReprSelector(HdReprTokens->hull));

TfTokenVector renderTags;
renderTags.push_back(HdTokens->geometry);
renderTags.push_back(HdRenderTagTokens->geometry);

_Init(usdStage, collection, SdfPath::AbsoluteRootPath(), renderTags);
}
Expand Down
8 changes: 4 additions & 4 deletions pxr/usdImaging/lib/usdImagingGL/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1330,15 +1330,15 @@ UsdImagingGLEngine::_ComputeRenderTags(UsdImagingGLRenderParams const& params,
// the application
renderTags->clear();
renderTags->reserve(4);
renderTags->push_back(HdTokens->geometry);
renderTags->push_back(HdRenderTagTokens->geometry);
if (params.showGuides) {
renderTags->push_back(HdxRenderTagsTokens->guide);
renderTags->push_back(HdRenderTagTokens->guide);
}
if (params.showProxy) {
renderTags->push_back(UsdGeomTokens->proxy);
renderTags->push_back(HdRenderTagTokens->proxy);
}
if (params.showRender) {
renderTags->push_back(UsdGeomTokens->render);
renderTags->push_back(HdRenderTagTokens->render);
}
}

Expand Down
4 changes: 3 additions & 1 deletion third_party/maya/lib/pxrUsdMayaGL/batchRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,9 @@ UsdMayaGLBatchRenderer::_GetIntersectionPrimFilters(
primFilters.push_back(
PxrMayaHdPrimFilter {
collection,
TfTokenVector{HdTokens->geometry, HdTokens->proxy}
TfTokenVector{
HdRenderTagTokens->geometry,
HdRenderTagTokens->proxy}
});
}

Expand Down
3 changes: 1 addition & 2 deletions third_party/maya/lib/pxrUsdMayaGL/sceneDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,9 @@ PxrMayaHdSceneDelegate::PxrMayaHdSceneDelegate(
{
// By default we only want geometry in the shadow pass
const TfTokenVector defaultShadowRenderTags = {
HdTokens->geometry,
HdRenderTagTokens->geometry,
};


renderIndex->InsertTask<HdxShadowTask>(this, _shadowTaskId);
_ValueCache& cache = _valueCacheMap[_shadowTaskId];
HdxShadowTaskParams taskParams;
Expand Down
8 changes: 4 additions & 4 deletions third_party/maya/lib/pxrUsdMayaGL/usdProxyShapeAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ PxrMayaHdUsdProxyShapeAdapter::_Sync(

// Update Render Tags
_renderTags.clear();
_renderTags.push_back(HdTokens->geometry);
_renderTags.push_back(HdRenderTagTokens->geometry);
if (drawRenderPurpose) {
_renderTags.push_back(UsdGeomTokens->render);
_renderTags.push_back(HdRenderTagTokens->render);
}
if (drawProxyPurpose) {
_renderTags.push_back(HdTokens->proxy);
_renderTags.push_back(HdRenderTagTokens->proxy);
}
if (drawGuidePurpose) {
_renderTags.push_back(HdTokens->guide);
_renderTags.push_back(HdRenderTagTokens->guide);
}

MStatus status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ int main(int argc, char *argv[])
hdUsdFrontend.SetTime(frameNum);
hdUsdFrontend.SetRefineLevelFallback(8); // max refinement

TfTokenVector renderTags(1, HdTokens->geometry);
TfTokenVector renderTags(1, HdRenderTagTokens->geometry);
// The collection of scene contents to render
HdRprimCollection hdCollection(_tokens->testCollection,
HdReprSelector(HdReprTokens->smoothHull));
Expand Down

0 comments on commit 889cf15

Please sign in to comment.