Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove virtual dispatch for PxrMayaHdShapeAdapter::IsViewport2() #451

Conversation

mattyjams
Copy link
Contributor

Following on from #450, we want to start being more explicit about the division between the legacy viewport and Viewport 2.0 so that it's easier to tear out the legacy stuff a little bit at a time.

There might also be a slight performance improvement here with PxrMayaHdShapeAdapter::IsViewport2() no longer dispatching virtually.

@kxl-adsk kxl-adsk requested a review from huidong-chen April 21, 2020 09:50
@kxl-adsk kxl-adsk added core Related to core library pxr Related to Pixar plugin labels Apr 21, 2020
@@ -177,7 +179,8 @@ class UsdMayaGL_InstancerImager : public TfWeakBase {
/// no factory has been set, returns a UsdMayaGL_InstancerShapeAdapter base
/// class object. The caller must manage the lifescope of the returned
/// object.
static UsdMayaGL_InstancerShapeAdapter* CreateInstancerShapeAdapter();
static UsdMayaGL_InstancerShapeAdapter* CreateInstancerShapeAdapter(
const bool isViewport2);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constness on the pass-by-value argument is not necessary. Can you remove it?

Regarding to coding style, we are likely to have 100 chars per line so there is no need to break a new line.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kxl-adsk Have we published the coding style guildline somewhere for partners?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another question: can this argument be true by default?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format is published on TSC forum...pending review.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the argument const-ness, yeah, I can remove that.

About defaulting it to true, I had thought of doing that initially, but if we made it default to true here, it seemed like it should default to true all the way down to the shape adapter constructors. It seemed safer to me to require callers to specify a value rather than accidentally end up creating a shape adapter for the wrong viewport. If you feel strongly though, I can revisit that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased and removed the const qualifiers in f0d2225.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have strong preference, it was just a question.

@@ -64,10 +64,11 @@ UsdMayaProxyDrawOverride::UsdMayaProxyDrawOverride(const MObject& obj) :
MHWRender::MPxDrawOverride(obj,
UsdMayaProxyDrawOverride::draw
#if MAYA_API_VERSION >= 201651

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't care about pre-2018 maya versions, we should also remove this conditional compilation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I can put up a separate PR for that later since it's not directly related to the changes here, and I'm sure there are a bunch of other places where we're testing for pre-2018 versions.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

///
/// Returns true if the shape adapter should be used for batched
/// drawing/selection in Viewport 2.0, or false if it should be used
/// in the legacy viewport.
MAYAUSD_CORE_PUBLIC
virtual bool IsViewport2() const;
bool IsViewport2() const {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure, we don't need to export this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, we don't need to export this anymore since it's now defined inline right here.

This change also requires that the viewport renderer affiliation for the
shape adapter be set when the adapter is constructed. It is not intended to
change over the lifetime of the shape adapter.

(Internal change: 2058187)
@mattyjams mattyjams force-pushed the pr/remove_pxr_shape_adapter_IsViewport2_virtual_dispatch branch from e916dcc to f0d2225 Compare April 22, 2020 00:41
@Autodesk Autodesk deleted a comment from AwanPydrall Apr 22, 2020
@kxl-adsk kxl-adsk merged commit 7f78743 into Autodesk:dev Apr 22, 2020
@mattyjams mattyjams deleted the pr/remove_pxr_shape_adapter_IsViewport2_virtual_dispatch branch April 23, 2020 21:57
@kxl-adsk kxl-adsk added the legacy rendering Related to draw override rendering label Jul 19, 2020
ppt-adsk pushed a commit that referenced this pull request Sep 27, 2023
…dra adapters for UFE items created by maya-usd) (#451)

* HYDRA-289 Add checks to prevent creating adapters for UFE items created by maya-usd

* HYDRA-289 Add extra check to prevent creating light adapters for USD's UFE lights in PreFrame light query step

* HYDRA-289 Whitespace changes

* HYDRA-289 Whitespace changes

* HYDRA-289 : Move mayaUsd plugin check for tests into usdUtils

* HYDRA-289 : Move check from usdUtils to mtohUtils

* HYDRA-289 : Revert usdUtils changes

* HYDRA-289 : Add test for ensuring skipping UFE items from maya-usd

* HYDRA-289 Move comments describing UFE to where IsUfeItemFromMayaUsd is declared
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to core library legacy rendering Related to draw override rendering pxr Related to Pixar plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants