You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.
At Unity we're finding that just updating the underlying ISPC compiler to 1.14 version gives a small compression speed increase (3-5% for BC7 & BC6H). That's cool! However the source code needs some fixes:
Integer type defs
ISPC now defines sized integer types, so ispc_texcomp/kernel.ispc needs removal of:
Not sure if due to new ISPC, or due to more recent C++ compiler, but the ASTC compressor dual plane flag was producing wrong results. Looks like ISPC produces 0 and 255 values for "bool", but some Clang optimizations assume it will only contain 0 and 1 values. Then the C++ code that does int D = !!block->dual_plane; and expects to produce 0 or 1 ends up producing 0 or 255 too, which when going into the ASTC block bitfields leads to much hilarity. Changing bool dual_plane; to uint8_t dual_plane; in ispc_texcomp_astc.cpp; and uniform bool dual_plane; to uniform uint8_t dual_plane; in kernel_astc.ispc fixes the issue.
ASTC solid color blocks
Solid color blocks in ASTC formats are encoded wrongly. In kernel_astc.ispc, ls_refine_scale() function for solid color blocks, sum_w and sum_ww can be zeroes, which makes sgesv2 return NaNs in xx[0] and xx[1], resulting in NaN scale too. Changing this:
if (scale > 0.9999) scale = 0.9999;
if (scale < 0) scale = 0;
to use clamp function fixes the issue:
scale = clamp(scale, 0.0f, 0.9999f); // note: clamp also takes care of possible NaNs
The text was updated successfully, but these errors were encountered:
consolidate rcp and rsqrt to inline function to explicitly pick level of approximation - note ispc files still compiled with --opt=fast-math so rcp and rsqrt still used.
also, ASTC solid block colors scale colors fix (issue #28)
thanks for catching this. I've added a check for divide by zero to avoid. i'll follow up with ispc team to make the behavior more consistent in the future.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
At Unity we're finding that just updating the underlying ISPC compiler to 1.14 version gives a small compression speed increase (3-5% for BC7 & BC6H). That's cool! However the source code needs some fixes:
Integer type defs
ISPC now defines sized integer types, so
ispc_texcomp/kernel.ispc
needs removal of:(a similar change is done in #27)
ASTC dual plane bool
Not sure if due to new ISPC, or due to more recent C++ compiler, but the ASTC compressor dual plane flag was producing wrong results. Looks like ISPC produces 0 and 255 values for "bool", but some Clang optimizations assume it will only contain 0 and 1 values. Then the C++ code that does
int D = !!block->dual_plane;
and expects to produce 0 or 1 ends up producing 0 or 255 too, which when going into the ASTC block bitfields leads to much hilarity. Changingbool dual_plane;
touint8_t dual_plane;
inispc_texcomp_astc.cpp
; anduniform bool dual_plane;
touniform uint8_t dual_plane;
inkernel_astc.ispc
fixes the issue.ASTC solid color blocks
Solid color blocks in ASTC formats are encoded wrongly. In
kernel_astc.ispc
,ls_refine_scale()
function for solid color blocks,sum_w
andsum_ww
can be zeroes, which makessgesv2
return NaNs inxx[0]
andxx[1]
, resulting in NaNscale
too. Changing this:to use clamp function fixes the issue:
The text was updated successfully, but these errors were encountered: