Open mihe opened 3 weeks ago
optimize=size
(aka /O1
) does not reproduce the issue, so it seems limited to optimize=speed
(aka /O2
)
I've also tried running the worker tasks serially on the main thread instead, to rule out threading issues, and it still reproduces, so it's not likely to be a threading issue.
I also tried running with Application Verifier (using the Basics/Exceptions
and Basics/Heaps
tests) and that only gave me a more specific call stack (i.e. the inlined portion) so that likely rules out this being a memory corruption caused elsewhere.
CC @BlueCube3310 @RandomShaper @bruvzg
Going as far back as 0f0106c101edd63351a8e3f8be4b1f87e4501d78 (in hopes of bisecting it to a Godot commit) did not change anything. It still results in a crash.
What did resolve the issue however was downgrading the MSVC toolchain from v14.40-17.10 (released May 21st 2024) to the previous version, v14.39-17.9 (released February 13th 2024), so it does seem quite likely that this is the result of some code generation bug introduced in MSVC v14.40-17.10.
I suppose the appropriate thing to do would be to report this to Microsoft, but reducing this down to something reportable strikes me as a difficult task.
It looks like this happens when SSE2 instructions are enabled. Are they enabled by default in the official builds?
Yes, SSE2 is explicitly enabled for x86 and already included (and thus implicitly enabled) in x86-64.
EDIT: Well, technically the /arch
option is left at its default value for MSVC, which is /arch:SSE2
, so perhaps not explicitly enabled with MSVC, but SSE2 is a baseline requirement for Godot.
Could you modify the function to look like this and check the results?
static UInt15 RoundAndConvertToU15(const Float &v, const void* /*roundingMode*/)
{
__m128i lo = _mm_cvtps_epi32(v.m_values[0]);
__m128i hi = _mm_cvtps_epi32(v.m_values[1]);
UInt15 result;
result.m_value = _mm_packs_epi32(lo, hi);
return result;
}
The crash might be happening due to the compiler getting confused about unused SIMD variables.
That did not change anything, unfortunately.
Does this also happen with HDR textures (BC6), or only with LDR (BC7)?
How would I go about using BC6?
How would I go about using BC6?
You can import a .hdr file (from polyhaven, for example) and enable VRAM compression.
Tested versions
Reproducible in: 4.3.beta [32eba1ee1]
System information
Windows 11 (10.0.22631), AMD Ryzen 9 7940HS
Issue description
When importing pretty much any texture to the BPTC format using a build of Godot compiled with MSVC (toolchain v14.40-17.10) on Windows you end up crashing in one of the CVTT worker tasks that's spawned by
image_compress_cvtt
found here, with the following call stack:With the main thread being here:
Note that this does not seem to happen when using the prebuilt release of Godot 4.3-beta1, and I've had this crash happen before the commit associated with that release, so I fear that this is likely an MSVC-specific issue, perhaps even a compiler bug.
Also note that this only seems to happen in optimized builds of Godot. Non-optimized builds (
dev_build=yes
) seems to import the texture just fine.The important details in terms of the MRP seems to be as follows:
textures/vram_compression/import_s3tc_bptc
must betrue
.Steps to reproduce
target=editor dev_build=no debug_symbols=yes
..godot
folder present in the MRP project.Minimal reproduction project (MRP)
bptc-crash.zip