Skip to content

Commit a5409da

Browse files
Disable tests and outline mode for MacOS
1 parent be17076 commit a5409da

4 files changed

Lines changed: 55 additions & 27 deletions

File tree

doc/outlineSelectionHighlightingArchitecture.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ return _isUsingHdSt && _globals.outlineSelectionHighlight;
4444
buffers and a GL compute shader for the mask, and gate themselves on Storm internally. A
4545
non-Storm delegate therefore keeps the legacy wireframe highlighting, whatever the global says.
4646
- **Not offered on USD 24.11**, where HgiGL corrupts the non-zero integer prim IDs the outline mask
47-
shader samples. On that version the enum lists *Legacy Selection* only, and it is the default.
47+
shader samples, **nor on macOS**, where outline selection highlighting is unsupported. In those
48+
configurations the enum lists *Legacy Selection* only, and it is the default.
4849

4950
Switching mode changes the scene index chain, so it cannot be done in place: `UpdateRenderGlobals()`
5051
flags `_needsClear`, and `Render()` runs `ClearHydraResources()` / `_InitHydraResources()` and then
@@ -348,7 +349,8 @@ thread.
348349
- **Storm only.** Other render delegates keep the legacy wireframe highlighting. Supporting a
349350
non-rasterizing delegate would mean a separate Storm pass rasterizing selected geometry alongside
350351
the beauty render and compositing the two — an HVT project, not a flag.
351-
- **Not available on USD 24.11**, where HgiGL corrupts the prim IDs the mask compute shader samples.
352+
- **Not available on USD 24.11**, where HgiGL corrupts the prim IDs the mask compute shader samples,
353+
**or on macOS**, where outline selection highlighting is unsupported.
352354
- **Wireframe-on-shaded shows both cues.** Deliberate: the alternative was recolouring VP2's wire,
353355
and there is no correct dormant colour to recolour it to for non-mesh shapes.
354356
- **`enableDefaultOutlines` is off by default.** This is an HVT outline feature — a faint outline on

lib/mayaHydra/mayaPlugin/renderGlobals.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@
4040
// This file is where we build the UI and expose to MEL the global parameters from this plug-in and
4141
// the parameters from the chosen render delegate.
4242

43+
// The Outline selection-highlight mode is not offered in these configurations: the
44+
// mayaHydraSelectionHighlightMode enum lists "Legacy Selection" only, and it is the default.
45+
// - USD <= 24.11: HgiGL corrupts the non-zero integer prim ids the outline compute shader samples.
46+
// - macOS: outline selection highlighting is not supported.
47+
// Keep this in sync with MayaHydraBaseTestCase.outlineSelectionHighlightSupported() in
48+
// test/testUtils/mtohUtils.py and MAYAHYDRA_OUTLINE_MODE_AVAILABLE in
49+
// test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt.
50+
#if PXR_VERSION <= 2411 || defined(__APPLE__)
51+
#define MAYAHYDRA_NO_OUTLINE_SELECTION_HIGHLIGHT
52+
#endif
53+
4354
PXR_NAMESPACE_OPEN_SCOPE
4455
// Bring the MayaHydra namespace into scope.
4556
// The following code currently lives inside the pxr namespace, but it would make more sense to
@@ -974,9 +985,7 @@ MObject MtohRenderGlobals::CreateAttributes(const GlobalParams& params)
974985
}
975986
}
976987
if (filter(MtohTokens->mayaHydraSelectionHighlightMode)) {
977-
#if PXR_VERSION <= 2411
978-
// USD 24.11's HgiGL corrupts non-zero integer prim ids sampled in the outline compute
979-
// shader, so the Outline selection-highlight mode cannot work. Offer Legacy only.
988+
#ifdef MAYAHYDRA_NO_OUTLINE_SELECTION_HIGHLIGHT
980989
static const TfTokenVector kSelectionHighlightModes = { TfToken("Legacy Selection") };
981990
#else
982991
static const TfTokenVector kSelectionHighlightModes
@@ -986,7 +995,7 @@ MObject MtohRenderGlobals::CreateAttributes(const GlobalParams& params)
986995
node,
987996
filter.mayaString(),
988997
kSelectionHighlightModes,
989-
kSelectionHighlightModes[0], // default = first entry (Legacy on 24.11, Outline otherwise)
998+
kSelectionHighlightModes[0], // default = first entry, Legacy where Outline is unavailable
990999
userDefaults);
9911000
if (filter.attributeFilter()) {
9921001
return mayaObject;
@@ -1217,9 +1226,7 @@ MtohRenderGlobals::GetInstance(const GlobalParams& params, bool storeUserSetting
12171226
}
12181227
}
12191228
if (filter(MtohTokens->mayaHydraSelectionHighlightMode)) {
1220-
#if PXR_VERSION <= 2411
1221-
// On USD 24.11 the Outline mode is unsupported (see above / renderGlobals.cpp enum
1222-
// creation), so fall back to Legacy when the attribute is unset.
1229+
#ifdef MAYAHYDRA_NO_OUTLINE_SELECTION_HIGHLIGHT
12231230
TfToken mode("Legacy Selection");
12241231
#else
12251232
TfToken mode("Outline Selection");

test/lib/mayaUsd/render/mayaToHydra/CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ set(INTERACTIVE_TEST_SCRIPT_FILES
2626
testMayaShadingModes.py|skipOnPlatform:osx # HYDRA-1127 : refinedWire not working on OSX
2727
testMayaDisplayLayers.py
2828
testMayaIsolateSelect.py
29-
testOutlineHover.py
29+
testOutlineHover.py|skipOnPlatform:osx # Outline selection highlighting is not available on macOS
3030
#HYDRA-1940 temporarily disable this test which doesn't pass on Maya 2026
3131
#testMayaLights.py
3232
testUSDLights.py
@@ -209,10 +209,12 @@ set(INTERACTIVE_TEST_SCRIPT_FILES_ENABLE_GENERATIVE_PROCEDURAL
209209
# be mode-sensitive after all, one of its two runs fails against the shared image
210210
# instead of silently losing coverage.
211211
#
212-
# Outline is only offered on USD > 24.11: below that the render global has a
213-
# single "Legacy Selection" entry, because HgiGL corrupts the prim ids the outline
214-
# compute shader samples. Every primary run is then the legacy one.
215-
if(USD_VERSION VERSION_GREATER "0.24.11")
212+
# Outline is not offered everywhere: on USD <= 24.11 HgiGL corrupts the prim ids the
213+
# outline compute shader samples, and it is unsupported on macOS. In both cases the
214+
# render global has a single "Legacy Selection" entry, so every primary run is the
215+
# legacy one and there are no _legacy counterparts. Keep this in sync with
216+
# MAYAHYDRA_NO_OUTLINE_SELECTION_HIGHLIGHT in lib/mayaHydra/mayaPlugin/renderGlobals.cpp.
217+
if(USD_VERSION VERSION_GREATER "0.24.11" AND NOT IS_MACOSX)
216218
set(MAYAHYDRA_OUTLINE_MODE_AVAILABLE TRUE)
217219
else()
218220
set(MAYAHYDRA_OUTLINE_MODE_AVAILABLE FALSE)

test/testUtils/mtohUtils.py

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@
4545

4646
# Selection highlighting mode support.
4747
#
48-
# The mode is a defaultRenderGlobals enum attribute, and its entries depend on
49-
# the USD version: on USD > 24.11 it is
50-
# {"Outline Selection", "Legacy Selection"}, while on USD <= 24.11 only
51-
# {"Legacy Selection"} is offered, because 24.11's HgiGL cannot support the
52-
# outline compute shader (see renderGlobals.cpp). The enum indices therefore
53-
# differ between USD versions, so the index is resolved by name rather than
48+
# The mode is a defaultRenderGlobals enum attribute, and its entries depend on the
49+
# configuration: usually it is {"Outline Selection", "Legacy Selection"}, but only
50+
# {"Legacy Selection"} is offered on USD <= 24.11, because 24.11's HgiGL cannot
51+
# support the outline compute shader, and on macOS, where outline selection
52+
# highlighting is unsupported (see renderGlobals.cpp). The enum indices therefore
53+
# differ between configurations, so the index is resolved by name rather than
5454
# hardcoded.
5555
SELECTION_HIGHLIGHT_MODE_NAME = "mayaHydraSelectionHighlightMode"
5656
SELECTION_HIGHLIGHT_MODE_NODE = "defaultRenderGlobals"
@@ -99,16 +99,31 @@ class MayaHydraBaseTestCase(unittest.TestCase, ImageDiffingTestCase):
9999
# mayaUsdPlugin looged as HYDRA-1896, we should remove this when HYDRA-1896 is fixed
100100
_pluginsCantUnload = ['mayaHydraFlowViewportAPILocator', 'mtoa', 'modelingToolkit', 'mayaUsdPlugin']
101101

102+
@classmethod
103+
def outlineSelectionHighlightSupported(cls):
104+
'''Whether the outline mode is offered at all in this configuration.
105+
106+
Mirrors the MAYAHYDRA_NO_OUTLINE_SELECTION_HIGHLIGHT gate in
107+
lib/mayaHydra/mayaPlugin/renderGlobals.cpp.
108+
'''
109+
if platform.system() == "Darwin":
110+
return False
111+
return Usd.GetVersion() > (0, 24, 11)
112+
102113
@classmethod
103114
def selectionHighlightMode(cls):
104115
'''Return the selection highlighting mode this run should use.
105116
106-
Taken from the MAYAHYDRA_SELECTION_HIGHLIGHT_MODE environment variable,
107-
defaulting to outline, which is what the plugin ships as its default.
117+
Taken from the MAYAHYDRA_SELECTION_HIGHLIGHT_MODE environment variable.
118+
With no variable set, this is outline, the mode the plugin ships as its
119+
default, except where outline is not offered at all - see
120+
outlineSelectionHighlightSupported().
108121
'''
109122
mode = os.environ.get(SELECTION_HIGHLIGHT_MODE_ENV_VAR, '').strip().lower()
110123
if not mode:
111-
return SELECTION_HIGHLIGHT_MODE_OUTLINE
124+
return (SELECTION_HIGHLIGHT_MODE_OUTLINE
125+
if cls.outlineSelectionHighlightSupported()
126+
else SELECTION_HIGHLIGHT_MODE_LEGACY)
112127
if mode not in SELECTION_HIGHLIGHT_MODE_ENUM_NAMES:
113128
raise ValueError(
114129
"Unknown {} value {!r}; expected one of {}.".format(
@@ -416,13 +431,15 @@ def applySelectionHighlightMode(self):
416431
listEnum=True)[0].split(':')
417432

418433
if wantedEnumName not in enumNames:
419-
# On USD <= 24.11 only "Legacy Selection" is offered, so an outline
420-
# run cannot be honoured. Skipping avoids silently comparing outline
434+
# Where outline is not offered - USD <= 24.11, or macOS - only
435+
# "Legacy Selection" exists, so an explicitly requested outline run
436+
# cannot be honoured. Skipping avoids silently comparing outline
421437
# reference images against a legacy render.
422438
self.skipTest(
423439
"Selection highlighting mode {!r} ({!r}) is not available on "
424-
"USD {}; available modes: {}.".format(
425-
mode, wantedEnumName, str(self._usdVersion), enumNames))
440+
"{} with USD {}; available modes: {}.".format(
441+
mode, wantedEnumName, platform.system(),
442+
str(self._usdVersion), enumNames))
426443

427444
wantedIndex = enumNames.index(wantedEnumName)
428445
if cmds.getAttr(SELECTION_HIGHLIGHT_MODE_ATTR) == wantedIndex:

0 commit comments

Comments
 (0)