- fixing tinydds so it writes the correct flags, so dds-ktx can view our DDS files

- upping WebGL KTX2 encoder/transcoder testbed so its max Memory64/WASM64 heap size is 15GB, so 4096x4096 textures can be encoded
This commit is contained in:
Richard Geldreich
2026-03-20 17:34:22 -04:00
parent 74ba7f4f6b
commit 08fabab89f
20 changed files with 21 additions and 15 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -2002,23 +2002,28 @@ bool TinyDDS_WriteImage(TinyDDS_WriteCallbacks const *callbacks,
header.formatFourCC = TINYDDS_MAKE_RIFFCODE('D','X','1','0');
headerDX10.arraySize = slices;
}
header.flags = TINYDDS_DDSD_CAPS | TINYDDS_DDSD_PIXELFORMAT | TINYDDS_DDSD_MIPMAPCOUNT;
header.flags = TINYDDS_DDSD_CAPS | TINYDDS_DDSD_PIXELFORMAT | TINYDDS_DDSD_MIPMAPCOUNT | TINYDDS_DDSD_WIDTH | TINYDDS_DDSD_HEIGHT;
header.caps1 = TINYDDS_DDSCAPS_TEXTURE | TINYDDS_DDSCAPS_COMPLEX | TINYDDS_DDSCAPS_MIPMAP;
if(depth > 1) {
if(depth > 1)
{
headerDX10.resourceDimension = TINYDDS_D3D10_RESOURCE_DIMENSION_TEXTURE3D;
header.flags |= TINYDDS_DDSD_DEPTH;
header.caps2 |= TINYDDS_DDSCAPS2_VOLUME;
}
else if(height > 1) {
else if(height > 1)
{
headerDX10.resourceDimension = TINYDDS_D3D10_RESOURCE_DIMENSION_TEXTURE2D;
header.flags |= TINYDDS_DDSD_HEIGHT;
//header.flags |= TINYDDS_DDSD_HEIGHT;
}
else if(width > 1) {
else if(width > 1)
{
headerDX10.resourceDimension = TINYDDS_D3D10_RESOURCE_DIMENSION_TEXTURE1D;
header.flags |= TINYDDS_DDSD_WIDTH;
//header.flags |= TINYDDS_DDSD_WIDTH;
}
if(cubemap) {
if(cubemap)
{
headerDX10.miscFlag |= TINYDDS_D3D10_RESOURCE_MISC_TEXTURECUBE;
header.caps2 |= TINYDDS_DDSCAPS2_CUBEMAP | TINYDDS_DDSCAPS2_CUBEMAP_ALL;
}

View File

@@ -999,7 +999,8 @@ bool random_compress_test()
flags |= cFlagDebug;
flags |= cFlagThreaded;
if (rnd.bit())
flags |= cFlagThreaded;
if (rnd.bit())
flags |= cFlagSRGB;
@@ -1101,7 +1102,7 @@ bool random_compress_test()
basisu::vector<imagef> hdr_source_images;
imagef hdr_src_img(src_img.get_width(), src_img.get_height());
const float max_y = rnd.frand(.000125f, 30000.0f) / 255.0f;
const float max_y = rnd.frand(.0000125f, basist::ASTC_HDR_MAX_VAL) / 255.0f;
for (uint32_t y = 0; y < src_img.get_height(); y++)
{

Binary file not shown.

View File

@@ -123,7 +123,7 @@ if(EMSCRIPTEN)
endif()
if(${use_wasm64})
set(_lf "${_lf} ${LINK_WASM64} -s INITIAL_MEMORY=1073741824 -s MAXIMUM_MEMORY=12884901888")
set(_lf "${_lf} ${LINK_WASM64} -s INITIAL_MEMORY=1073741824 -s MAXIMUM_MEMORY=16106127360")
endif()
set_target_properties(${target} PROPERTIES LINK_FLAGS "${_lf}")

File diff suppressed because one or more lines are too long

View File

@@ -2435,7 +2435,7 @@
<br>
<div style="font-size: 24pt; font-weight: bold">
Basis Universal .KTX2 Supercompressed GPU Texture Encoding/Transcoding Testbed v2.18
Basis Universal .KTX2 Supercompressed GPU Texture Encoding/Transcoding Testbed v2.19
</div>
<br>This simple demo uses the <a href="https://github.com/BinomialLLC/basis_universal/">Basis Universal</a> C++ transcoder (compiled to WebAssembly using Emscripten) to transcode a .ktx2 file to:
@@ -2445,7 +2445,7 @@
Thanks to Evan Parker for providing <a href="https://github.com/toji/webgl-texture-utils">webgl-texture-utils</a> and this test bed. <a href="../index.html">Go back.</a>
Notes: Enable your browser debug console (F12 on Chrome/Firefox) to see debug output.
The largest image resolution that can be compressed in the browser with
this library is limited to either 12 megapixels or 4 megapixels (depending on format and WASM64/WASM32) to avoid running out of WASM memory.
this library is limited to either 16 megapixels or 4 megapixels (depending on format and WASM64/WASM32) to avoid running out of WASM memory.
<br><br>
<div id="supported-formats">

View File

@@ -35,8 +35,8 @@
// 32-bit WASM limitation (TODO: remove for 64-bit), to prevent OOM crashes during HDR encoding in particular.
// TODO: Even WASM64 in Chrome has limits which seem too low for us. For now, just impose this limit.
#ifdef __wasm64__
#define BASISU_ENCODER_MAX_SOURCE_IMAGE_PIXELS (1024*1024*12)
#define BASISU_ENCODER_MAX_SOURCE_IMAGE_PIXELS_HIGHER_LIMIT (1024*1024*12)
#define BASISU_ENCODER_MAX_SOURCE_IMAGE_PIXELS (1024*1024*16)
#define BASISU_ENCODER_MAX_SOURCE_IMAGE_PIXELS_HIGHER_LIMIT (1024*1024*16)
#else
#define BASISU_ENCODER_MAX_SOURCE_IMAGE_PIXELS (1024*1024*4)
#define BASISU_ENCODER_MAX_SOURCE_IMAGE_PIXELS_HIGHER_LIMIT (1024*1024*12)