sergeymakeev / goofy Goto Github PK
View Code? Open in Web Editor NEWGoofy - Realtime DXT1/ETC1 encoder
License: MIT License
Goofy - Realtime DXT1/ETC1 encoder
License: MIT License
https://github.com/SergeyMakeev/Goofy/blob/master/GoofyTC/goofy_tc.h#L1453
blRangeY.m128i_u8[0]
is not available outside MSVC.
Possible replacement (and I am no expert in using processor intrinsics):
alignas(16) unsigned char m128i_u8[16];
_mm_storeu_si128((__m128i*)m128i_u8, blRangeY);
const uint32_t block0a = etc1BrighnessRangeTocontrolByte[m128i_u8[0]] | ((baseColors.r0 << 3ull) & 0xFFFFFF);
Seems to work OK for me.
Some other things needed
#if defined(__GNUC__) || defined(__clang__)
# define ALIGN(x) __attribute__ ((aligned(x)))
# define goofy_inline __attribute__((always_inline)) inline
# define goofy_restrict __restrict
#elif defined(_MSC_VER)
# define ALIGN(x) __declspec(align(x))
# define goofy_restrict __restrict
# define goofy_inline __forceinline
#else
# error "Unknown compiler; can't define ALIGN"
#endif
// constants
ALIGN(16) static const uint32_t gConstEight[4] = { 0x08080808, 0x08080808, 0x08080808, 0x08080808 };
ALIGN(16) static const uint32_t gConstSixteen[4] = { 0x10101010, 0x10101010, 0x10101010, 0x10101010 };
ALIGN(16) static const uint32_t gConstMaxInt[4] = { 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f, 0x7f7f7f7f };
Possibly also x86intrin.h
instead of immintrin.h
Also, the program completely fails if compressETC1 is not wrapped in #pragma optimize( "", off )
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.