mmp / pbrt-v3

Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.
http://pbrt.org
BSD 2-Clause "Simplified" License
4.91k stars 1.2k forks source link

`__builtin_bswap32()' may not be available on non-MSCV compiler, thus… #99

Closed syoyo closed 7 years ago

syoyo commented 7 years ago

… use our own byteswap function.

I have no idea how to test materials/fourier.cpp, but the fix is tiny and should work well. (If required, I can run test on big endian machine(i.e. SPARC) once test data is given)

mmp commented 7 years ago

I added a unit test for FourierBSDF in 371c518cce1de303472184588357e2fca08129ae which should both help verify that this doesn't break other platforms (though I don't see how it could), and also verify that this does in fact do the right thing on big endian systems. I'll go ahead and merge this, but please let me know if the test does in fact pass in SPARC.

Thanks!

syoyo commented 7 years ago

Thanks for the test code.

if the test does in fact pass in SPARC.

I have confirmed the unit test passes on SPARC machine.

$ ./pbrt_test --gtest_filter="*Four*"
Running main() from gtest_main.cc
Note: Google Test filter = *Four*
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from BSDFs
[ RUN      ] BSDFs.Fourier
[       OK ] BSDFs.Fourier (6 ms)
[----------] 1 test from BSDFs (6 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (6 ms total)
[  PASSED  ] 1 test.