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

Xcode16 build fix #2585

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from
Open

Xcode16 build fix #2585

wants to merge 28 commits into from

Conversation

marchcat
Copy link
Contributor

No description provided.

@Ansariel
Copy link
Contributor

I see you are trying to enable C++20 on macOS at least. Are you going to fix the broken hash generation in llgltfmaterial and llmaterial we discovered in #2330?

@marchcat
Copy link
Contributor Author

That should be the next step.
For now, it builds successfully (with the test temporarily disabled) on my mac with xcode 16.0 and fails on github, so it's a bit harder to fix with all this commit-juggling. I'm going to return to fixing the test after some success with the actual build.

@Ansariel
Copy link
Contributor

Ok, but you should check LLMaterial::getHash() as well - it does the same kind of hash generation.

@marchcat marchcat force-pushed the marchcat/xcode-16 branch 3 times, most recently from 707ffc3 to 42f7774 Compare September 17, 2024 19:35
@marchcat marchcat marked this pull request as ready for review September 17, 2024 21:29
@marchcat marchcat added this to the Develop milestone Sep 17, 2024
@@ -1331,7 +1331,7 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
// Check the whitelist, if there's media (otherwise just show it)
if (te->getMediaData() == NULL || te->getMediaData()->checkCandidateUrl(url))
{
if ( obj != mDragHoveredObject)
if (obj != mDragHoveredObject.get())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's pull in Ansariel's free functions to compare (T* == LLPointer<T>) and !=.

Copy link
Contributor

@Ansariel Ansariel Sep 23, 2024

Choose a reason for hiding this comment

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

They are already in the develop branch (d91d39f). The problem here is that obj is a LLVOVolume pointer and mDragHoveredObject is an LLPointer<LLViewerObject>, so the overloaded operator doesn't work.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we're comparing pointers to different types in the same class hierarchy, shouldn't we formally be downcasting one of them to match the other? We don't use a lot of multiple inheritance, but a pointer to object A's base class doesn't necessarily have the same bit pattern as a pointer to A.

Copy link
Contributor

Choose a reason for hiding this comment

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

That would probably be a smart thing to do.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I should have realized the language takes care of that.

That being the case, I'll try tweaking the (T* == LLPointer<T>) comparisons to accept a raw pointer to arbitrary type, letting the compiler produce an error if the two pointer types can't be compared.

Copy link
Collaborator

Choose a reason for hiding this comment

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

nat-goodspeed and others added 6 commits September 24, 2024 12:53
That is, both `LLPointer::operator==()` and `operator!=()` and the free function
`operator==()` and `operator!=()` now accept pointer types other than the type
of the subject `LLPointer`, letting the compiler apply implicit pointer
conversions or diagnose an error.
Instead of restating the whole class, requiring changes to be made in parallel
(which has already failed), just make a template alias.
This affords strong exception safety. Also, eliminating the conditional may
improve speed.
Given templated constructors and assignment operators, it's tempting to remove
specific constructors and assignment operators with the same LLPointer<Type>
parameters. That turns out to be a mistake. Add comments to warn future
maintainers.
Generalize LLPointer's comparison operators to allow comparable LLPointer types.
@Ansariel
Copy link
Contributor

Excuse me while I'm capturing this PR for an unrelated, but kinda similar question: Is the Linux runner using Ubuntu 22.04? And if so, can we get a Ubuntu 24.04 / GCC13 compatibility pass? (Buggy) GCC13 gets really angry about some templating stuff that was added with the Lua feature merge.

@brad-linden
Copy link
Collaborator

brad-linden commented Sep 26, 2024

Is the Linux runner using Ubuntu 22.04? And if so, can we get a Ubuntu 24.04 / GCC13 compatibility pass?

linux-large is currently Ubuntu 22.04.5. I tried to build on ubuntu-24.04 runner and got the same set of errors, but slower.

we will certainly want to keep our distributed builds on 22.04 for some time. we can do work for compatibility with newer compilers, but moving to a newer glibc based system will limit our distribution compatibility even further

marchcat and others added 3 commits September 26, 2024 20:38
Now the lerp() in global namespace is std::lerp(), but it remains true that
for some calls to std::lerp(), MSVC issues fatal argument conversion warnings.
In those places, call flerp() (our historic lerp()) instead.
@nat-goodspeed
Copy link
Collaborator

This PR actually does turn on C++20. Once it succeeds, do we need further discussion with anyone before merging to develop?

@Ansariel
Copy link
Contributor

Ansariel commented Sep 26, 2024

This PR actually does turn on C++20. Once it succeeds, do we need further discussion with anyone before merging to develop?

What about the hash calculation for BP and GLTF materials? Is that fixed or does it need more attention? See #2330 (comment)

@nat-goodspeed
Copy link
Collaborator

Dave was running some head-to-head performance tests with various hash tactics; I don't know where he committed the results of his work.

@Ansariel
Copy link
Contributor

But does the test succeed now? Previously xcode seem to have changed something to the memory alignment of the said material classes, causing the test to fail.

@Ansariel
Copy link
Contributor

Ansariel commented Sep 26, 2024

Sigh, Windows dislikes the lerp() change. On it.

Looking at the cases that got changed to flerp, could it be VS got mad because in all those cases you are mixing parameter types (int/float)?

Will test that after this PR got merged.
See #2712

@Ansariel
Copy link
Contributor

FYI: C++23 builds fine with VS 🫡

@marchcat
Copy link
Contributor Author

This allows removing #include "llerror.h" from llpointer.h.
Also remove #include "llmutex.h" as a heavy way to get
<boost/functional/hash.hpp>.

That requires adding #include "llmutex.h" to llimage.h, llnotifications.h,
llwatchdog.cpp and llvolumemgr.cpp, which were inheriting it from llpointer.h.
Instead of using strdup() and free() to store comment_text in JPEG2KEncode,
store a std::string. Similarly, instead of manually managing pointers to
encoder, decoder, image, stream and codestream_info in JPEG2KDecode and
JPEG2KEncode, use std::unique_ptr for each, specifying their respective
deleter functions.
owning_ptr<T> adapts std::unique_ptr<T> to be a better drop-in replacement for
a legacy class that formerly stored plain T* data members, and explicitly
destroyed them using domain-specific destructor functions.

Directly substituting std::unique_ptr into JPEG2KEncode and JPEG2KDecode was
cumbersome because every such pointer declaration required a redundant
template parameter describing the deleter function passed into its
constructor. Moreover, it required lots of little syntax tweaks: changing
every assignment to a reset() call, changing every reference to a get() call.

Using owning_ptr<T> allows us to leave the code more or less as it was before,
save that assignment and destruction automatically handle the previous
referenced T instance.
Clean up llpointer.h per previous discussions.
@nat-goodspeed
Copy link
Collaborator

A new branch tip build for evaluation

@nat-goodspeed
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants