Commit graph

1092 commits

Author SHA1 Message Date
Richard Davey
6ff216d832 Create WebGLPipelineBatchEntry.js 2022-10-09 17:49:11 +01:00
Richard Davey
7600f2f6b6 Added all new jsdocs 2022-10-09 17:49:08 +01:00
Richard Davey
a2d5f25a55 Added new method 2022-10-09 17:30:36 +01:00
Richard Davey
3c54c852dc Don't forget to update the batch count 2022-10-09 17:30:27 +01:00
Richard Davey
70ef38c03c Fixed rendering 2022-10-09 17:29:37 +01:00
Richard Davey
e44a148882 Store actual WebGLTextures 2022-10-09 17:29:29 +01:00
Richard Davey
57f2f7abd7 Broken for now 2022-10-07 18:03:16 +01:00
Richard Davey
5908eea4ce Use new methods 2022-10-07 16:24:07 +01:00
Richard Davey
496882fbd2 Inc count on batchVert 2022-10-07 16:23:57 +01:00
Richard Davey
c9e37ed373 Remove calls to resetTextures 2022-10-07 16:09:23 +01:00
Richard Davey
080242f928 Due to all of the changes with how WebGL texture batching works a lot of mostly internal methods and properties have been removed. This is the complete list
* The `WebGLRenderer.currentActiveTexture` property has been removed.
* The `WebGLRenderer.startActiveTexture` property has been removed.
* The `WebGLRenderer.tempTextures` property has been removed.
* The `WebGLRenderer.textureZero` property has been removed.
* The `WebGLRenderer.normalTexture` property has been removed.
* The `WebGLRenderer.textueFlush` property has been removed.
* The `WebGLRenderer.isTextureClean` property has been removed.
* The `WebGLRenderer.setBlankTexture` method has been removed.
* The `WebGLRenderer.setTextureSource` method has been removed.
* The `WebGLRenderer.isNewNormalMap` method has been removed.
* The `WebGLRenderer.setTextureZero` method has been removed.
* The `WebGLRenderer.clearTextureZero` method has been removed.
* The `WebGLRenderer.setNormalMap` method has been removed.
* The `WebGLRenderer.clearNormalMap` method has been removed.
* The `WebGLRenderer.unbindTextures` method has been removed.
* The `WebGLRenderer.resetTextures` method has been removed.
* The `WebGLRenderer.setTexture2D` method has been removed.
* The `WebGLRenderer.pushFramebuffer` method has had the `resetTextures` argument removed.
* The `WebGLRenderer.setFramebuffer` method has had the `resetTextures` argument removed.
* The `WebGLRenderer.popFramebuffer` method has had the `resetTextures` argument removed.
* The `WebGLRenderer.deleteTexture` method has had the `reset` argument removed.
2022-10-07 16:08:39 +01:00
Richard Davey
cbc0ac5a7a Create a batch if empty 2022-10-07 12:47:04 +01:00
Richard Davey
f4a248e575 Debugging while testing texture batching 2022-10-07 01:37:37 +01:00
Richard Davey
e2187086ce Merged batch code in 2022-10-07 01:37:17 +01:00
Richard Davey
e18c7fe6c9 New shaders 2022-10-07 01:36:58 +01:00
Richard Davey
3f4ebf5dd7 Update WebGLRenderer.js 2022-10-06 18:35:04 +01:00
Richard Davey
f0d3588f7b Use batch system to avoid bufferSubData spamming - massively improves performance! 2022-10-05 00:59:04 +01:00
Richard Davey
08ee414ad5 Inline array add to stop branching 2022-10-05 00:58:33 +01:00
Richard Davey
010db3f2a3 Updated jsdocs 2022-10-04 18:27:19 +01:00
Richard Davey
ba8d25909f Update PipelineManager.js 2022-10-04 18:27:11 +01:00
Richard Davey
03f09e2c10 Added setDefaultPipeline method 2022-10-04 18:20:17 +01:00
Richard Davey
3d3b675ae8 Pass over the config values 2022-10-04 18:04:26 +01:00
Richard Davey
64972f8456 Added default pipeline and mobile swap 2022-10-04 18:04:18 +01:00
Richard Davey
20485e1aa2 Added MobilePipeline 2022-10-04 17:08:48 +01:00
Richard Davey
554ef91353 Correct docs 2022-10-04 14:49:26 +01:00
Richard Davey
e774987897 Removed unused code 2022-10-04 14:49:19 +01:00
Richard Davey
1316c09d1c Merge branch 'master' of https://github.com/photonstorm/phaser 2022-10-04 13:17:44 +01:00
Richard Davey
d9a30e6c52 Remove unused shaders 2022-10-04 13:17:33 +01:00
arbassic
58cf547d47 fix: use webgl 1 pattern to always use best precision available 2022-10-04 01:11:10 +02:00
Richard Davey
1a23b31947 Remove swap and rename method 2022-10-03 22:07:07 +01:00
Richard Davey
b52a730f9b Rename function 2022-10-03 22:06:58 +01:00
Richard Davey
416aa053da Swap to using RenderTarget, much cleaner 2022-10-03 21:09:15 +01:00
Richard Davey
eba9254e1a The BitmapMaskPipeline now hands over most control of the framebuffers to the WebGLRenderer. 2022-10-03 18:50:48 +01:00
Richard Davey
b327f39c5e Bitmap Mask updates
* The `WebGLRenderer` has 4 new properties: `maskTargetFramebuffer`, `maskSourceFramebuffer`, `maskTargetTexture` and `maskSourceTexture`. These are the new global locations of the mask framebuffers.
* `WebGLRenderer.createBitmapMask` is a new method that internally creates the Bitmap Mask framebuffers.
* `WebGLRenderer.clearBitmapMask` is a new method that internally clears the existing Bitmap Mask framebuffers, called as part of a resize event.
* `WebGLRenderer.enableBitmapMask` is a new method that starts the process of using the mask target framebuffer for drawing. This is called by the `BitmapMaskPipeline`.
* `WebGLRenderer.drawBitmapMask` is a new method that completes the process of rendering using the mask target framebuffer. This is called by the `BitmapMaskPipeline`.
2022-10-03 18:49:55 +01:00
Richard Davey
dcb1c8a9dd Allowing custom resolution for mask shader 2022-09-29 23:35:06 +01:00
Richard Davey
3abea4286f When rendering a Sprite with a Camera set to roundPixels it will now run Math.floor on the Matrix position, preventing you from noticing 'jitters' as much when Camera following sprites in heavily zoomed Camera systems. 2022-09-29 22:11:02 +01:00
Richard Davey
2e870a0a2c Previously, the Multi Tint methods batchSprite, batchTexture, batchTextureFrame and batchFillRect would all make heavy use of the TransformMatrix.getXRound and getYRound methods, which in turn called getX and getY and applied optional rounding to them. This is all now handled by one single function (setQuad) with no branching, meaning rendering one single sprite has cut down 16 function calls and 48 getters to just 1 function. 2022-09-29 17:17:24 +01:00
Richard Davey
ab04cb6c05 Lots of LightPipeline improvements
* The Light Pipeline no longer creates up to `maxLights` copies of the Light shader on boot. Previously it would then pick which shader to use, based on the number of visible lights in the Scene. Now, the number of lights is passed to the shader and branches accordingly. This means rather than compiling _n_ shaders on boot, it now only ever needs to create one.
* You can now have no lights in a Scene, but the Scene will still be impacted by the ambient light. Previously, you always needed at least 1 light to trigger ambient light (thanks jstnldrs)
* The `Light.frag` shader now uses a new `uLightCount` uniform to know when to stop iterating through the max lights.
* The `LightPipeline.LIGHT_COUNT` constant has been removed as it's not used internally.
* The `LightPipeline` previous created a global level temporary vec2 for calculations. This is now part of the class as the new `tempVec2` property.
2022-09-23 00:42:04 +01:00
Richard Davey
a135271f19 Use new uLightCount uniform 2022-09-23 00:41:47 +01:00
Richard Davey
b789742636 Update Utils.js 2022-09-22 14:55:29 +01:00
Richard Davey
9d43583a63 This shader is just better. More crappy iOS testing needed though. 2022-09-21 23:13:04 +01:00
brendo
93eceb7d99 show error code 2022-08-30 07:42:14 +08:00
Richard Davey
4c2d3e3cff setTextureZero will now set isTextureClean to false 2022-08-24 13:56:12 +01:00
Richard Davey
9bc8826684 Specify the canvas is for drawing, not reading 2022-08-18 18:01:45 +01:00
Richard Davey
f09ec762ee Removed Graphics Pipeline
The WebGL Graphics Pipeline has been removed. This pipeline wasn't used in v3.55, as all Graphics rendering is handled by the MultiTint pipeline, for better batching support. No Phaser Game Objects use the Graphics pipeline any longer, so to save space it has been removed and is no longer installed by the Pipeline Manager.
2022-07-12 13:39:51 +01:00
Richard Davey
aa2dda09e2 UtilityPipeline.blitFrame has a new optional boolean parameter flipY which, if set, will invert the source Render Target while drawing it to the destination Render Target. 2022-05-30 18:25:21 +01:00
samme
54d12080eb
Docs: fix the mipmapFilter example code 2022-05-09 09:44:09 -07:00
Richard Davey
59fbcc5ca3 Updated copyright year 2022-02-28 14:29:51 +00:00
Richard Davey
c8d3a20754 Updated Multi Pipeline shader so it no longer smacks Safari's arse. 2022-02-03 23:12:15 +00:00
Andy Mikulski
6108414b75
WebGLSnapshot: Support custom rendering contexts 2022-01-26 15:02:59 -07:00
Richard Davey
0e364321e6 Update BitmapMask-frag.js 2021-11-23 18:24:14 +00:00
Richard Davey
6c459eb3d5 Update Multi-frag.js 2021-11-23 18:19:05 +00:00
Richard Davey
8699e97f94 The BitmapMask shader has been recoded so it now works correctly if you mask a Game Object that has alpha set on it, or in its texture. Previously it would alpha the Game Object against black 2021-11-23 18:18:47 +00:00
Richard Davey
c37da11d36 pma is essential - to hell with Firefox! 2021-11-08 21:51:08 +00:00
Richard Davey
2efa08d3db Testing pma off 2021-11-08 18:49:48 +00:00
Richard Davey
fc1234e55b Added createProgram, setBoolean and the new src properties 2021-11-02 18:05:18 +00:00
Richard Davey
565dfc801a WebGLPipeline.setBoolean is a new method that allows you to set a boolean uniform on a shader. 2021-11-02 18:00:25 +00:00
Richard Davey
95d7dc71b2 Update SpriteFXPipeline.js 2021-11-02 17:05:23 +00:00
Richard Davey
c94719e0b8 Added alt swap frame 2021-10-28 01:19:52 +01:00
Richard Davey
03345ea60c Update WebGLPipeline.js 2021-10-27 17:21:59 +01:00
Richard Davey
9980c35c3e Update SpriteFXPipeline.js 2021-10-27 17:21:55 +01:00
Richard Davey
29ada646e0 Updated docs 2021-10-26 00:04:37 +01:00
Richard Davey
17c76c831c The Multi Tint fragment shader now uses the new getSampler function approach from Phaser 4 2021-10-26 00:00:35 +01:00
Richard Davey
4d18ad6ff8 Removed GenerateSrc, removed need for forloop declaration 2021-10-26 00:00:20 +01:00
Richard Davey
55ef37b6fb Removed spriteData, added destroy, tidied up docs 2021-10-21 18:38:15 +01:00
Richard Davey
0020f03ead Fixed Sprite FX targetBounds 2021-10-20 17:02:37 +01:00
Richard Davey
143d63dcb0 Debugging 2021-10-20 12:37:05 +01:00
Richard Davey
508630ad81 Added renderTargets, maxDimension, frameInc and targetIndex 2021-10-20 12:36:54 +01:00
Richard Davey
9e38e37d6f Removed RenderTargets (moved to PM) and flipped projection matrix 2021-10-19 22:48:02 +01:00
Richard Davey
5fb2604292 Removed flip verts 2021-10-19 22:47:34 +01:00
Richard Davey
d46f6e37f3 WebGLPipeline.flipProjectionMatrix is a new method that allows you to flip the y and bottom projection matrix values via a parameter. 2021-10-19 22:47:22 +01:00
Richard Davey
ef4d5d94bb New fsTarget copySubTex approach (faster) 2021-10-19 18:43:15 +01:00
Richard Davey
c6ac6125c9 Update MultiPipeline.js 2021-10-19 18:42:58 +01:00
Richard Davey
b434c3b4f8 Fixed jsdocs 2021-10-18 17:54:25 +01:00
Richard Davey
347b6db490 Added altFrame option and calculations + handy utility functions 2021-10-18 17:49:09 +01:00
Richard Davey
d4edcbd8ca Set default vert shader 2021-10-18 16:01:53 +01:00
Richard Davey
ba0a52e386 Update SpriteFXPipeline.js 2021-10-16 15:30:03 +01:00
Richard Davey
638fd113b5 Flip the Y on textures 2021-10-16 15:23:33 +01:00
Richard Davey
5e509bd72b Removed 'drawToFrame' (it's the only option) and added 'batchTexture' 2021-10-16 15:08:58 +01:00
Richard Davey
acc9f07e5c Fixed data and alpha value 2021-10-15 18:45:23 +01:00
Richard Davey
fd1ab765a3 Full JSDocs and tidied up all the methods 2021-10-15 18:39:10 +01:00
Richard Davey
efa8c8b5a5 Fixed verts and called onFX 2021-10-15 00:59:04 +01:00
Richard Davey
6c00b5cfc4 Added onPreCopy 2021-10-14 18:51:39 +01:00
Richard Davey
8a89700bf7 Fixed shader uniform issue and tidied up code 2021-10-14 18:45:59 +01:00
Richard Davey
bfecf9da5a RenderTarget will now automatically set the wrapping mode to clamp. 2021-10-14 18:45:41 +01:00
Richard Davey
c1c8e5d12b The WebGLRenderer.createTextureFromSource method has a new optional boolean parameter forceClamp that will for the clamp wrapping mode even if the texture is a power-of-two. 2021-10-14 18:45:28 +01:00
Richard Davey
d5a86d7b07 Update SpriteFXPipeline.js 2021-10-14 01:08:06 +01:00
Richard Davey
5d2749f5d6 Update SpriteFXPipeline.js 2021-10-14 00:55:27 +01:00
Richard Davey
219ff50b90 Fixed copyFrame handling 2021-10-13 23:38:04 +01:00
Richard Davey
c4c5453dfb Removed log 2021-10-13 23:35:29 +01:00
Richard Davey
fd54fa741c Update SpriteFXPipeline.js 2021-10-13 18:56:41 +01:00
Richard Davey
635e7283d5 Added buffer to setVertexBuffer and setShader 2021-10-13 18:56:31 +01:00
Richard Davey
0bf366a096 Update SpriteFXPipeline.js 2021-10-13 13:04:08 +01:00
Richard Davey
803d71469e Fixed the vert and uv handling 2021-10-12 21:47:48 +01:00
Richard Davey
4f454a5701 Update WebGLPipeline.js 2021-10-12 21:47:39 +01:00
Richard Davey
3afc8b1a8e Flip the verts 2021-10-12 21:47:33 +01:00
Richard Davey
2a473889dc Update SpriteFXPipeline.js 2021-10-12 18:54:06 +01:00
Richard Davey
85c6c4be44 Swap frame support added and drawSprite method 2021-10-12 18:00:50 +01:00
Richard Davey
68c3fc4171 Fixed resizing. Set RTs in boot. 2021-10-12 16:09:53 +01:00
Richard Davey
6fe88aeee7 Refactored to use existing functions where possible 2021-10-12 13:32:39 +01:00
Richard Davey
9e9c9298eb Much better renderTarget handling. Sprite now draws properly. Config handling done. Need to fix bindAndDraw 2021-10-12 01:03:45 +01:00
Richard Davey
53eb64b92b Added isSpriteFX property 2021-10-12 01:03:18 +01:00
Richard Davey
904ca9f7c4 Removed SpriteFX as you extend it, not instantiate it 2021-10-12 01:03:04 +01:00
Richard Davey
e9d85c57ee Update SpriteFXPipeline.js 2021-10-11 18:49:17 +01:00
Richard Davey
7af3693fb5 Add SpriteFX Pipeline to const and default array 2021-10-11 18:49:13 +01:00
Richard Davey
038ffa7b77 Create SpriteFXPipeline.js 2021-10-11 18:06:42 +01:00
Richard Davey
fa25b9e254 Removed temp function 2021-10-11 18:06:35 +01:00
Richard Davey
5c88dd8593 Only need to set the width 2021-10-11 17:56:26 +01:00
Richard Davey
784f722b90 Remove, we'll handle this elsewhere 2021-10-11 17:56:11 +01:00
Richard Davey
e26eb49769 Update RenderTargetConfig.js 2021-10-11 17:04:20 +01:00
Richard Davey
d32badabf5 When defining the renderTargets in a pipeline config, you can now set optional width and height properties, which will create a Render Target of that exact size, ignoring the scale value (if also given). 2021-10-11 17:02:36 +01:00
Richard Davey
c1430f41dc Testing FX padding 2021-10-11 15:10:57 +01:00
Richard Davey
bf02aaa7ee Update WebGLTextureCompression.js 2021-10-06 18:48:04 +01:00
Richard Davey
01beb898b3 The WebGLRenderer.createTextureFromSource method now accepts the CompressedTextureData data objects and creates WebGL textures from them. 2021-10-06 18:47:35 +01:00
Richard Davey
234ba03b35 Update WebGLRenderer.js 2021-10-05 18:36:50 +01:00
Richard Davey
f376958ca1 Added getCompressedTextureName method 2021-10-05 18:30:17 +01:00
Richard Davey
7bdb9d672f Added supportsCompressedTexture method 2021-10-05 17:04:44 +01:00
Richard Davey
5a941ed509 Expanded to support all formats 2021-10-05 16:48:51 +01:00
Richard Davey
573dd3a14d Added getCompressedTextures method 2021-10-05 16:48:42 +01:00
Richard Davey
b968e46ee2 The Multi Pipeline now uses highp float precision by default, instead of mediump. This fixes issues with strange blue 'spots' appearing under WebGL on some Android devices. Fix #5751 #5659 #5655 2021-09-28 15:56:54 +01:00
Richard Davey
0ab2534306 Update PipelineManager.js 2021-09-21 14:53:18 +01:00
Richard Davey
78b9215e2f Added the missing WebGLPipelineUniformsConfig type def. Fix #5718 (thanks @PhaserEditor2D) 2021-05-26 15:38:51 +01:00
Richard Davey
3a6e82a042 The WebGLShader.set1fv, set2fv, set3fv, set4fv, set1iv, set2iv, set3iv, set4iv, setMatrix2fv, setMatrix3fv and setMatrix4fv methods no longer try to do array comparisons when setting the uniforms, but sets them directly. Fix #5670 2021-05-24 17:24:03 +01:00
Benjamin Magalhaes
562a05a642 Remove unused WebGLPipelineUniformsConfig 2021-05-13 15:21:35 +02:00
Benjamin Magalhaes
aa97541c3f Fix WebGLPipelineAttributeConfig documentation 2021-05-13 13:31:18 +02:00
Richard Davey
9879a1062e Merged the Graphics Pipeline functions into the MultiPipeline 2021-04-16 18:18:42 +01:00
Vladislav Forsh
670a66c697 Improve types for WebGL texture compression support
(cherry picked from commit 5626acffec17c6b4d66c78b8e0aa52e5cfcd8478)
2021-04-13 13:19:24 +03:00
Richard Davey
e954547cf7 The PipelineManager.rebind method will now flag all pipelines as glReset = true, so they know to fully rebind the next time they are invoked. 2021-03-01 17:50:40 +00:00
Richard Davey
8d7519b84d * WebGLPipeline.glReset is a new boolean property that keeps track of when the GL Context was last reset by the Pipeline Manager. It then redirects calls to bind to rebind instead to restore the pipeline state.
The `WebGLPipeline.rebind` method now accepts an optional parameter `currentShader`. If provided it will set the current shader to be this after the pipeline reset is complete.
2021-03-01 17:50:39 +00:00
Richard Davey
a95c34ce92 WebGLRenderer.deleteTexture will now run resetTextures(true) first, incase the requested texture to be deleted is currently bound. Previously, it would delete the texture and then reset them. 2021-02-17 13:10:10 +00:00
Richard Davey
3deb6672aa RenderTarget.resize will now Math.floor the scaled width and height as well as ensure they're not <= 0 which causes Framebuffer status: Incomplete Attachment errors. Fix #5563 2021-02-16 12:32:55 +00:00
Richard Davey
dff17f52e8 The LightPipeline now only calls batchSprite, batchTexture and batchTextureFrame if the Scene Lights Manager is active. Fix #5522 2021-02-04 16:38:09 +00:00
Richard Davey
c5cbb413d2 You can now set the boolean preserveDrawingBuffer in the Game Config (either directly, or in the Render Config). This is passed to the WebGL context during creation and controls if the buffers are automatically cleared each frame or not. The default is to clear them. Set to true to retain them. 2021-02-04 15:58:41 +00:00
Richard Davey
a765b7edfc WebGLRenderer.isTextureClean is a new boolean property that tracks of all of the multi-textures are in a clean 'default' state, to avoid lots of gl texture binds and activations during a Scene restart or destruction process. 2021-01-04 15:49:39 +00:00
Richard Davey
e7aff5d0dc Data type fix 2020-12-16 10:25:27 +00:00
Richard Davey
6912124780 Fixed docs 2020-12-15 16:05:34 +00:00
Richard Davey
67b3f812f8 JSDocs 2020-12-14 13:50:50 +00:00
Richard Davey
00ec07d67f JSDoc update 2020-12-14 13:36:51 +00:00
Richard Davey
cbe1a3219a JSDoc improvements 2020-12-14 13:33:42 +00:00
Richard Davey
5a532da7bf Disable scissor before clearing. 2020-12-14 09:08:28 +00:00
Richard Davey
166c333d13 Should rebind shaders too 2020-12-11 12:41:48 +00:00
Richard Davey
519afd031b Fixed Camera Fade Effect check. Fix #5438 2020-12-11 11:29:16 +00:00
Richard Davey
69f4a6d8fb Added getAspectRatio method 2020-12-11 11:05:20 +00:00
Richard Davey
e4be6dbc90 Fixed JSDocs and removed unused method 2020-12-11 10:33:53 +00:00
Richard Davey
11990bccb4 Added global projection matrix back and removed events 2020-12-11 10:26:15 +00:00
Richard Davey
0d67548343 Compare projection matrix with renderer 2020-12-11 10:24:47 +00:00
Richard Davey
8839007e0f Update the projection matrix on bind 2020-12-11 10:24:27 +00:00
Richard Davey
27da1dfa4b Clear just the color buffer 2020-12-11 10:24:05 +00:00
Richard Davey
7acbd816f3 Added new Projection Update event and respond to it 2020-12-10 18:07:25 +00:00
Richard Davey
4f5cedde03 Better method name. Reset once done. 2020-12-10 16:58:34 +00:00