@babylonjs/core 7.6.0 → 7.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/Animations/animation.js +7 -5
  2. package/Animations/animation.js.map +1 -1
  3. package/Bones/bone.js +1 -1
  4. package/Bones/bone.js.map +1 -1
  5. package/Cameras/camera.js +1 -1
  6. package/Cameras/camera.js.map +1 -1
  7. package/Debug/debugLayer.d.ts +4 -0
  8. package/Debug/debugLayer.js.map +1 -1
  9. package/Engines/Native/nativeInterfaces.d.ts +2 -0
  10. package/Engines/Native/nativeInterfaces.js.map +1 -1
  11. package/Engines/Processors/iShaderProcessor.d.ts +3 -1
  12. package/Engines/Processors/iShaderProcessor.js.map +1 -1
  13. package/Engines/Processors/shaderProcessor.js +2 -2
  14. package/Engines/Processors/shaderProcessor.js.map +1 -1
  15. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +1 -2
  16. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  17. package/Engines/WebGPU/webgpuShaderProcessor.d.ts +0 -1
  18. package/Engines/WebGPU/webgpuShaderProcessor.js +0 -1
  19. package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
  20. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +2 -1
  21. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  22. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +10 -1
  23. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +45 -15
  24. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  25. package/Engines/abstractEngine.js +7 -3
  26. package/Engines/abstractEngine.js.map +1 -1
  27. package/Engines/constants.d.ts +4 -0
  28. package/Engines/constants.js +4 -0
  29. package/Engines/constants.js.map +1 -1
  30. package/Engines/engine.common.js +2 -2
  31. package/Engines/engine.common.js.map +1 -1
  32. package/Engines/engine.js +5 -2
  33. package/Engines/engine.js.map +1 -1
  34. package/Engines/nativeEngine.d.ts +7 -2
  35. package/Engines/nativeEngine.js +25 -3
  36. package/Engines/nativeEngine.js.map +1 -1
  37. package/Engines/webgpuEngine.js +5 -9
  38. package/Engines/webgpuEngine.js.map +1 -1
  39. package/Lights/Shadows/cascadedShadowGenerator.js +4 -4
  40. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  41. package/Lights/Shadows/shadowGenerator.js +11 -5
  42. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  43. package/Lights/light.js +1 -1
  44. package/Lights/light.js.map +1 -1
  45. package/Lights/spotLight.js +1 -1
  46. package/Lights/spotLight.js.map +1 -1
  47. package/Materials/Node/Blocks/Dual/fogBlock.js +20 -3
  48. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  49. package/Materials/Node/Blocks/Dual/imageSourceBlock.d.ts +1 -1
  50. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +10 -4
  51. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  52. package/Materials/Node/Blocks/Dual/lightBlock.d.ts +1 -0
  53. package/Materials/Node/Blocks/Dual/lightBlock.js +35 -27
  54. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  55. package/Materials/Node/Blocks/Dual/textureBlock.d.ts +1 -2
  56. package/Materials/Node/Blocks/Dual/textureBlock.js +13 -20
  57. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  58. package/Materials/Node/Blocks/Fragment/discardBlock.js +1 -1
  59. package/Materials/Node/Blocks/Fragment/discardBlock.js.map +1 -1
  60. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +3 -1
  61. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
  62. package/Materials/Node/Blocks/Fragment/fragDepthBlock.js +6 -4
  63. package/Materials/Node/Blocks/Fragment/fragDepthBlock.js.map +1 -1
  64. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js +4 -1
  65. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
  66. package/Materials/Node/Blocks/Input/inputBlock.js +1 -1
  67. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  68. package/Materials/Node/Blocks/Vertex/instancesBlock.js +11 -2
  69. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  70. package/Materials/Node/Blocks/biPlanarBlock.d.ts +2 -0
  71. package/Materials/Node/Blocks/biPlanarBlock.js +48 -23
  72. package/Materials/Node/Blocks/biPlanarBlock.js.map +1 -1
  73. package/Materials/Node/Blocks/clampBlock.js +4 -1
  74. package/Materials/Node/Blocks/clampBlock.js.map +1 -1
  75. package/Materials/Node/Blocks/cloudBlock.js +32 -17
  76. package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
  77. package/Materials/Node/Blocks/conditionalBlock.js +9 -9
  78. package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
  79. package/Materials/Node/Blocks/curveBlock.js +12 -12
  80. package/Materials/Node/Blocks/curveBlock.js.map +1 -1
  81. package/Materials/Node/Blocks/matrixBuilderBlock.js +3 -1
  82. package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
  83. package/Materials/Node/Blocks/matrixTransposeBlock.js +1 -1
  84. package/Materials/Node/Blocks/matrixTransposeBlock.js.map +1 -1
  85. package/Materials/Node/Blocks/normalBlendBlock.js +2 -2
  86. package/Materials/Node/Blocks/normalBlendBlock.js.map +1 -1
  87. package/Materials/Node/Blocks/simplexPerlin3DBlock.js +14 -6
  88. package/Materials/Node/Blocks/simplexPerlin3DBlock.js.map +1 -1
  89. package/Materials/Node/Blocks/transformBlock.js +1 -1
  90. package/Materials/Node/Blocks/transformBlock.js.map +1 -1
  91. package/Materials/Node/Blocks/triPlanarBlock.d.ts +2 -0
  92. package/Materials/Node/Blocks/triPlanarBlock.js +33 -14
  93. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  94. package/Materials/Node/Blocks/trigonometryBlock.d.ts +3 -1
  95. package/Materials/Node/Blocks/trigonometryBlock.js +6 -0
  96. package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
  97. package/Materials/Node/Blocks/worleyNoise3DBlock.js +17 -8
  98. package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
  99. package/Materials/Node/nodeMaterial.d.ts +8 -3
  100. package/Materials/Node/nodeMaterial.js +15 -24
  101. package/Materials/Node/nodeMaterial.js.map +1 -1
  102. package/Materials/Node/nodeMaterialBlock.d.ts +1 -1
  103. package/Materials/Node/nodeMaterialBlock.js +1 -1
  104. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  105. package/Materials/Node/nodeMaterialBuildState.d.ts +10 -5
  106. package/Materials/Node/nodeMaterialBuildState.js +45 -18
  107. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  108. package/Materials/materialHelper.functions.js +3 -3
  109. package/Materials/materialHelper.functions.js.map +1 -1
  110. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +8 -2
  111. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  112. package/Meshes/mesh.js +7 -7
  113. package/Meshes/mesh.js.map +1 -1
  114. package/Meshes/transformNode.js +1 -1
  115. package/Meshes/transformNode.js.map +1 -1
  116. package/Physics/v2/Plugins/havokPlugin.js +12 -4
  117. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  118. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +3 -0
  119. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  120. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +7 -0
  121. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +18 -0
  122. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  123. package/Rendering/prePassRenderer.js +3 -0
  124. package/Rendering/prePassRenderer.js.map +1 -1
  125. package/Shaders/ShadersInclude/lightFragment.js +29 -29
  126. package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
  127. package/Shaders/ShadersInclude/lightFragmentDeclaration.js +8 -8
  128. package/Shaders/ShadersInclude/lightFragmentDeclaration.js.map +1 -1
  129. package/Shaders/ShadersInclude/lightUboDeclaration.js +8 -8
  130. package/Shaders/ShadersInclude/lightUboDeclaration.js.map +1 -1
  131. package/Shaders/ShadersInclude/shadowsFragmentFunctions.js +1 -1
  132. package/Shaders/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
  133. package/Shaders/fluidRenderingRender.fragment.js +12 -3
  134. package/Shaders/fluidRenderingRender.fragment.js.map +1 -1
  135. package/Shaders/gaussianSplatting.vertex.js +2 -2
  136. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  137. package/Shaders/sprites.fragment.d.ts +2 -0
  138. package/Shaders/sprites.fragment.js +8 -1
  139. package/Shaders/sprites.fragment.js.map +1 -1
  140. package/Shaders/sprites.vertex.d.ts +2 -0
  141. package/Shaders/sprites.vertex.js +4 -0
  142. package/Shaders/sprites.vertex.js.map +1 -1
  143. package/ShadersWGSL/ShadersInclude/fogFragmentDeclaration.d.ts +5 -0
  144. package/ShadersWGSL/ShadersInclude/fogFragmentDeclaration.js +24 -0
  145. package/ShadersWGSL/ShadersInclude/fogFragmentDeclaration.js.map +1 -0
  146. package/ShadersWGSL/ShadersInclude/lightFragment.d.ts +5 -0
  147. package/ShadersWGSL/ShadersInclude/lightFragment.js +279 -0
  148. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -0
  149. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.d.ts +5 -0
  150. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +70 -0
  151. package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -0
  152. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.d.ts +5 -0
  153. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js +33 -0
  154. package/ShadersWGSL/ShadersInclude/lightVxUboDeclaration.js.map +1 -0
  155. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.d.ts +5 -0
  156. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +57 -0
  157. package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -0
  158. package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js +1 -1
  159. package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js.map +1 -1
  160. package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.d.ts +5 -0
  161. package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js +307 -0
  162. package/ShadersWGSL/ShadersInclude/shadowsFragmentFunctions.js.map +1 -0
  163. package/ShadersWGSL/ShadersInclude/shadowsVertex.d.ts +5 -0
  164. package/ShadersWGSL/ShadersInclude/shadowsVertex.js +53 -0
  165. package/ShadersWGSL/ShadersInclude/shadowsVertex.js.map +1 -0
  166. package/Sprites/spriteManager.d.ts +3 -0
  167. package/Sprites/spriteManager.js +11 -0
  168. package/Sprites/spriteManager.js.map +1 -1
  169. package/Sprites/spriteRenderer.d.ts +11 -3
  170. package/Sprites/spriteRenderer.js +49 -32
  171. package/Sprites/spriteRenderer.js.map +1 -1
  172. package/node.d.ts +2 -1
  173. package/node.js +5 -1
  174. package/node.js.map +1 -1
  175. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"nativeInterfaces.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Native/nativeInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { DeviceType } from \"../../DeviceInput/InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"../../DeviceInput/inputInterfaces\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ICanvas, IImage } from \"../ICanvas\";\r\nimport type { NativeData, NativeDataStream } from \"./nativeDataStream\";\r\n\r\nexport type NativeTexture = NativeData;\r\nexport type NativeFramebuffer = NativeData;\r\nexport type NativeVertexArrayObject = NativeData;\r\nexport type NativeProgram = NativeData;\r\nexport type NativeUniform = NativeData;\r\n\r\n/** @internal */\r\nexport interface INativeEngine {\r\n dispose(): void;\r\n\r\n requestAnimationFrame(callback: () => void): void;\r\n setDeviceLostCallback(callback: () => void): void;\r\n\r\n createVertexArray(): NativeData;\r\n\r\n createIndexBuffer(dataBuffer: ArrayBuffer, dataByteOffset: number, dataByteLength: number, is32Bits: boolean, dynamic: boolean): NativeData;\r\n recordIndexBuffer(vertexArray: NativeData, indexBuffer: NativeData): void;\r\n updateDynamicIndexBuffer(indexBuffer: NativeData, data: ArrayBuffer, dataByteOffset: number, dataByteLength: number, startIndex: number): void;\r\n\r\n createVertexBuffer(dataBuffer: ArrayBuffer, dataByteOffset: number, dataByteLength: number, dynamic: boolean): NativeData;\r\n recordVertexBuffer(\r\n vertexArray: NativeData,\r\n vertexBuffer: NativeData,\r\n location: number,\r\n byteOffset: number,\r\n byteStride: number,\r\n numElements: number,\r\n type: number,\r\n normalized: boolean,\r\n instanceDivisor: number\r\n ): void;\r\n updateDynamicVertexBuffer(vertexBuffer: NativeData, dataBuffer: ArrayBuffer, dataByteOffset: number, dataByteLength: number, vertexByteOffset?: number): void;\r\n\r\n createProgram(vertexShader: string, fragmentShader: string): NativeProgram;\r\n createProgramAsync(vertexShader: string, fragmentShader: string, onSuccess: () => void, onError: (error: Error) => void): NativeProgram;\r\n getUniforms(shaderProgram: NativeProgram, uniformsNames: string[]): WebGLUniformLocation[];\r\n getAttributes(shaderProgram: NativeProgram, attributeNames: string[]): number[];\r\n\r\n createTexture(): NativeTexture;\r\n initializeTexture(texture: NativeTexture, width: number, height: number, hasMips: boolean, format: number, renderTarget: boolean, srgb: boolean, samples: number): void;\r\n loadTexture(texture: NativeTexture, data: ArrayBufferView, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadRawTexture(texture: NativeTexture, data: ArrayBufferView, width: number, height: number, format: number, generateMips: boolean, invertY: boolean): void;\r\n loadRawTexture2DArray(\r\n texture: NativeTexture,\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean\r\n ): void;\r\n loadCubeTexture(texture: NativeTexture, data: Array<ArrayBufferView>, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadCubeTextureWithMips(texture: NativeTexture, data: Array<Array<ArrayBufferView>>, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n getTextureWidth(texture: NativeTexture): number;\r\n getTextureHeight(texture: NativeTexture): number;\r\n copyTexture(desination: NativeTexture, source: NativeTexture): void;\r\n deleteTexture(texture: NativeTexture): void;\r\n readTexture(\r\n texture: NativeTexture,\r\n mipLevel: number,\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n buffer: Nullable<ArrayBuffer>,\r\n bufferOffset: number,\r\n bufferLength: number\r\n ): Promise<ArrayBuffer>;\r\n\r\n createImageBitmap(data: ArrayBufferView | IImage): ImageBitmap;\r\n resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;\r\n\r\n createFrameBuffer(\r\n texture: Nullable<NativeTexture>,\r\n width: number,\r\n height: number,\r\n generateStencilBuffer: boolean,\r\n generateDepthBuffer: boolean,\r\n samples: number\r\n ): NativeFramebuffer;\r\n\r\n getRenderWidth(): number;\r\n getRenderHeight(): number;\r\n\r\n setHardwareScalingLevel(level: number): void;\r\n\r\n setViewPort(x: number, y: number, width: number, height: number): void;\r\n\r\n setCommandDataStream(dataStream: NativeDataStream): void;\r\n submitCommands(): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeEngineConstructor {\r\n prototype: INativeEngine;\r\n new (): INativeEngine;\r\n\r\n readonly PROTOCOL_VERSION: number;\r\n\r\n readonly CAPS_LIMITS_MAX_TEXTURE_SIZE: number;\r\n readonly CAPS_LIMITS_MAX_TEXTURE_LAYERS: number;\r\n\r\n readonly TEXTURE_NEAREST_NEAREST: number;\r\n readonly TEXTURE_LINEAR_LINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_LINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST: number;\r\n\r\n readonly DEPTH_TEST_LESS: number;\r\n readonly DEPTH_TEST_LEQUAL: number;\r\n readonly DEPTH_TEST_EQUAL: number;\r\n readonly DEPTH_TEST_GEQUAL: number;\r\n readonly DEPTH_TEST_GREATER: number;\r\n readonly DEPTH_TEST_NOTEQUAL: number;\r\n readonly DEPTH_TEST_NEVER: number;\r\n readonly DEPTH_TEST_ALWAYS: number;\r\n\r\n readonly ADDRESS_MODE_WRAP: number;\r\n readonly ADDRESS_MODE_MIRROR: number;\r\n readonly ADDRESS_MODE_CLAMP: number;\r\n readonly ADDRESS_MODE_BORDER: number;\r\n readonly ADDRESS_MODE_MIRROR_ONCE: number;\r\n\r\n readonly TEXTURE_FORMAT_BC1: number;\r\n readonly TEXTURE_FORMAT_BC2: number;\r\n readonly TEXTURE_FORMAT_BC3: number;\r\n readonly TEXTURE_FORMAT_BC4: number;\r\n readonly TEXTURE_FORMAT_BC5: number;\r\n readonly TEXTURE_FORMAT_BC6H: number;\r\n readonly TEXTURE_FORMAT_BC7: number;\r\n readonly TEXTURE_FORMAT_ETC1: number;\r\n readonly TEXTURE_FORMAT_ETC2: number;\r\n readonly TEXTURE_FORMAT_ETC2A: number;\r\n readonly TEXTURE_FORMAT_ETC2A1: number;\r\n readonly TEXTURE_FORMAT_PTC12: number;\r\n readonly TEXTURE_FORMAT_PTC14: number;\r\n readonly TEXTURE_FORMAT_PTC12A: number;\r\n readonly TEXTURE_FORMAT_PTC14A: number;\r\n readonly TEXTURE_FORMAT_PTC22: number;\r\n readonly TEXTURE_FORMAT_PTC24: number;\r\n readonly TEXTURE_FORMAT_ATC: number;\r\n readonly TEXTURE_FORMAT_ATCE: number;\r\n readonly TEXTURE_FORMAT_ATCI: number;\r\n readonly TEXTURE_FORMAT_ASTC4x4: number;\r\n readonly TEXTURE_FORMAT_ASTC5x4: number;\r\n readonly TEXTURE_FORMAT_ASTC5x5: number;\r\n readonly TEXTURE_FORMAT_ASTC6x5: number;\r\n readonly TEXTURE_FORMAT_ASTC6x6: number;\r\n readonly TEXTURE_FORMAT_ASTC8x5: number;\r\n readonly TEXTURE_FORMAT_ASTC8x6: number;\r\n readonly TEXTURE_FORMAT_ASTC8x8: number;\r\n readonly TEXTURE_FORMAT_ASTC10x5: number;\r\n readonly TEXTURE_FORMAT_ASTC10x6: number;\r\n readonly TEXTURE_FORMAT_ASTC10x8: number;\r\n readonly TEXTURE_FORMAT_ASTC10x10: number;\r\n readonly TEXTURE_FORMAT_ASTC12x10: number;\r\n readonly TEXTURE_FORMAT_ASTC12x12: number;\r\n\r\n readonly TEXTURE_FORMAT_R1: number;\r\n readonly TEXTURE_FORMAT_A8: number;\r\n readonly TEXTURE_FORMAT_R8: number;\r\n readonly TEXTURE_FORMAT_R8I: number;\r\n readonly TEXTURE_FORMAT_R8U: number;\r\n readonly TEXTURE_FORMAT_R8S: number;\r\n readonly TEXTURE_FORMAT_R16: number;\r\n readonly TEXTURE_FORMAT_R16I: number;\r\n readonly TEXTURE_FORMAT_R16U: number;\r\n readonly TEXTURE_FORMAT_R16F: number;\r\n readonly TEXTURE_FORMAT_R16S: number;\r\n readonly TEXTURE_FORMAT_R32I: number;\r\n readonly TEXTURE_FORMAT_R32U: number;\r\n readonly TEXTURE_FORMAT_R32F: number;\r\n readonly TEXTURE_FORMAT_RG8: number;\r\n readonly TEXTURE_FORMAT_RG8I: number;\r\n readonly TEXTURE_FORMAT_RG8U: number;\r\n readonly TEXTURE_FORMAT_RG8S: number;\r\n readonly TEXTURE_FORMAT_RG16: number;\r\n readonly TEXTURE_FORMAT_RG16I: number;\r\n readonly TEXTURE_FORMAT_RG16U: number;\r\n readonly TEXTURE_FORMAT_RG16F: number;\r\n readonly TEXTURE_FORMAT_RG16S: number;\r\n readonly TEXTURE_FORMAT_RG32I: number;\r\n readonly TEXTURE_FORMAT_RG32U: number;\r\n readonly TEXTURE_FORMAT_RG32F: number;\r\n readonly TEXTURE_FORMAT_RGB8: number;\r\n readonly TEXTURE_FORMAT_RGB8I: number;\r\n readonly TEXTURE_FORMAT_RGB8U: number;\r\n readonly TEXTURE_FORMAT_RGB8S: number;\r\n readonly TEXTURE_FORMAT_RGB9E5F: number;\r\n readonly TEXTURE_FORMAT_BGRA8: number;\r\n readonly TEXTURE_FORMAT_RGBA8: number;\r\n readonly TEXTURE_FORMAT_RGBA8I: number;\r\n readonly TEXTURE_FORMAT_RGBA8U: number;\r\n readonly TEXTURE_FORMAT_RGBA8S: number;\r\n readonly TEXTURE_FORMAT_RGBA16: number;\r\n readonly TEXTURE_FORMAT_RGBA16I: number;\r\n readonly TEXTURE_FORMAT_RGBA16U: number;\r\n readonly TEXTURE_FORMAT_RGBA16F: number;\r\n readonly TEXTURE_FORMAT_RGBA16S: number;\r\n readonly TEXTURE_FORMAT_RGBA32I: number;\r\n readonly TEXTURE_FORMAT_RGBA32U: number;\r\n readonly TEXTURE_FORMAT_RGBA32F: number;\r\n readonly TEXTURE_FORMAT_B5G6R5: number;\r\n readonly TEXTURE_FORMAT_R5G6B5: number;\r\n readonly TEXTURE_FORMAT_BGRA4: number;\r\n readonly TEXTURE_FORMAT_RGBA4: number;\r\n readonly TEXTURE_FORMAT_BGR5A1: number;\r\n readonly TEXTURE_FORMAT_RGB5A1: number;\r\n readonly TEXTURE_FORMAT_RGB10A2: number;\r\n readonly TEXTURE_FORMAT_RG11B10F: number;\r\n\r\n readonly TEXTURE_FORMAT_D16: number;\r\n readonly TEXTURE_FORMAT_D24: number;\r\n readonly TEXTURE_FORMAT_D24S8: number;\r\n readonly TEXTURE_FORMAT_D32: number;\r\n readonly TEXTURE_FORMAT_D16F: number;\r\n readonly TEXTURE_FORMAT_D24F: number;\r\n readonly TEXTURE_FORMAT_D32F: number;\r\n readonly TEXTURE_FORMAT_D0S8: number;\r\n\r\n readonly ATTRIB_TYPE_INT8: number;\r\n readonly ATTRIB_TYPE_UINT8: number;\r\n readonly ATTRIB_TYPE_INT16: number;\r\n readonly ATTRIB_TYPE_UINT16: number;\r\n readonly ATTRIB_TYPE_FLOAT: number;\r\n\r\n readonly ALPHA_DISABLE: number;\r\n readonly ALPHA_ADD: number;\r\n readonly ALPHA_COMBINE: number;\r\n readonly ALPHA_SUBTRACT: number;\r\n readonly ALPHA_MULTIPLY: number;\r\n readonly ALPHA_MAXIMIZED: number;\r\n readonly ALPHA_ONEONE: number;\r\n readonly ALPHA_PREMULTIPLIED: number;\r\n readonly ALPHA_PREMULTIPLIED_PORTERDUFF: number;\r\n readonly ALPHA_INTERPOLATE: number;\r\n readonly ALPHA_SCREENMODE: number;\r\n\r\n readonly STENCIL_TEST_LESS: number;\r\n readonly STENCIL_TEST_LEQUAL: number;\r\n readonly STENCIL_TEST_EQUAL: number;\r\n readonly STENCIL_TEST_GEQUAL: number;\r\n readonly STENCIL_TEST_GREATER: number;\r\n readonly STENCIL_TEST_NOTEQUAL: number;\r\n readonly STENCIL_TEST_NEVER: number;\r\n readonly STENCIL_TEST_ALWAYS: number;\r\n\r\n readonly STENCIL_OP_FAIL_S_ZERO: number;\r\n readonly STENCIL_OP_FAIL_S_KEEP: number;\r\n readonly STENCIL_OP_FAIL_S_REPLACE: number;\r\n readonly STENCIL_OP_FAIL_S_INCR: number;\r\n readonly STENCIL_OP_FAIL_S_INCRSAT: number;\r\n readonly STENCIL_OP_FAIL_S_DECR: number;\r\n readonly STENCIL_OP_FAIL_S_DECRSAT: number;\r\n readonly STENCIL_OP_FAIL_S_INVERT: number;\r\n\r\n readonly STENCIL_OP_FAIL_Z_ZERO: number;\r\n readonly STENCIL_OP_FAIL_Z_KEEP: number;\r\n readonly STENCIL_OP_FAIL_Z_REPLACE: number;\r\n readonly STENCIL_OP_FAIL_Z_INCR: number;\r\n readonly STENCIL_OP_FAIL_Z_INCRSAT: number;\r\n readonly STENCIL_OP_FAIL_Z_DECR: number;\r\n readonly STENCIL_OP_FAIL_Z_DECRSAT: number;\r\n readonly STENCIL_OP_FAIL_Z_INVERT: number;\r\n\r\n readonly STENCIL_OP_PASS_Z_ZERO: number;\r\n readonly STENCIL_OP_PASS_Z_KEEP: number;\r\n readonly STENCIL_OP_PASS_Z_REPLACE: number;\r\n readonly STENCIL_OP_PASS_Z_INCR: number;\r\n readonly STENCIL_OP_PASS_Z_INCRSAT: number;\r\n readonly STENCIL_OP_PASS_Z_DECR: number;\r\n readonly STENCIL_OP_PASS_Z_DECRSAT: number;\r\n readonly STENCIL_OP_PASS_Z_INVERT: number;\r\n\r\n readonly COMMAND_DELETEVERTEXARRAY: NativeData;\r\n readonly COMMAND_DELETEINDEXBUFFER: NativeData;\r\n readonly COMMAND_DELETEVERTEXBUFFER: NativeData;\r\n readonly COMMAND_SETPROGRAM: NativeData;\r\n readonly COMMAND_SETMATRIX: NativeData;\r\n readonly COMMAND_SETMATRIX3X3: NativeData;\r\n readonly COMMAND_SETMATRIX2X2: NativeData;\r\n readonly COMMAND_SETMATRICES: NativeData;\r\n readonly COMMAND_SETINT: NativeData;\r\n readonly COMMAND_SETINTARRAY: NativeData;\r\n readonly COMMAND_SETINTARRAY2: NativeData;\r\n readonly COMMAND_SETINTARRAY3: NativeData;\r\n readonly COMMAND_SETINTARRAY4: NativeData;\r\n readonly COMMAND_SETFLOATARRAY: NativeData;\r\n readonly COMMAND_SETFLOATARRAY2: NativeData;\r\n readonly COMMAND_SETFLOATARRAY3: NativeData;\r\n readonly COMMAND_SETFLOATARRAY4: NativeData;\r\n readonly COMMAND_SETTEXTURESAMPLING: NativeData;\r\n readonly COMMAND_SETTEXTUREWRAPMODE: NativeData;\r\n readonly COMMAND_SETTEXTUREANISOTROPICLEVEL: NativeData;\r\n readonly COMMAND_SETTEXTURE: NativeData;\r\n readonly COMMAND_BINDVERTEXARRAY: NativeData;\r\n readonly COMMAND_SETSTATE: NativeData;\r\n readonly COMMAND_DELETEPROGRAM: NativeData;\r\n readonly COMMAND_SETZOFFSET: NativeData;\r\n readonly COMMAND_SETZOFFSETUNITS: NativeData;\r\n readonly COMMAND_SETDEPTHTEST: NativeData;\r\n readonly COMMAND_SETDEPTHWRITE: NativeData;\r\n readonly COMMAND_SETCOLORWRITE: NativeData;\r\n readonly COMMAND_SETBLENDMODE: NativeData;\r\n readonly COMMAND_SETFLOAT: NativeData;\r\n readonly COMMAND_SETFLOAT2: NativeData;\r\n readonly COMMAND_SETFLOAT3: NativeData;\r\n readonly COMMAND_SETFLOAT4: NativeData;\r\n readonly COMMAND_BINDFRAMEBUFFER: NativeData;\r\n readonly COMMAND_UNBINDFRAMEBUFFER: NativeData;\r\n readonly COMMAND_DELETEFRAMEBUFFER: NativeData;\r\n readonly COMMAND_DRAWINDEXED: NativeData;\r\n readonly COMMAND_DRAWINDEXEDINSTANCED?: NativeData;\r\n readonly COMMAND_DRAW: NativeData;\r\n readonly COMMAND_DRAWINSTANCED?: NativeData;\r\n readonly COMMAND_CLEAR: NativeData;\r\n readonly COMMAND_SETSTENCIL: NativeData;\r\n readonly COMMAND_SETVIEWPORT: NativeData;\r\n readonly COMMAND_SETSCISSOR: NativeData;\r\n}\r\n\r\n/** @internal */\r\nexport interface INativeCamera {\r\n createVideo(constraints: MediaTrackConstraints): any;\r\n updateVideoTexture(texture: Nullable<InternalTexture>, video: HTMLVideoElement, invertY: boolean): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeCameraConstructor {\r\n prototype: INativeCamera;\r\n new (): INativeCamera;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeCanvasConstructor {\r\n prototype: ICanvas;\r\n new (): ICanvas;\r\n\r\n loadTTFAsync(fontName: string, buffer: ArrayBuffer): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeImageConstructor {\r\n prototype: IImage;\r\n new (): IImage;\r\n}\r\n\r\n/** @internal */\r\ninterface IDeviceInputSystemConstructor {\r\n prototype: IDeviceInputSystem;\r\n new (\r\n onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onInputChanged: (deviceType: DeviceType, deviceSlot: number, inputIndex: number, currentState: number) => void\r\n ): IDeviceInputSystem;\r\n}\r\n\r\n/** @internal */\r\nexport interface INativeDataStream {\r\n writeBuffer(buffer: ArrayBuffer, length: number): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeDataStreamConstructor {\r\n prototype: INativeDataStream;\r\n new (requestFlushCallback: () => void): INativeDataStream;\r\n\r\n readonly VALIDATION_ENABLED: boolean;\r\n readonly VALIDATION_UINT_32: number;\r\n readonly VALIDATION_INT_32: number;\r\n readonly VALIDATION_FLOAT_32: number;\r\n readonly VALIDATION_UINT_32_ARRAY: number;\r\n readonly VALIDATION_INT_32_ARRAY: number;\r\n readonly VALIDATION_FLOAT_32_ARRAY: number;\r\n readonly VALIDATION_NATIVE_DATA: number;\r\n readonly VALIDATION_BOOLEAN: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface INative {\r\n Engine: INativeEngineConstructor;\r\n Camera: INativeCameraConstructor;\r\n Canvas: INativeCanvasConstructor;\r\n Image: INativeImageConstructor;\r\n XMLHttpRequest: any; // TODO: how to do this?\r\n DeviceInputSystem: IDeviceInputSystemConstructor;\r\n NativeDataStream: INativeDataStreamConstructor;\r\n}\r\n"]}
1
+ {"version":3,"file":"nativeInterfaces.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Native/nativeInterfaces.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { DeviceType } from \"../../DeviceInput/InputDevices/deviceEnums\";\r\nimport type { IDeviceInputSystem } from \"../../DeviceInput/inputInterfaces\";\r\nimport type { InternalTexture } from \"../../Materials/Textures/internalTexture\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ICanvas, IImage } from \"../ICanvas\";\r\nimport type { NativeData, NativeDataStream } from \"./nativeDataStream\";\r\n\r\nexport type NativeTexture = NativeData;\r\nexport type NativeFramebuffer = NativeData;\r\nexport type NativeVertexArrayObject = NativeData;\r\nexport type NativeProgram = NativeData;\r\nexport type NativeUniform = NativeData;\r\n\r\n/** @internal */\r\nexport interface INativeEngine {\r\n dispose(): void;\r\n\r\n requestAnimationFrame(callback: () => void): void;\r\n setDeviceLostCallback(callback: () => void): void;\r\n\r\n createVertexArray(): NativeData;\r\n\r\n createIndexBuffer(dataBuffer: ArrayBuffer, dataByteOffset: number, dataByteLength: number, is32Bits: boolean, dynamic: boolean): NativeData;\r\n recordIndexBuffer(vertexArray: NativeData, indexBuffer: NativeData): void;\r\n updateDynamicIndexBuffer(indexBuffer: NativeData, data: ArrayBuffer, dataByteOffset: number, dataByteLength: number, startIndex: number): void;\r\n\r\n createVertexBuffer(dataBuffer: ArrayBuffer, dataByteOffset: number, dataByteLength: number, dynamic: boolean): NativeData;\r\n recordVertexBuffer(\r\n vertexArray: NativeData,\r\n vertexBuffer: NativeData,\r\n location: number,\r\n byteOffset: number,\r\n byteStride: number,\r\n numElements: number,\r\n type: number,\r\n normalized: boolean,\r\n instanceDivisor: number\r\n ): void;\r\n updateDynamicVertexBuffer(vertexBuffer: NativeData, dataBuffer: ArrayBuffer, dataByteOffset: number, dataByteLength: number, vertexByteOffset?: number): void;\r\n\r\n createProgram(vertexShader: string, fragmentShader: string): NativeProgram;\r\n createProgramAsync(vertexShader: string, fragmentShader: string, onSuccess: () => void, onError: (error: Error) => void): NativeProgram;\r\n getUniforms(shaderProgram: NativeProgram, uniformsNames: string[]): WebGLUniformLocation[];\r\n getAttributes(shaderProgram: NativeProgram, attributeNames: string[]): number[];\r\n\r\n createTexture(): NativeTexture;\r\n initializeTexture(texture: NativeTexture, width: number, height: number, hasMips: boolean, format: number, renderTarget: boolean, srgb: boolean, samples: number): void;\r\n loadTexture(texture: NativeTexture, data: ArrayBufferView, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadRawTexture(texture: NativeTexture, data: ArrayBufferView, width: number, height: number, format: number, generateMips: boolean, invertY: boolean): void;\r\n loadRawTexture2DArray(\r\n texture: NativeTexture,\r\n data: Nullable<ArrayBufferView>,\r\n width: number,\r\n height: number,\r\n depth: number,\r\n format: number,\r\n generateMipMaps: boolean,\r\n invertY: boolean\r\n ): void;\r\n loadCubeTexture(texture: NativeTexture, data: Array<ArrayBufferView>, generateMips: boolean, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n loadCubeTextureWithMips(texture: NativeTexture, data: Array<Array<ArrayBufferView>>, invertY: boolean, srgb: boolean, onSuccess: () => void, onError: () => void): void;\r\n getTextureWidth(texture: NativeTexture): number;\r\n getTextureHeight(texture: NativeTexture): number;\r\n copyTexture(desination: NativeTexture, source: NativeTexture): void;\r\n deleteTexture(texture: NativeTexture): void;\r\n readTexture(\r\n texture: NativeTexture,\r\n mipLevel: number,\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n buffer: Nullable<ArrayBuffer>,\r\n bufferOffset: number,\r\n bufferLength: number\r\n ): Promise<ArrayBuffer>;\r\n\r\n createImageBitmap(data: ArrayBufferView | IImage): ImageBitmap;\r\n resizeImageBitmap(image: ImageBitmap, bufferWidth: number, bufferHeight: number): Uint8Array;\r\n\r\n createFrameBuffer(\r\n texture: Nullable<NativeTexture>,\r\n width: number,\r\n height: number,\r\n generateStencilBuffer: boolean,\r\n generateDepthBuffer: boolean,\r\n samples: number\r\n ): NativeFramebuffer;\r\n\r\n getRenderWidth(): number;\r\n getRenderHeight(): number;\r\n\r\n setHardwareScalingLevel(level: number): void;\r\n\r\n setViewPort(x: number, y: number, width: number, height: number): void;\r\n\r\n setCommandDataStream(dataStream: NativeDataStream): void;\r\n submitCommands(): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeEngineConstructor {\r\n prototype: INativeEngine;\r\n new (): INativeEngine;\r\n\r\n readonly PROTOCOL_VERSION: number;\r\n\r\n readonly CAPS_LIMITS_MAX_TEXTURE_SIZE: number;\r\n readonly CAPS_LIMITS_MAX_TEXTURE_LAYERS: number;\r\n\r\n readonly TEXTURE_NEAREST_NEAREST: number;\r\n readonly TEXTURE_LINEAR_LINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_NEAREST_LINEAR_MIPLINEAR: number;\r\n readonly TEXTURE_NEAREST_LINEAR: number;\r\n readonly TEXTURE_NEAREST_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST_MIPLINEAR: number;\r\n readonly TEXTURE_LINEAR_LINEAR_MIPNEAREST: number;\r\n readonly TEXTURE_LINEAR_NEAREST: number;\r\n\r\n readonly DEPTH_TEST_LESS: number;\r\n readonly DEPTH_TEST_LEQUAL: number;\r\n readonly DEPTH_TEST_EQUAL: number;\r\n readonly DEPTH_TEST_GEQUAL: number;\r\n readonly DEPTH_TEST_GREATER: number;\r\n readonly DEPTH_TEST_NOTEQUAL: number;\r\n readonly DEPTH_TEST_NEVER: number;\r\n readonly DEPTH_TEST_ALWAYS: number;\r\n\r\n readonly ADDRESS_MODE_WRAP: number;\r\n readonly ADDRESS_MODE_MIRROR: number;\r\n readonly ADDRESS_MODE_CLAMP: number;\r\n readonly ADDRESS_MODE_BORDER: number;\r\n readonly ADDRESS_MODE_MIRROR_ONCE: number;\r\n\r\n readonly TEXTURE_FORMAT_BC1: number;\r\n readonly TEXTURE_FORMAT_BC2: number;\r\n readonly TEXTURE_FORMAT_BC3: number;\r\n readonly TEXTURE_FORMAT_BC4: number;\r\n readonly TEXTURE_FORMAT_BC5: number;\r\n readonly TEXTURE_FORMAT_BC6H: number;\r\n readonly TEXTURE_FORMAT_BC7: number;\r\n readonly TEXTURE_FORMAT_ETC1: number;\r\n readonly TEXTURE_FORMAT_ETC2: number;\r\n readonly TEXTURE_FORMAT_ETC2A: number;\r\n readonly TEXTURE_FORMAT_ETC2A1: number;\r\n readonly TEXTURE_FORMAT_PTC12: number;\r\n readonly TEXTURE_FORMAT_PTC14: number;\r\n readonly TEXTURE_FORMAT_PTC12A: number;\r\n readonly TEXTURE_FORMAT_PTC14A: number;\r\n readonly TEXTURE_FORMAT_PTC22: number;\r\n readonly TEXTURE_FORMAT_PTC24: number;\r\n readonly TEXTURE_FORMAT_ATC: number;\r\n readonly TEXTURE_FORMAT_ATCE: number;\r\n readonly TEXTURE_FORMAT_ATCI: number;\r\n readonly TEXTURE_FORMAT_ASTC4x4: number;\r\n readonly TEXTURE_FORMAT_ASTC5x4: number;\r\n readonly TEXTURE_FORMAT_ASTC5x5: number;\r\n readonly TEXTURE_FORMAT_ASTC6x5: number;\r\n readonly TEXTURE_FORMAT_ASTC6x6: number;\r\n readonly TEXTURE_FORMAT_ASTC8x5: number;\r\n readonly TEXTURE_FORMAT_ASTC8x6: number;\r\n readonly TEXTURE_FORMAT_ASTC8x8: number;\r\n readonly TEXTURE_FORMAT_ASTC10x5: number;\r\n readonly TEXTURE_FORMAT_ASTC10x6: number;\r\n readonly TEXTURE_FORMAT_ASTC10x8: number;\r\n readonly TEXTURE_FORMAT_ASTC10x10: number;\r\n readonly TEXTURE_FORMAT_ASTC12x10: number;\r\n readonly TEXTURE_FORMAT_ASTC12x12: number;\r\n\r\n readonly TEXTURE_FORMAT_R1: number;\r\n readonly TEXTURE_FORMAT_A8: number;\r\n readonly TEXTURE_FORMAT_R8: number;\r\n readonly TEXTURE_FORMAT_R8I: number;\r\n readonly TEXTURE_FORMAT_R8U: number;\r\n readonly TEXTURE_FORMAT_R8S: number;\r\n readonly TEXTURE_FORMAT_R16: number;\r\n readonly TEXTURE_FORMAT_R16I: number;\r\n readonly TEXTURE_FORMAT_R16U: number;\r\n readonly TEXTURE_FORMAT_R16F: number;\r\n readonly TEXTURE_FORMAT_R16S: number;\r\n readonly TEXTURE_FORMAT_R32I: number;\r\n readonly TEXTURE_FORMAT_R32U: number;\r\n readonly TEXTURE_FORMAT_R32F: number;\r\n readonly TEXTURE_FORMAT_RG8: number;\r\n readonly TEXTURE_FORMAT_RG8I: number;\r\n readonly TEXTURE_FORMAT_RG8U: number;\r\n readonly TEXTURE_FORMAT_RG8S: number;\r\n readonly TEXTURE_FORMAT_RG16: number;\r\n readonly TEXTURE_FORMAT_RG16I: number;\r\n readonly TEXTURE_FORMAT_RG16U: number;\r\n readonly TEXTURE_FORMAT_RG16F: number;\r\n readonly TEXTURE_FORMAT_RG16S: number;\r\n readonly TEXTURE_FORMAT_RG32I: number;\r\n readonly TEXTURE_FORMAT_RG32U: number;\r\n readonly TEXTURE_FORMAT_RG32F: number;\r\n readonly TEXTURE_FORMAT_RGB8: number;\r\n readonly TEXTURE_FORMAT_RGB8I: number;\r\n readonly TEXTURE_FORMAT_RGB8U: number;\r\n readonly TEXTURE_FORMAT_RGB8S: number;\r\n readonly TEXTURE_FORMAT_RGB9E5F: number;\r\n readonly TEXTURE_FORMAT_BGRA8: number;\r\n readonly TEXTURE_FORMAT_RGBA8: number;\r\n readonly TEXTURE_FORMAT_RGBA8I: number;\r\n readonly TEXTURE_FORMAT_RGBA8U: number;\r\n readonly TEXTURE_FORMAT_RGBA8S: number;\r\n readonly TEXTURE_FORMAT_RGBA16: number;\r\n readonly TEXTURE_FORMAT_RGBA16I: number;\r\n readonly TEXTURE_FORMAT_RGBA16U: number;\r\n readonly TEXTURE_FORMAT_RGBA16F: number;\r\n readonly TEXTURE_FORMAT_RGBA16S: number;\r\n readonly TEXTURE_FORMAT_RGBA32I: number;\r\n readonly TEXTURE_FORMAT_RGBA32U: number;\r\n readonly TEXTURE_FORMAT_RGBA32F: number;\r\n readonly TEXTURE_FORMAT_B5G6R5: number;\r\n readonly TEXTURE_FORMAT_R5G6B5: number;\r\n readonly TEXTURE_FORMAT_BGRA4: number;\r\n readonly TEXTURE_FORMAT_RGBA4: number;\r\n readonly TEXTURE_FORMAT_BGR5A1: number;\r\n readonly TEXTURE_FORMAT_RGB5A1: number;\r\n readonly TEXTURE_FORMAT_RGB10A2: number;\r\n readonly TEXTURE_FORMAT_RG11B10F: number;\r\n\r\n readonly TEXTURE_FORMAT_D16: number;\r\n readonly TEXTURE_FORMAT_D24: number;\r\n readonly TEXTURE_FORMAT_D24S8: number;\r\n readonly TEXTURE_FORMAT_D32: number;\r\n readonly TEXTURE_FORMAT_D16F: number;\r\n readonly TEXTURE_FORMAT_D24F: number;\r\n readonly TEXTURE_FORMAT_D32F: number;\r\n readonly TEXTURE_FORMAT_D0S8: number;\r\n\r\n readonly ATTRIB_TYPE_INT8: number;\r\n readonly ATTRIB_TYPE_UINT8: number;\r\n readonly ATTRIB_TYPE_INT16: number;\r\n readonly ATTRIB_TYPE_UINT16: number;\r\n readonly ATTRIB_TYPE_FLOAT: number;\r\n\r\n readonly ALPHA_DISABLE: number;\r\n readonly ALPHA_ADD: number;\r\n readonly ALPHA_COMBINE: number;\r\n readonly ALPHA_SUBTRACT: number;\r\n readonly ALPHA_MULTIPLY: number;\r\n readonly ALPHA_MAXIMIZED: number;\r\n readonly ALPHA_ONEONE: number;\r\n readonly ALPHA_PREMULTIPLIED: number;\r\n readonly ALPHA_PREMULTIPLIED_PORTERDUFF: number;\r\n readonly ALPHA_INTERPOLATE: number;\r\n readonly ALPHA_SCREENMODE: number;\r\n\r\n readonly STENCIL_TEST_LESS: number;\r\n readonly STENCIL_TEST_LEQUAL: number;\r\n readonly STENCIL_TEST_EQUAL: number;\r\n readonly STENCIL_TEST_GEQUAL: number;\r\n readonly STENCIL_TEST_GREATER: number;\r\n readonly STENCIL_TEST_NOTEQUAL: number;\r\n readonly STENCIL_TEST_NEVER: number;\r\n readonly STENCIL_TEST_ALWAYS: number;\r\n\r\n readonly STENCIL_OP_FAIL_S_ZERO: number;\r\n readonly STENCIL_OP_FAIL_S_KEEP: number;\r\n readonly STENCIL_OP_FAIL_S_REPLACE: number;\r\n readonly STENCIL_OP_FAIL_S_INCR: number;\r\n readonly STENCIL_OP_FAIL_S_INCRSAT: number;\r\n readonly STENCIL_OP_FAIL_S_DECR: number;\r\n readonly STENCIL_OP_FAIL_S_DECRSAT: number;\r\n readonly STENCIL_OP_FAIL_S_INVERT: number;\r\n\r\n readonly STENCIL_OP_FAIL_Z_ZERO: number;\r\n readonly STENCIL_OP_FAIL_Z_KEEP: number;\r\n readonly STENCIL_OP_FAIL_Z_REPLACE: number;\r\n readonly STENCIL_OP_FAIL_Z_INCR: number;\r\n readonly STENCIL_OP_FAIL_Z_INCRSAT: number;\r\n readonly STENCIL_OP_FAIL_Z_DECR: number;\r\n readonly STENCIL_OP_FAIL_Z_DECRSAT: number;\r\n readonly STENCIL_OP_FAIL_Z_INVERT: number;\r\n\r\n readonly STENCIL_OP_PASS_Z_ZERO: number;\r\n readonly STENCIL_OP_PASS_Z_KEEP: number;\r\n readonly STENCIL_OP_PASS_Z_REPLACE: number;\r\n readonly STENCIL_OP_PASS_Z_INCR: number;\r\n readonly STENCIL_OP_PASS_Z_INCRSAT: number;\r\n readonly STENCIL_OP_PASS_Z_DECR: number;\r\n readonly STENCIL_OP_PASS_Z_DECRSAT: number;\r\n readonly STENCIL_OP_PASS_Z_INVERT: number;\r\n\r\n readonly COMMAND_DELETEVERTEXARRAY: NativeData;\r\n readonly COMMAND_DELETEINDEXBUFFER: NativeData;\r\n readonly COMMAND_DELETEVERTEXBUFFER: NativeData;\r\n readonly COMMAND_SETPROGRAM: NativeData;\r\n readonly COMMAND_SETMATRIX: NativeData;\r\n readonly COMMAND_SETMATRIX3X3: NativeData;\r\n readonly COMMAND_SETMATRIX2X2: NativeData;\r\n readonly COMMAND_SETMATRICES: NativeData;\r\n readonly COMMAND_SETINT: NativeData;\r\n readonly COMMAND_SETINTARRAY: NativeData;\r\n readonly COMMAND_SETINTARRAY2: NativeData;\r\n readonly COMMAND_SETINTARRAY3: NativeData;\r\n readonly COMMAND_SETINTARRAY4: NativeData;\r\n readonly COMMAND_SETFLOATARRAY: NativeData;\r\n readonly COMMAND_SETFLOATARRAY2: NativeData;\r\n readonly COMMAND_SETFLOATARRAY3: NativeData;\r\n readonly COMMAND_SETFLOATARRAY4: NativeData;\r\n readonly COMMAND_SETTEXTURESAMPLING: NativeData;\r\n readonly COMMAND_SETTEXTUREWRAPMODE: NativeData;\r\n readonly COMMAND_SETTEXTUREANISOTROPICLEVEL: NativeData;\r\n readonly COMMAND_SETTEXTURE: NativeData;\r\n readonly COMMAND_UNSETTEXTURE?: NativeData;\r\n readonly COMMAND_DISCARDALLTEXTURES?: NativeData;\r\n readonly COMMAND_BINDVERTEXARRAY: NativeData;\r\n readonly COMMAND_SETSTATE: NativeData;\r\n readonly COMMAND_DELETEPROGRAM: NativeData;\r\n readonly COMMAND_SETZOFFSET: NativeData;\r\n readonly COMMAND_SETZOFFSETUNITS: NativeData;\r\n readonly COMMAND_SETDEPTHTEST: NativeData;\r\n readonly COMMAND_SETDEPTHWRITE: NativeData;\r\n readonly COMMAND_SETCOLORWRITE: NativeData;\r\n readonly COMMAND_SETBLENDMODE: NativeData;\r\n readonly COMMAND_SETFLOAT: NativeData;\r\n readonly COMMAND_SETFLOAT2: NativeData;\r\n readonly COMMAND_SETFLOAT3: NativeData;\r\n readonly COMMAND_SETFLOAT4: NativeData;\r\n readonly COMMAND_BINDFRAMEBUFFER: NativeData;\r\n readonly COMMAND_UNBINDFRAMEBUFFER: NativeData;\r\n readonly COMMAND_DELETEFRAMEBUFFER: NativeData;\r\n readonly COMMAND_DRAWINDEXED: NativeData;\r\n readonly COMMAND_DRAWINDEXEDINSTANCED?: NativeData;\r\n readonly COMMAND_DRAW: NativeData;\r\n readonly COMMAND_DRAWINSTANCED?: NativeData;\r\n readonly COMMAND_CLEAR: NativeData;\r\n readonly COMMAND_SETSTENCIL: NativeData;\r\n readonly COMMAND_SETVIEWPORT: NativeData;\r\n readonly COMMAND_SETSCISSOR: NativeData;\r\n}\r\n\r\n/** @internal */\r\nexport interface INativeCamera {\r\n createVideo(constraints: MediaTrackConstraints): any;\r\n updateVideoTexture(texture: Nullable<InternalTexture>, video: HTMLVideoElement, invertY: boolean): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeCameraConstructor {\r\n prototype: INativeCamera;\r\n new (): INativeCamera;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeCanvasConstructor {\r\n prototype: ICanvas;\r\n new (): ICanvas;\r\n\r\n loadTTFAsync(fontName: string, buffer: ArrayBuffer): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeImageConstructor {\r\n prototype: IImage;\r\n new (): IImage;\r\n}\r\n\r\n/** @internal */\r\ninterface IDeviceInputSystemConstructor {\r\n prototype: IDeviceInputSystem;\r\n new (\r\n onDeviceConnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onDeviceDisconnected: (deviceType: DeviceType, deviceSlot: number) => void,\r\n onInputChanged: (deviceType: DeviceType, deviceSlot: number, inputIndex: number, currentState: number) => void\r\n ): IDeviceInputSystem;\r\n}\r\n\r\n/** @internal */\r\nexport interface INativeDataStream {\r\n writeBuffer(buffer: ArrayBuffer, length: number): void;\r\n}\r\n\r\n/** @internal */\r\ninterface INativeDataStreamConstructor {\r\n prototype: INativeDataStream;\r\n new (requestFlushCallback: () => void): INativeDataStream;\r\n\r\n readonly VALIDATION_ENABLED: boolean;\r\n readonly VALIDATION_UINT_32: number;\r\n readonly VALIDATION_INT_32: number;\r\n readonly VALIDATION_FLOAT_32: number;\r\n readonly VALIDATION_UINT_32_ARRAY: number;\r\n readonly VALIDATION_INT_32_ARRAY: number;\r\n readonly VALIDATION_FLOAT_32_ARRAY: number;\r\n readonly VALIDATION_NATIVE_DATA: number;\r\n readonly VALIDATION_BOOLEAN: number;\r\n}\r\n\r\n/** @internal */\r\nexport interface INative {\r\n Engine: INativeEngineConstructor;\r\n Camera: INativeCameraConstructor;\r\n Canvas: INativeCanvasConstructor;\r\n Image: INativeImageConstructor;\r\n XMLHttpRequest: any; // TODO: how to do this?\r\n DeviceInputSystem: IDeviceInputSystemConstructor;\r\n NativeDataStream: INativeDataStreamConstructor;\r\n}\r\n"]}
@@ -29,7 +29,9 @@ export interface IShaderProcessor {
29
29
  }, processingContext: Nullable<ShaderProcessingContext>) => string;
30
30
  endOfUniformBufferProcessor?: (closingBracketLine: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;
31
31
  lineProcessor?: (line: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;
32
- preProcessor?: (code: string, defines: string[], isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;
32
+ preProcessor?: (code: string, defines: string[], preProcessors: {
33
+ [key: string]: string;
34
+ }, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;
33
35
  postProcessor?: (code: string, defines: string[], isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>, patameters: {
34
36
  [key: string]: number | string | boolean | undefined;
35
37
  }) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"iShaderProcessor.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Processors/iShaderProcessor.ts"],"names":[],"mappings":"","sourcesContent":["import type { ShaderLanguage } from \"../../Materials/shaderLanguage\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ShaderProcessingContext } from \"./shaderProcessingOptions\";\r\n\r\n/** @internal */\r\nexport interface IShaderProcessor {\r\n shaderLanguage: ShaderLanguage;\r\n\r\n uniformRegexp?: RegExp;\r\n uniformBufferRegexp?: RegExp;\r\n textureRegexp?: RegExp;\r\n noPrecision?: boolean;\r\n parseGLES3?: boolean;\r\n\r\n attributeKeywordName?: string;\r\n varyingVertexKeywordName?: string;\r\n varyingFragmentKeywordName?: string;\r\n\r\n preProcessShaderCode?: (code: string, isFragment: boolean) => string;\r\n attributeProcessor?: (attribute: string, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n varyingCheck?: (varying: string, isFragment: boolean) => boolean;\r\n varyingProcessor?: (varying: string, isFragment: boolean, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n uniformProcessor?: (uniform: string, isFragment: boolean, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n uniformBufferProcessor?: (uniformBuffer: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n textureProcessor?: (texture: string, isFragment: boolean, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n endOfUniformBufferProcessor?: (closingBracketLine: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n lineProcessor?: (line: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n preProcessor?: (code: string, defines: string[], isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n postProcessor?: (\r\n code: string,\r\n defines: string[],\r\n isFragment: boolean,\r\n processingContext: Nullable<ShaderProcessingContext>,\r\n patameters: {\r\n [key: string]: number | string | boolean | undefined;\r\n }\r\n ) => string;\r\n initializeShaders?: (processingContext: Nullable<ShaderProcessingContext>) => void;\r\n finalizeShaders?: (vertexCode: string, fragmentCode: string, processingContext: Nullable<ShaderProcessingContext>) => { vertexCode: string; fragmentCode: string };\r\n}\r\n"]}
1
+ {"version":3,"file":"iShaderProcessor.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Processors/iShaderProcessor.ts"],"names":[],"mappings":"","sourcesContent":["import type { ShaderLanguage } from \"../../Materials/shaderLanguage\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { ShaderProcessingContext } from \"./shaderProcessingOptions\";\r\n\r\n/** @internal */\r\nexport interface IShaderProcessor {\r\n shaderLanguage: ShaderLanguage;\r\n\r\n uniformRegexp?: RegExp;\r\n uniformBufferRegexp?: RegExp;\r\n textureRegexp?: RegExp;\r\n noPrecision?: boolean;\r\n parseGLES3?: boolean;\r\n\r\n attributeKeywordName?: string;\r\n varyingVertexKeywordName?: string;\r\n varyingFragmentKeywordName?: string;\r\n\r\n preProcessShaderCode?: (code: string, isFragment: boolean) => string;\r\n attributeProcessor?: (attribute: string, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n varyingCheck?: (varying: string, isFragment: boolean) => boolean;\r\n varyingProcessor?: (varying: string, isFragment: boolean, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n uniformProcessor?: (uniform: string, isFragment: boolean, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n uniformBufferProcessor?: (uniformBuffer: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n textureProcessor?: (texture: string, isFragment: boolean, preProcessors: { [key: string]: string }, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n endOfUniformBufferProcessor?: (closingBracketLine: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n lineProcessor?: (line: string, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n preProcessor?: (code: string, defines: string[], preProcessors: { [key: string]: string }, isFragment: boolean, processingContext: Nullable<ShaderProcessingContext>) => string;\r\n postProcessor?: (\r\n code: string,\r\n defines: string[],\r\n isFragment: boolean,\r\n processingContext: Nullable<ShaderProcessingContext>,\r\n patameters: {\r\n [key: string]: number | string | boolean | undefined;\r\n }\r\n ) => string;\r\n initializeShaders?: (processingContext: Nullable<ShaderProcessingContext>) => void;\r\n finalizeShaders?: (vertexCode: string, fragmentCode: string, processingContext: Nullable<ShaderProcessingContext>) => { vertexCode: string; fragmentCode: string };\r\n}\r\n"]}
@@ -262,7 +262,7 @@ function _ProcessShaderConversion(sourceCode, options, engine) {
262
262
  const preprocessors = _PreparePreProcessors(options, engine);
263
263
  // General pre processing
264
264
  if (options.processor.preProcessor) {
265
- preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, options.isFragment, options.processingContext);
265
+ preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, preprocessors, options.isFragment, options.processingContext);
266
266
  }
267
267
  preparedSourceCode = _EvaluatePreProcessors(preparedSourceCode, preprocessors, options);
268
268
  // Post processing
@@ -285,7 +285,7 @@ function _ApplyPreProcessing(sourceCode, options, engine) {
285
285
  const preprocessors = _PreparePreProcessors(options, engine);
286
286
  // General pre processing
287
287
  if (options.processor?.preProcessor) {
288
- preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, options.isFragment, options.processingContext);
288
+ preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, preprocessors, options.isFragment, options.processingContext);
289
289
  }
290
290
  preparedSourceCode = _EvaluatePreProcessors(preparedSourceCode, preprocessors, options);
291
291
  // Post processing
@@ -1 +1 @@
1
- {"version":3,"file":"shaderProcessor.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Processors/shaderProcessor.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,uDAAuD,CAAC;AACtG,OAAO,EAAE,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F,kBAAkB,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,WAAW,EAAE,EAAE;gBAC1D,OAAO,CAAC,oBAAoB,CAAC,WAAW,CAAC,GAAG,WAAqB,CAAC;gBAClE,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;YACxD,CAAC,CAAC,CAAC;YACH,OAAO;SACV;KACJ;IACD,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;IAE3B,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAE7B,IAAI,cAAc,EAAE;QAChB,gBAAgB,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;KAC/D;SAAM;QACH,QAAQ,CAAC,WAAW,CAAC,CAAC;KACzB;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B;;;;;;;;;;OAUG;IACH,QAAQ,EAAE,CACN,GAAW,EACX,SAAqE,EACrE,UAAwC,EACxC,eAAkC,EAClC,cAAwB,EACxB,OAAmE,EACvD,EAAE;QACd,MAAM,WAAW,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CACJ,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { ShaderCodeNode } from \"./shaderCodeNode\";\r\nimport { ShaderCodeCursor } from \"./shaderCodeCursor\";\r\nimport { ShaderCodeConditionNode } from \"./shaderCodeConditionNode\";\r\nimport { ShaderCodeTestNode } from \"./shaderCodeTestNode\";\r\nimport { ShaderDefineIsDefinedOperator } from \"./Expressions/Operators/shaderDefineIsDefinedOperator\";\r\nimport { ShaderDefineOrOperator } from \"./Expressions/Operators/shaderDefineOrOperator\";\r\nimport { ShaderDefineAndOperator } from \"./Expressions/Operators/shaderDefineAndOperator\";\r\nimport { ShaderDefineExpression } from \"./Expressions/shaderDefineExpression\";\r\nimport { ShaderDefineArithmeticOperator } from \"./Expressions/Operators/shaderDefineArithmeticOperator\";\r\nimport type { ProcessingOptions } from \"./shaderProcessingOptions\";\r\nimport { _WarnImport } from \"../../Misc/devTools\";\r\nimport { ShaderLanguage } from \"../../Materials/shaderLanguage\";\r\n\r\nimport type { WebRequest } from \"../../Misc/webRequest\";\r\nimport type { LoadFileError } from \"../../Misc/fileTools\";\r\nimport type { IOfflineProvider } from \"../../Offline/IOfflineProvider\";\r\nimport type { IFileRequest } from \"../../Misc/fileRequest\";\r\nimport { _getGlobalDefines } from \"../abstractEngine.functions\";\r\nimport type { AbstractEngine } from \"../abstractEngine\";\r\n\r\nconst regexSE = /defined\\s*?\\((.+?)\\)/g;\r\nconst regexSERevert = /defined\\s*?\\[(.+?)\\]/g;\r\nconst regexShaderInclude = /#include\\s?<(.+)>(\\((.*)\\))*(\\[(.*)\\])*/g;\r\nconst regexShaderDecl = /__decl__/;\r\nconst regexLightX = /light\\{X\\}.(\\w*)/g;\r\nconst regexX = /\\{X\\}/g;\r\nconst reusableMatches: RegExpMatchArray[] = [];\r\n\r\nconst _MoveCursorRegex = /(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/;\r\n\r\nexport function Initialize(options: ProcessingOptions): void {\r\n if (options.processor && options.processor.initializeShaders) {\r\n options.processor.initializeShaders(options.processingContext);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function Process(sourceCode: string, options: ProcessingOptions, callback: (migratedCode: string, codeBeforeMigration: string) => void, engine?: AbstractEngine) {\r\n if (options.processor?.preProcessShaderCode) {\r\n sourceCode = options.processor.preProcessShaderCode(sourceCode, options.isFragment);\r\n }\r\n _ProcessIncludes(sourceCode, options, (codeWithIncludes) => {\r\n if (options.processCodeAfterIncludes) {\r\n codeWithIncludes = options.processCodeAfterIncludes(options.isFragment ? \"fragment\" : \"vertex\", codeWithIncludes);\r\n }\r\n const migratedCode = _ProcessShaderConversion(codeWithIncludes, options, engine);\r\n callback(migratedCode, codeWithIncludes);\r\n });\r\n}\r\n\r\n/** @internal */\r\nexport function PreProcess(sourceCode: string, options: ProcessingOptions, callback: (migratedCode: string, codeBeforeMigration: string) => void, engine: AbstractEngine) {\r\n if (options.processor?.preProcessShaderCode) {\r\n sourceCode = options.processor.preProcessShaderCode(sourceCode, options.isFragment);\r\n }\r\n _ProcessIncludes(sourceCode, options, (codeWithIncludes) => {\r\n if (options.processCodeAfterIncludes) {\r\n codeWithIncludes = options.processCodeAfterIncludes(options.isFragment ? \"fragment\" : \"vertex\", codeWithIncludes);\r\n }\r\n const migratedCode = _ApplyPreProcessing(codeWithIncludes, options, engine);\r\n callback(migratedCode, codeWithIncludes);\r\n });\r\n}\r\n\r\n/** @internal */\r\nexport function Finalize(vertexCode: string, fragmentCode: string, options: ProcessingOptions): { vertexCode: string; fragmentCode: string } {\r\n if (!options.processor || !options.processor.finalizeShaders) {\r\n return { vertexCode, fragmentCode };\r\n }\r\n\r\n return options.processor.finalizeShaders(vertexCode, fragmentCode, options.processingContext);\r\n}\r\n\r\nfunction _ProcessPrecision(source: string, options: ProcessingOptions): string {\r\n if (options.processor?.noPrecision) {\r\n return source;\r\n }\r\n\r\n const shouldUseHighPrecisionShader = options.shouldUseHighPrecisionShader;\r\n\r\n if (source.indexOf(\"precision highp float\") === -1) {\r\n if (!shouldUseHighPrecisionShader) {\r\n source = \"precision mediump float;\\n\" + source;\r\n } else {\r\n source = \"precision highp float;\\n\" + source;\r\n }\r\n } else {\r\n if (!shouldUseHighPrecisionShader) {\r\n // Moving highp to mediump\r\n source = source.replace(\"precision highp float\", \"precision mediump float\");\r\n }\r\n }\r\n\r\n return source;\r\n}\r\n\r\nfunction _ExtractOperation(expression: string) {\r\n const regex = /defined\\((.+)\\)/;\r\n\r\n const match = regex.exec(expression);\r\n\r\n if (match && match.length) {\r\n return new ShaderDefineIsDefinedOperator(match[1].trim(), expression[0] === \"!\");\r\n }\r\n\r\n const operators = [\"==\", \"!=\", \">=\", \"<=\", \"<\", \">\"];\r\n let operator = \"\";\r\n let indexOperator = 0;\r\n\r\n for (operator of operators) {\r\n indexOperator = expression.indexOf(operator);\r\n\r\n if (indexOperator > -1) {\r\n break;\r\n }\r\n }\r\n\r\n if (indexOperator === -1) {\r\n return new ShaderDefineIsDefinedOperator(expression);\r\n }\r\n\r\n const define = expression.substring(0, indexOperator).trim();\r\n const value = expression.substring(indexOperator + operator.length).trim();\r\n\r\n return new ShaderDefineArithmeticOperator(define, operator, value);\r\n}\r\n\r\nfunction _BuildSubExpression(expression: string): ShaderDefineExpression {\r\n expression = expression.replace(regexSE, \"defined[$1]\");\r\n\r\n const postfix = ShaderDefineExpression.infixToPostfix(expression);\r\n\r\n const stack: (string | ShaderDefineExpression)[] = [];\r\n\r\n for (const c of postfix) {\r\n if (c !== \"||\" && c !== \"&&\") {\r\n stack.push(c);\r\n } else if (stack.length >= 2) {\r\n let v1 = stack[stack.length - 1],\r\n v2 = stack[stack.length - 2];\r\n\r\n stack.length -= 2;\r\n\r\n const operator = c == \"&&\" ? new ShaderDefineAndOperator() : new ShaderDefineOrOperator();\r\n\r\n if (typeof v1 === \"string\") {\r\n v1 = v1.replace(regexSERevert, \"defined($1)\");\r\n }\r\n\r\n if (typeof v2 === \"string\") {\r\n v2 = v2.replace(regexSERevert, \"defined($1)\");\r\n }\r\n\r\n operator.leftOperand = typeof v2 === \"string\" ? _ExtractOperation(v2) : v2;\r\n operator.rightOperand = typeof v1 === \"string\" ? _ExtractOperation(v1) : v1;\r\n\r\n stack.push(operator);\r\n }\r\n }\r\n\r\n let result = stack[stack.length - 1];\r\n\r\n if (typeof result === \"string\") {\r\n result = result.replace(regexSERevert, \"defined($1)\");\r\n }\r\n\r\n // note: stack.length !== 1 if there was an error in the parsing\r\n\r\n return typeof result === \"string\" ? _ExtractOperation(result) : result;\r\n}\r\n\r\nfunction _BuildExpression(line: string, start: number): ShaderCodeTestNode {\r\n const node = new ShaderCodeTestNode();\r\n const command = line.substring(0, start);\r\n let expression = line.substring(start);\r\n\r\n expression = expression.substring(0, (expression.indexOf(\"//\") + 1 || expression.length + 1) - 1).trim();\r\n\r\n if (command === \"#ifdef\") {\r\n node.testExpression = new ShaderDefineIsDefinedOperator(expression);\r\n } else if (command === \"#ifndef\") {\r\n node.testExpression = new ShaderDefineIsDefinedOperator(expression, true);\r\n } else {\r\n node.testExpression = _BuildSubExpression(expression);\r\n }\r\n\r\n return node;\r\n}\r\n\r\nfunction _MoveCursorWithinIf(cursor: ShaderCodeCursor, rootNode: ShaderCodeConditionNode, ifNode: ShaderCodeNode) {\r\n let line = cursor.currentLine;\r\n while (_MoveCursor(cursor, ifNode)) {\r\n line = cursor.currentLine;\r\n const first5 = line.substring(0, 5).toLowerCase();\r\n\r\n if (first5 === \"#else\") {\r\n const elseNode = new ShaderCodeNode();\r\n rootNode.children.push(elseNode);\r\n _MoveCursor(cursor, elseNode);\r\n return;\r\n } else if (first5 === \"#elif\") {\r\n const elifNode = _BuildExpression(line, 5);\r\n\r\n rootNode.children.push(elifNode);\r\n ifNode = elifNode;\r\n }\r\n }\r\n}\r\n\r\nfunction _MoveCursor(cursor: ShaderCodeCursor, rootNode: ShaderCodeNode): boolean {\r\n while (cursor.canRead) {\r\n cursor.lineIndex++;\r\n const line = cursor.currentLine;\r\n\r\n if (line.indexOf(\"#\") >= 0) {\r\n const matches = _MoveCursorRegex.exec(line);\r\n\r\n if (matches && matches.length) {\r\n const keyword = matches[0];\r\n\r\n switch (keyword) {\r\n case \"#ifdef\": {\r\n const newRootNode = new ShaderCodeConditionNode();\r\n rootNode.children.push(newRootNode);\r\n\r\n const ifNode = _BuildExpression(line, 6);\r\n newRootNode.children.push(ifNode);\r\n _MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#else\":\r\n case \"#elif\":\r\n return true;\r\n case \"#endif\":\r\n return false;\r\n case \"#ifndef\": {\r\n const newRootNode = new ShaderCodeConditionNode();\r\n rootNode.children.push(newRootNode);\r\n\r\n const ifNode = _BuildExpression(line, 7);\r\n newRootNode.children.push(ifNode);\r\n _MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#if\": {\r\n const newRootNode = new ShaderCodeConditionNode();\r\n const ifNode = _BuildExpression(line, 3);\r\n rootNode.children.push(newRootNode);\r\n\r\n newRootNode.children.push(ifNode);\r\n _MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n }\r\n continue;\r\n }\r\n }\r\n\r\n const newNode = new ShaderCodeNode();\r\n newNode.line = line;\r\n rootNode.children.push(newNode);\r\n\r\n // Detect additional defines\r\n if (line[0] === \"#\" && line[1] === \"d\") {\r\n const split = line.replace(\";\", \"\").split(\" \");\r\n newNode.additionalDefineKey = split[1];\r\n\r\n if (split.length === 3) {\r\n newNode.additionalDefineValue = split[2];\r\n }\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction _EvaluatePreProcessors(sourceCode: string, preprocessors: { [key: string]: string }, options: ProcessingOptions): string {\r\n const rootNode = new ShaderCodeNode();\r\n const cursor = new ShaderCodeCursor();\r\n\r\n cursor.lineIndex = -1;\r\n cursor.lines = sourceCode.split(\"\\n\");\r\n\r\n // Decompose (We keep it in 2 steps so it is easier to maintain and perf hit is insignificant)\r\n _MoveCursor(cursor, rootNode);\r\n\r\n // Recompose\r\n return rootNode.process(preprocessors, options);\r\n}\r\n\r\nfunction _PreparePreProcessors(options: ProcessingOptions, engine?: AbstractEngine): { [key: string]: string } {\r\n const defines = options.defines;\r\n const preprocessors: { [key: string]: string } = {};\r\n\r\n for (const define of defines) {\r\n const keyValue = define.replace(\"#define\", \"\").replace(\";\", \"\").trim();\r\n const split = keyValue.split(\" \");\r\n preprocessors[split[0]] = split.length > 1 ? split[1] : \"\";\r\n }\r\n\r\n if (options.processor?.shaderLanguage === ShaderLanguage.GLSL) {\r\n preprocessors[\"GL_ES\"] = \"true\";\r\n }\r\n preprocessors[\"__VERSION__\"] = options.version;\r\n preprocessors[options.platformName] = \"true\";\r\n\r\n _getGlobalDefines(preprocessors, engine?.isNDCHalfZRange, engine?.useReverseDepthBuffer, engine?.useExactSrgbConversions);\r\n\r\n return preprocessors;\r\n}\r\n\r\nfunction _ProcessShaderConversion(sourceCode: string, options: ProcessingOptions, engine?: AbstractEngine): string {\r\n let preparedSourceCode = _ProcessPrecision(sourceCode, options);\r\n\r\n if (!options.processor) {\r\n return preparedSourceCode;\r\n }\r\n\r\n // Already converted\r\n if (options.processor.shaderLanguage === ShaderLanguage.GLSL && preparedSourceCode.indexOf(\"#version 3\") !== -1) {\r\n preparedSourceCode = preparedSourceCode.replace(\"#version 300 es\", \"\");\r\n if (!options.processor.parseGLES3) {\r\n return preparedSourceCode;\r\n }\r\n }\r\n\r\n const defines = options.defines;\r\n\r\n const preprocessors = _PreparePreProcessors(options, engine);\r\n\r\n // General pre processing\r\n if (options.processor.preProcessor) {\r\n preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, options.isFragment, options.processingContext);\r\n }\r\n\r\n preparedSourceCode = _EvaluatePreProcessors(preparedSourceCode, preprocessors, options);\r\n\r\n // Post processing\r\n if (options.processor.postProcessor) {\r\n preparedSourceCode = options.processor.postProcessor(\r\n preparedSourceCode,\r\n defines,\r\n options.isFragment,\r\n options.processingContext,\r\n engine\r\n ? {\r\n drawBuffersExtensionDisabled: engine.getCaps().drawBuffersExtension ? false : true,\r\n }\r\n : {}\r\n );\r\n }\r\n\r\n // Inline functions tagged with #define inline\r\n if (engine?._features.needShaderCodeInlining) {\r\n preparedSourceCode = engine.inlineShaderCode(preparedSourceCode);\r\n }\r\n\r\n return preparedSourceCode;\r\n}\r\n\r\nfunction _ApplyPreProcessing(sourceCode: string, options: ProcessingOptions, engine: AbstractEngine): string {\r\n let preparedSourceCode = sourceCode;\r\n\r\n const defines = options.defines;\r\n\r\n const preprocessors = _PreparePreProcessors(options, engine);\r\n\r\n // General pre processing\r\n if (options.processor?.preProcessor) {\r\n preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, options.isFragment, options.processingContext);\r\n }\r\n\r\n preparedSourceCode = _EvaluatePreProcessors(preparedSourceCode, preprocessors, options);\r\n\r\n // Post processing\r\n if (options.processor?.postProcessor) {\r\n preparedSourceCode = options.processor.postProcessor(\r\n preparedSourceCode,\r\n defines,\r\n options.isFragment,\r\n options.processingContext,\r\n engine\r\n ? {\r\n drawBuffersExtensionDisabled: engine.getCaps().drawBuffersExtension ? false : true,\r\n }\r\n : {}\r\n );\r\n }\r\n\r\n // Inline functions tagged with #define inline\r\n if (engine._features.needShaderCodeInlining) {\r\n preparedSourceCode = engine.inlineShaderCode(preparedSourceCode);\r\n }\r\n\r\n return preparedSourceCode;\r\n}\r\n\r\n/** @internal */\r\nexport function _ProcessIncludes(sourceCode: string, options: ProcessingOptions, callback: (data: any) => void): void {\r\n reusableMatches.length = 0;\r\n let match: RegExpMatchArray | null;\r\n // stay back-compat to the old matchAll syntax\r\n while ((match = regexShaderInclude.exec(sourceCode)) !== null) {\r\n reusableMatches.push(match);\r\n }\r\n\r\n let returnValue = String(sourceCode);\r\n let parts = [sourceCode];\r\n\r\n let keepProcessing = false;\r\n\r\n for (const match of reusableMatches) {\r\n let includeFile = match[1];\r\n\r\n // Uniform declaration\r\n if (includeFile.indexOf(\"__decl__\") !== -1) {\r\n includeFile = includeFile.replace(regexShaderDecl, \"\");\r\n if (options.supportsUniformBuffers) {\r\n includeFile = includeFile.replace(\"Vertex\", \"Ubo\").replace(\"Fragment\", \"Ubo\");\r\n }\r\n includeFile = includeFile + \"Declaration\";\r\n }\r\n\r\n if (options.includesShadersStore[includeFile]) {\r\n // Substitution\r\n let includeContent = options.includesShadersStore[includeFile];\r\n if (match[2]) {\r\n const splits = match[3].split(\",\");\r\n\r\n for (let index = 0; index < splits.length; index += 2) {\r\n const source = new RegExp(splits[index], \"g\");\r\n const dest = splits[index + 1];\r\n\r\n includeContent = includeContent.replace(source, dest);\r\n }\r\n }\r\n\r\n if (match[4]) {\r\n const indexString = match[5];\r\n\r\n if (indexString.indexOf(\"..\") !== -1) {\r\n const indexSplits = indexString.split(\"..\");\r\n const minIndex = parseInt(indexSplits[0]);\r\n let maxIndex = parseInt(indexSplits[1]);\r\n let sourceIncludeContent = includeContent.slice(0);\r\n includeContent = \"\";\r\n\r\n if (isNaN(maxIndex)) {\r\n maxIndex = options.indexParameters[indexSplits[1]];\r\n }\r\n\r\n for (let i = minIndex; i < maxIndex; i++) {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n sourceIncludeContent = sourceIncludeContent.replace(regexLightX, (str: string, p1: string) => {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent += sourceIncludeContent.replace(regexX, i.toString()) + \"\\n\";\r\n }\r\n } else {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n includeContent = includeContent.replace(regexLightX, (str: string, p1: string) => {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent = includeContent.replace(regexX, indexString);\r\n }\r\n }\r\n\r\n // Replace\r\n // Split all parts on match[0] and intersperse the parts with the include content\r\n const newParts = [];\r\n for (const part of parts) {\r\n const splitPart = part.split(match[0]);\r\n for (let i = 0; i < splitPart.length - 1; i++) {\r\n newParts.push(splitPart[i]);\r\n newParts.push(includeContent);\r\n }\r\n newParts.push(splitPart[splitPart.length - 1]);\r\n }\r\n parts = newParts;\r\n\r\n keepProcessing = keepProcessing || includeContent.indexOf(\"#include<\") >= 0 || includeContent.indexOf(\"#include <\") >= 0;\r\n } else {\r\n const includeShaderUrl = options.shadersRepository + \"ShadersInclude/\" + includeFile + \".fx\";\r\n\r\n _functionContainer.loadFile(includeShaderUrl, (fileContent) => {\r\n options.includesShadersStore[includeFile] = fileContent as string;\r\n _ProcessIncludes(parts.join(\"\"), options, callback);\r\n });\r\n return;\r\n }\r\n }\r\n reusableMatches.length = 0;\r\n\r\n returnValue = parts.join(\"\");\r\n\r\n if (keepProcessing) {\r\n _ProcessIncludes(returnValue.toString(), options, callback);\r\n } else {\r\n callback(returnValue);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport const _functionContainer = {\r\n /**\r\n * Loads a file from a url\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n * @internal\r\n */\r\n loadFile: (\r\n url: string,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void,\r\n onProgress?: (ev: ProgressEvent) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void\r\n ): IFileRequest => {\r\n throw _WarnImport(\"FileTools\");\r\n },\r\n};\r\n"]}
1
+ {"version":3,"file":"shaderProcessor.js","sourceRoot":"","sources":["../../../../../dev/core/src/Engines/Processors/shaderProcessor.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,uDAAuD,CAAC;AACtG,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,8BAA8B,EAAE,MAAM,wDAAwD,CAAC;AAExG,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAMhE,OAAO,EAAE,iBAAiB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,GAAG,CAAC,CAAC;IAE3B,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAE7B,IAAI,cAAc,EAAE;QAChB,gBAAgB,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;KAC/D;SAAM;QACH,QAAQ,CAAC,WAAW,CAAC,CAAC;KACzB;AACL,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B;;;;;;;;;;OAUG;IACH,QAAQ,EAAE,CACN,GAAW,EACX,SAAqE,EACrE,UAAwC,EACxC,eAAkC,EAClC,cAAwB,EACxB,OAAmE,EACvD,EAAE;QACd,MAAM,WAAW,CAAC,WAAW,CAAC,CAAC;IACnC,CAAC;CACJ,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\r\nimport { ShaderCodeNode } from \"./shaderCodeNode\";\r\nimport { ShaderCodeCursor } from \"./shaderCodeCursor\";\r\nimport { ShaderCodeConditionNode } from \"./shaderCodeConditionNode\";\r\nimport { ShaderCodeTestNode } from \"./shaderCodeTestNode\";\r\nimport { ShaderDefineIsDefinedOperator } from \"./Expressions/Operators/shaderDefineIsDefinedOperator\";\r\nimport { ShaderDefineOrOperator } from \"./Expressions/Operators/shaderDefineOrOperator\";\r\nimport { ShaderDefineAndOperator } from \"./Expressions/Operators/shaderDefineAndOperator\";\r\nimport { ShaderDefineExpression } from \"./Expressions/shaderDefineExpression\";\r\nimport { ShaderDefineArithmeticOperator } from \"./Expressions/Operators/shaderDefineArithmeticOperator\";\r\nimport type { ProcessingOptions } from \"./shaderProcessingOptions\";\r\nimport { _WarnImport } from \"../../Misc/devTools\";\r\nimport { ShaderLanguage } from \"../../Materials/shaderLanguage\";\r\n\r\nimport type { WebRequest } from \"../../Misc/webRequest\";\r\nimport type { LoadFileError } from \"../../Misc/fileTools\";\r\nimport type { IOfflineProvider } from \"../../Offline/IOfflineProvider\";\r\nimport type { IFileRequest } from \"../../Misc/fileRequest\";\r\nimport { _getGlobalDefines } from \"../abstractEngine.functions\";\r\nimport type { AbstractEngine } from \"../abstractEngine\";\r\n\r\nconst regexSE = /defined\\s*?\\((.+?)\\)/g;\r\nconst regexSERevert = /defined\\s*?\\[(.+?)\\]/g;\r\nconst regexShaderInclude = /#include\\s?<(.+)>(\\((.*)\\))*(\\[(.*)\\])*/g;\r\nconst regexShaderDecl = /__decl__/;\r\nconst regexLightX = /light\\{X\\}.(\\w*)/g;\r\nconst regexX = /\\{X\\}/g;\r\nconst reusableMatches: RegExpMatchArray[] = [];\r\n\r\nconst _MoveCursorRegex = /(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/;\r\n\r\nexport function Initialize(options: ProcessingOptions): void {\r\n if (options.processor && options.processor.initializeShaders) {\r\n options.processor.initializeShaders(options.processingContext);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport function Process(sourceCode: string, options: ProcessingOptions, callback: (migratedCode: string, codeBeforeMigration: string) => void, engine?: AbstractEngine) {\r\n if (options.processor?.preProcessShaderCode) {\r\n sourceCode = options.processor.preProcessShaderCode(sourceCode, options.isFragment);\r\n }\r\n _ProcessIncludes(sourceCode, options, (codeWithIncludes) => {\r\n if (options.processCodeAfterIncludes) {\r\n codeWithIncludes = options.processCodeAfterIncludes(options.isFragment ? \"fragment\" : \"vertex\", codeWithIncludes);\r\n }\r\n const migratedCode = _ProcessShaderConversion(codeWithIncludes, options, engine);\r\n callback(migratedCode, codeWithIncludes);\r\n });\r\n}\r\n\r\n/** @internal */\r\nexport function PreProcess(sourceCode: string, options: ProcessingOptions, callback: (migratedCode: string, codeBeforeMigration: string) => void, engine: AbstractEngine) {\r\n if (options.processor?.preProcessShaderCode) {\r\n sourceCode = options.processor.preProcessShaderCode(sourceCode, options.isFragment);\r\n }\r\n _ProcessIncludes(sourceCode, options, (codeWithIncludes) => {\r\n if (options.processCodeAfterIncludes) {\r\n codeWithIncludes = options.processCodeAfterIncludes(options.isFragment ? \"fragment\" : \"vertex\", codeWithIncludes);\r\n }\r\n const migratedCode = _ApplyPreProcessing(codeWithIncludes, options, engine);\r\n callback(migratedCode, codeWithIncludes);\r\n });\r\n}\r\n\r\n/** @internal */\r\nexport function Finalize(vertexCode: string, fragmentCode: string, options: ProcessingOptions): { vertexCode: string; fragmentCode: string } {\r\n if (!options.processor || !options.processor.finalizeShaders) {\r\n return { vertexCode, fragmentCode };\r\n }\r\n\r\n return options.processor.finalizeShaders(vertexCode, fragmentCode, options.processingContext);\r\n}\r\n\r\nfunction _ProcessPrecision(source: string, options: ProcessingOptions): string {\r\n if (options.processor?.noPrecision) {\r\n return source;\r\n }\r\n\r\n const shouldUseHighPrecisionShader = options.shouldUseHighPrecisionShader;\r\n\r\n if (source.indexOf(\"precision highp float\") === -1) {\r\n if (!shouldUseHighPrecisionShader) {\r\n source = \"precision mediump float;\\n\" + source;\r\n } else {\r\n source = \"precision highp float;\\n\" + source;\r\n }\r\n } else {\r\n if (!shouldUseHighPrecisionShader) {\r\n // Moving highp to mediump\r\n source = source.replace(\"precision highp float\", \"precision mediump float\");\r\n }\r\n }\r\n\r\n return source;\r\n}\r\n\r\nfunction _ExtractOperation(expression: string) {\r\n const regex = /defined\\((.+)\\)/;\r\n\r\n const match = regex.exec(expression);\r\n\r\n if (match && match.length) {\r\n return new ShaderDefineIsDefinedOperator(match[1].trim(), expression[0] === \"!\");\r\n }\r\n\r\n const operators = [\"==\", \"!=\", \">=\", \"<=\", \"<\", \">\"];\r\n let operator = \"\";\r\n let indexOperator = 0;\r\n\r\n for (operator of operators) {\r\n indexOperator = expression.indexOf(operator);\r\n\r\n if (indexOperator > -1) {\r\n break;\r\n }\r\n }\r\n\r\n if (indexOperator === -1) {\r\n return new ShaderDefineIsDefinedOperator(expression);\r\n }\r\n\r\n const define = expression.substring(0, indexOperator).trim();\r\n const value = expression.substring(indexOperator + operator.length).trim();\r\n\r\n return new ShaderDefineArithmeticOperator(define, operator, value);\r\n}\r\n\r\nfunction _BuildSubExpression(expression: string): ShaderDefineExpression {\r\n expression = expression.replace(regexSE, \"defined[$1]\");\r\n\r\n const postfix = ShaderDefineExpression.infixToPostfix(expression);\r\n\r\n const stack: (string | ShaderDefineExpression)[] = [];\r\n\r\n for (const c of postfix) {\r\n if (c !== \"||\" && c !== \"&&\") {\r\n stack.push(c);\r\n } else if (stack.length >= 2) {\r\n let v1 = stack[stack.length - 1],\r\n v2 = stack[stack.length - 2];\r\n\r\n stack.length -= 2;\r\n\r\n const operator = c == \"&&\" ? new ShaderDefineAndOperator() : new ShaderDefineOrOperator();\r\n\r\n if (typeof v1 === \"string\") {\r\n v1 = v1.replace(regexSERevert, \"defined($1)\");\r\n }\r\n\r\n if (typeof v2 === \"string\") {\r\n v2 = v2.replace(regexSERevert, \"defined($1)\");\r\n }\r\n\r\n operator.leftOperand = typeof v2 === \"string\" ? _ExtractOperation(v2) : v2;\r\n operator.rightOperand = typeof v1 === \"string\" ? _ExtractOperation(v1) : v1;\r\n\r\n stack.push(operator);\r\n }\r\n }\r\n\r\n let result = stack[stack.length - 1];\r\n\r\n if (typeof result === \"string\") {\r\n result = result.replace(regexSERevert, \"defined($1)\");\r\n }\r\n\r\n // note: stack.length !== 1 if there was an error in the parsing\r\n\r\n return typeof result === \"string\" ? _ExtractOperation(result) : result;\r\n}\r\n\r\nfunction _BuildExpression(line: string, start: number): ShaderCodeTestNode {\r\n const node = new ShaderCodeTestNode();\r\n const command = line.substring(0, start);\r\n let expression = line.substring(start);\r\n\r\n expression = expression.substring(0, (expression.indexOf(\"//\") + 1 || expression.length + 1) - 1).trim();\r\n\r\n if (command === \"#ifdef\") {\r\n node.testExpression = new ShaderDefineIsDefinedOperator(expression);\r\n } else if (command === \"#ifndef\") {\r\n node.testExpression = new ShaderDefineIsDefinedOperator(expression, true);\r\n } else {\r\n node.testExpression = _BuildSubExpression(expression);\r\n }\r\n\r\n return node;\r\n}\r\n\r\nfunction _MoveCursorWithinIf(cursor: ShaderCodeCursor, rootNode: ShaderCodeConditionNode, ifNode: ShaderCodeNode) {\r\n let line = cursor.currentLine;\r\n while (_MoveCursor(cursor, ifNode)) {\r\n line = cursor.currentLine;\r\n const first5 = line.substring(0, 5).toLowerCase();\r\n\r\n if (first5 === \"#else\") {\r\n const elseNode = new ShaderCodeNode();\r\n rootNode.children.push(elseNode);\r\n _MoveCursor(cursor, elseNode);\r\n return;\r\n } else if (first5 === \"#elif\") {\r\n const elifNode = _BuildExpression(line, 5);\r\n\r\n rootNode.children.push(elifNode);\r\n ifNode = elifNode;\r\n }\r\n }\r\n}\r\n\r\nfunction _MoveCursor(cursor: ShaderCodeCursor, rootNode: ShaderCodeNode): boolean {\r\n while (cursor.canRead) {\r\n cursor.lineIndex++;\r\n const line = cursor.currentLine;\r\n\r\n if (line.indexOf(\"#\") >= 0) {\r\n const matches = _MoveCursorRegex.exec(line);\r\n\r\n if (matches && matches.length) {\r\n const keyword = matches[0];\r\n\r\n switch (keyword) {\r\n case \"#ifdef\": {\r\n const newRootNode = new ShaderCodeConditionNode();\r\n rootNode.children.push(newRootNode);\r\n\r\n const ifNode = _BuildExpression(line, 6);\r\n newRootNode.children.push(ifNode);\r\n _MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#else\":\r\n case \"#elif\":\r\n return true;\r\n case \"#endif\":\r\n return false;\r\n case \"#ifndef\": {\r\n const newRootNode = new ShaderCodeConditionNode();\r\n rootNode.children.push(newRootNode);\r\n\r\n const ifNode = _BuildExpression(line, 7);\r\n newRootNode.children.push(ifNode);\r\n _MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#if\": {\r\n const newRootNode = new ShaderCodeConditionNode();\r\n const ifNode = _BuildExpression(line, 3);\r\n rootNode.children.push(newRootNode);\r\n\r\n newRootNode.children.push(ifNode);\r\n _MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n }\r\n continue;\r\n }\r\n }\r\n\r\n const newNode = new ShaderCodeNode();\r\n newNode.line = line;\r\n rootNode.children.push(newNode);\r\n\r\n // Detect additional defines\r\n if (line[0] === \"#\" && line[1] === \"d\") {\r\n const split = line.replace(\";\", \"\").split(\" \");\r\n newNode.additionalDefineKey = split[1];\r\n\r\n if (split.length === 3) {\r\n newNode.additionalDefineValue = split[2];\r\n }\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction _EvaluatePreProcessors(sourceCode: string, preprocessors: { [key: string]: string }, options: ProcessingOptions): string {\r\n const rootNode = new ShaderCodeNode();\r\n const cursor = new ShaderCodeCursor();\r\n\r\n cursor.lineIndex = -1;\r\n cursor.lines = sourceCode.split(\"\\n\");\r\n\r\n // Decompose (We keep it in 2 steps so it is easier to maintain and perf hit is insignificant)\r\n _MoveCursor(cursor, rootNode);\r\n\r\n // Recompose\r\n return rootNode.process(preprocessors, options);\r\n}\r\n\r\nfunction _PreparePreProcessors(options: ProcessingOptions, engine?: AbstractEngine): { [key: string]: string } {\r\n const defines = options.defines;\r\n const preprocessors: { [key: string]: string } = {};\r\n\r\n for (const define of defines) {\r\n const keyValue = define.replace(\"#define\", \"\").replace(\";\", \"\").trim();\r\n const split = keyValue.split(\" \");\r\n preprocessors[split[0]] = split.length > 1 ? split[1] : \"\";\r\n }\r\n\r\n if (options.processor?.shaderLanguage === ShaderLanguage.GLSL) {\r\n preprocessors[\"GL_ES\"] = \"true\";\r\n }\r\n preprocessors[\"__VERSION__\"] = options.version;\r\n preprocessors[options.platformName] = \"true\";\r\n\r\n _getGlobalDefines(preprocessors, engine?.isNDCHalfZRange, engine?.useReverseDepthBuffer, engine?.useExactSrgbConversions);\r\n\r\n return preprocessors;\r\n}\r\n\r\nfunction _ProcessShaderConversion(sourceCode: string, options: ProcessingOptions, engine?: AbstractEngine): string {\r\n let preparedSourceCode = _ProcessPrecision(sourceCode, options);\r\n\r\n if (!options.processor) {\r\n return preparedSourceCode;\r\n }\r\n\r\n // Already converted\r\n if (options.processor.shaderLanguage === ShaderLanguage.GLSL && preparedSourceCode.indexOf(\"#version 3\") !== -1) {\r\n preparedSourceCode = preparedSourceCode.replace(\"#version 300 es\", \"\");\r\n if (!options.processor.parseGLES3) {\r\n return preparedSourceCode;\r\n }\r\n }\r\n\r\n const defines = options.defines;\r\n\r\n const preprocessors = _PreparePreProcessors(options, engine);\r\n\r\n // General pre processing\r\n if (options.processor.preProcessor) {\r\n preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, preprocessors, options.isFragment, options.processingContext);\r\n }\r\n\r\n preparedSourceCode = _EvaluatePreProcessors(preparedSourceCode, preprocessors, options);\r\n\r\n // Post processing\r\n if (options.processor.postProcessor) {\r\n preparedSourceCode = options.processor.postProcessor(\r\n preparedSourceCode,\r\n defines,\r\n options.isFragment,\r\n options.processingContext,\r\n engine\r\n ? {\r\n drawBuffersExtensionDisabled: engine.getCaps().drawBuffersExtension ? false : true,\r\n }\r\n : {}\r\n );\r\n }\r\n\r\n // Inline functions tagged with #define inline\r\n if (engine?._features.needShaderCodeInlining) {\r\n preparedSourceCode = engine.inlineShaderCode(preparedSourceCode);\r\n }\r\n\r\n return preparedSourceCode;\r\n}\r\n\r\nfunction _ApplyPreProcessing(sourceCode: string, options: ProcessingOptions, engine: AbstractEngine): string {\r\n let preparedSourceCode = sourceCode;\r\n\r\n const defines = options.defines;\r\n\r\n const preprocessors = _PreparePreProcessors(options, engine);\r\n\r\n // General pre processing\r\n if (options.processor?.preProcessor) {\r\n preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, preprocessors, options.isFragment, options.processingContext);\r\n }\r\n\r\n preparedSourceCode = _EvaluatePreProcessors(preparedSourceCode, preprocessors, options);\r\n\r\n // Post processing\r\n if (options.processor?.postProcessor) {\r\n preparedSourceCode = options.processor.postProcessor(\r\n preparedSourceCode,\r\n defines,\r\n options.isFragment,\r\n options.processingContext,\r\n engine\r\n ? {\r\n drawBuffersExtensionDisabled: engine.getCaps().drawBuffersExtension ? false : true,\r\n }\r\n : {}\r\n );\r\n }\r\n\r\n // Inline functions tagged with #define inline\r\n if (engine._features.needShaderCodeInlining) {\r\n preparedSourceCode = engine.inlineShaderCode(preparedSourceCode);\r\n }\r\n\r\n return preparedSourceCode;\r\n}\r\n\r\n/** @internal */\r\nexport function _ProcessIncludes(sourceCode: string, options: ProcessingOptions, callback: (data: any) => void): void {\r\n reusableMatches.length = 0;\r\n let match: RegExpMatchArray | null;\r\n // stay back-compat to the old matchAll syntax\r\n while ((match = regexShaderInclude.exec(sourceCode)) !== null) {\r\n reusableMatches.push(match);\r\n }\r\n\r\n let returnValue = String(sourceCode);\r\n let parts = [sourceCode];\r\n\r\n let keepProcessing = false;\r\n\r\n for (const match of reusableMatches) {\r\n let includeFile = match[1];\r\n\r\n // Uniform declaration\r\n if (includeFile.indexOf(\"__decl__\") !== -1) {\r\n includeFile = includeFile.replace(regexShaderDecl, \"\");\r\n if (options.supportsUniformBuffers) {\r\n includeFile = includeFile.replace(\"Vertex\", \"Ubo\").replace(\"Fragment\", \"Ubo\");\r\n }\r\n includeFile = includeFile + \"Declaration\";\r\n }\r\n\r\n if (options.includesShadersStore[includeFile]) {\r\n // Substitution\r\n let includeContent = options.includesShadersStore[includeFile];\r\n if (match[2]) {\r\n const splits = match[3].split(\",\");\r\n\r\n for (let index = 0; index < splits.length; index += 2) {\r\n const source = new RegExp(splits[index], \"g\");\r\n const dest = splits[index + 1];\r\n\r\n includeContent = includeContent.replace(source, dest);\r\n }\r\n }\r\n\r\n if (match[4]) {\r\n const indexString = match[5];\r\n\r\n if (indexString.indexOf(\"..\") !== -1) {\r\n const indexSplits = indexString.split(\"..\");\r\n const minIndex = parseInt(indexSplits[0]);\r\n let maxIndex = parseInt(indexSplits[1]);\r\n let sourceIncludeContent = includeContent.slice(0);\r\n includeContent = \"\";\r\n\r\n if (isNaN(maxIndex)) {\r\n maxIndex = options.indexParameters[indexSplits[1]];\r\n }\r\n\r\n for (let i = minIndex; i < maxIndex; i++) {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n sourceIncludeContent = sourceIncludeContent.replace(regexLightX, (str: string, p1: string) => {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent += sourceIncludeContent.replace(regexX, i.toString()) + \"\\n\";\r\n }\r\n } else {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n includeContent = includeContent.replace(regexLightX, (str: string, p1: string) => {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent = includeContent.replace(regexX, indexString);\r\n }\r\n }\r\n\r\n // Replace\r\n // Split all parts on match[0] and intersperse the parts with the include content\r\n const newParts = [];\r\n for (const part of parts) {\r\n const splitPart = part.split(match[0]);\r\n for (let i = 0; i < splitPart.length - 1; i++) {\r\n newParts.push(splitPart[i]);\r\n newParts.push(includeContent);\r\n }\r\n newParts.push(splitPart[splitPart.length - 1]);\r\n }\r\n parts = newParts;\r\n\r\n keepProcessing = keepProcessing || includeContent.indexOf(\"#include<\") >= 0 || includeContent.indexOf(\"#include <\") >= 0;\r\n } else {\r\n const includeShaderUrl = options.shadersRepository + \"ShadersInclude/\" + includeFile + \".fx\";\r\n\r\n _functionContainer.loadFile(includeShaderUrl, (fileContent) => {\r\n options.includesShadersStore[includeFile] = fileContent as string;\r\n _ProcessIncludes(parts.join(\"\"), options, callback);\r\n });\r\n return;\r\n }\r\n }\r\n reusableMatches.length = 0;\r\n\r\n returnValue = parts.join(\"\");\r\n\r\n if (keepProcessing) {\r\n _ProcessIncludes(returnValue.toString(), options, callback);\r\n } else {\r\n callback(returnValue);\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport const _functionContainer = {\r\n /**\r\n * Loads a file from a url\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n * @internal\r\n */\r\n loadFile: (\r\n url: string,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void,\r\n onProgress?: (ev: ProgressEvent) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void\r\n ): IFileRequest => {\r\n throw _WarnImport(\"FileTools\");\r\n },\r\n};\r\n"]}
@@ -4,7 +4,6 @@
4
4
 
5
5
  import * as WebGPUConstants from "./webgpuConstants.js";
6
6
  import { VertexBuffer } from "../../Buffers/buffer.js";
7
- import { WebGPUShaderProcessor } from "./webgpuShaderProcessor.js";
8
7
  import { WebGPUTextureHelper } from "./webgpuTextureHelper.js";
9
8
  import { renderableTextureFormatToIndex } from "./webgpuTextureManager.js";
10
9
  var StatePosition;
@@ -698,7 +697,7 @@ export class WebGPUCacheRenderPipeline {
698
697
  if (entry.texture) {
699
698
  const name = shaderProcessingContext.bindGroupLayoutEntryInfo[i][entry.binding].name;
700
699
  const textureInfo = shaderProcessingContext.availableTextures[name];
701
- const samplerInfo = textureInfo.autoBindSampler ? shaderProcessingContext.availableSamplers[name + WebGPUShaderProcessor.AutoSamplerSuffix] : null;
700
+ const samplerInfo = textureInfo.autoBindSampler ? shaderProcessingContext.availableSamplers[name + `Sampler`] : null;
702
701
  let sampleType = textureInfo.sampleType;
703
702
  let samplerType = samplerInfo?.type ?? WebGPUConstants.SamplerBindingType.Filtering;
704
703
  if (this._textureState & bitVal && sampleType !== WebGPUConstants.TextureSampleType.Depth) {