@next2d/webgpu 3.0.5 → 3.1.0
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.
- package/package.json +3 -3
- package/src/AtlasManager.d.ts +75 -6
- package/src/AtlasManager.js +106 -30
- package/src/AttachmentManager/service/AttachmentManagerCreateAttachmentObjectService.d.ts +2 -2
- package/src/AttachmentManager/service/AttachmentManagerCreateAttachmentObjectService.js +3 -3
- package/src/AttachmentManager/service/AttachmentManagerCreateColorBufferService.d.ts +4 -4
- package/src/AttachmentManager/service/AttachmentManagerCreateColorBufferService.js +4 -4
- package/src/AttachmentManager/service/AttachmentManagerCreateStencilBufferService.d.ts +5 -5
- package/src/AttachmentManager/service/AttachmentManagerCreateStencilBufferService.js +6 -6
- package/src/AttachmentManager/service/AttachmentManagerCreateTextureObjectService.d.ts +6 -6
- package/src/AttachmentManager/service/AttachmentManagerCreateTextureObjectService.js +7 -7
- package/src/AttachmentManager/service/AttachmentManagerGetColorBufferService.d.ts +6 -6
- package/src/AttachmentManager/service/AttachmentManagerGetColorBufferService.js +9 -9
- package/src/AttachmentManager/service/AttachmentManagerGetStencilBufferService.d.ts +6 -6
- package/src/AttachmentManager/service/AttachmentManagerGetStencilBufferService.js +10 -10
- package/src/AttachmentManager/service/AttachmentManagerGetTextureService.d.ts +7 -7
- package/src/AttachmentManager/service/AttachmentManagerGetTextureService.js +10 -10
- package/src/AttachmentManager/service/AttachmentManagerReleaseTextureService.d.ts +3 -3
- package/src/AttachmentManager/service/AttachmentManagerReleaseTextureService.js +7 -7
- package/src/AttachmentManager/usecase/AttachmentManagerGetAttachmentObjectUseCase.d.ts +10 -10
- package/src/AttachmentManager/usecase/AttachmentManagerGetAttachmentObjectUseCase.js +16 -16
- package/src/AttachmentManager/usecase/AttachmentManagerReleaseAttachmentUseCase.d.ts +6 -6
- package/src/AttachmentManager/usecase/AttachmentManagerReleaseAttachmentUseCase.js +10 -10
- package/src/AttachmentManager.d.ts +28 -6
- package/src/AttachmentManager.js +28 -23
- package/src/BezierConverter/BezierConverter.d.ts +9 -3
- package/src/BezierConverter/BezierConverter.js +5 -3
- package/src/BezierConverter/usecase/BezierConverterAdaptiveCubicToQuadUseCase.d.ts +2 -13
- package/src/BezierConverter/usecase/BezierConverterAdaptiveCubicToQuadUseCase.js +13 -25
- package/src/Blend/BlendInstancedManager.d.ts +19 -15
- package/src/Blend/BlendInstancedManager.js +35 -22
- package/src/Blend/usecase/BlendApplyComplexBlendUseCase.d.ts +9 -2
- package/src/Blend/usecase/BlendApplyComplexBlendUseCase.js +28 -17
- package/src/Blend.d.ts +20 -2
- package/src/Blend.js +20 -4
- package/src/BufferManager/service/BufferManagerReleaseUniformBufferService.js +2 -2
- package/src/BufferManager/service/BufferManagerReleaseVertexBufferService.js +2 -2
- package/src/BufferManager/service/BufferManagerUpdateIndirectBufferService.d.ts +1 -0
- package/src/BufferManager/service/BufferManagerUpdateIndirectBufferService.js +1 -0
- package/src/BufferManager/usecase/BufferManagerCleanupStorageBuffersUseCase.d.ts +1 -0
- package/src/BufferManager/usecase/BufferManagerCleanupStorageBuffersUseCase.js +1 -0
- package/src/BufferManager.d.ts +108 -43
- package/src/BufferManager.js +113 -153
- package/src/Context/service/ContextComputeBitmapMatrixService.d.ts +7 -0
- package/src/Context/service/ContextComputeBitmapMatrixService.js +7 -0
- package/src/Context/service/ContextComputeGradientMatrixService.d.ts +9 -1
- package/src/Context/service/ContextComputeGradientMatrixService.js +15 -7
- package/src/Context/service/ContextFillSimpleService.d.ts +14 -0
- package/src/Context/service/ContextFillSimpleService.js +14 -0
- package/src/Context/service/ContextFillWithStencilMainService.d.ts +11 -0
- package/src/Context/service/ContextFillWithStencilMainService.js +11 -0
- package/src/Context/service/ContextFillWithStencilService.d.ts +11 -0
- package/src/Context/service/ContextFillWithStencilService.js +11 -0
- package/src/Context/usecase/ContextApplyFilterUseCase.d.ts +17 -0
- package/src/Context/usecase/ContextApplyFilterUseCase.js +201 -62
- package/src/Context/usecase/ContextBitmapFillUseCase.d.ts +23 -0
- package/src/Context/usecase/ContextBitmapFillUseCase.js +47 -0
- package/src/Context/usecase/ContextBitmapStrokeUseCase.d.ts +23 -0
- package/src/Context/usecase/ContextBitmapStrokeUseCase.js +35 -0
- package/src/Context/usecase/ContextClipUseCase.d.ts +15 -0
- package/src/Context/usecase/ContextClipUseCase.js +19 -0
- package/src/Context/usecase/ContextContainerEndLayerUseCase.d.ts +21 -1
- package/src/Context/usecase/ContextContainerEndLayerUseCase.js +195 -104
- package/src/Context/usecase/ContextDrawArraysInstancedUseCase.d.ts +13 -0
- package/src/Context/usecase/ContextDrawArraysInstancedUseCase.js +41 -20
- package/src/Context/usecase/ContextDrawIndirectUseCase.d.ts +16 -1
- package/src/Context/usecase/ContextDrawIndirectUseCase.js +53 -30
- package/src/Context/usecase/ContextGradientFillUseCase.d.ts +23 -0
- package/src/Context/usecase/ContextGradientFillUseCase.js +47 -0
- package/src/Context/usecase/ContextGradientStrokeUseCase.d.ts +23 -0
- package/src/Context/usecase/ContextGradientStrokeUseCase.js +35 -0
- package/src/Context/usecase/ContextProcessComplexBlendQueueUseCase.d.ts +13 -1
- package/src/Context/usecase/ContextProcessComplexBlendQueueUseCase.js +126 -60
- package/src/Context.d.ts +445 -63
- package/src/Context.js +566 -144
- package/src/FillTexturePool.d.ts +39 -0
- package/src/FillTexturePool.js +70 -7
- package/src/Filter/BevelFilter/FilterApplyBevelFilterUseCase.d.ts +21 -2
- package/src/Filter/BevelFilter/FilterApplyBevelFilterUseCase.js +33 -26
- package/src/Filter/BlurFilter/FilterApplyBlurFilterUseCase.d.ts +5 -5
- package/src/Filter/BlurFilter/FilterApplyBlurFilterUseCase.js +81 -64
- package/src/Filter/BlurFilterUseCase.d.ts +15 -11
- package/src/Filter/BlurFilterUseCase.js +22 -17
- package/src/Filter/ColorMatrixFilter/FilterApplyColorMatrixFilterUseCase.d.ts +2 -2
- package/src/Filter/ColorMatrixFilter/FilterApplyColorMatrixFilterUseCase.js +5 -5
- package/src/Filter/ConvolutionFilter/FilterApplyConvolutionFilterUseCase.d.ts +15 -1
- package/src/Filter/ConvolutionFilter/FilterApplyConvolutionFilterUseCase.js +23 -17
- package/src/Filter/DisplacementMapFilter/FilterApplyDisplacementMapFilterUseCase.d.ts +20 -1
- package/src/Filter/DisplacementMapFilter/FilterApplyDisplacementMapFilterUseCase.js +37 -26
- package/src/Filter/DropShadowFilter/FilterApplyDropShadowFilterUseCase.d.ts +7 -7
- package/src/Filter/DropShadowFilter/FilterApplyDropShadowFilterUseCase.js +19 -31
- package/src/Filter/FilterGradientLUTCache.js +2 -0
- package/src/Filter/FilterUtil.d.ts +23 -0
- package/src/Filter/FilterUtil.js +33 -0
- package/src/Filter/GlowFilter/FilterApplyGlowFilterUseCase.d.ts +5 -5
- package/src/Filter/GlowFilter/FilterApplyGlowFilterUseCase.js +12 -21
- package/src/Filter/GradientBevelFilter/FilterApplyGradientBevelFilterUseCase.d.ts +6 -6
- package/src/Filter/GradientBevelFilter/FilterApplyGradientBevelFilterUseCase.js +16 -19
- package/src/Filter/GradientGlowFilter/FilterApplyGradientGlowFilterUseCase.d.ts +5 -5
- package/src/Filter/GradientGlowFilter/FilterApplyGradientGlowFilterUseCase.js +13 -16
- package/src/FrameBufferManager/service/FrameBufferManagerCreateRenderPassDescriptorService.d.ts +13 -1
- package/src/FrameBufferManager/service/FrameBufferManagerCreateRenderPassDescriptorService.js +30 -3
- package/src/FrameBufferManager/service/FrameBufferManagerCreateStencilRenderPassDescriptorService.d.ts +11 -1
- package/src/FrameBufferManager/service/FrameBufferManagerCreateStencilRenderPassDescriptorService.js +36 -6
- package/src/FrameBufferManager/usecase/FrameBufferManagerCreateAttachmentUseCase.d.ts +10 -10
- package/src/FrameBufferManager/usecase/FrameBufferManagerCreateAttachmentUseCase.js +15 -15
- package/src/FrameBufferManager/usecase/FrameBufferManagerReleaseTemporaryAttachmentUseCase.d.ts +4 -4
- package/src/FrameBufferManager/usecase/FrameBufferManagerReleaseTemporaryAttachmentUseCase.js +5 -5
- package/src/FrameBufferManager.d.ts +95 -3
- package/src/FrameBufferManager.js +97 -8
- package/src/Gradient/GradientLUTCache.d.ts +36 -4
- package/src/Gradient/GradientLUTCache.js +61 -5
- package/src/Gradient/GradientLUTGenerator.d.ts +26 -14
- package/src/Gradient/GradientLUTGenerator.js +74 -43
- package/src/Mask/service/MaskUnionMaskService.d.ts +16 -1
- package/src/Mask/service/MaskUnionMaskService.js +45 -31
- package/src/Mask.d.ts +57 -3
- package/src/Mask.js +75 -11
- package/src/Mesh/service/MeshFillGenerateService.d.ts +4 -4
- package/src/Mesh/service/MeshFillGenerateService.js +4 -4
- package/src/Mesh/service/MeshStrokeFillGenerateService.d.ts +4 -4
- package/src/Mesh/service/MeshStrokeFillGenerateService.js +4 -4
- package/src/Mesh/usecase/MeshBitmapStrokeGenerateUseCase.d.ts +3 -3
- package/src/Mesh/usecase/MeshBitmapStrokeGenerateUseCase.js +10 -3
- package/src/Mesh/usecase/MeshFillGenerateUseCase.d.ts +2 -2
- package/src/Mesh/usecase/MeshFillGenerateUseCase.js +9 -2
- package/src/Mesh/usecase/MeshGradientStrokeGenerateUseCase.d.ts +3 -3
- package/src/Mesh/usecase/MeshGradientStrokeGenerateUseCase.js +10 -3
- package/src/Mesh/usecase/MeshStrokeGenerateUseCase.d.ts +8 -14
- package/src/Mesh/usecase/MeshStrokeGenerateUseCase.js +214 -129
- package/src/PathCommand.d.ts +24 -23
- package/src/PathCommand.js +25 -79
- package/src/Shader/PipelineManager.d.ts +223 -6
- package/src/Shader/PipelineManager.js +308 -66
- package/src/Shader/ShaderInstancedManager.d.ts +17 -0
- package/src/Shader/ShaderInstancedManager.js +17 -0
- package/src/Shader/ShaderSource.d.ts +317 -12
- package/src/Shader/ShaderSource.js +328 -39
- package/src/Shader/wgsl/common/SharedWgsl.d.ts +28 -1
- package/src/Shader/wgsl/common/SharedWgsl.js +28 -9
- package/src/Shader/wgsl/fragment/BasicFragment.d.ts +14 -0
- package/src/Shader/wgsl/fragment/BasicFragment.js +14 -0
- package/src/Shader/wgsl/fragment/BitmapFragment.d.ts +7 -0
- package/src/Shader/wgsl/fragment/BitmapFragment.js +7 -0
- package/src/Shader/wgsl/fragment/EffectFragment.d.ts +42 -0
- package/src/Shader/wgsl/fragment/EffectFragment.js +42 -0
- package/src/Shader/wgsl/fragment/FillFragment.d.ts +7 -0
- package/src/Shader/wgsl/fragment/FillFragment.js +7 -0
- package/src/Shader/wgsl/fragment/FilterFragment.d.ts +70 -0
- package/src/Shader/wgsl/fragment/FilterFragment.js +70 -0
- package/src/Shader/wgsl/fragment/GradientFragment.d.ts +21 -0
- package/src/Shader/wgsl/fragment/GradientFragment.js +43 -8
- package/src/Shader/wgsl/fragment/InstancedFragment.d.ts +7 -0
- package/src/Shader/wgsl/fragment/InstancedFragment.js +7 -0
- package/src/Shader/wgsl/fragment/MaskFragment.d.ts +7 -0
- package/src/Shader/wgsl/fragment/MaskFragment.js +7 -0
- package/src/Shader/wgsl/fragment/StencilFragment.d.ts +14 -0
- package/src/Shader/wgsl/fragment/StencilFragment.js +14 -0
- package/src/Shader/wgsl/vertex/BasicVertex.d.ts +7 -0
- package/src/Shader/wgsl/vertex/BasicVertex.js +7 -0
- package/src/Shader/wgsl/vertex/BitmapVertex.d.ts +7 -0
- package/src/Shader/wgsl/vertex/BitmapVertex.js +7 -0
- package/src/Shader/wgsl/vertex/FillVertex.d.ts +7 -0
- package/src/Shader/wgsl/vertex/FillVertex.js +7 -0
- package/src/Shader/wgsl/vertex/FilterVertex.d.ts +77 -1
- package/src/Shader/wgsl/vertex/FilterVertex.js +135 -42
- package/src/Shader/wgsl/vertex/GradientVertex.d.ts +7 -0
- package/src/Shader/wgsl/vertex/GradientVertex.js +7 -0
- package/src/Shader/wgsl/vertex/InstancedVertex.d.ts +7 -0
- package/src/Shader/wgsl/vertex/InstancedVertex.js +7 -0
- package/src/Shader/wgsl/vertex/MaskVertex.d.ts +7 -0
- package/src/Shader/wgsl/vertex/MaskVertex.js +7 -0
- package/src/Shader/wgsl/vertex/StencilVertex.d.ts +14 -0
- package/src/Shader/wgsl/vertex/StencilVertex.js +14 -0
- package/src/TextureManager/service/TextureManagerInitializeSamplersService.d.ts +2 -2
- package/src/TextureManager/service/TextureManagerInitializeSamplersService.js +2 -2
- package/src/TextureManager.d.ts +36 -5
- package/src/TextureManager.js +36 -24
- package/src/TexturePool/service/TexturePoolCleanupService.d.ts +4 -4
- package/src/TexturePool/service/TexturePoolCleanupService.js +6 -6
- package/src/TexturePool/service/TexturePoolReleaseService.d.ts +4 -4
- package/src/TexturePool/service/TexturePoolReleaseService.js +5 -5
- package/src/TexturePool/usecase/TexturePoolAcquireUseCase.d.ts +10 -10
- package/src/TexturePool/usecase/TexturePoolAcquireUseCase.js +19 -18
- package/src/TexturePool.d.ts +36 -35
- package/src/TexturePool.js +44 -65
- package/src/WebGPUUtil.d.ts +79 -34
- package/src/WebGPUUtil.js +79 -36
- package/src/interface/IAttachmentObject.d.ts +36 -0
- package/src/interface/IBlendMode.d.ts +7 -0
- package/src/interface/IBlendState.d.ts +8 -0
- package/src/interface/IBounds.d.ts +23 -0
- package/src/interface/IColorBufferObject.d.ts +28 -0
- package/src/interface/IComplexBlendItem.d.ts +48 -0
- package/src/interface/IFilterConfig.d.ts +28 -2
- package/src/interface/IGradientStop.d.ts +20 -0
- package/src/interface/ILocalFilterConfig.d.ts +32 -2
- package/src/interface/IMeshResult.d.ts +8 -0
- package/src/interface/IPoint.d.ts +12 -0
- package/src/interface/IPooledTexture.d.ts +24 -0
- package/src/interface/IQuadraticSegment.d.ts +8 -0
- package/src/interface/IStencilBufferObject.d.ts +28 -0
- package/src/interface/IStorageBufferConfig.d.ts +8 -1
- package/src/interface/ITextureObject.d.ts +28 -0
- package/src/AttachmentManager/service/AttachmentManagerCreateRenderPassDescriptorService.d.ts +0 -5
- package/src/AttachmentManager/service/AttachmentManagerCreateRenderPassDescriptorService.js +0 -42
- package/src/Blend/service/BlendAddService.d.ts +0 -1
- package/src/Blend/service/BlendAddService.js +0 -8
- package/src/Blend/service/BlendAlphaService.d.ts +0 -1
- package/src/Blend/service/BlendAlphaService.js +0 -8
- package/src/Blend/service/BlendEraseService.d.ts +0 -1
- package/src/Blend/service/BlendEraseService.js +0 -8
- package/src/Blend/service/BlendGetStateService.d.ts +0 -12
- package/src/Blend/service/BlendGetStateService.js +0 -13
- package/src/Blend/service/BlendOneZeroService.d.ts +0 -1
- package/src/Blend/service/BlendOneZeroService.js +0 -8
- package/src/Blend/service/BlendResetService.d.ts +0 -1
- package/src/Blend/service/BlendResetService.js +0 -8
- package/src/Blend/service/BlendScreenService.d.ts +0 -1
- package/src/Blend/service/BlendScreenService.js +0 -8
- package/src/Blend/service/BlendSetModeService.d.ts +0 -2
- package/src/Blend/service/BlendSetModeService.js +0 -4
- package/src/Blend/usecase/BlendOperationUseCase.d.ts +0 -11
- package/src/Blend/usecase/BlendOperationUseCase.js +0 -31
- package/src/BufferManager/usecase/BufferManagerReleaseStorageBufferUseCase.d.ts +0 -9
- package/src/BufferManager/usecase/BufferManagerReleaseStorageBufferUseCase.js +0 -15
- package/src/Compute/ComputePipelineManager.d.ts +0 -61
- package/src/Compute/ComputePipelineManager.js +0 -313
- package/src/Compute/service/ComputeExecuteBlurService.d.ts +0 -21
- package/src/Compute/service/ComputeExecuteBlurService.js +0 -81
- package/src/Filter/BevelFilterShader.d.ts +0 -2
- package/src/Filter/BevelFilterShader.js +0 -107
- package/src/Filter/BitmapFilterShader.d.ts +0 -2
- package/src/Filter/BitmapFilterShader.js +0 -207
- package/src/Filter/BlurFilter/service/BlurFilterComputeShaderService.d.ts +0 -40
- package/src/Filter/BlurFilter/service/BlurFilterComputeShaderService.js +0 -51
- package/src/Filter/BlurFilter/usecase/FilterApplyBlurComputeUseCase.d.ts +0 -25
- package/src/Filter/BlurFilter/usecase/FilterApplyBlurComputeUseCase.js +0 -180
- package/src/Filter/BlurFilterShader.d.ts +0 -5
- package/src/Filter/BlurFilterShader.js +0 -109
- package/src/Filter/ColorMatrixFilterShader.d.ts +0 -4
- package/src/Filter/ColorMatrixFilterShader.js +0 -51
- package/src/Filter/ConvolutionFilterShader.d.ts +0 -2
- package/src/Filter/ConvolutionFilterShader.js +0 -115
- package/src/Filter/DisplacementMapFilterShader.d.ts +0 -2
- package/src/Filter/DisplacementMapFilterShader.js +0 -114
- package/src/Filter/DropShadowFilterShader.d.ts +0 -4
- package/src/Filter/DropShadowFilterShader.js +0 -93
- package/src/Filter/GlowFilterShader.d.ts +0 -4
- package/src/Filter/GlowFilterShader.js +0 -66
- package/src/FrameBufferManager/service/FrameBufferManagerFlushPendingReleasesService.d.ts +0 -11
- package/src/FrameBufferManager/service/FrameBufferManagerFlushPendingReleasesService.js +0 -19
- package/src/Mask/usecase/MaskBindUseCase.d.ts +0 -10
- package/src/Mask/usecase/MaskBindUseCase.js +0 -20
- package/src/Mesh/service/MeshLerpService.d.ts +0 -13
- package/src/Mesh/service/MeshLerpService.js +0 -17
- package/src/Mesh/usecase/MeshSplitQuadraticBezierUseCase.d.ts +0 -14
- package/src/Mesh/usecase/MeshSplitQuadraticBezierUseCase.js +0 -28
- package/src/Mesh/usecase/MeshStrokeFillGenerateUseCase.d.ts +0 -18
- package/src/Mesh/usecase/MeshStrokeFillGenerateUseCase.js +0 -54
- package/src/SamplerCache/service/SamplerCacheCreateCommonSamplersService.d.ts +0 -11
- package/src/SamplerCache/service/SamplerCacheCreateCommonSamplersService.js +0 -35
- package/src/SamplerCache/service/SamplerCacheGenerateKeyService.d.ts +0 -13
- package/src/SamplerCache/service/SamplerCacheGenerateKeyService.js +0 -15
- package/src/SamplerCache/service/SamplerCacheGetOrCreateService.d.ts +0 -15
- package/src/SamplerCache/service/SamplerCacheGetOrCreateService.js +0 -30
- package/src/SamplerCache.d.ts +0 -18
- package/src/SamplerCache.js +0 -61
- package/src/Shader/BlendModeShader.d.ts +0 -51
- package/src/Shader/BlendModeShader.js +0 -71
- package/src/Shader/GradientLUTGenerator/service/GradientLUTCalculateResolutionService.d.ts +0 -12
- package/src/Shader/GradientLUTGenerator/service/GradientLUTCalculateResolutionService.js +0 -28
- package/src/Shader/GradientLUTGenerator/service/GradientLUTGeneratePixelsService.d.ts +0 -13
- package/src/Shader/GradientLUTGenerator/service/GradientLUTGeneratePixelsService.js +0 -61
- package/src/Shader/GradientLUTGenerator/service/GradientLUTInterpolateColorService.d.ts +0 -19
- package/src/Shader/GradientLUTGenerator/service/GradientLUTInterpolateColorService.js +0 -37
- package/src/Shader/GradientLUTGenerator/service/GradientLUTParseStopsService.d.ts +0 -11
- package/src/Shader/GradientLUTGenerator/service/GradientLUTParseStopsService.js +0 -24
- package/src/Shader/GradientLUTGenerator/usecase/GradientLUTGenerateDataUseCase.d.ts +0 -14
- package/src/Shader/GradientLUTGenerator/usecase/GradientLUTGenerateDataUseCase.js +0 -24
- package/src/Shader/wgsl/fragment/BlendFragment.d.ts +0 -8
- package/src/Shader/wgsl/fragment/BlendFragment.js +0 -63
- package/src/TextureManager/usecase/TextureManagerCreateTextureFromImageBitmapUseCase.d.ts +0 -13
- package/src/TextureManager/usecase/TextureManagerCreateTextureFromImageBitmapUseCase.js +0 -30
- package/src/TextureManager/usecase/TextureManagerCreateTextureFromPixelsUseCase.d.ts +0 -15
- package/src/TextureManager/usecase/TextureManagerCreateTextureFromPixelsUseCase.js +0 -26
- package/src/TexturePool/service/TexturePoolEvictOldestService.d.ts +0 -11
- package/src/TexturePool/service/TexturePoolEvictOldestService.js +0 -24
- package/src/interface/ICachedBindGroup.d.ts +0 -8
- package/src/interface/ICachedBindGroup.js +0 -1
- package/src/interface/IGradientLUTData.d.ts +0 -8
- package/src/interface/IGradientLUTData.js +0 -1
- package/src/interface/IPooledBuffer.d.ts +0 -8
- package/src/interface/IPooledBuffer.js +0 -1
- package/src/interface/IRectangleInfo.d.ts +0 -13
- package/src/interface/IRectangleInfo.js +0 -1
package/src/Context.js
CHANGED
|
@@ -5,9 +5,7 @@ import { PathCommand } from "./PathCommand";
|
|
|
5
5
|
import { BufferManager } from "./BufferManager";
|
|
6
6
|
import { TextureManager } from "./TextureManager";
|
|
7
7
|
import { FrameBufferManager } from "./FrameBufferManager";
|
|
8
|
-
import { AttachmentManager } from "./AttachmentManager";
|
|
9
8
|
import { PipelineManager } from "./Shader/PipelineManager";
|
|
10
|
-
import { ComputePipelineManager } from "./Compute/ComputePipelineManager";
|
|
11
9
|
import { $rootNodes, $resetAtlas, $getActiveAtlasIndex, $setActiveAtlasIndex, $setAtlasCreator, $getAtlasAttachmentObject, $getAtlasAttachmentObjectByIndex } from "./AtlasManager";
|
|
12
10
|
import { addDisplayObjectToInstanceArray, getInstancedShaderManager } from "./Blend/BlendInstancedManager";
|
|
13
11
|
import { execute as maskBeginMaskService } from "./Mask/service/MaskBeginMaskService";
|
|
@@ -38,14 +36,17 @@ import { execute as contextApplyFilterUseCase } from "./Context/usecase/ContextA
|
|
|
38
36
|
import { execute as contextContainerEndLayerUseCase } from "./Context/usecase/ContextContainerEndLayerUseCase";
|
|
39
37
|
/**
|
|
40
38
|
* @description スワップチェーン転送用のIdentity UV定数: scale=(1,1), offset=(0,0)
|
|
39
|
+
* Identity UV constant for swap-chain transfer: scale=(1,1), offset=(0,0)
|
|
41
40
|
*/
|
|
42
41
|
const $IDENTITY_UV = new Float32Array([1.0, 1.0, 0.0, 0.0]);
|
|
43
42
|
/**
|
|
44
43
|
* @description save()/restore()用の Float32Array プール
|
|
44
|
+
* Float32Array pool for save()/restore() operations
|
|
45
45
|
*/
|
|
46
46
|
const $matrixPool = [];
|
|
47
47
|
/**
|
|
48
48
|
* @description leaveMask() 用フルスクリーンメッシュ定数
|
|
49
|
+
* Full-screen mesh constant for leaveMask()
|
|
49
50
|
*/
|
|
50
51
|
const $FULLSCREEN_MESH = new Float32Array([
|
|
51
52
|
// Triangle 1: (0,0), (1,0), (0,1)
|
|
@@ -59,6 +60,7 @@ const $FULLSCREEN_MESH = new Float32Array([
|
|
|
59
60
|
]);
|
|
60
61
|
/**
|
|
61
62
|
* @description clearNodeArea() 用クワッド頂点定数
|
|
63
|
+
* Quad vertex constant for clearNodeArea()
|
|
62
64
|
*/
|
|
63
65
|
const $QUAD_VERTICES = new Float32Array([
|
|
64
66
|
0, 0, // 左上
|
|
@@ -70,10 +72,17 @@ const $QUAD_VERTICES = new Float32Array([
|
|
|
70
72
|
]);
|
|
71
73
|
/**
|
|
72
74
|
* @description containerDrawCachedFilter() 用 CT uniform プリアロケート
|
|
75
|
+
* Pre-allocated CT uniform for containerDrawCachedFilter()
|
|
73
76
|
*/
|
|
74
77
|
const $ctUniform8 = new Float32Array(8);
|
|
78
|
+
/**
|
|
79
|
+
* @description copyTempToAtlasNode() 用 uniform プリアロケート (scale=1,-1, offset=0,1)
|
|
80
|
+
* Pre-allocated uniform for atlas node copy with Y-flip
|
|
81
|
+
*/
|
|
82
|
+
const $atlasNodeCopyUniform = new Float32Array([1, -1, 0, 1]);
|
|
75
83
|
/**
|
|
76
84
|
* @description fill() 用 uniform プリアロケート (color + matrix = 16 floats = 64 bytes)
|
|
85
|
+
* Pre-allocated uniform for fill() (color + matrix = 16 floats = 64 bytes)
|
|
77
86
|
*/
|
|
78
87
|
const $fillUniform16 = new Float32Array(16);
|
|
79
88
|
// present() 用 Static BindGroup キャッシュ
|
|
@@ -137,343 +146,381 @@ const $msaaDescriptor = {
|
|
|
137
146
|
* @class
|
|
138
147
|
*/
|
|
139
148
|
export class Context {
|
|
149
|
+
/**
|
|
150
|
+
* @description WebGPUコンテキストを初期化する
|
|
151
|
+
* Initialize the WebGPU context
|
|
152
|
+
*
|
|
153
|
+
* @param {GPUDevice} device - GPUデバイス / GPU device instance
|
|
154
|
+
* @param {GPUCanvasContext} canvas_context - GPUキャンバスコンテキスト / GPU canvas context
|
|
155
|
+
* @param {GPUTextureFormat} preferred_format - 優先テクスチャフォーマット / Preferred texture format
|
|
156
|
+
* @param {number} device_pixel_ratio - デバイスピクセル比 / Device pixel ratio
|
|
157
|
+
*/
|
|
140
158
|
constructor(device, canvas_context, preferred_format, device_pixel_ratio = 1) {
|
|
159
|
+
/** @description 変換行列スタック / Transform matrix stack */
|
|
141
160
|
Object.defineProperty(this, "$stack", {
|
|
142
161
|
enumerable: true,
|
|
143
162
|
configurable: true,
|
|
144
163
|
writable: true,
|
|
145
164
|
value: void 0
|
|
146
165
|
});
|
|
166
|
+
/** @description 現在の2D変換行列 / Current 2D transform matrix */
|
|
147
167
|
Object.defineProperty(this, "$matrix", {
|
|
148
168
|
enumerable: true,
|
|
149
169
|
configurable: true,
|
|
150
170
|
writable: true,
|
|
151
171
|
value: void 0
|
|
152
172
|
});
|
|
173
|
+
/** @description 背景クリア色R / Background clear color R */
|
|
153
174
|
Object.defineProperty(this, "$clearColorR", {
|
|
154
175
|
enumerable: true,
|
|
155
176
|
configurable: true,
|
|
156
177
|
writable: true,
|
|
157
178
|
value: void 0
|
|
158
179
|
});
|
|
180
|
+
/** @description 背景クリア色G / Background clear color G */
|
|
159
181
|
Object.defineProperty(this, "$clearColorG", {
|
|
160
182
|
enumerable: true,
|
|
161
183
|
configurable: true,
|
|
162
184
|
writable: true,
|
|
163
185
|
value: void 0
|
|
164
186
|
});
|
|
187
|
+
/** @description 背景クリア色B / Background clear color B */
|
|
165
188
|
Object.defineProperty(this, "$clearColorB", {
|
|
166
189
|
enumerable: true,
|
|
167
190
|
configurable: true,
|
|
168
191
|
writable: true,
|
|
169
192
|
value: void 0
|
|
170
193
|
});
|
|
194
|
+
/** @description 背景クリア色A / Background clear color A */
|
|
171
195
|
Object.defineProperty(this, "$clearColorA", {
|
|
172
196
|
enumerable: true,
|
|
173
197
|
configurable: true,
|
|
174
198
|
writable: true,
|
|
175
199
|
value: void 0
|
|
176
200
|
});
|
|
201
|
+
/** @description メインアタッチメントオブジェクト / Main attachment object */
|
|
177
202
|
Object.defineProperty(this, "$mainAttachmentObject", {
|
|
178
203
|
enumerable: true,
|
|
179
204
|
configurable: true,
|
|
180
205
|
writable: true,
|
|
181
206
|
value: void 0
|
|
182
207
|
});
|
|
208
|
+
/** @description アタッチメントオブジェクトのスタック / Attachment object stack */
|
|
183
209
|
Object.defineProperty(this, "$stackAttachmentObject", {
|
|
184
210
|
enumerable: true,
|
|
185
211
|
configurable: true,
|
|
186
212
|
writable: true,
|
|
187
213
|
value: void 0
|
|
188
214
|
});
|
|
215
|
+
/** @description グローバルアルファ値 / Global alpha value */
|
|
189
216
|
Object.defineProperty(this, "globalAlpha", {
|
|
190
217
|
enumerable: true,
|
|
191
218
|
configurable: true,
|
|
192
219
|
writable: true,
|
|
193
220
|
value: void 0
|
|
194
221
|
});
|
|
222
|
+
/** @description グローバル合成操作 / Global composite operation */
|
|
195
223
|
Object.defineProperty(this, "globalCompositeOperation", {
|
|
196
224
|
enumerable: true,
|
|
197
225
|
configurable: true,
|
|
198
226
|
writable: true,
|
|
199
227
|
value: void 0
|
|
200
228
|
});
|
|
229
|
+
/** @description 画像スムージングの有効/無効 / Whether image smoothing is enabled */
|
|
201
230
|
Object.defineProperty(this, "imageSmoothingEnabled", {
|
|
202
231
|
enumerable: true,
|
|
203
232
|
configurable: true,
|
|
204
233
|
writable: true,
|
|
205
234
|
value: void 0
|
|
206
235
|
});
|
|
236
|
+
/** @description 塗りつぶしスタイル / Fill style color */
|
|
207
237
|
Object.defineProperty(this, "$fillStyle", {
|
|
208
238
|
enumerable: true,
|
|
209
239
|
configurable: true,
|
|
210
240
|
writable: true,
|
|
211
241
|
value: void 0
|
|
212
242
|
});
|
|
243
|
+
/** @description 線スタイル / Stroke style color */
|
|
213
244
|
Object.defineProperty(this, "$strokeStyle", {
|
|
214
245
|
enumerable: true,
|
|
215
246
|
configurable: true,
|
|
216
247
|
writable: true,
|
|
217
248
|
value: void 0
|
|
218
249
|
});
|
|
250
|
+
/** @description マスク描画範囲 / Mask drawing bounds */
|
|
219
251
|
Object.defineProperty(this, "maskBounds", {
|
|
220
252
|
enumerable: true,
|
|
221
253
|
configurable: true,
|
|
222
254
|
writable: true,
|
|
223
255
|
value: void 0
|
|
224
256
|
});
|
|
257
|
+
/** @description 線の太さ / Line thickness */
|
|
225
258
|
Object.defineProperty(this, "thickness", {
|
|
226
259
|
enumerable: true,
|
|
227
260
|
configurable: true,
|
|
228
261
|
writable: true,
|
|
229
262
|
value: void 0
|
|
230
263
|
});
|
|
264
|
+
/** @description 線端の形状 / Line cap style */
|
|
231
265
|
Object.defineProperty(this, "caps", {
|
|
232
266
|
enumerable: true,
|
|
233
267
|
configurable: true,
|
|
234
268
|
writable: true,
|
|
235
269
|
value: void 0
|
|
236
270
|
});
|
|
271
|
+
/** @description 線の結合スタイル / Line joint style */
|
|
237
272
|
Object.defineProperty(this, "joints", {
|
|
238
273
|
enumerable: true,
|
|
239
274
|
configurable: true,
|
|
240
275
|
writable: true,
|
|
241
276
|
value: void 0
|
|
242
277
|
});
|
|
278
|
+
/** @description マイターリミット / Miter limit */
|
|
243
279
|
Object.defineProperty(this, "miterLimit", {
|
|
244
280
|
enumerable: true,
|
|
245
281
|
configurable: true,
|
|
246
282
|
writable: true,
|
|
247
283
|
value: void 0
|
|
248
284
|
});
|
|
285
|
+
/** @description GPUデバイス / GPU device instance */
|
|
249
286
|
Object.defineProperty(this, "device", {
|
|
250
287
|
enumerable: true,
|
|
251
288
|
configurable: true,
|
|
252
289
|
writable: true,
|
|
253
290
|
value: void 0
|
|
254
291
|
});
|
|
292
|
+
/** @description GPUキャンバスコンテキスト / GPU canvas context */
|
|
255
293
|
Object.defineProperty(this, "canvasContext", {
|
|
256
294
|
enumerable: true,
|
|
257
295
|
configurable: true,
|
|
258
296
|
writable: true,
|
|
259
297
|
value: void 0
|
|
260
298
|
});
|
|
299
|
+
/** @description 優先テクスチャフォーマット / Preferred texture format */
|
|
261
300
|
Object.defineProperty(this, "preferredFormat", {
|
|
262
301
|
enumerable: true,
|
|
263
302
|
configurable: true,
|
|
264
303
|
writable: true,
|
|
265
304
|
value: void 0
|
|
266
305
|
});
|
|
306
|
+
/** @description コマンドエンコーダー / Command encoder */
|
|
267
307
|
Object.defineProperty(this, "commandEncoder", {
|
|
268
308
|
enumerable: true,
|
|
269
309
|
configurable: true,
|
|
270
310
|
writable: true,
|
|
271
311
|
value: null
|
|
272
312
|
});
|
|
313
|
+
/** @description レンダーパスエンコーダー / Render pass encoder */
|
|
273
314
|
Object.defineProperty(this, "renderPassEncoder", {
|
|
274
315
|
enumerable: true,
|
|
275
316
|
configurable: true,
|
|
276
317
|
writable: true,
|
|
277
318
|
value: null
|
|
278
319
|
});
|
|
279
|
-
|
|
320
|
+
/** @description メインキャンバステクスチャ(最終表示用、フレームごとに1回取得) / Main canvas texture (for final display, acquired once per frame) */
|
|
280
321
|
Object.defineProperty(this, "mainTexture", {
|
|
281
322
|
enumerable: true,
|
|
282
323
|
configurable: true,
|
|
283
324
|
writable: true,
|
|
284
325
|
value: null
|
|
285
326
|
});
|
|
327
|
+
/** @description メインキャンバステクスチャビュー / Main canvas texture view */
|
|
286
328
|
Object.defineProperty(this, "mainTextureView", {
|
|
287
329
|
enumerable: true,
|
|
288
330
|
configurable: true,
|
|
289
331
|
writable: true,
|
|
290
332
|
value: null
|
|
291
333
|
});
|
|
334
|
+
/** @description フレーム開始済みフラグ / Whether the frame has been started */
|
|
292
335
|
Object.defineProperty(this, "frameStarted", {
|
|
293
336
|
enumerable: true,
|
|
294
337
|
configurable: true,
|
|
295
338
|
writable: true,
|
|
296
339
|
value: false
|
|
297
340
|
});
|
|
298
|
-
|
|
341
|
+
/** @description フレームごとの一時テクスチャ(endFrame()でdestroy) / Per-frame temporary textures (destroyed in endFrame()) */
|
|
299
342
|
Object.defineProperty(this, "frameTextures", {
|
|
300
343
|
enumerable: true,
|
|
301
344
|
configurable: true,
|
|
302
345
|
writable: true,
|
|
303
346
|
value: []
|
|
304
347
|
});
|
|
305
|
-
|
|
348
|
+
/** @description フレームごとのプール管理テクスチャ(endFrame()でプールに返却) / Per-frame pooled textures (returned to pool in endFrame()) */
|
|
306
349
|
Object.defineProperty(this, "pooledTextures", {
|
|
307
350
|
enumerable: true,
|
|
308
351
|
configurable: true,
|
|
309
352
|
writable: true,
|
|
310
353
|
value: []
|
|
311
354
|
});
|
|
312
|
-
|
|
355
|
+
/** @description フレームごとのレンダーテクスチャプール管理(endFrame()でプールに返却) / Per-frame render texture pool (returned to pool in endFrame()) */
|
|
313
356
|
Object.defineProperty(this, "pooledRenderTextures", {
|
|
314
357
|
enumerable: true,
|
|
315
358
|
configurable: true,
|
|
316
359
|
writable: true,
|
|
317
360
|
value: []
|
|
318
361
|
});
|
|
319
|
-
|
|
362
|
+
/** @description 現在のレンダーターゲット(メインまたはアトラス) / Current render target (could be main or atlas) */
|
|
320
363
|
Object.defineProperty(this, "currentRenderTarget", {
|
|
321
364
|
enumerable: true,
|
|
322
365
|
configurable: true,
|
|
323
366
|
writable: true,
|
|
324
367
|
value: null
|
|
325
368
|
});
|
|
326
|
-
|
|
369
|
+
/** @description 現在のビューポート幅(アトラス描画時はアトラスサイズ) / Current viewport width (atlas size during atlas rendering) */
|
|
327
370
|
Object.defineProperty(this, "viewportWidth", {
|
|
328
371
|
enumerable: true,
|
|
329
372
|
configurable: true,
|
|
330
373
|
writable: true,
|
|
331
374
|
value: 0
|
|
332
375
|
});
|
|
376
|
+
/** @description 現在のビューポート高さ(アトラス描画時はアトラスサイズ) / Current viewport height (atlas size during atlas rendering) */
|
|
333
377
|
Object.defineProperty(this, "viewportHeight", {
|
|
334
378
|
enumerable: true,
|
|
335
379
|
configurable: true,
|
|
336
380
|
writable: true,
|
|
337
381
|
value: 0
|
|
338
382
|
});
|
|
383
|
+
/** @description パスコマンド / Path command handler */
|
|
339
384
|
Object.defineProperty(this, "pathCommand", {
|
|
340
385
|
enumerable: true,
|
|
341
386
|
configurable: true,
|
|
342
387
|
writable: true,
|
|
343
388
|
value: void 0
|
|
344
389
|
});
|
|
390
|
+
/** @description バッファマネージャー / Buffer manager */
|
|
345
391
|
Object.defineProperty(this, "bufferManager", {
|
|
346
392
|
enumerable: true,
|
|
347
393
|
configurable: true,
|
|
348
394
|
writable: true,
|
|
349
395
|
value: void 0
|
|
350
396
|
});
|
|
397
|
+
/** @description テクスチャマネージャー / Texture manager */
|
|
351
398
|
Object.defineProperty(this, "textureManager", {
|
|
352
399
|
enumerable: true,
|
|
353
400
|
configurable: true,
|
|
354
401
|
writable: true,
|
|
355
402
|
value: void 0
|
|
356
403
|
});
|
|
404
|
+
/** @description フレームバッファマネージャー / Frame buffer manager */
|
|
357
405
|
Object.defineProperty(this, "frameBufferManager", {
|
|
358
406
|
enumerable: true,
|
|
359
407
|
configurable: true,
|
|
360
408
|
writable: true,
|
|
361
409
|
value: void 0
|
|
362
410
|
});
|
|
411
|
+
/** @description パイプラインマネージャー / Pipeline manager */
|
|
363
412
|
Object.defineProperty(this, "pipelineManager", {
|
|
364
413
|
enumerable: true,
|
|
365
414
|
configurable: true,
|
|
366
415
|
writable: true,
|
|
367
416
|
value: void 0
|
|
368
417
|
});
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
configurable: true,
|
|
372
|
-
writable: true,
|
|
373
|
-
value: void 0
|
|
374
|
-
});
|
|
375
|
-
Object.defineProperty(this, "attachmentManager", {
|
|
418
|
+
/** @description 新しい描画状態フラグ / New draw state flag */
|
|
419
|
+
Object.defineProperty(this, "newDrawState", {
|
|
376
420
|
enumerable: true,
|
|
377
421
|
configurable: true,
|
|
378
422
|
writable: true,
|
|
379
|
-
value:
|
|
423
|
+
value: false
|
|
380
424
|
});
|
|
381
|
-
|
|
425
|
+
/** @description cacheAsBitmap用の保留中アトラスノードスタック / Pending atlas nodes stack for cacheAsBitmap */
|
|
426
|
+
Object.defineProperty(this, "_pendingAtlasNodes", {
|
|
382
427
|
enumerable: true,
|
|
383
428
|
configurable: true,
|
|
384
429
|
writable: true,
|
|
385
|
-
value:
|
|
430
|
+
value: []
|
|
386
431
|
});
|
|
387
|
-
|
|
432
|
+
/** @description コンテナレイヤースタック(フィルター/ブレンド用) / Container layer stack (for filter/blend) */
|
|
388
433
|
Object.defineProperty(this, "$containerLayerStack", {
|
|
389
434
|
enumerable: true,
|
|
390
435
|
configurable: true,
|
|
391
436
|
writable: true,
|
|
392
437
|
value: []
|
|
393
438
|
});
|
|
439
|
+
/** @description コンテナレイヤーのコンテンツサイズ / Container layer content sizes */
|
|
394
440
|
Object.defineProperty(this, "containerLayerContentSizes", {
|
|
395
441
|
enumerable: true,
|
|
396
442
|
configurable: true,
|
|
397
443
|
writable: true,
|
|
398
444
|
value: []
|
|
399
445
|
});
|
|
400
|
-
|
|
446
|
+
/** @description マスク描画モードフラグ(beginMask〜endMask間でtrue) / Mask drawing mode flag (true between beginMask and endMask) */
|
|
401
447
|
Object.defineProperty(this, "inMaskMode", {
|
|
402
448
|
enumerable: true,
|
|
403
449
|
configurable: true,
|
|
404
450
|
writable: true,
|
|
405
451
|
value: false
|
|
406
452
|
});
|
|
407
|
-
|
|
453
|
+
/** @description ノード領域クリア済みフラグ(beginNodeRendering〜endNodeRendering間で使用) / Node area cleared flag (used between beginNodeRendering and endNodeRendering) */
|
|
408
454
|
Object.defineProperty(this, "nodeAreaCleared", {
|
|
409
455
|
enumerable: true,
|
|
410
456
|
configurable: true,
|
|
411
457
|
writable: true,
|
|
412
458
|
value: false
|
|
413
459
|
});
|
|
414
|
-
|
|
460
|
+
/** @description 現在のノードのシザー範囲(クリア後に戻すため) / Current node scissor rect (to restore after clearing) */
|
|
415
461
|
Object.defineProperty(this, "currentNodeScissor", {
|
|
416
462
|
enumerable: true,
|
|
417
463
|
configurable: true,
|
|
418
464
|
writable: true,
|
|
419
465
|
value: null
|
|
420
466
|
});
|
|
421
|
-
|
|
467
|
+
/** @description アトラスレンダーパス統合: 同一アトラスへの連続描画でパスを再利用 / Atlas render pass integration: reuse pass for consecutive draws to the same atlas */
|
|
422
468
|
Object.defineProperty(this, "nodeRenderPassAtlasIndex", {
|
|
423
469
|
enumerable: true,
|
|
424
470
|
configurable: true,
|
|
425
471
|
writable: true,
|
|
426
472
|
value: -1
|
|
427
473
|
});
|
|
428
|
-
|
|
474
|
+
/** @description Dynamic Uniform BindGroup(fill/stencilパイプライン共有、フレームごとに1回作成) / Dynamic Uniform BindGroup (shared by fill/stencil pipelines, created once per frame) */
|
|
429
475
|
Object.defineProperty(this, "fillDynamicBindGroup", {
|
|
430
476
|
enumerable: true,
|
|
431
477
|
configurable: true,
|
|
432
478
|
writable: true,
|
|
433
479
|
value: null
|
|
434
480
|
});
|
|
481
|
+
/** @description Dynamic Uniform BindGroupのバッファ / Dynamic Uniform BindGroup buffer */
|
|
435
482
|
Object.defineProperty(this, "fillDynamicBindGroupBuffer", {
|
|
436
483
|
enumerable: true,
|
|
437
484
|
configurable: true,
|
|
438
485
|
writable: true,
|
|
439
486
|
value: null
|
|
440
487
|
});
|
|
441
|
-
|
|
488
|
+
/** @description clearNodeArea() 用頂点バッファキャッシュ / Vertex buffer cache for clearNodeArea() */
|
|
442
489
|
Object.defineProperty(this, "nodeClearQuadBuffer", {
|
|
443
490
|
enumerable: true,
|
|
444
491
|
configurable: true,
|
|
445
492
|
writable: true,
|
|
446
493
|
value: null
|
|
447
494
|
});
|
|
448
|
-
|
|
495
|
+
/** @description Storage Buffer + Indirect Drawing を使用するかどうか / Whether to use Storage Buffer + Indirect Drawing */
|
|
449
496
|
Object.defineProperty(this, "useOptimizedInstancing", {
|
|
450
497
|
enumerable: true,
|
|
451
498
|
configurable: true,
|
|
452
499
|
writable: true,
|
|
453
500
|
value: true
|
|
454
501
|
});
|
|
455
|
-
|
|
456
|
-
// ($resizeComplete()でcanvas.width/heightが設定された後、ensureMainTexture()でconfigure()を呼ぶ)
|
|
502
|
+
/** @description リサイズ後にcanvasContextの再設定が必要かどうか / Whether canvasContext reconfiguration is needed after resize */
|
|
457
503
|
Object.defineProperty(this, "$needsReconfigure", {
|
|
458
504
|
enumerable: true,
|
|
459
505
|
configurable: true,
|
|
460
506
|
writable: true,
|
|
461
507
|
value: false
|
|
462
508
|
});
|
|
463
|
-
|
|
509
|
+
/** @description Hot Path 用の事前割り当てバッファ / Pre-allocated buffer for hot path */
|
|
464
510
|
Object.defineProperty(this, "$uniformData8", {
|
|
465
511
|
enumerable: true,
|
|
466
512
|
configurable: true,
|
|
467
513
|
writable: true,
|
|
468
514
|
value: new Float32Array(8)
|
|
469
515
|
});
|
|
516
|
+
/** @description Hot Path 用の事前割り当てシザーレクト / Pre-allocated scissor rect for hot path */
|
|
470
517
|
Object.defineProperty(this, "$scissorRect", {
|
|
471
518
|
enumerable: true,
|
|
472
519
|
configurable: true,
|
|
473
520
|
writable: true,
|
|
474
521
|
value: { "x": 0, "y": 0, "w": 0, "h": 0 }
|
|
475
522
|
});
|
|
476
|
-
|
|
523
|
+
/** @description フィルター/コンテナレイヤー用のプリアロケートされた設定オブジェクト / Pre-allocated config object for filter/container layers */
|
|
477
524
|
Object.defineProperty(this, "$filterConfig", {
|
|
478
525
|
enumerable: true,
|
|
479
526
|
configurable: true,
|
|
@@ -528,8 +575,6 @@ export class Context {
|
|
|
528
575
|
this.pipelineManager = new PipelineManager(device, preferred_format);
|
|
529
576
|
// 遅延パイプライン群を即座に先行作成(初回アクセス時のレイテンシ解消)
|
|
530
577
|
this.pipelineManager.preloadLazyGroups();
|
|
531
|
-
this.computePipelineManager = new ComputePipelineManager(device);
|
|
532
|
-
this.attachmentManager = new AttachmentManager(device);
|
|
533
578
|
// グラデーションLUT共有アタッチメントにGPUDeviceを設定
|
|
534
579
|
$setGradientLUTDevice(device);
|
|
535
580
|
$setFilterGradientLUTDevice(device);
|
|
@@ -546,7 +591,6 @@ export class Context {
|
|
|
546
591
|
"frameBufferManager": this.frameBufferManager,
|
|
547
592
|
"pipelineManager": this.pipelineManager,
|
|
548
593
|
"textureManager": this.textureManager,
|
|
549
|
-
"computePipelineManager": this.computePipelineManager,
|
|
550
594
|
"frameTextures": this.frameTextures
|
|
551
595
|
};
|
|
552
596
|
// コンテキストをグローバル変数にセット
|
|
@@ -554,6 +598,9 @@ export class Context {
|
|
|
554
598
|
}
|
|
555
599
|
/**
|
|
556
600
|
* @description 転送範囲をリセット(フレーム開始)
|
|
601
|
+
* Reset transfer bounds (frame start)
|
|
602
|
+
*
|
|
603
|
+
* @return {void}
|
|
557
604
|
*/
|
|
558
605
|
clearTransferBounds() {
|
|
559
606
|
// フレーム開始時に呼ばれる
|
|
@@ -562,6 +609,13 @@ export class Context {
|
|
|
562
609
|
}
|
|
563
610
|
/**
|
|
564
611
|
* @description 背景色を更新
|
|
612
|
+
* Update the background color
|
|
613
|
+
*
|
|
614
|
+
* @param {number} red - 赤色成分 / Red component
|
|
615
|
+
* @param {number} green - 緑色成分 / Green component
|
|
616
|
+
* @param {number} blue - 青色成分 / Blue component
|
|
617
|
+
* @param {number} alpha - アルファ成分 / Alpha component
|
|
618
|
+
* @return {void}
|
|
565
619
|
*/
|
|
566
620
|
updateBackgroundColor(red, green, blue, alpha) {
|
|
567
621
|
this.$clearColorR = red;
|
|
@@ -571,6 +625,9 @@ export class Context {
|
|
|
571
625
|
}
|
|
572
626
|
/**
|
|
573
627
|
* @description 背景色で塗りつぶす(メインアタッチメント)
|
|
628
|
+
* Fill with background color (main attachment)
|
|
629
|
+
*
|
|
630
|
+
* @return {void}
|
|
574
631
|
*/
|
|
575
632
|
fillBackgroundColor() {
|
|
576
633
|
// メインアタッチメントがない場合はスキップ
|
|
@@ -618,6 +675,12 @@ export class Context {
|
|
|
618
675
|
}
|
|
619
676
|
/**
|
|
620
677
|
* @description メインcanvasのサイズを変更
|
|
678
|
+
* Resize the main canvas
|
|
679
|
+
*
|
|
680
|
+
* @param {number} width - 新しい幅 / New width
|
|
681
|
+
* @param {number} height - 新しい高さ / New height
|
|
682
|
+
* @param {boolean} cache_clear - キャッシュをクリアするか / Whether to clear cache
|
|
683
|
+
* @return {void}
|
|
621
684
|
*/
|
|
622
685
|
resize(width, height, cache_clear = true) {
|
|
623
686
|
// インスタンス配列をクリア(WebGL版と同じ)
|
|
@@ -706,16 +769,11 @@ export class Context {
|
|
|
706
769
|
// メインアタッチメントをバインド
|
|
707
770
|
this.bind(this.$mainAttachmentObject);
|
|
708
771
|
}
|
|
709
|
-
/**
|
|
710
|
-
* @description 指定範囲をクリアする
|
|
711
|
-
*/
|
|
712
|
-
clearRect(_x, _y, _w, _h) {
|
|
713
|
-
// WebGPU clear rect implementation
|
|
714
|
-
// WebGPUではclearはレンダーパス開始時に行うため、ここでは何もしない
|
|
715
|
-
// 実際のクリアはbeginNodeRenderingやbeginFrameで行われる
|
|
716
|
-
}
|
|
717
772
|
/**
|
|
718
773
|
* @description 現在の2D変換行列を保存
|
|
774
|
+
* Save the current 2D transform matrix
|
|
775
|
+
*
|
|
776
|
+
* @return {void}
|
|
719
777
|
*/
|
|
720
778
|
save() {
|
|
721
779
|
const matrix = $matrixPool.length > 0 ? $matrixPool.pop() : new Float32Array(9);
|
|
@@ -724,6 +782,9 @@ export class Context {
|
|
|
724
782
|
}
|
|
725
783
|
/**
|
|
726
784
|
* @description 2D変換行列を復元
|
|
785
|
+
* Restore the 2D transform matrix
|
|
786
|
+
*
|
|
787
|
+
* @return {void}
|
|
727
788
|
*/
|
|
728
789
|
restore() {
|
|
729
790
|
const matrix = this.$stack.pop();
|
|
@@ -734,6 +795,15 @@ export class Context {
|
|
|
734
795
|
}
|
|
735
796
|
/**
|
|
736
797
|
* @description 2D変換行列を設定
|
|
798
|
+
* Set the 2D transform matrix
|
|
799
|
+
*
|
|
800
|
+
* @param {number} a - 水平スケール / Horizontal scale
|
|
801
|
+
* @param {number} b - 垂直スキュー / Vertical skew
|
|
802
|
+
* @param {number} c - 水平スキュー / Horizontal skew
|
|
803
|
+
* @param {number} d - 垂直スケール / Vertical scale
|
|
804
|
+
* @param {number} e - 水平移動 / Horizontal translation
|
|
805
|
+
* @param {number} f - 垂直移動 / Vertical translation
|
|
806
|
+
* @return {void}
|
|
737
807
|
*/
|
|
738
808
|
setTransform(a, b, c, d, e, f) {
|
|
739
809
|
this.$matrix[0] = a;
|
|
@@ -745,6 +815,15 @@ export class Context {
|
|
|
745
815
|
}
|
|
746
816
|
/**
|
|
747
817
|
* @description 現在の2D変換行列に対して乗算を行います
|
|
818
|
+
* Multiply the current 2D transform matrix
|
|
819
|
+
*
|
|
820
|
+
* @param {number} a - 水平スケール / Horizontal scale
|
|
821
|
+
* @param {number} b - 垂直スキュー / Vertical skew
|
|
822
|
+
* @param {number} c - 水平スキュー / Horizontal skew
|
|
823
|
+
* @param {number} d - 垂直スケール / Vertical scale
|
|
824
|
+
* @param {number} e - 水平移動 / Horizontal translation
|
|
825
|
+
* @param {number} f - 垂直移動 / Vertical translation
|
|
826
|
+
* @return {void}
|
|
748
827
|
*/
|
|
749
828
|
transform(a, b, c, d, e, f) {
|
|
750
829
|
const m = this.$matrix;
|
|
@@ -758,6 +837,9 @@ export class Context {
|
|
|
758
837
|
}
|
|
759
838
|
/**
|
|
760
839
|
* @description コンテキストの値を初期化する
|
|
840
|
+
* Reset all context values to their initial state
|
|
841
|
+
*
|
|
842
|
+
* @return {void}
|
|
761
843
|
*/
|
|
762
844
|
reset() {
|
|
763
845
|
this.$matrix.set([1, 0, 0, 0, 1, 0, 0, 0, 1]);
|
|
@@ -769,30 +851,57 @@ export class Context {
|
|
|
769
851
|
}
|
|
770
852
|
/**
|
|
771
853
|
* @description パスを開始
|
|
854
|
+
* Begin a new path
|
|
855
|
+
*
|
|
856
|
+
* @return {void}
|
|
772
857
|
*/
|
|
773
858
|
beginPath() {
|
|
774
859
|
this.pathCommand.beginPath();
|
|
775
860
|
}
|
|
776
861
|
/**
|
|
777
862
|
* @description パスを移動
|
|
863
|
+
* Move the path to the specified point
|
|
864
|
+
*
|
|
865
|
+
* @param {number} x - X座標 / X coordinate
|
|
866
|
+
* @param {number} y - Y座標 / Y coordinate
|
|
867
|
+
* @return {void}
|
|
778
868
|
*/
|
|
779
869
|
moveTo(x, y) {
|
|
780
870
|
this.pathCommand.moveTo(x, y);
|
|
781
871
|
}
|
|
782
872
|
/**
|
|
783
873
|
* @description パスを線で結ぶ
|
|
874
|
+
* Draw a line to the specified point
|
|
875
|
+
*
|
|
876
|
+
* @param {number} x - X座標 / X coordinate
|
|
877
|
+
* @param {number} y - Y座標 / Y coordinate
|
|
878
|
+
* @return {void}
|
|
784
879
|
*/
|
|
785
880
|
lineTo(x, y) {
|
|
786
881
|
this.pathCommand.lineTo(x, y);
|
|
787
882
|
}
|
|
788
883
|
/**
|
|
789
884
|
* @description 二次ベジェ曲線を描画
|
|
885
|
+
* Draw a quadratic Bézier curve
|
|
886
|
+
*
|
|
887
|
+
* @param {number} cx - 制御点X / Control point X
|
|
888
|
+
* @param {number} cy - 制御点Y / Control point Y
|
|
889
|
+
* @param {number} x - 終点X / End point X
|
|
890
|
+
* @param {number} y - 終点Y / End point Y
|
|
891
|
+
* @return {void}
|
|
790
892
|
*/
|
|
791
893
|
quadraticCurveTo(cx, cy, x, y) {
|
|
792
894
|
this.pathCommand.quadraticCurveTo(cx, cy, x, y);
|
|
793
895
|
}
|
|
794
896
|
/**
|
|
795
897
|
* @description 塗りつぶしスタイルを設定
|
|
898
|
+
* Set the fill style color
|
|
899
|
+
*
|
|
900
|
+
* @param {number} red - 赤色成分 / Red component
|
|
901
|
+
* @param {number} green - 緑色成分 / Green component
|
|
902
|
+
* @param {number} blue - 青色成分 / Blue component
|
|
903
|
+
* @param {number} alpha - アルファ成分 / Alpha component
|
|
904
|
+
* @return {void}
|
|
796
905
|
*/
|
|
797
906
|
fillStyle(red, green, blue, alpha) {
|
|
798
907
|
this.$fillStyle[0] = red;
|
|
@@ -802,6 +911,13 @@ export class Context {
|
|
|
802
911
|
}
|
|
803
912
|
/**
|
|
804
913
|
* @description 線のスタイルを設定
|
|
914
|
+
* Set the stroke style color
|
|
915
|
+
*
|
|
916
|
+
* @param {number} red - 赤色成分 / Red component
|
|
917
|
+
* @param {number} green - 緑色成分 / Green component
|
|
918
|
+
* @param {number} blue - 青色成分 / Blue component
|
|
919
|
+
* @param {number} alpha - アルファ成分 / Alpha component
|
|
920
|
+
* @return {void}
|
|
805
921
|
*/
|
|
806
922
|
strokeStyle(red, green, blue, alpha) {
|
|
807
923
|
this.$strokeStyle[0] = red;
|
|
@@ -811,25 +927,46 @@ export class Context {
|
|
|
811
927
|
}
|
|
812
928
|
/**
|
|
813
929
|
* @description パスを閉じる
|
|
930
|
+
* Close the current path
|
|
931
|
+
*
|
|
932
|
+
* @return {void}
|
|
814
933
|
*/
|
|
815
934
|
closePath() {
|
|
816
935
|
this.pathCommand.closePath();
|
|
817
936
|
}
|
|
818
937
|
/**
|
|
819
938
|
* @description 円弧を描画
|
|
939
|
+
* Draw an arc
|
|
940
|
+
*
|
|
941
|
+
* @param {number} x - 中心X / Center X
|
|
942
|
+
* @param {number} y - 中心Y / Center Y
|
|
943
|
+
* @param {number} radius - 半径 / Radius
|
|
944
|
+
* @return {void}
|
|
820
945
|
*/
|
|
821
946
|
arc(x, y, radius) {
|
|
822
947
|
this.pathCommand.arc(x, y, radius);
|
|
823
948
|
}
|
|
824
949
|
/**
|
|
825
950
|
* @description 3次ベジェ曲線を描画
|
|
951
|
+
* Draw a cubic Bézier curve
|
|
952
|
+
*
|
|
953
|
+
* @param {number} cx1 - 第1制御点X / First control point X
|
|
954
|
+
* @param {number} cy1 - 第1制御点Y / First control point Y
|
|
955
|
+
* @param {number} cx2 - 第2制御点X / Second control point X
|
|
956
|
+
* @param {number} cy2 - 第2制御点Y / Second control point Y
|
|
957
|
+
* @param {number} x - 終点X / End point X
|
|
958
|
+
* @param {number} y - 終点Y / End point Y
|
|
959
|
+
* @return {void}
|
|
826
960
|
*/
|
|
827
961
|
bezierCurveTo(cx1, cy1, cx2, cy2, x, y) {
|
|
828
962
|
this.pathCommand.bezierCurveTo(cx1, cy1, cx2, cy2, x, y);
|
|
829
963
|
}
|
|
830
964
|
/**
|
|
831
965
|
* @description 描画メソッド共通: レンダーパスの確保とノード領域クリア
|
|
966
|
+
* Common drawing method: ensure render pass and clear node area
|
|
832
967
|
* fill(), stroke(), gradientFill(), bitmapFill(), gradientStroke(), bitmapStroke() で使用
|
|
968
|
+
*
|
|
969
|
+
* @return {void}
|
|
833
970
|
*/
|
|
834
971
|
ensureFillRenderPass() {
|
|
835
972
|
// フレームが開始されていない場合は開始
|
|
@@ -918,6 +1055,9 @@ export class Context {
|
|
|
918
1055
|
}
|
|
919
1056
|
/**
|
|
920
1057
|
* @description 塗りつぶしを実行(Loop-Blinn方式対応)
|
|
1058
|
+
* Execute fill operation (with Loop-Blinn support)
|
|
1059
|
+
*
|
|
1060
|
+
* @return {void}
|
|
921
1061
|
*/
|
|
922
1062
|
fill() {
|
|
923
1063
|
const pathVertices = this.pathCommand.$getVertices;
|
|
@@ -954,6 +1094,9 @@ export class Context {
|
|
|
954
1094
|
}
|
|
955
1095
|
/**
|
|
956
1096
|
* @description Dynamic Uniform BindGroupを取得(フレーム内で初回呼び出し時に作成)
|
|
1097
|
+
* Get or create the Dynamic Uniform BindGroup (created on first call within a frame)
|
|
1098
|
+
*
|
|
1099
|
+
* @return {GPUBindGroup} Dynamic Uniform BindGroup
|
|
957
1100
|
*/
|
|
958
1101
|
getOrCreateFillDynamicBindGroup() {
|
|
959
1102
|
const currentBuffer = this.bufferManager.dynamicUniform.getBuffer();
|
|
@@ -978,89 +1121,93 @@ export class Context {
|
|
|
978
1121
|
}
|
|
979
1122
|
/**
|
|
980
1123
|
* @description fill/stroke用のcolor/matrix uniformを書き込む
|
|
981
|
-
*
|
|
982
|
-
*
|
|
983
|
-
|
|
984
|
-
|
|
1124
|
+
* Write color/matrix uniform for fill/stroke operations
|
|
1125
|
+
* FillUniforms構造体: color(vec4) + matrix0(vec4) + matrix1(vec4) + matrix2(vec4) = 64 bytes
|
|
1126
|
+
*
|
|
1127
|
+
* @param {number} red - 赤色成分 / Red component
|
|
1128
|
+
* @param {number} green - 緑色成分 / Green component
|
|
1129
|
+
* @param {number} blue - 青色成分 / Blue component
|
|
1130
|
+
* @param {number} alpha - アルファ成分 / Alpha component
|
|
1131
|
+
* @param {number} a - 変換行列a / Transform matrix a
|
|
1132
|
+
* @param {number} b - 変換行列b / Transform matrix b
|
|
1133
|
+
* @param {number} c - 変換行列c / Transform matrix c
|
|
1134
|
+
* @param {number} d - 変換行列d / Transform matrix d
|
|
1135
|
+
* @param {number} tx - 変換行列tx / Transform matrix tx
|
|
1136
|
+
* @param {number} ty - 変換行列ty / Transform matrix ty
|
|
1137
|
+
* @param {number} viewport_width - ビューポート幅 / Viewport width
|
|
1138
|
+
* @param {number} viewport_height - ビューポート高さ / Viewport height
|
|
1139
|
+
* @return {number} Dynamic Uniform Buffer内のアライメント済みオフセット / Aligned offset in the Dynamic Uniform Buffer
|
|
1140
|
+
*/
|
|
1141
|
+
writeFillUniform(red, green, blue, alpha, a, b, c, d, tx, ty, viewport_width, viewport_height) {
|
|
985
1142
|
// color
|
|
986
1143
|
$fillUniform16[0] = red;
|
|
987
1144
|
$fillUniform16[1] = green;
|
|
988
1145
|
$fillUniform16[2] = blue;
|
|
989
1146
|
$fillUniform16[3] = alpha;
|
|
990
1147
|
// matrix0 (a, b, 0, pad) — ビューポート正規化
|
|
991
|
-
$fillUniform16[4] = a /
|
|
992
|
-
$fillUniform16[5] = b /
|
|
1148
|
+
$fillUniform16[4] = a / viewport_width;
|
|
1149
|
+
$fillUniform16[5] = b / viewport_height;
|
|
993
1150
|
$fillUniform16[6] = 0;
|
|
994
1151
|
$fillUniform16[7] = 0;
|
|
995
1152
|
// matrix1 (c, d, 0, pad)
|
|
996
|
-
$fillUniform16[8] = c /
|
|
997
|
-
$fillUniform16[9] = d /
|
|
1153
|
+
$fillUniform16[8] = c / viewport_width;
|
|
1154
|
+
$fillUniform16[9] = d / viewport_height;
|
|
998
1155
|
$fillUniform16[10] = 0;
|
|
999
1156
|
$fillUniform16[11] = 0;
|
|
1000
1157
|
// matrix2 (tx, ty, 1, pad)
|
|
1001
|
-
$fillUniform16[12] = tx /
|
|
1002
|
-
$fillUniform16[13] = ty /
|
|
1158
|
+
$fillUniform16[12] = tx / viewport_width;
|
|
1159
|
+
$fillUniform16[13] = ty / viewport_height;
|
|
1003
1160
|
$fillUniform16[14] = 1;
|
|
1004
1161
|
$fillUniform16[15] = 0;
|
|
1005
1162
|
return this.bufferManager.dynamicUniform.allocate($fillUniform16);
|
|
1006
1163
|
}
|
|
1007
1164
|
/**
|
|
1008
1165
|
* @description 2パスステンシルフィル(アトラス用)
|
|
1166
|
+
* Two-pass stencil fill (for atlas)
|
|
1167
|
+
*
|
|
1168
|
+
* @param {GPUBuffer} vertex_buffer - 頂点バッファ / Vertex buffer
|
|
1169
|
+
* @param {number} vertex_count - 頂点数 / Vertex count
|
|
1170
|
+
* @param {GPUBindGroup} bind_group - バインドグループ / Bind group
|
|
1171
|
+
* @param {number} uniform_offset - ユニフォームオフセット / Uniform offset
|
|
1172
|
+
* @return {void}
|
|
1009
1173
|
*/
|
|
1010
|
-
fillWithStencil(
|
|
1011
|
-
contextFillWithStencilService(this.renderPassEncoder, this.pipelineManager,
|
|
1174
|
+
fillWithStencil(vertex_buffer, vertex_count, bind_group, uniform_offset) {
|
|
1175
|
+
contextFillWithStencilService(this.renderPassEncoder, this.pipelineManager, vertex_buffer, vertex_count, bind_group, uniform_offset);
|
|
1012
1176
|
}
|
|
1013
1177
|
/**
|
|
1014
1178
|
* @description 2パスステンシルフィル(メインキャンバス用)
|
|
1179
|
+
* Two-pass stencil fill (for main canvas)
|
|
1180
|
+
*
|
|
1181
|
+
* @param {GPUBuffer} vertex_buffer - 頂点バッファ / Vertex buffer
|
|
1182
|
+
* @param {number} vertex_count - 頂点数 / Vertex count
|
|
1183
|
+
* @param {GPUBindGroup} bind_group - バインドグループ / Bind group
|
|
1184
|
+
* @param {number} uniform_offset - ユニフォームオフセット / Uniform offset
|
|
1185
|
+
* @return {void}
|
|
1015
1186
|
*/
|
|
1016
|
-
fillWithStencilMain(
|
|
1017
|
-
contextFillWithStencilMainService(this.renderPassEncoder, this.pipelineManager,
|
|
1187
|
+
fillWithStencilMain(vertex_buffer, vertex_count, bind_group, uniform_offset) {
|
|
1188
|
+
contextFillWithStencilMainService(this.renderPassEncoder, this.pipelineManager, vertex_buffer, vertex_count, bind_group, uniform_offset);
|
|
1018
1189
|
}
|
|
1019
1190
|
/**
|
|
1020
1191
|
* @description 単純なフィル(ステンシルなし、キャンバス描画用)
|
|
1021
|
-
|
|
1022
|
-
|
|
1192
|
+
* Simple fill (no stencil, for canvas rendering)
|
|
1193
|
+
*
|
|
1194
|
+
* @param {GPUBuffer} vertex_buffer - 頂点バッファ / Vertex buffer
|
|
1195
|
+
* @param {number} vertex_count - 頂点数 / Vertex count
|
|
1196
|
+
* @param {boolean} use_stencil_pipeline - ステンシルパイプラインを使用するか / Whether to use stencil pipeline
|
|
1197
|
+
* @param {GPUBindGroup} bind_group - バインドグループ / Bind group
|
|
1198
|
+
* @param {number} uniform_offset - ユニフォームオフセット / Uniform offset
|
|
1199
|
+
* @return {void}
|
|
1200
|
+
*/
|
|
1201
|
+
fillSimple(vertex_buffer, vertex_count, use_stencil_pipeline, bind_group, uniform_offset) {
|
|
1023
1202
|
const clipLevel = this.$mainAttachmentObject?.clipLevel ?? 1;
|
|
1024
|
-
contextFillSimpleService(this.renderPassEncoder, this.pipelineManager,
|
|
1025
|
-
}
|
|
1026
|
-
/**
|
|
1027
|
-
* @description オフスクリーンアタッチメントにバインド
|
|
1028
|
-
* WebGL: FrameBufferManagerBindAttachmentObjectService
|
|
1029
|
-
*/
|
|
1030
|
-
bindAttachment(attachment) {
|
|
1031
|
-
this.attachmentManager.bindAttachment(attachment);
|
|
1032
|
-
// 現在のレンダーターゲットをオフスクリーンに切り替え
|
|
1033
|
-
// color?.view または texture?.view を使用
|
|
1034
|
-
const view = attachment.color?.view ?? attachment.texture?.view;
|
|
1035
|
-
if (view) {
|
|
1036
|
-
this.currentRenderTarget = view;
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
/**
|
|
1040
|
-
* @description メインキャンバスにバインド
|
|
1041
|
-
* WebGL: FrameBufferManagerUnBindAttachmentObjectService
|
|
1042
|
-
*/
|
|
1043
|
-
unbindAttachment() {
|
|
1044
|
-
this.attachmentManager.unbindAttachment();
|
|
1045
|
-
this.currentRenderTarget = null;
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* @description アタッチメントオブジェクトを取得
|
|
1049
|
-
* WebGL: FrameBufferManagerGetAttachmentObjectUseCase
|
|
1050
|
-
*/
|
|
1051
|
-
getAttachmentObject(width, height, msaa = false) {
|
|
1052
|
-
return this.attachmentManager.getAttachmentObject(width, height, msaa);
|
|
1053
|
-
}
|
|
1054
|
-
/**
|
|
1055
|
-
* @description アタッチメントオブジェクトを解放
|
|
1056
|
-
* WebGL: FrameBufferManagerReleaseAttachmentObjectUseCase
|
|
1057
|
-
*/
|
|
1058
|
-
releaseAttachment(attachment) {
|
|
1059
|
-
this.attachmentManager.releaseAttachment(attachment);
|
|
1203
|
+
contextFillSimpleService(this.renderPassEncoder, this.pipelineManager, vertex_buffer, vertex_count, bind_group, uniform_offset, this.currentRenderTarget !== null, use_stencil_pipeline, clipLevel);
|
|
1060
1204
|
}
|
|
1061
1205
|
/**
|
|
1062
1206
|
* @description 線の描画を実行(WebGL版と同じ仕様)
|
|
1207
|
+
* Execute stroke drawing (same specification as WebGL version)
|
|
1063
1208
|
* WebGL版と同様に、ストロークを塗りとして描画する
|
|
1209
|
+
*
|
|
1210
|
+
* @return {void}
|
|
1064
1211
|
*/
|
|
1065
1212
|
stroke() {
|
|
1066
1213
|
// WebGL版と同じ: IPath[]形式で頂点を取得
|
|
@@ -1101,6 +1248,15 @@ export class Context {
|
|
|
1101
1248
|
}
|
|
1102
1249
|
/**
|
|
1103
1250
|
* @description グラデーションの塗りつぶしを実行
|
|
1251
|
+
* Execute gradient fill
|
|
1252
|
+
*
|
|
1253
|
+
* @param {number} type - グラデーションタイプ / Gradient type
|
|
1254
|
+
* @param {number[]} stops - カラーストップ配列 / Color stop array
|
|
1255
|
+
* @param {Float32Array} matrix - グラデーション変換行列 / Gradient transform matrix
|
|
1256
|
+
* @param {number} spread - スプレッドメソッド / Spread method
|
|
1257
|
+
* @param {number} interpolation - 補間方法 / Interpolation method
|
|
1258
|
+
* @param {number} focal - 焦点距離 / Focal point ratio
|
|
1259
|
+
* @return {void}
|
|
1104
1260
|
*/
|
|
1105
1261
|
gradientFill(type, stops, matrix, spread, interpolation, focal) {
|
|
1106
1262
|
const pathVertices = this.pathCommand.$getVertices;
|
|
@@ -1116,7 +1272,7 @@ export class Context {
|
|
|
1116
1272
|
const useMainStencil = !!((this.inMaskMode || $isMaskTestEnabled()) && this.$mainAttachmentObject?.stencil?.view && !this.currentRenderTarget);
|
|
1117
1273
|
const useStencilPipeline = useMainStencil;
|
|
1118
1274
|
// アトラスへの描画かどうか
|
|
1119
|
-
const useAtlasTarget =
|
|
1275
|
+
const useAtlasTarget = this.currentRenderTarget !== null;
|
|
1120
1276
|
const lutTexture = contextGradientFillUseCase(this.device, this.renderPassEncoder, this.bufferManager, this.pipelineManager, pathVertices, this.$matrix, this.$fillStyle, type, stops, matrix, spread, interpolation, focal, viewportWidth, viewportHeight, useAtlasTarget, useStencilPipeline, this.$mainAttachmentObject?.clipLevel ?? 1);
|
|
1121
1277
|
if (lutTexture) {
|
|
1122
1278
|
this.addFrameTexture(lutTexture);
|
|
@@ -1127,6 +1283,15 @@ export class Context {
|
|
|
1127
1283
|
}
|
|
1128
1284
|
/**
|
|
1129
1285
|
* @description ビットマップの塗りつぶしを実行
|
|
1286
|
+
* Execute bitmap fill
|
|
1287
|
+
*
|
|
1288
|
+
* @param {Uint8Array} pixels - ピクセルデータ / Pixel data
|
|
1289
|
+
* @param {Float32Array} matrix - ビットマップ変換行列 / Bitmap transform matrix
|
|
1290
|
+
* @param {number} width - ビットマップ幅 / Bitmap width
|
|
1291
|
+
* @param {number} height - ビットマップ高さ / Bitmap height
|
|
1292
|
+
* @param {boolean} repeat - 繰り返しフラグ / Repeat flag
|
|
1293
|
+
* @param {boolean} smooth - スムージングフラグ / Smoothing flag
|
|
1294
|
+
* @return {void}
|
|
1130
1295
|
*/
|
|
1131
1296
|
bitmapFill(pixels, matrix, width, height, repeat, smooth) {
|
|
1132
1297
|
const pathVertices = this.pathCommand.$getVertices;
|
|
@@ -1144,7 +1309,7 @@ export class Context {
|
|
|
1144
1309
|
const useStencilPipeline = useAtlasStencil || useMainStencil;
|
|
1145
1310
|
// マスク描画時のクリップレベルを取得
|
|
1146
1311
|
const clipLevel = this.$mainAttachmentObject?.clipLevel ?? 1;
|
|
1147
|
-
const bitmapTexture = contextBitmapFillUseCase(this.device, this.renderPassEncoder, this.bufferManager, this.pipelineManager, pathVertices, this.$matrix, this.$fillStyle, pixels, matrix, width, height, repeat, smooth, this.viewportWidth, this.viewportHeight,
|
|
1312
|
+
const bitmapTexture = contextBitmapFillUseCase(this.device, this.renderPassEncoder, this.bufferManager, this.pipelineManager, pathVertices, this.$matrix, this.$fillStyle, pixels, matrix, width, height, repeat, smooth, this.viewportWidth, this.viewportHeight, this.currentRenderTarget !== null, !!useStencilPipeline, clipLevel);
|
|
1148
1313
|
// ビットマップテクスチャをフレーム終了時に解放するリストに追加
|
|
1149
1314
|
if (bitmapTexture) {
|
|
1150
1315
|
this.addFrameTexture(bitmapTexture);
|
|
@@ -1155,6 +1320,15 @@ export class Context {
|
|
|
1155
1320
|
}
|
|
1156
1321
|
/**
|
|
1157
1322
|
* @description グラデーション線の描画を実行
|
|
1323
|
+
* Execute gradient stroke drawing
|
|
1324
|
+
*
|
|
1325
|
+
* @param {number} type - グラデーションタイプ / Gradient type
|
|
1326
|
+
* @param {number[]} stops - カラーストップ配列 / Color stop array
|
|
1327
|
+
* @param {Float32Array} matrix - グラデーション変換行列 / Gradient transform matrix
|
|
1328
|
+
* @param {number} spread - スプレッドメソッド / Spread method
|
|
1329
|
+
* @param {number} interpolation - 補間方法 / Interpolation method
|
|
1330
|
+
* @param {number} focal - 焦点距離 / Focal point ratio
|
|
1331
|
+
* @return {void}
|
|
1158
1332
|
*/
|
|
1159
1333
|
gradientStroke(type, stops, matrix, spread, interpolation, focal) {
|
|
1160
1334
|
// WebGL版と同じ: IPath[]形式で頂点を取得
|
|
@@ -1170,7 +1344,7 @@ export class Context {
|
|
|
1170
1344
|
const useMainStencil = !!(!this.currentRenderTarget && this.$mainAttachmentObject?.stencil?.view);
|
|
1171
1345
|
const useStencilPipeline = useAtlasStencil || useMainStencil;
|
|
1172
1346
|
// WebGL版と同じ: thicknessをそのまま渡し、内部で/2される
|
|
1173
|
-
const lutTexture = contextGradientStrokeUseCase(this.device, this.renderPassEncoder, this.bufferManager, this.pipelineManager, vertices, this.thickness, this.$matrix, this.$strokeStyle, type, stops, matrix, spread, interpolation, focal, this.viewportWidth, this.viewportHeight,
|
|
1347
|
+
const lutTexture = contextGradientStrokeUseCase(this.device, this.renderPassEncoder, this.bufferManager, this.pipelineManager, vertices, this.thickness, this.$matrix, this.$strokeStyle, type, stops, matrix, spread, interpolation, focal, this.viewportWidth, this.viewportHeight, this.currentRenderTarget !== null, useStencilPipeline);
|
|
1174
1348
|
// LUTテクスチャをフレーム終了時に解放するリストに追加
|
|
1175
1349
|
if (lutTexture) {
|
|
1176
1350
|
this.addFrameTexture(lutTexture);
|
|
@@ -1181,6 +1355,15 @@ export class Context {
|
|
|
1181
1355
|
}
|
|
1182
1356
|
/**
|
|
1183
1357
|
* @description ビットマップ線の描画を実行
|
|
1358
|
+
* Execute bitmap stroke drawing
|
|
1359
|
+
*
|
|
1360
|
+
* @param {Uint8Array} pixels - ピクセルデータ / Pixel data
|
|
1361
|
+
* @param {Float32Array} matrix - ビットマップ変換行列 / Bitmap transform matrix
|
|
1362
|
+
* @param {number} width - ビットマップ幅 / Bitmap width
|
|
1363
|
+
* @param {number} height - ビットマップ高さ / Bitmap height
|
|
1364
|
+
* @param {boolean} repeat - 繰り返しフラグ / Repeat flag
|
|
1365
|
+
* @param {boolean} smooth - スムージングフラグ / Smoothing flag
|
|
1366
|
+
* @return {void}
|
|
1184
1367
|
*/
|
|
1185
1368
|
bitmapStroke(pixels, matrix, width, height, repeat, smooth) {
|
|
1186
1369
|
// WebGL版と同じ: IPath[]形式で頂点を取得
|
|
@@ -1196,7 +1379,7 @@ export class Context {
|
|
|
1196
1379
|
const useMainStencil = !!(!this.currentRenderTarget && this.$mainAttachmentObject?.stencil?.view);
|
|
1197
1380
|
const useStencilPipeline = useAtlasStencil || useMainStencil;
|
|
1198
1381
|
// WebGL版と同じ: thicknessをそのまま渡し、内部で/2される
|
|
1199
|
-
const bitmapTexture = contextBitmapStrokeUseCase(this.device, this.renderPassEncoder, this.bufferManager, this.pipelineManager, vertices, this.thickness, this.$matrix, this.$strokeStyle, pixels, matrix, width, height, repeat, smooth, this.viewportWidth, this.viewportHeight,
|
|
1382
|
+
const bitmapTexture = contextBitmapStrokeUseCase(this.device, this.renderPassEncoder, this.bufferManager, this.pipelineManager, vertices, this.thickness, this.$matrix, this.$strokeStyle, pixels, matrix, width, height, repeat, smooth, this.viewportWidth, this.viewportHeight, this.currentRenderTarget !== null, useStencilPipeline);
|
|
1200
1383
|
// ビットマップテクスチャをフレーム終了時に解放するリストに追加
|
|
1201
1384
|
if (bitmapTexture) {
|
|
1202
1385
|
this.addFrameTexture(bitmapTexture);
|
|
@@ -1207,8 +1390,11 @@ export class Context {
|
|
|
1207
1390
|
}
|
|
1208
1391
|
/**
|
|
1209
1392
|
* @description マスク処理を実行
|
|
1393
|
+
* Execute mask clipping operation
|
|
1210
1394
|
* WebGL版と同様にステンシルバッファを使用したクリッピング
|
|
1211
1395
|
* メインアタッチメントとアトラス両方でマスク処理をサポート
|
|
1396
|
+
*
|
|
1397
|
+
* @return {void}
|
|
1212
1398
|
*/
|
|
1213
1399
|
clip() {
|
|
1214
1400
|
// メインアタッチメントまたはアトラスのいずれかを使用
|
|
@@ -1253,6 +1439,10 @@ export class Context {
|
|
|
1253
1439
|
}
|
|
1254
1440
|
/**
|
|
1255
1441
|
* @description アタッチメントオブジェクトをバインド
|
|
1442
|
+
* Bind an attachment object
|
|
1443
|
+
*
|
|
1444
|
+
* @param {IAttachmentObject} attachment_object - バインドするアタッチメント / Attachment to bind
|
|
1445
|
+
* @return {void}
|
|
1256
1446
|
*/
|
|
1257
1447
|
bind(attachment_object) {
|
|
1258
1448
|
this.frameBufferManager.setCurrentAttachment(attachment_object);
|
|
@@ -1262,8 +1452,11 @@ export class Context {
|
|
|
1262
1452
|
}
|
|
1263
1453
|
/**
|
|
1264
1454
|
* @description 現在のアタッチメントオブジェクトを取得
|
|
1455
|
+
* Get the current attachment object
|
|
1265
1456
|
* アトラスがバインドされていない場合はメインアタッチメントを返す
|
|
1266
1457
|
* When no atlas is bound, returns the main attachment
|
|
1458
|
+
*
|
|
1459
|
+
* @return {IAttachmentObject | null} 現在のアタッチメント / Current attachment
|
|
1267
1460
|
*/
|
|
1268
1461
|
get currentAttachmentObject() {
|
|
1269
1462
|
// WebGL版と同じ: currentAttachmentがない場合はmainAttachmentを返す
|
|
@@ -1273,19 +1466,30 @@ export class Context {
|
|
|
1273
1466
|
}
|
|
1274
1467
|
/**
|
|
1275
1468
|
* @description アトラス専用のアタッチメントオブジェクトを取得
|
|
1469
|
+
* Get the atlas-specific attachment object
|
|
1470
|
+
*
|
|
1471
|
+
* @return {IAttachmentObject | null} アトラスアタッチメント / Atlas attachment
|
|
1276
1472
|
*/
|
|
1277
1473
|
get atlasAttachmentObject() {
|
|
1278
1474
|
return $getAtlasAttachmentObject();
|
|
1279
1475
|
}
|
|
1280
1476
|
/**
|
|
1281
1477
|
* @description グリッドの描画データをセット
|
|
1478
|
+
* Set grid drawing data
|
|
1479
|
+
*
|
|
1480
|
+
* @param {Float32Array | null} grid_data - グリッドデータ / Grid data
|
|
1481
|
+
* @return {void}
|
|
1282
1482
|
*/
|
|
1283
1483
|
useGrid(grid_data) {
|
|
1284
1484
|
$gridDataMap.set($fillBufferIndex, grid_data);
|
|
1285
1485
|
}
|
|
1286
1486
|
/**
|
|
1287
1487
|
* @description 指定のノード範囲で描画を開始(アトラステクスチャへの描画)
|
|
1488
|
+
* Begin rendering for the specified node region (drawing to atlas texture)
|
|
1288
1489
|
* 2パスステンシルフィル対応: ステンシルバッファ付きレンダーパスを使用
|
|
1490
|
+
*
|
|
1491
|
+
* @param {Node} node - 描画対象ノード / Target node for rendering
|
|
1492
|
+
* @return {void}
|
|
1289
1493
|
*/
|
|
1290
1494
|
beginNodeRendering(node) {
|
|
1291
1495
|
// ノード領域クリアフラグをリセット
|
|
@@ -1353,7 +1557,10 @@ export class Context {
|
|
|
1353
1557
|
}
|
|
1354
1558
|
/**
|
|
1355
1559
|
* @description ノード領域がまだクリアされていない場合にクリアを実行
|
|
1560
|
+
* Clear the node area if it has not been cleared yet
|
|
1356
1561
|
* 最初の描画操作(fill, gradientFill, gradientStroke等)で呼び出される
|
|
1562
|
+
*
|
|
1563
|
+
* @return {void}
|
|
1357
1564
|
*/
|
|
1358
1565
|
ensureNodeAreaCleared() {
|
|
1359
1566
|
if (this.nodeAreaCleared) {
|
|
@@ -1364,7 +1571,10 @@ export class Context {
|
|
|
1364
1571
|
}
|
|
1365
1572
|
/**
|
|
1366
1573
|
* @description ノード領域をクリア(透明色 + ステンシル=0)
|
|
1574
|
+
* Clear the node area (transparent color + stencil=0)
|
|
1367
1575
|
* WebGL版の gl.clear(COLOR_BUFFER_BIT | STENCIL_BUFFER_BIT) と同等
|
|
1576
|
+
*
|
|
1577
|
+
* @return {void}
|
|
1368
1578
|
*/
|
|
1369
1579
|
clearNodeArea() {
|
|
1370
1580
|
if (!this.renderPassEncoder) {
|
|
@@ -1399,7 +1609,10 @@ export class Context {
|
|
|
1399
1609
|
}
|
|
1400
1610
|
/**
|
|
1401
1611
|
* @description 指定のノード範囲で描画を終了
|
|
1612
|
+
* End rendering for the current node region
|
|
1402
1613
|
* レンダーパスは終了しない(次のbeginNodeRenderingで再利用するため)
|
|
1614
|
+
*
|
|
1615
|
+
* @return {void}
|
|
1403
1616
|
*/
|
|
1404
1617
|
endNodeRendering() {
|
|
1405
1618
|
// レンダーパスは終了しない(次のbeginNodeRenderingで同一アトラスなら再利用)
|
|
@@ -1413,6 +1626,9 @@ export class Context {
|
|
|
1413
1626
|
}
|
|
1414
1627
|
/**
|
|
1415
1628
|
* @description 塗りの描画を実行
|
|
1629
|
+
* Execute fill drawing
|
|
1630
|
+
*
|
|
1631
|
+
* @return {void}
|
|
1416
1632
|
*/
|
|
1417
1633
|
drawFill() {
|
|
1418
1634
|
// WebGL版ではfill()がバッファに蓄積し、drawFill()がまとめてGPU描画する
|
|
@@ -1425,6 +1641,15 @@ export class Context {
|
|
|
1425
1641
|
}
|
|
1426
1642
|
/**
|
|
1427
1643
|
* @description インスタンスを描画
|
|
1644
|
+
* Draw a display object instance
|
|
1645
|
+
*
|
|
1646
|
+
* @param {Node} node - 描画対象ノード / Target node
|
|
1647
|
+
* @param {number} x_min - バウンディングボックス左端 / Bounding box left
|
|
1648
|
+
* @param {number} y_min - バウンディングボックス上端 / Bounding box top
|
|
1649
|
+
* @param {number} x_max - バウンディングボックス右端 / Bounding box right
|
|
1650
|
+
* @param {number} y_max - バウンディングボックス下端 / Bounding box bottom
|
|
1651
|
+
* @param {Float32Array} color_transform - カラー変換パラメータ / Color transform parameters
|
|
1652
|
+
* @return {void}
|
|
1428
1653
|
*/
|
|
1429
1654
|
drawDisplayObject(node, x_min, y_min, x_max, y_max, color_transform) {
|
|
1430
1655
|
// WebGPU display object drawing
|
|
@@ -1438,10 +1663,11 @@ export class Context {
|
|
|
1438
1663
|
* @description インスタンス配列を描画
|
|
1439
1664
|
* Draw instanced arrays
|
|
1440
1665
|
*
|
|
1441
|
-
*
|
|
1442
|
-
*
|
|
1443
|
-
*
|
|
1666
|
+
* useOptimizedInstancingがtrueの場合、Storage BufferとIndirect Drawingを使用。
|
|
1667
|
+
* - Storage Buffer: メモリアロケーション削減、CPU負荷15-25%軽減
|
|
1668
|
+
* - Indirect Drawing: CPU-GPUオーバーヘッド5-15%削減
|
|
1444
1669
|
*
|
|
1670
|
+
* @return {void}
|
|
1445
1671
|
*/
|
|
1446
1672
|
drawArraysInstanced() {
|
|
1447
1673
|
// フレームが開始されていない場合は開始
|
|
@@ -1474,24 +1700,11 @@ export class Context {
|
|
|
1474
1700
|
// 複雑なブレンドモードの処理
|
|
1475
1701
|
this.processComplexBlendQueue();
|
|
1476
1702
|
}
|
|
1477
|
-
/**
|
|
1478
|
-
* @description 最適化インスタンス描画の有効/無効を設定
|
|
1479
|
-
* Enable or disable optimized instancing
|
|
1480
|
-
*
|
|
1481
|
-
*/
|
|
1482
|
-
setOptimizedInstancing(enabled) {
|
|
1483
|
-
this.useOptimizedInstancing = enabled;
|
|
1484
|
-
}
|
|
1485
|
-
/**
|
|
1486
|
-
* @description 最適化インスタンス描画が有効かどうか
|
|
1487
|
-
* Whether optimized instancing is enabled
|
|
1488
|
-
*
|
|
1489
|
-
*/
|
|
1490
|
-
isOptimizedInstancingEnabled() {
|
|
1491
|
-
return this.useOptimizedInstancing;
|
|
1492
|
-
}
|
|
1493
1703
|
/**
|
|
1494
1704
|
* @description 複雑なブレンドモードのキューを処理
|
|
1705
|
+
* Process the complex blend mode queue
|
|
1706
|
+
*
|
|
1707
|
+
* @return {void}
|
|
1495
1708
|
*/
|
|
1496
1709
|
processComplexBlendQueue() {
|
|
1497
1710
|
// コマンドエンコーダーを確保
|
|
@@ -1501,6 +1714,9 @@ export class Context {
|
|
|
1501
1714
|
}
|
|
1502
1715
|
/**
|
|
1503
1716
|
* @description インスタンス配列をクリア
|
|
1717
|
+
* Clear instanced arrays
|
|
1718
|
+
*
|
|
1719
|
+
* @return {void}
|
|
1504
1720
|
*/
|
|
1505
1721
|
clearArraysInstanced() {
|
|
1506
1722
|
// WebGPU clear instanced arrays
|
|
@@ -1509,8 +1725,13 @@ export class Context {
|
|
|
1509
1725
|
}
|
|
1510
1726
|
/**
|
|
1511
1727
|
* @description ピクセルバッファをNodeの指定箇所に転送
|
|
1728
|
+
* Transfer pixel buffer to the specified position of the Node
|
|
1512
1729
|
* WebGPUでは、Shapeのシェーダーが-ndc.yでY軸反転しているため、
|
|
1513
1730
|
* Bitmapも同じ方向になるよう画像を上下反転して書き込む
|
|
1731
|
+
*
|
|
1732
|
+
* @param {Node} node - 描画対象ノード / Target node
|
|
1733
|
+
* @param {Uint8Array} pixels - ピクセルデータ / Pixel data
|
|
1734
|
+
* @return {void}
|
|
1514
1735
|
*/
|
|
1515
1736
|
drawPixels(node, pixels) {
|
|
1516
1737
|
// WebGPU draw pixels
|
|
@@ -1554,6 +1775,14 @@ export class Context {
|
|
|
1554
1775
|
}
|
|
1555
1776
|
/**
|
|
1556
1777
|
* @description 一時テクスチャ経由でピクセルデータをMSAAテクスチャに描画
|
|
1778
|
+
* Draw pixel data to MSAA texture via a temporary texture
|
|
1779
|
+
*
|
|
1780
|
+
* @param {IAttachmentObject} attachment - アタッチメントオブジェクト / Attachment object
|
|
1781
|
+
* @param {Node} node - 描画対象ノード / Target node
|
|
1782
|
+
* @param {Uint8Array} pixels - ピクセルデータ / Pixel data
|
|
1783
|
+
* @param {number} width - 幅 / Width
|
|
1784
|
+
* @param {number} height - 高さ / Height
|
|
1785
|
+
* @return {void}
|
|
1557
1786
|
*/
|
|
1558
1787
|
drawPixelsToMsaa(attachment, node, pixels, width, height) {
|
|
1559
1788
|
// 一時テクスチャをプールから取得
|
|
@@ -1620,10 +1849,16 @@ export class Context {
|
|
|
1620
1849
|
}
|
|
1621
1850
|
/**
|
|
1622
1851
|
* @description OffscreenCanvasをNodeの指定箇所に転送
|
|
1852
|
+
* Transfer OffscreenCanvas to the specified position of the Node
|
|
1623
1853
|
* WebGPUでは、Shapeのシェーダーが-ndc.yでY軸反転しているため、
|
|
1624
1854
|
* Bitmapも同じ方向になるよう画像を上下反転して書き込む
|
|
1855
|
+
*
|
|
1856
|
+
* @param {Node} node - 描画対象ノード / Target node
|
|
1857
|
+
* @param {OffscreenCanvas | ImageBitmap} element - 描画要素 / Element to draw
|
|
1858
|
+
* @param {boolean} flip_y - Y軸反転フラグ / Y-axis flip flag
|
|
1859
|
+
* @return {void}
|
|
1625
1860
|
*/
|
|
1626
|
-
drawElement(node, element,
|
|
1861
|
+
drawElement(node, element, flip_y = false) {
|
|
1627
1862
|
// WebGPU draw element
|
|
1628
1863
|
// OffscreenCanvasまたはImageBitmapをアトラステクスチャに描画
|
|
1629
1864
|
// ノードのインデックスを使用して正しいアトラスを取得
|
|
@@ -1645,21 +1880,30 @@ export class Context {
|
|
|
1645
1880
|
// MSAAが有効な場合は一時テクスチャ経由でMSAAテクスチャに直接描画
|
|
1646
1881
|
// MSAAが無効な場合もシェーダー経由で描画(WebGLと同じ処理フロー)
|
|
1647
1882
|
if (attachment.msaa && attachment.msaaTexture?.view) {
|
|
1648
|
-
this.drawElementToMsaa(attachment, node, element, width, height,
|
|
1883
|
+
this.drawElementToMsaa(attachment, node, element, width, height, flip_y);
|
|
1649
1884
|
}
|
|
1650
1885
|
else {
|
|
1651
|
-
this.drawElementToTexture(attachment, node, element, width, height,
|
|
1886
|
+
this.drawElementToTexture(attachment, node, element, width, height, flip_y);
|
|
1652
1887
|
}
|
|
1653
1888
|
}
|
|
1654
1889
|
/**
|
|
1655
1890
|
* @description 一時テクスチャ経由でMSAAテクスチャに直接描画
|
|
1656
|
-
|
|
1657
|
-
|
|
1891
|
+
* Draw to MSAA texture directly via a temporary texture
|
|
1892
|
+
*
|
|
1893
|
+
* @param {IAttachmentObject} attachment - アタッチメントオブジェクト / Attachment object
|
|
1894
|
+
* @param {Node} node - 描画対象ノード / Target node
|
|
1895
|
+
* @param {OffscreenCanvas | ImageBitmap} element - 描画要素 / Element to draw
|
|
1896
|
+
* @param {number} width - 幅 / Width
|
|
1897
|
+
* @param {number} height - 高さ / Height
|
|
1898
|
+
* @param {boolean} flip_y - Y軸反転フラグ / Y-axis flip flag
|
|
1899
|
+
* @return {void}
|
|
1900
|
+
*/
|
|
1901
|
+
drawElementToMsaa(attachment, node, element, width, height, flip_y) {
|
|
1658
1902
|
// 一時テクスチャをプールから取得
|
|
1659
1903
|
const tempTexture = $acquireRenderTexture(this.device, width, height);
|
|
1660
1904
|
this.device.queue.copyExternalImageToTexture({
|
|
1661
1905
|
"source": element,
|
|
1662
|
-
"flipY":
|
|
1906
|
+
"flipY": flip_y
|
|
1663
1907
|
}, {
|
|
1664
1908
|
"texture": tempTexture,
|
|
1665
1909
|
"premultipliedAlpha": true
|
|
@@ -1720,15 +1964,24 @@ export class Context {
|
|
|
1720
1964
|
}
|
|
1721
1965
|
/**
|
|
1722
1966
|
* @description 一時テクスチャ経由で通常テクスチャに描画(非MSAA版)
|
|
1723
|
-
|
|
1724
|
-
|
|
1967
|
+
* Draw to a regular texture via a temporary texture (non-MSAA version)
|
|
1968
|
+
*
|
|
1969
|
+
* @param {IAttachmentObject} attachment - アタッチメントオブジェクト / Attachment object
|
|
1970
|
+
* @param {Node} node - 描画対象ノード / Target node
|
|
1971
|
+
* @param {OffscreenCanvas | ImageBitmap} element - 描画要素 / Element to draw
|
|
1972
|
+
* @param {number} width - 幅 / Width
|
|
1973
|
+
* @param {number} height - 高さ / Height
|
|
1974
|
+
* @param {boolean} flip_y - Y軸反転フラグ / Y-axis flip flag
|
|
1975
|
+
* @return {void}
|
|
1976
|
+
*/
|
|
1977
|
+
drawElementToTexture(attachment, node, element, width, height, flip_y) {
|
|
1725
1978
|
// 一時テクスチャをプールから取得
|
|
1726
1979
|
const tempTexture = $acquireRenderTexture(this.device, width, height);
|
|
1727
1980
|
// ImageBitmapを一時テクスチャにコピー
|
|
1728
1981
|
// flipYパラメータで画像の上下反転を制御(Videoはtrue、TextFieldはfalse)
|
|
1729
1982
|
this.device.queue.copyExternalImageToTexture({
|
|
1730
1983
|
"source": element,
|
|
1731
|
-
"flipY":
|
|
1984
|
+
"flipY": flip_y
|
|
1732
1985
|
}, {
|
|
1733
1986
|
"texture": tempTexture,
|
|
1734
1987
|
"premultipliedAlpha": true
|
|
@@ -1789,6 +2042,20 @@ export class Context {
|
|
|
1789
2042
|
}
|
|
1790
2043
|
/**
|
|
1791
2044
|
* @description フィルターを適用
|
|
2045
|
+
* Apply filter effects
|
|
2046
|
+
*
|
|
2047
|
+
* @param {Node} node - 描画対象ノード / Target node
|
|
2048
|
+
* @param {string} _unique_key - ユニークキー / Unique key
|
|
2049
|
+
* @param {boolean} _updated - 更新フラグ / Updated flag
|
|
2050
|
+
* @param {number} width - 幅 / Width
|
|
2051
|
+
* @param {number} height - 高さ / Height
|
|
2052
|
+
* @param {boolean} _is_bitmap - ビットマップかどうか / Whether it is a bitmap
|
|
2053
|
+
* @param {Float32Array} matrix - 変換行列 / Transform matrix
|
|
2054
|
+
* @param {Float32Array} color_transform - カラー変換パラメータ / Color transform parameters
|
|
2055
|
+
* @param {IBlendMode} blend_mode - ブレンドモード / Blend mode
|
|
2056
|
+
* @param {Float32Array} bounds - バウンディングボックス / Bounding box
|
|
2057
|
+
* @param {Float32Array} params - フィルターパラメータ / Filter parameters
|
|
2058
|
+
* @return {void}
|
|
1792
2059
|
*/
|
|
1793
2060
|
applyFilter(node, _unique_key, _updated, width, height, _is_bitmap, matrix, color_transform, blend_mode, bounds, params) {
|
|
1794
2061
|
// インスタンス配列を先に描画
|
|
@@ -1813,6 +2080,9 @@ export class Context {
|
|
|
1813
2080
|
* @description コンテナのフィルター/ブレンド用のレイヤーを開始
|
|
1814
2081
|
* Begin a container layer for filter/blend processing
|
|
1815
2082
|
*
|
|
2083
|
+
* @param {number} width - レイヤー幅 / Layer width
|
|
2084
|
+
* @param {number} height - レイヤー高さ / Layer height
|
|
2085
|
+
* @return {void}
|
|
1816
2086
|
*/
|
|
1817
2087
|
containerBeginLayer(width, height) {
|
|
1818
2088
|
this.drawArraysInstanced();
|
|
@@ -1839,14 +2109,15 @@ export class Context {
|
|
|
1839
2109
|
* @description コンテナのフィルター/ブレンド用レイヤーを終了し、結果を元のメインに合成
|
|
1840
2110
|
* End the container layer and composite the result back to the original main
|
|
1841
2111
|
*
|
|
1842
|
-
* @param {IBlendMode}
|
|
1843
|
-
* @param {Float32Array} matrix
|
|
1844
|
-
* @param {Float32Array | null} color_transform
|
|
1845
|
-
* @param {boolean}
|
|
1846
|
-
* @param {Float32Array | null} filter_bounds
|
|
1847
|
-
* @param {Float32Array | null} filter_params
|
|
1848
|
-
* @param {string}
|
|
1849
|
-
* @param {string}
|
|
2112
|
+
* @param {IBlendMode} blend_mode - ブレンドモード / Blend mode
|
|
2113
|
+
* @param {Float32Array} matrix - 変換行列 / Transform matrix
|
|
2114
|
+
* @param {Float32Array | null} color_transform - カラー変換パラメータ / Color transform parameters
|
|
2115
|
+
* @param {boolean} use_filter - フィルター使用フラグ / Whether to use filter
|
|
2116
|
+
* @param {Float32Array | null} filter_bounds - フィルターバウンド / Filter bounds
|
|
2117
|
+
* @param {Float32Array | null} filter_params - フィルターパラメータ / Filter parameters
|
|
2118
|
+
* @param {string} unique_key - ユニークキー / Unique key
|
|
2119
|
+
* @param {string} filter_key - フィルターキー / Filter key
|
|
2120
|
+
* @return {void}
|
|
1850
2121
|
*/
|
|
1851
2122
|
containerEndLayer(blend_mode, matrix, color_transform, use_filter, filter_bounds, filter_params, unique_key, filter_key) {
|
|
1852
2123
|
this.drawArraysInstanced();
|
|
@@ -1866,16 +2137,124 @@ export class Context {
|
|
|
1866
2137
|
// メインのアタッチメントをバインド
|
|
1867
2138
|
this.bind(this.$mainAttachmentObject);
|
|
1868
2139
|
}
|
|
2140
|
+
/**
|
|
2141
|
+
* @description cacheAsBitmap: temp FBO作成→子要素描画開始
|
|
2142
|
+
* Begin container cacheAsBitmap: create temp bgra8unorm FBO for children,
|
|
2143
|
+
* allocate atlas node for later copy
|
|
2144
|
+
*
|
|
2145
|
+
* @param {number} width - ノード幅 / Node width
|
|
2146
|
+
* @param {number} height - ノード高さ / Node height
|
|
2147
|
+
* @return {Node}
|
|
2148
|
+
*/
|
|
2149
|
+
containerBeginAtlasNode(width, height) {
|
|
2150
|
+
this.drawArraysInstanced();
|
|
2151
|
+
// アトラスノードを確保(後でコピー先として使用)
|
|
2152
|
+
const node = this.createNode(width, height);
|
|
2153
|
+
this._pendingAtlasNodes.push(node);
|
|
2154
|
+
// mainをスタックに保存
|
|
2155
|
+
const mainAttachment = this.$mainAttachmentObject;
|
|
2156
|
+
this.$containerLayerStack.push(mainAttachment);
|
|
2157
|
+
// 既存のレンダーパスを終了
|
|
2158
|
+
if (this.renderPassEncoder) {
|
|
2159
|
+
this.renderPassEncoder.end();
|
|
2160
|
+
this.renderPassEncoder = null;
|
|
2161
|
+
}
|
|
2162
|
+
// bgra8unormのtemp FBOを作成(全パイプラインが互換)
|
|
2163
|
+
const tempAttachment = this.frameBufferManager.createAttachment("container_layer", width, height, mainAttachment.msaa, true);
|
|
2164
|
+
this.$mainAttachmentObject = tempAttachment;
|
|
2165
|
+
this.bind(tempAttachment);
|
|
2166
|
+
return node;
|
|
2167
|
+
}
|
|
2168
|
+
/**
|
|
2169
|
+
* @description cacheAsBitmap: temp FBO→アトラスノードへコピー
|
|
2170
|
+
* End container cacheAsBitmap: copy temp FBO content to atlas node,
|
|
2171
|
+
* release temp FBO
|
|
2172
|
+
*
|
|
2173
|
+
* @return {void}
|
|
2174
|
+
*/
|
|
2175
|
+
containerEndAtlasNode() {
|
|
2176
|
+
this.drawArraysInstanced();
|
|
2177
|
+
// 既存のレンダーパスを終了(temp FBOのMSAAリゾルブが実行される)
|
|
2178
|
+
if (this.renderPassEncoder) {
|
|
2179
|
+
this.renderPassEncoder.end();
|
|
2180
|
+
this.renderPassEncoder = null;
|
|
2181
|
+
}
|
|
2182
|
+
this.ensureCommandEncoder();
|
|
2183
|
+
const tempAttachment = this.$mainAttachmentObject;
|
|
2184
|
+
const node = this._pendingAtlasNodes.pop();
|
|
2185
|
+
// mainを復元
|
|
2186
|
+
this.$mainAttachmentObject = this.$containerLayerStack.pop();
|
|
2187
|
+
// temp FBO → アトラスノードへコピー
|
|
2188
|
+
this.copyTempToAtlasNode(tempAttachment, node);
|
|
2189
|
+
// temp FBOをリリース
|
|
2190
|
+
this.frameBufferManager.releaseTemporaryAttachment(tempAttachment);
|
|
2191
|
+
// メインをバインド
|
|
2192
|
+
this.bind(this.$mainAttachmentObject);
|
|
2193
|
+
}
|
|
2194
|
+
/**
|
|
2195
|
+
* @description temp FBOの内容をアトラスノード領域にコピー
|
|
2196
|
+
* Copy temp FBO content to the atlas node region using texture_copy pipeline
|
|
2197
|
+
*
|
|
2198
|
+
* @param {IAttachmentObject} temp_attachment - コピー元のtemp FBO / Source temp FBO
|
|
2199
|
+
* @param {Node} node - コピー先のアトラスノード / Destination atlas node
|
|
2200
|
+
* @return {void}
|
|
2201
|
+
*/
|
|
2202
|
+
copyTempToAtlasNode(temp_attachment, node) {
|
|
2203
|
+
const atlas = $getAtlasAttachmentObjectByIndex(node.index) || $getAtlasAttachmentObject();
|
|
2204
|
+
if (!atlas || !atlas.texture || !temp_attachment.texture) {
|
|
2205
|
+
return;
|
|
2206
|
+
}
|
|
2207
|
+
// アトラスはrgba8unormフォーマット(FrameBufferManagerCreateAttachmentUseCase参照)
|
|
2208
|
+
// atlas_*テクスチャはcopyExternalImageToTextureとの互換性のためrgba8unormで作成される
|
|
2209
|
+
const useMsaa = atlas.msaa && atlas.msaaTexture?.view;
|
|
2210
|
+
const pipelineName = useMsaa ? "texture_copy_rgba8_msaa" : "texture_copy_rgba8";
|
|
2211
|
+
const pipeline = this.pipelineManager.getPipeline(pipelineName);
|
|
2212
|
+
const bindGroupLayout = this.pipelineManager.getBindGroupLayout("texture_copy");
|
|
2213
|
+
if (!pipeline || !bindGroupLayout) {
|
|
2214
|
+
return;
|
|
2215
|
+
}
|
|
2216
|
+
// uniform: temp FBO全体をサンプリング(Y軸反転してアトラスに格納)
|
|
2217
|
+
// アトラスのShape描画はFillVertexのyFlipSign=1.0によりY反転で格納されるため、
|
|
2218
|
+
// cacheAsBitmapのコピーも同じ規則に合わせてY反転する
|
|
2219
|
+
// UV.y = texCoord.y * scaleY + offsetY = texCoord.y * (-1) + 1 = 1 - texCoord.y
|
|
2220
|
+
const uniformBuffer = this.bufferManager.acquireAndWriteUniformBuffer($atlasNodeCopyUniform);
|
|
2221
|
+
// サンプラーとソーステクスチャ(MSAAリゾルブ済みのテクスチャ)
|
|
2222
|
+
const sampler = this.textureManager.createSampler("container_atlas_copy", false);
|
|
2223
|
+
const srcView = temp_attachment.texture.view;
|
|
2224
|
+
const bindGroup = this.device.createBindGroup({
|
|
2225
|
+
"layout": bindGroupLayout,
|
|
2226
|
+
"entries": [
|
|
2227
|
+
{ "binding": 0, "resource": { "buffer": uniformBuffer } },
|
|
2228
|
+
{ "binding": 1, "resource": sampler },
|
|
2229
|
+
{ "binding": 2, "resource": srcView }
|
|
2230
|
+
]
|
|
2231
|
+
});
|
|
2232
|
+
// アトラスのノード領域にレンダーパスを作成
|
|
2233
|
+
const colorView = useMsaa ? atlas.msaaTexture.view : atlas.texture.view;
|
|
2234
|
+
const resolveTarget = useMsaa ? atlas.texture.view : null;
|
|
2235
|
+
const renderPassDescriptor = this.frameBufferManager.createRenderPassDescriptor(colorView, 0, 0, 0, 0, "load", resolveTarget);
|
|
2236
|
+
const passEncoder = this.commandEncoder.beginRenderPass(renderPassDescriptor);
|
|
2237
|
+
// ビューポートとシザーでノード領域に制限
|
|
2238
|
+
passEncoder.setViewport(node.x, node.y, node.w, node.h, 0, 1);
|
|
2239
|
+
passEncoder.setScissorRect(node.x, node.y, node.w, node.h);
|
|
2240
|
+
passEncoder.setPipeline(pipeline);
|
|
2241
|
+
passEncoder.setBindGroup(0, bindGroup);
|
|
2242
|
+
passEncoder.draw(6, 1, 0, 0);
|
|
2243
|
+
passEncoder.end();
|
|
2244
|
+
// アトラスレンダーパスインデックスをリセット(次のbeginNodeRenderingで新規作成させる)
|
|
2245
|
+
this.nodeRenderPassAtlasIndex = -1;
|
|
2246
|
+
}
|
|
1869
2247
|
/**
|
|
1870
2248
|
* @description キャッシュされたコンテナフィルターテクスチャをメインに描画
|
|
1871
2249
|
* Draw a cached container filter texture to the main attachment
|
|
1872
2250
|
*
|
|
1873
|
-
* @param {IBlendMode}
|
|
1874
|
-
* @param {Float32Array} matrix
|
|
1875
|
-
* @param {Float32Array} color_transform
|
|
1876
|
-
* @param {Float32Array} filter_bounds
|
|
1877
|
-
* @param {string}
|
|
1878
|
-
* @param {string}
|
|
2251
|
+
* @param {IBlendMode} blend_mode - ブレンドモード / Blend mode
|
|
2252
|
+
* @param {Float32Array} matrix - 変換行列 / Transform matrix
|
|
2253
|
+
* @param {Float32Array} color_transform - カラー変換パラメータ / Color transform parameters
|
|
2254
|
+
* @param {Float32Array} filter_bounds - フィルターバウンド / Filter bounds
|
|
2255
|
+
* @param {string} unique_key - ユニークキー / Unique key
|
|
2256
|
+
* @param {string} filter_key - フィルターキー / Filter key
|
|
2257
|
+
* @return {void}
|
|
1879
2258
|
*/
|
|
1880
2259
|
containerDrawCachedFilter(blend_mode, matrix, color_transform, filter_bounds, unique_key, filter_key) {
|
|
1881
2260
|
const cachedKey = $cacheStore.get(unique_key, "fKey");
|
|
@@ -2012,6 +2391,9 @@ export class Context {
|
|
|
2012
2391
|
}
|
|
2013
2392
|
/**
|
|
2014
2393
|
* @description メインテクスチャを確保(フレーム開始時に一度だけgetCurrentTexture呼び出し)
|
|
2394
|
+
* Ensure the main texture is acquired (calls getCurrentTexture once per frame)
|
|
2395
|
+
*
|
|
2396
|
+
* @return {void}
|
|
2015
2397
|
*/
|
|
2016
2398
|
ensureMainTexture() {
|
|
2017
2399
|
if (!this.mainTexture) {
|
|
@@ -2031,6 +2413,9 @@ export class Context {
|
|
|
2031
2413
|
}
|
|
2032
2414
|
/**
|
|
2033
2415
|
* @description 現在の描画ターゲットのテクスチャビューを取得
|
|
2416
|
+
* Get the texture view of the current render target
|
|
2417
|
+
*
|
|
2418
|
+
* @return {GPUTextureView} 現在のテクスチャビュー / Current texture view
|
|
2034
2419
|
*/
|
|
2035
2420
|
getCurrentTextureView() {
|
|
2036
2421
|
// アトラステクスチャへのレンダリング中の場合
|
|
@@ -2043,6 +2428,9 @@ export class Context {
|
|
|
2043
2428
|
}
|
|
2044
2429
|
/**
|
|
2045
2430
|
* @description コマンドエンコーダーが存在することを保証
|
|
2431
|
+
* Ensure the command encoder exists
|
|
2432
|
+
*
|
|
2433
|
+
* @return {void}
|
|
2046
2434
|
*/
|
|
2047
2435
|
ensureCommandEncoder() {
|
|
2048
2436
|
// Note: RenderPassEncoderの終了はここでは行わない
|
|
@@ -2053,6 +2441,9 @@ export class Context {
|
|
|
2053
2441
|
}
|
|
2054
2442
|
/**
|
|
2055
2443
|
* @description フレーム開始(レンダリング開始前に呼ぶ)
|
|
2444
|
+
* Begin a new frame (call before rendering starts)
|
|
2445
|
+
*
|
|
2446
|
+
* @return {void}
|
|
2056
2447
|
*/
|
|
2057
2448
|
beginFrame() {
|
|
2058
2449
|
if (!this.frameStarted) {
|
|
@@ -2066,12 +2457,19 @@ export class Context {
|
|
|
2066
2457
|
}
|
|
2067
2458
|
/**
|
|
2068
2459
|
* @description フレームごとのプール管理テクスチャを追加(endFrame()でプールに返却)
|
|
2460
|
+
* Add a pooled texture for the current frame (returned to pool in endFrame())
|
|
2461
|
+
*
|
|
2462
|
+
* @param {GPUTexture} texture - プール管理テクスチャ / Pooled texture
|
|
2463
|
+
* @return {void}
|
|
2069
2464
|
*/
|
|
2070
2465
|
addFrameTexture(texture) {
|
|
2071
2466
|
this.pooledTextures.push(texture);
|
|
2072
2467
|
}
|
|
2073
2468
|
/**
|
|
2074
2469
|
* @description フレーム終了とコマンド送信(レンダリング完了後に呼ぶ)
|
|
2470
|
+
* End the frame and submit commands (call after rendering is complete)
|
|
2471
|
+
*
|
|
2472
|
+
* @return {void}
|
|
2075
2473
|
*/
|
|
2076
2474
|
endFrame() {
|
|
2077
2475
|
if (!this.frameStarted) {
|
|
@@ -2130,13 +2528,21 @@ export class Context {
|
|
|
2130
2528
|
}
|
|
2131
2529
|
/**
|
|
2132
2530
|
* @description コマンドを送信(後方互換性のため残す)
|
|
2531
|
+
* Submit commands (kept for backward compatibility)
|
|
2532
|
+
*
|
|
2533
|
+
* @return {void}
|
|
2133
2534
|
*/
|
|
2134
2535
|
submit() {
|
|
2135
2536
|
this.endFrame();
|
|
2136
2537
|
}
|
|
2137
2538
|
/**
|
|
2138
2539
|
* @description ノードを作成
|
|
2540
|
+
* Create a node in the texture atlas
|
|
2139
2541
|
* アトラスがいっぱいの場合は新しいアトラスを作成して再試行
|
|
2542
|
+
*
|
|
2543
|
+
* @param {number} width - ノード幅 / Node width
|
|
2544
|
+
* @param {number} height - ノード高さ / Node height
|
|
2545
|
+
* @return {Node} 作成されたノード / Created node
|
|
2140
2546
|
*/
|
|
2141
2547
|
createNode(width, height) {
|
|
2142
2548
|
// WebGPU node creation implementation using texture-packer
|
|
@@ -2156,6 +2562,10 @@ export class Context {
|
|
|
2156
2562
|
}
|
|
2157
2563
|
/**
|
|
2158
2564
|
* @description ノードを削除
|
|
2565
|
+
* Remove a node from the texture atlas
|
|
2566
|
+
*
|
|
2567
|
+
* @param {Node} node - 削除対象ノード / Node to remove
|
|
2568
|
+
* @return {void}
|
|
2159
2569
|
*/
|
|
2160
2570
|
removeNode(node) {
|
|
2161
2571
|
// WebGPU node removal implementation
|
|
@@ -2167,7 +2577,10 @@ export class Context {
|
|
|
2167
2577
|
}
|
|
2168
2578
|
/**
|
|
2169
2579
|
* @description フレームバッファの描画情報をキャンバスに転送
|
|
2580
|
+
* Transfer frame buffer contents to the canvas
|
|
2170
2581
|
* スワップチェーンはCopyDstをサポートしないため、レンダーパスでブリット
|
|
2582
|
+
*
|
|
2583
|
+
* @return {void}
|
|
2171
2584
|
*/
|
|
2172
2585
|
transferMainCanvas() {
|
|
2173
2586
|
// メインアタッチメントの内容をスワップチェーン(キャンバス)にコピー
|
|
@@ -2225,6 +2638,11 @@ export class Context {
|
|
|
2225
2638
|
}
|
|
2226
2639
|
/**
|
|
2227
2640
|
* @description ImageBitmapを生成
|
|
2641
|
+
* Create an ImageBitmap from the current rendering result
|
|
2642
|
+
*
|
|
2643
|
+
* @param {number} width - 画像幅 / Image width
|
|
2644
|
+
* @param {number} height - 画像高さ / Image height
|
|
2645
|
+
* @return {Promise<ImageBitmap>} 生成されたImageBitmap / Created ImageBitmap
|
|
2228
2646
|
*/
|
|
2229
2647
|
async createImageBitmap(width, height) {
|
|
2230
2648
|
// メインアタッチメントから合成済み描画結果を取得
|
|
@@ -2323,6 +2741,7 @@ export class Context {
|
|
|
2323
2741
|
* @description マスク描画の開始準備
|
|
2324
2742
|
* Prepare to start drawing the mask
|
|
2325
2743
|
*
|
|
2744
|
+
* @return {void}
|
|
2326
2745
|
*/
|
|
2327
2746
|
beginMask() {
|
|
2328
2747
|
// メインアタッチメントをバインド(マスクはメインアタッチメントのステンシルに書き込む)
|
|
@@ -2375,10 +2794,11 @@ export class Context {
|
|
|
2375
2794
|
* @description マスクの描画範囲を設定
|
|
2376
2795
|
* Set the mask drawing bounds
|
|
2377
2796
|
*
|
|
2378
|
-
* @param {number} x_min
|
|
2379
|
-
* @param {number} y_min
|
|
2380
|
-
* @param {number} x_max
|
|
2381
|
-
* @param {number} y_max
|
|
2797
|
+
* @param {number} x_min - 最小X座標 / Minimum X coordinate
|
|
2798
|
+
* @param {number} y_min - 最小Y座標 / Minimum Y coordinate
|
|
2799
|
+
* @param {number} x_max - 最大X座標 / Maximum X coordinate
|
|
2800
|
+
* @param {number} y_max - 最大Y座標 / Maximum Y coordinate
|
|
2801
|
+
* @return {void}
|
|
2382
2802
|
*/
|
|
2383
2803
|
setMaskBounds(x_min, y_min, x_max, y_max) {
|
|
2384
2804
|
maskSetMaskBoundsService(x_min, y_min, x_max, y_max);
|
|
@@ -2387,6 +2807,7 @@ export class Context {
|
|
|
2387
2807
|
* @description マスクの描画を終了
|
|
2388
2808
|
* End mask drawing
|
|
2389
2809
|
*
|
|
2810
|
+
* @return {void}
|
|
2390
2811
|
*/
|
|
2391
2812
|
endMask() {
|
|
2392
2813
|
// マスク描画用のレンダーパスを終了
|
|
@@ -2400,8 +2821,9 @@ export class Context {
|
|
|
2400
2821
|
}
|
|
2401
2822
|
/**
|
|
2402
2823
|
* @description マスクの終了処理
|
|
2403
|
-
* Mask end processing
|
|
2824
|
+
* Mask end processing (leave the mask)
|
|
2404
2825
|
*
|
|
2826
|
+
* @return {void}
|
|
2405
2827
|
*/
|
|
2406
2828
|
leaveMask() {
|
|
2407
2829
|
this.drawArraysInstanced();
|