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

Fix incorrect SamplerParams operators #7150

Merged
merged 1 commit into from
Sep 8, 2023
Merged

Fix incorrect SamplerParams operators #7150

merged 1 commit into from
Sep 8, 2023

Conversation

bejado
Copy link
Member

@bejado bejado commented Sep 8, 2023

This was causing the OpenGL backend to assert on x86_64 Macs:

assert_invariant(mSamplerMap.find(params) == mSamplerMap.end());

@bejado bejado added the internal Issue/PR does not affect clients label Sep 8, 2023
@@ -838,6 +838,7 @@ struct SamplerParams { // NOLINT
return SamplerParams::LessThan{}(lhs, rhs);
}
};
static_assert(sizeof(SamplerParams) == 4);
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@pixelflinger pixelflinger left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -813,22 +813,22 @@ struct SamplerParams { // NOLINT
struct Hasher {
size_t operator()(SamplerParams p) const noexcept {
// we don't use std::hash<> here, so we don't have to include <functional>
return *reinterpret_cast<uint64_t const*>(reinterpret_cast<char const*>(&p));
return *reinterpret_cast<uint32_t const*>(reinterpret_cast<char const*>(&p));
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any conflict with #7104 ?

This was causing the OpenGL backend to assert on x86_64 Macs:
It seems it's not just an OpenGL backend issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

#7104 was the cause of the bug, yes. And certainly this could affect backends other than OpenGL, but the assert that was firing was specific to the OpenGL backend.

@bejado bejado merged commit 3ab7780 into main Sep 8, 2023
12 checks passed
@bejado bejado deleted the bjd/fix-samplerparams branch September 8, 2023 20:06
plepers pushed a commit to plepers/filament that referenced this pull request Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Issue/PR does not affect clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants