Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KTX2 support and remove KTX/CRN #9513

Merged
merged 93 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
33bbf82
remove ktx and crn
ebogo1 Apr 13, 2021
4de23ca
clean up diff
ebogo1 Apr 14, 2021
67190ba
delete spec data
ebogo1 Apr 14, 2021
8ede332
first pass of ktx2 changes
ebogo1 Apr 15, 2021
53b2ad1
fix eslint in Model.js
ebogo1 Apr 15, 2021
6f3dafa
add parseKTX2 files
ebogo1 Apr 16, 2021
f56d0db
first ktx2 pass
ebogo1 Apr 25, 2021
e5ecf33
update sandcastles
ebogo1 Apr 27, 2021
343744e
check for ArrayBuffer type in KTX2Transcoder
ebogo1 Apr 29, 2021
864acae
add missing specs and sample data
ebogo1 Apr 30, 2021
513fa74
fix eslint
ebogo1 Apr 30, 2021
d47948f
revert launch.json changes
ebogo1 Apr 30, 2021
0f1aa60
remove accidental text
ebogo1 Apr 30, 2021
aad0036
remove msc module
ebogo1 Apr 30, 2021
1585932
actually remove msc transcoder
ebogo1 Apr 30, 2021
0ba0518
fix Sandcastles
ebogo1 Apr 30, 2021
681f952
remove unused .ktx2 files
ebogo1 Apr 30, 2021
4d0682a
use KTX-Parse library
ebogo1 Apr 30, 2021
3d6962d
first pass PR feedback
ebogo1 May 2, 2021
8e708d1
fix parseKTX2 logic and add mip level support to Material.js
ebogo1 May 4, 2021
da30ff7
UASTC support
ebogo1 May 6, 2021
4baf571
fix uastc logic
ebogo1 May 6, 2021
107db85
add ASTC, BC7 formats; update CHANGES.md
ebogo1 May 12, 2021
7dc28ca
fix BC7 check
ebogo1 May 12, 2021
eefbeee
update KTX2 glTF/glb to KHR_texture_basisu spec
ebogo1 May 20, 2021
ee9f2f8
update loadKTX2Spec, first pass
ebogo1 May 22, 2021
1c1b3c1
mip logic in Material.js, update width/height in parseKTX2
ebogo1 May 26, 2021
570e116
add unorm support to uncompressed KTX 2
ebogo1 May 26, 2021
81f702a
fix mip specs in loadKTX2
ebogo1 May 27, 2021
4947a60
Merge branch 'fix-broken-image'
ebogo1 Jun 2, 2021
d1b4c41
first pass UNORM support
ebogo1 Jun 4, 2021
118dffd
fix eslint
ebogo1 Jun 4, 2021
959445c
remove fdescribe, add BC7 to normalized formats
ebogo1 Jun 4, 2021
dd812dc
SFLOAT logic, cleanup in parseKTX2
ebogo1 Jun 4, 2021
ab6c6cf
pass pixelDatatype to CubeMap
ebogo1 Jun 11, 2021
44fded0
use Float32Array for full float
ebogo1 Jun 14, 2021
4634c36
fix eslint
ebogo1 Jun 14, 2021
21daf50
first pass PR feedback
ebogo1 Jun 16, 2021
d9f50b2
merge master
ebogo1 Jun 17, 2021
e9300c8
update CHANGES.md and GltfImageLoader after merging master
ebogo1 Jun 17, 2021
598c601
more PR feedback
ebogo1 Jun 17, 2021
613124d
Merge branch 'master' of github.com:CesiumGS/cesium
ebogo1 Jun 17, 2021
39f26d6
fixed model mipmap, added ModelSpec, other fixes
ebogo1 Jun 17, 2021
c34b4f5
throw if KTX2Transcoder fails
ebogo1 Jun 17, 2021
96383b7
fix RGB8 logic in parseKTX2 and KTX2 mipmap test in ModelSpec
ebogo1 Jun 17, 2021
a2177b2
loadKTX2 specs
ebogo1 Jun 18, 2021
04e1095
update error messages
ebogo1 Jun 18, 2021
32e95f6
update LICENSE.md
ebogo1 Jun 18, 2021
11edcf9
octahedral cubemap specs
ebogo1 Jun 18, 2021
6bc8374
remove arraySlice from loadKTX2, update specs
ebogo1 Jun 21, 2021
db76034
rework format precedence for ktx2 and try to use ETC2 extension
ebogo1 Jun 22, 2021
34c852c
Merge branch 'master' of github.com:CesiumGS/cesium
ebogo1 Jun 22, 2021
804f1eb
Fixes misc crn/ktx occurrences
lilleyse Jun 22, 2021
58c846d
remove arraySlice in loadKTX2
ebogo1 Jun 22, 2021
0509e73
Merge branch 'add-ktx2' of github.com:CesiumGS/cesium into add-ktx2
ebogo1 Jun 22, 2021
2729b9d
fix misnamed texture formats, update link in Material.js
ebogo1 Jun 22, 2021
0d9b9ab
fixed comments in Texture.js
ebogo1 Jun 22, 2021
75d8b0d
add etc check in Scene
ebogo1 Jun 22, 2021
c1ac0da
Merge branch 'master', remote-tracking branch 'origin' into add-ktx2
ebogo1 Jun 23, 2021
2d02f92
add loadKTX2Spec tests for all formats
ebogo1 Jun 23, 2021
7e5fba2
Added KTX2 support for new glTF loader files
lilleyse Jun 23, 2021
b33dc12
Added KTX2 support for new glTF loader files
lilleyse Jun 23, 2021
89b3267
Merge branch 'add-ktx2' of github.com:CesiumGS/cesium into add-ktx2
ebogo1 Jun 23, 2021
7aa9ce1
Merge branch 'master' into add-ktx2
lilleyse Jun 24, 2021
966aefc
Merge branch 'add-ktx2' of github.com:CesiumGS/cesium into add-ktx2
ebogo1 Jun 24, 2021
cc02514
helper func for ktx2 specs
ebogo1 Jun 24, 2021
d20fda3
don't use spy for CI ktx2 specs
ebogo1 Jun 24, 2021
5f59d0f
remove two more loadKTX2 calls in spec
ebogo1 Jun 24, 2021
c70923b
check typeOf to defined
ebogo1 Jun 24, 2021
c8afbd6
Merge branch 'add-ktx2' of github.com:CesiumGS/cesium into add-ktx2
ebogo1 Jun 24, 2021
9273229
remove arraySlice in ktx2 worker, use transferableObjects
ebogo1 Jun 25, 2021
4594ac1
don't run loadKTX2 in TextureSpec if unsupported
ebogo1 Jun 25, 2021
7295751
remove fdescribe
ebogo1 Jun 25, 2021
c68d07c
supportsBasis checks in specs, add mipmap ktx2 model, prettier
ebogo1 Jun 25, 2021
785d763
use toThrowDeveloperError in loadKTX2Spec
ebogo1 Jun 25, 2021
121e9ed
respond to test feedback
ebogo1 Jun 25, 2021
938a742
fix import in TextureSpec
ebogo1 Jun 25, 2021
d1af0e1
throw if invalid data in loadKTX2
ebogo1 Jun 26, 2021
e6b833d
update IBL Sandcastle and shader
ebogo1 Jun 26, 2021
1635089
Edit to loadKTX2 promise
lilleyse Jun 26, 2021
c05d669
Fix unrelated doc
lilleyse Jun 26, 2021
4325679
Change minFilter logic for missing mipmaps, update KTX2 basis box mod…
ebogo1 Jun 26, 2021
b6ea255
Merge branch 'add-ktx2' of github.com:CesiumGS/cesium into add-ktx2
ebogo1 Jun 26, 2021
61e2ae9
remove empty samplers array
ebogo1 Jun 26, 2021
ed95611
update GltfTextureLoader and spec, respond to other feedback
ebogo1 Jun 27, 2021
42b4122
Merge branch 'master' into add-ktx2
ebogo1 Jun 27, 2021
0b586f0
fix prettier
ebogo1 Jun 28, 2021
86fa3ae
Merge branch 'add-ktx2' of github.com:CesiumGS/cesium into add-ktx2
ebogo1 Jun 28, 2021
4e8fdc0
Update GltfTextureLoader test
lilleyse Jun 28, 2021
637f6dc
Update model in GltfLoader folder
lilleyse Jun 28, 2021
22c7fba
update gltf-pipeline
ebogo1 Jun 28, 2021
5314d15
Merge branch 'add-ktx2' of github.com:CesiumGS/cesium into add-ktx2
ebogo1 Jun 28, 2021
5b45436
Fix tests
lilleyse Jun 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
"Source/Shaders/**/*.js": true
},
"files.associations": {
"*.czml": "json"
"*.czml": "json",
"array": "cpp",
"string": "cpp",
"string_view": "cpp"
},
"eslint.enable": true,
"javascript.format.insertSpaceAfterCommaDelimiter": true,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
9 changes: 9 additions & 0 deletions Apps/Sandcastle/gallery/3D Models.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@
);
},
},
{
text: "KTX2 Compressed Balloon",
onselect: function () {
createModel(
"../../SampleData/models/CesiumBalloonKTX2/CesiumBalloonKTX2.glb",
1000.0
);
},
},
];

Sandcastle.addToolbarMenu(options);
Expand Down
2 changes: 1 addition & 1 deletion Apps/Sandcastle/gallery/Image-Based Lighting.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
}

var environmentMapURL =
"https://cesium.com/public/SandcastleSampleData/kiara_6_afternoon_2k_ibl.ktx";
"../../SampleData/EnvironmentMap/kiara_6_afternoon_2k_ibl.ktx2";
var modelURL = "../../SampleData/models/Pawns/Pawns.glb";

// This environment map was processed using Google's Filament project. To process your own:
Expand Down
9 changes: 1 addition & 8 deletions Apps/Sandcastle/gallery/Materials.html
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,7 @@
function applyCompressedTextureMaterial(primitive, scene) {
Sandcastle.declare(applyCompressedTextureMaterial); // For highlighting in Sandcastle.

var compressedImageUrl;
if (scene.getCompressedTextureFormatSupported("s3tc")) {
compressedImageUrl = "../images/LogoDXT1.ktx";
} else if (scene.getCompressedTextureFormatSupported("etc1")) {
compressedImageUrl = "../images/LogoETC1.ktx";
} else if (scene.getCompressedTextureFormatSupported("pvrtc")) {
compressedImageUrl = "../images/LogoPVR.ktx";
}
var compressedImageUrl = "../images/LogoETC1.ktx2";

primitive.appearance.material = new Cesium.Material({
fabric: {
Expand Down
Binary file added Apps/Sandcastle/images/Logo.ktx2
Binary file not shown.
Binary file removed Apps/Sandcastle/images/LogoDXT1.ktx
Binary file not shown.
Binary file not shown.
Binary file removed Apps/Sandcastle/images/LogoPVR.ktx
Binary file not shown.
5 changes: 5 additions & 0 deletions Source/Core/FeatureDetection.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ function supportsPointerEvents() {
return hasPointerEvents;
}

function supportsBasis(context) {
return context.etc1 || context.s3tc || context.pvrtc;
}

var imageRenderingValueResult;
var supportsImageRenderingPixelatedResult;
function supportsImageRenderingPixelated() {
Expand Down Expand Up @@ -304,6 +308,7 @@ var FeatureDetection = {
supportsPointerEvents: supportsPointerEvents,
supportsImageRenderingPixelated: supportsImageRenderingPixelated,
supportsWebP: supportsWebP,
supportsBasis: supportsBasis,
imageRenderingValue: imageRenderingValue,
typedArrayTypes: typedArrayTypes,
};
Expand Down
287 changes: 287 additions & 0 deletions Source/Core/VulkanConstants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
/**
* Enum containing Vulkan Constant values by name.
*
* These match the constants from the [Vulkan 1.2]{@link https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#formats-definition}
* specifications.
*
* @enum {Number}
* @private
*/
var VulkanConstants = {
VK_FORMAT_UNDEFINED: 0,
VK_FORMAT_R4G4_UNORM_PACK8: 1,
VK_FORMAT_R4G4B4A4_UNORM_PACK16: 2,
VK_FORMAT_B4G4R4A4_UNORM_PACK16: 3,
VK_FORMAT_R5G6B5_UNORM_PACK16: 4,
VK_FORMAT_B5G6R5_UNORM_PACK16: 5,
VK_FORMAT_R5G5B5A1_UNORM_PACK16: 6,
VK_FORMAT_B5G5R5A1_UNORM_PACK16: 7,
VK_FORMAT_A1R5G5B5_UNORM_PACK16: 8,
VK_FORMAT_R8_UNORM: 9,
VK_FORMAT_R8_SNORM: 10,
VK_FORMAT_R8_USCALED: 11,
VK_FORMAT_R8_SSCALED: 12,
VK_FORMAT_R8_UINT: 13,
VK_FORMAT_R8_SINT: 14,
VK_FORMAT_R8_SRGB: 15,
VK_FORMAT_R8G8_UNORM: 16,
VK_FORMAT_R8G8_SNORM: 17,
VK_FORMAT_R8G8_USCALED: 18,
VK_FORMAT_R8G8_SSCALED: 19,
VK_FORMAT_R8G8_UINT: 20,
VK_FORMAT_R8G8_SINT: 21,
VK_FORMAT_R8G8_SRGB: 22,
VK_FORMAT_R8G8B8_UNORM: 23,
VK_FORMAT_R8G8B8_SNORM: 24,
VK_FORMAT_R8G8B8_USCALED: 25,
VK_FORMAT_R8G8B8_SSCALED: 26,
VK_FORMAT_R8G8B8_UINT: 27,
VK_FORMAT_R8G8B8_SINT: 28,
VK_FORMAT_R8G8B8_SRGB: 29,
VK_FORMAT_B8G8R8_UNORM: 30,
VK_FORMAT_B8G8R8_SNORM: 31,
VK_FORMAT_B8G8R8_USCALED: 32,
VK_FORMAT_B8G8R8_SSCALED: 33,
VK_FORMAT_B8G8R8_UINT: 34,
VK_FORMAT_B8G8R8_SINT: 35,
VK_FORMAT_B8G8R8_SRGB: 36,
VK_FORMAT_R8G8B8A8_UNORM: 37,
VK_FORMAT_R8G8B8A8_SNORM: 38,
VK_FORMAT_R8G8B8A8_USCALED: 39,
VK_FORMAT_R8G8B8A8_SSCALED: 40,
VK_FORMAT_R8G8B8A8_UINT: 41,
VK_FORMAT_R8G8B8A8_SINT: 42,
VK_FORMAT_R8G8B8A8_SRGB: 43,
VK_FORMAT_B8G8R8A8_UNORM: 44,
VK_FORMAT_B8G8R8A8_SNORM: 45,
VK_FORMAT_B8G8R8A8_USCALED: 46,
VK_FORMAT_B8G8R8A8_SSCALED: 47,
VK_FORMAT_B8G8R8A8_UINT: 48,
VK_FORMAT_B8G8R8A8_SINT: 49,
VK_FORMAT_B8G8R8A8_SRGB: 50,
VK_FORMAT_A8B8G8R8_UNORM_PACK32: 51,
VK_FORMAT_A8B8G8R8_SNORM_PACK32: 52,
VK_FORMAT_A8B8G8R8_USCALED_PACK32: 53,
VK_FORMAT_A8B8G8R8_SSCALED_PACK32: 54,
VK_FORMAT_A8B8G8R8_UINT_PACK32: 55,
VK_FORMAT_A8B8G8R8_SINT_PACK32: 56,
VK_FORMAT_A8B8G8R8_SRGB_PACK32: 57,
VK_FORMAT_A2R10G10B10_UNORM_PACK32: 58,
VK_FORMAT_A2R10G10B10_SNORM_PACK32: 59,
VK_FORMAT_A2R10G10B10_USCALED_PACK32: 60,
VK_FORMAT_A2R10G10B10_SSCALED_PACK32: 61,
VK_FORMAT_A2R10G10B10_UINT_PACK32: 62,
VK_FORMAT_A2R10G10B10_SINT_PACK32: 63,
VK_FORMAT_A2B10G10R10_UNORM_PACK32: 64,
VK_FORMAT_A2B10G10R10_SNORM_PACK32: 65,
VK_FORMAT_A2B10G10R10_USCALED_PACK32: 66,
VK_FORMAT_A2B10G10R10_SSCALED_PACK32: 67,
VK_FORMAT_A2B10G10R10_UINT_PACK32: 68,
VK_FORMAT_A2B10G10R10_SINT_PACK32: 69,
VK_FORMAT_R16_UNORM: 70,
VK_FORMAT_R16_SNORM: 71,
VK_FORMAT_R16_USCALED: 72,
VK_FORMAT_R16_SSCALED: 73,
VK_FORMAT_R16_UINT: 74,
VK_FORMAT_R16_SINT: 75,
VK_FORMAT_R16_SFLOAT: 76,
VK_FORMAT_R16G16_UNORM: 77,
VK_FORMAT_R16G16_SNORM: 78,
VK_FORMAT_R16G16_USCALED: 79,
VK_FORMAT_R16G16_SSCALED: 80,
VK_FORMAT_R16G16_UINT: 81,
VK_FORMAT_R16G16_SINT: 82,
VK_FORMAT_R16G16_SFLOAT: 83,
VK_FORMAT_R16G16B16_UNORM: 84,
VK_FORMAT_R16G16B16_SNORM: 85,
VK_FORMAT_R16G16B16_USCALED: 86,
VK_FORMAT_R16G16B16_SSCALED: 87,
VK_FORMAT_R16G16B16_UINT: 88,
VK_FORMAT_R16G16B16_SINT: 89,
VK_FORMAT_R16G16B16_SFLOAT: 90,
VK_FORMAT_R16G16B16A16_UNORM: 91,
VK_FORMAT_R16G16B16A16_SNORM: 92,
VK_FORMAT_R16G16B16A16_USCALED: 93,
VK_FORMAT_R16G16B16A16_SSCALED: 94,
VK_FORMAT_R16G16B16A16_UINT: 95,
VK_FORMAT_R16G16B16A16_SINT: 96,
VK_FORMAT_R16G16B16A16_SFLOAT: 97,
VK_FORMAT_R32_UINT: 98,
VK_FORMAT_R32_SINT: 99,
VK_FORMAT_R32_SFLOAT: 100,
VK_FORMAT_R32G32_UINT: 101,
VK_FORMAT_R32G32_SINT: 102,
VK_FORMAT_R32G32_SFLOAT: 103,
VK_FORMAT_R32G32B32_UINT: 104,
VK_FORMAT_R32G32B32_SINT: 105,
VK_FORMAT_R32G32B32_SFLOAT: 106,
VK_FORMAT_R32G32B32A32_UINT: 107,
VK_FORMAT_R32G32B32A32_SINT: 108,
VK_FORMAT_R32G32B32A32_SFLOAT: 109,
VK_FORMAT_R64_UINT: 110,
VK_FORMAT_R64_SINT: 111,
VK_FORMAT_R64_SFLOAT: 112,
VK_FORMAT_R64G64_UINT: 113,
VK_FORMAT_R64G64_SINT: 114,
VK_FORMAT_R64G64_SFLOAT: 115,
VK_FORMAT_R64G64B64_UINT: 116,
VK_FORMAT_R64G64B64_SINT: 117,
VK_FORMAT_R64G64B64_SFLOAT: 118,
VK_FORMAT_R64G64B64A64_UINT: 119,
VK_FORMAT_R64G64B64A64_SINT: 120,
VK_FORMAT_R64G64B64A64_SFLOAT: 121,
VK_FORMAT_B10G11R11_UFLOAT_PACK32: 122,
VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: 123,
VK_FORMAT_D16_UNORM: 124,
VK_FORMAT_X8_D24_UNORM_PACK32: 125,
VK_FORMAT_D32_SFLOAT: 126,
VK_FORMAT_S8_UINT: 127,
VK_FORMAT_D16_UNORM_S8_UINT: 128,
VK_FORMAT_D24_UNORM_S8_UINT: 129,
VK_FORMAT_D32_SFLOAT_S8_UINT: 130,
VK_FORMAT_BC1_RGB_UNORM_BLOCK: 131,
VK_FORMAT_BC1_RGB_SRGB_BLOCK: 132,
VK_FORMAT_BC1_RGBA_UNORM_BLOCK: 133,
VK_FORMAT_BC1_RGBA_SRGB_BLOCK: 134,
VK_FORMAT_BC2_UNORM_BLOCK: 135,
VK_FORMAT_BC2_SRGB_BLOCK: 136,
VK_FORMAT_BC3_UNORM_BLOCK: 137,
VK_FORMAT_BC3_SRGB_BLOCK: 138,
VK_FORMAT_BC4_UNORM_BLOCK: 139,
VK_FORMAT_BC4_SNORM_BLOCK: 140,
VK_FORMAT_BC5_UNORM_BLOCK: 141,
VK_FORMAT_BC5_SNORM_BLOCK: 142,
VK_FORMAT_BC6H_UFLOAT_BLOCK: 143,
VK_FORMAT_BC6H_SFLOAT_BLOCK: 144,
VK_FORMAT_BC7_UNORM_BLOCK: 145,
VK_FORMAT_BC7_SRGB_BLOCK: 146,
VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK: 147,
VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK: 148,
VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK: 149,
VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK: 150,
VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK: 151,
VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK: 152,
VK_FORMAT_EAC_R11_UNORM_BLOCK: 153,
VK_FORMAT_EAC_R11_SNORM_BLOCK: 154,
VK_FORMAT_EAC_R11G11_UNORM_BLOCK: 155,
VK_FORMAT_EAC_R11G11_SNORM_BLOCK: 156,
VK_FORMAT_ASTC_4x4_UNORM_BLOCK: 157,
VK_FORMAT_ASTC_4x4_SRGB_BLOCK: 158,
VK_FORMAT_ASTC_5x4_UNORM_BLOCK: 159,
VK_FORMAT_ASTC_5x4_SRGB_BLOCK: 160,
VK_FORMAT_ASTC_5x5_UNORM_BLOCK: 161,
VK_FORMAT_ASTC_5x5_SRGB_BLOCK: 162,
VK_FORMAT_ASTC_6x5_UNORM_BLOCK: 163,
VK_FORMAT_ASTC_6x5_SRGB_BLOCK: 164,
VK_FORMAT_ASTC_6x6_UNORM_BLOCK: 165,
VK_FORMAT_ASTC_6x6_SRGB_BLOCK: 166,
VK_FORMAT_ASTC_8x5_UNORM_BLOCK: 167,
VK_FORMAT_ASTC_8x5_SRGB_BLOCK: 168,
VK_FORMAT_ASTC_8x6_UNORM_BLOCK: 169,
VK_FORMAT_ASTC_8x6_SRGB_BLOCK: 170,
VK_FORMAT_ASTC_8x8_UNORM_BLOCK: 171,
VK_FORMAT_ASTC_8x8_SRGB_BLOCK: 172,
VK_FORMAT_ASTC_10x5_UNORM_BLOCK: 173,
VK_FORMAT_ASTC_10x5_SRGB_BLOCK: 174,
VK_FORMAT_ASTC_10x6_UNORM_BLOCK: 175,
VK_FORMAT_ASTC_10x6_SRGB_BLOCK: 176,
VK_FORMAT_ASTC_10x8_UNORM_BLOCK: 177,
VK_FORMAT_ASTC_10x8_SRGB_BLOCK: 178,
VK_FORMAT_ASTC_10x10_UNORM_BLOCK: 179,
VK_FORMAT_ASTC_10x10_SRGB_BLOCK: 180,
VK_FORMAT_ASTC_12x10_UNORM_BLOCK: 181,
VK_FORMAT_ASTC_12x10_SRGB_BLOCK: 182,
VK_FORMAT_ASTC_12x12_UNORM_BLOCK: 183,
VK_FORMAT_ASTC_12x12_SRGB_BLOCK: 184,
VK_FORMAT_G8B8G8R8_422_UNORM: 1000156000,
VK_FORMAT_B8G8R8G8_422_UNORM: 1000156001,
VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM: 1000156002,
VK_FORMAT_G8_B8R8_2PLANE_420_UNORM: 1000156003,
VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM: 1000156004,
VK_FORMAT_G8_B8R8_2PLANE_422_UNORM: 1000156005,
VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM: 1000156006,
VK_FORMAT_R10X6_UNORM_PACK16: 1000156007,
VK_FORMAT_R10X6G10X6_UNORM_2PACK16: 1000156008,
VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16: 1000156009,
VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16: 1000156010,
VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16: 1000156011,
VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16: 1000156012,
VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16: 1000156013,
VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16: 1000156014,
VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16: 1000156015,
VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16: 1000156016,
VK_FORMAT_R12X4_UNORM_PACK16: 1000156017,
VK_FORMAT_R12X4G12X4_UNORM_2PACK16: 1000156018,
VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16: 1000156019,
VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16: 1000156020,
VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16: 1000156021,
VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16: 1000156022,
VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16: 1000156023,
VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16: 1000156024,
VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16: 1000156025,
VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16: 1000156026,
VK_FORMAT_G16B16G16R16_422_UNORM: 1000156027,
VK_FORMAT_B16G16R16G16_422_UNORM: 1000156028,
VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM: 1000156029,
VK_FORMAT_G16_B16R16_2PLANE_420_UNORM: 1000156030,
VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM: 1000156031,
VK_FORMAT_G16_B16R16_2PLANE_422_UNORM: 1000156032,
VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM: 1000156033,
VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG: 1000054000,
VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG: 1000054001,
VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG: 1000054002,
VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG: 1000054003,
VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG: 1000054004,
VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG: 1000054005,
VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG: 1000054006,
VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG: 1000054007,
VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT: 1000066000,
VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT: 1000066001,
VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT: 1000066002,
VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT: 1000066003,
VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT: 1000066004,
VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT: 1000066005,
VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT: 1000066006,
VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT: 1000066007,
VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT: 1000066008,
VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT: 1000066009,
VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT: 1000066010,
VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT: 1000066011,
VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT: 1000066012,
VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT: 1000066013,
VK_FORMAT_G8B8G8R8_422_UNORM_KHR: 1000156000,
VK_FORMAT_B8G8R8G8_422_UNORM_KHR: 1000156001,
VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR: 1000156002,
VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR: 1000156003,
VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR: 1000156004,
VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR: 1000156005,
VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR: 1000156006,
VK_FORMAT_R10X6_UNORM_PACK16_KHR: 1000156007,
VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR: 1000156008,
VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR: 1000156009,
VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR: 1000156010,
VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR: 1000156011,
VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR: 1000156012,
VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR: 1000156013,
VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR: 1000156014,
VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR: 1000156015,
VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR: 1000156016,
VK_FORMAT_R12X4_UNORM_PACK16_KHR: 1000156017,
VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR: 1000156018,
VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR: 1000156019,
VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR: 1000156020,
VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR: 1000156021,
VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR: 1000156022,
VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR: 1000156023,
VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR: 1000156024,
VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR: 1000156025,
VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR: 1000156026,
VK_FORMAT_G16B16G16R16_422_UNORM_KHR: 1000156027,
VK_FORMAT_B16G16R16G16_422_UNORM_KHR: 1000156028,
VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR: 1000156029,
VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR: 1000156030,
VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR: 1000156031,
VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR: 1000156032,
VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR: 1000156033,
};
export default Object.freeze(VulkanConstants);
34 changes: 34 additions & 0 deletions Source/Core/getUint64FromDataView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Javascript does not support Uint64, so reading a Uint64 value is not implemented as
* a method for DataViews. UInt64 values can be read up to Number.MAX_SAFE_INTEGER, or (2^53) - 1,
* which is also 9007199254740991.
*
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView
* for more information.
*
* @function
* @param {DataView} view DataView from which a Uint64 needs to be read.
* @param {Number} byteOffset Byte offset into the DataView at which to read the Uint64.
* @param {Boolean} littleEndian Whether the DataView is big or little endian.
*
* @returns {Number} The uint64 result.
*/
function getUint64FromDataView(view, byteOffset, littleEndian) {
// split 64-bit number into two 32-bit parts
var left = view.getUint32(byteOffset, littleEndian);
var right = view.getUint32(byteOffset + 4, littleEndian);

// combine the two 32-bit values
var combined = littleEndian
? left + Math.pow(2, 32) * right
: Math.pow(2, 32) * left + right;

// if (!combined > Number.MAX_SAFE_INTEGER) {
// //9007199254740991) { // MAX_SAFE_INTEGER not available in IE11
// console.warn(combined, "exceeds MAX_SAFE_INTEGER. Precision may be lost");
// }

return combined;
}

export default getUint64FromDataView;
Loading