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

Windows Build Can't Open USDC File #87

Closed
zhoub opened this issue Oct 21, 2016 · 4 comments
Closed

Windows Build Can't Open USDC File #87

zhoub opened this issue Oct 21, 2016 · 4 comments

Comments

@zhoub
Copy link

zhoub commented Oct 21, 2016

Hi,

I found a serious low level issue about CrateFile, that's from the C++ memory layout and object persistent for cross-platform IO.

There is a hack class named.

// Tag indicating trivially copyable types, hack since gcc doesn't yet implement
// is_trivially_copyable correctly.
struct _BitwiseReadWrite {};

Then all the internal structure will inherent from this class, but the code doesn't consider the alignment on different compilers. After my test, the GCC on Linux will write 16bytes aligned structure but the padded bytes starts from the head, but MSVC might don't follow the same rule.

Here are some structures from my personal tiny test program in a reversed engineering way to figure out where is the problem.

struct UsdcFileField
{
    uint32_t mReserved; // Padded by GCC
    uint32_t mTokenIndex;
    uint64_t mValueRep;
};

struct UsdcPathItemHeader
{
    uint32_t mReserved; // Padded by GCC
    uint32_t mIndex;
    uint32_t mElementTokenIndex;
    uint8_t  mBits;
};

struct UsdcSpec
{
    uint32_t mReserved; // Padded by GCC
    uint32_t mPathIndex;
    uint32_t mFieldSetIndex;
    int32_t  mSdfSpecType;
};

Also, I suggest to add the unit test for the USDA and USDC file, which makes more sense to cover this kind of issue.

Thank you very much.

@sunyab
Copy link
Contributor

sunyab commented Oct 21, 2016

Hi @zhoub, I believe commit 753f62b should address this problem.

@jtran56
Copy link

jtran56 commented Oct 24, 2016

Filed as internal issue #139103.

@c64kernal
Copy link
Contributor

Bo, if you can verify with a build that has the fix Sunya mentioned to make sure this isn't another issue, that'd be greatly appreciated, and if it is fixed, we can close this out. Thanks!

@c64kernal
Copy link
Contributor

Going to close this out for now. Please file a new issue with repro steps if you encounter another similar issue.

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

No branches or pull requests

4 participants