Commit graph

405 commits

Author SHA1 Message Date
Richard Davey
c445303ffb Revert define changes as they don't work 2024-02-21 13:23:52 +00:00
Richard Davey
7aaa976a4e Updated webpack config DefinePlugin use and corresponding defs to allow those crazy souls who import source directly on node to have a better life #6644 2024-02-21 12:57:48 +00:00
Ben Richards
13d6defb33 Fix rare text sizes failing to render.
If initialized at a power-of-two resolution, then resized to a
non-power-of-two resolution, some extra parameters must be updated.
2024-02-21 11:48:59 +13:00
Ben Richards
93b4b083f1 Fix setting unnecessarily high texture filters. 2024-02-20 13:10:08 +13:00
Ben Richards
a2178c8466 Fix MIPMaps being disabled for compressed textures. 2024-02-20 13:02:19 +13:00
Richard Davey
1f8276ac76 Updated copyright year, company and author 2024-02-19 17:12:24 +00:00
Richard Davey
56213a5f7e Update WebGLRenderer.js 2024-02-19 15:28:21 +00:00
Ben Richards
878d3d2211 Fix support for BPTC and RGTC texture compression.
They use different WebGL extension name formats.
2024-02-13 17:38:19 +13:00
Ben Richards
2e8a8f8081 Add default normal map texture __NORMAL.
Remove `LightPipeline.defaultNormalMap`, as this universal texture is
now available to use.
2024-02-09 15:51:53 +13:00
Ben Richards
23a672bc48 Improve resize handling.
Although the `resize` function does make GL calls,
they will have no effect during context loss.
2024-02-09 12:28:20 +13:00
Ben Richards
4353a1e175 Improve safety around context loss.
Clarify notes on drawing dynamic textures during context loss.
Allow `Shader` to initialize and operate during context loss.
Improve resize handling on context loss and recovery.
2024-02-08 18:53:10 +13:00
Ben Richards
49e9d45435 Emit LOSE_WEBGL event.
Also rearrange RESTORE_WEBGL event code.
2024-02-02 21:57:28 +13:00
Ben Richards
d57b46e690 Tidy up wrappers on WebGLRenderer destroy. 2024-02-02 20:55:09 +13:00
Ben Richards
ade7b57e3d Restore WebGL extensions. 2024-02-02 16:29:24 +13:00
Ben Richards
4c849cb2f7 Tidy up WebGL Wrappers.
Dispose of all references on destroy.
Properly name WebGLProgramWrapper#initialize.
Remove renderer dependence in WebGLFramebufferWrapper.
2024-02-02 15:30:38 +13:00
Ben Richards
24d739ed72 Emit RESTORE_WEBGL event. 2024-02-02 11:33:27 +13:00
Ben Richards
a0f066c543 Restore WebGL context.
All textures and shaders should automatically recover from WebGL
context loss.
Dynamic textures will lose their contents, unfortunately, as the texture
was stored on the GPU.
Frame buffers still have some bugs to work out.
2024-02-01 16:59:00 +13:00
Ben Richards
b9deef7e61 Destroy location wrappers when they're unused. 2024-01-31 11:53:50 +13:00
Ben Richards
e920b1a961 Create and use wrappers for WebGLUniformLocation and WebGLAttribLocation. 2024-01-30 22:13:51 +13:00
Ben Richards
0f9fb3177d Fix incorrect WebGL calls. 2024-01-30 11:23:27 +13:00
Ben Richards
2382f7c1eb Create and use WebGLProgramWrapper.
This handles shader programs.
Also tweak the documentation in WebGLBufferWrapper and
WebGLFramebufferWrapper to better reflect purpose.
2024-01-29 17:35:57 +13:00
Ben Richards
377221de35 Create and use WebGLBufferWrapper.
This mostly handles VertexBuffers, but there's an IndexBuffer which
is not internally used that uses the same wrapper.
2024-01-29 16:40:18 +13:00
Ben Richards
842d666ebf Use and document WebGLFramebufferWrapper.
Also tweak WebGLTextureWrapper to have more standard destroyers
in itself and WebGLRenderer.
2024-01-29 14:53:23 +13:00
Ben Richards
b591c3674a Document usage of WebGLTextureWrapper in place of WebGLTexture. 2024-01-29 11:47:39 +13:00
Ben Richards
216b7564f6 Update systems to use WebGLTextureWrapper and Uint8Array textures.
This is mostly hooking up gl calls to look inside the wrapper.
A few other things have changed.
Spector metadata is set the new way.
`Frame` changed `glTexture` to a getter, simplifying bookkeeping.
`LightPipeline` and `Plane` use standard methods to create textures.
`WebGLRenderer` maintains a list of wrappers, and automatically
manages it through `createTexture2D` and `deleteTexture`. The update
methods `updateCanvasTexture` and `updateVideoTexture` have been
delegated to the wrapper.
2024-01-29 11:45:12 +13:00
Ben Richards
a8dff1f990 Add Uint8Array texture creation methods. 2024-01-29 11:30:54 +13:00
Richard Davey
a26f827650 Optimized setTextureFilter 2023-11-07 18:28:27 +00:00
Richard Davey
b28ad7f3d3 The BitmapMask wouldn't correctly set the gl viewport when binding, which caused the mask to distort in games where the canvas resizes from its default. Fix #6527 2023-10-13 17:53:55 +01:00
Richard Davey
bae26a5205 When a framebuffer is deleted, it now sets its renderTexture property to undefined to ensure the reference is cleared. 2023-10-13 17:15:21 +01:00
Richard Davey
d74e767050 Delete color attachment 2023-10-12 18:49:06 +01:00
Richard Davey
1935119141 Array Remove and unbind before deleting the framebuffer 2023-10-12 15:22:26 +01:00
Richard Davey
e8e57b6b0c The WebGLRenderer.deleteFramebuffer method has been updated so it now tests for the exitennce of a COLOR and DEPTH_STENCIL attachments, and if found, removes the bindings and deletes the stencil buffer. The code that previously deelted the RENDERERBUFFER_BINDING has also been removed to avoid side-effects. 2023-09-05 13:40:45 +01:00
Richard Davey
8e1809688c The WebGLRenderer will now validate that the mipmapFilter property in the Game Config is a valid mipmap before assigning it. 2023-08-01 13:44:58 +01:00
Richard Davey
96ee7679c4 Added Spector method docs 2023-04-12 03:45:19 +01:00
Richard Davey
4fbd7eec82 Rename zero method and remove logs 2023-03-16 21:56:55 +00:00
Richard Davey
b093ece620 Debugging stencil stack 2023-03-16 18:49:43 +00:00
Richard Davey
4c19106c63 Debugging fx stacks 2023-03-16 18:23:30 +00:00
Richard Davey
5b12080cef Added methods zeroStencilMask and restoreStencilMask 2023-03-14 19:45:44 +00:00
Richard Davey
684a2ab35a setFramebuffer accepts texture and clear param 2023-03-03 18:53:36 +00:00
Richard Davey
8b493834dc Log can take any parameters 2023-03-02 18:45:42 +00:00
Richard Davey
eaf6fa7f45 Added log method, depth buffer and missing parameter default 2023-03-02 18:16:59 +00:00
Richard Davey
6f678e0825 If mipmapFilter is not set on the config (now the default) it won't create them at all. 2023-01-23 20:59:02 +00:00
Richard Davey
468bf7821d Updated copyright year 2023-01-02 17:36:27 +00:00
Richard Davey
7a5d138271 Testing deleting renderbuffer #6311 2022-12-07 18:29:11 +00:00
Richard Davey
e608c2caf1 The CONTEXT_RESTORED Game Event has been removed and the WebGL Renderer no longer listens for the contextrestored DOM event, or has a contextRestoredHandler method. This never actually worked properly, in any version of Phaser 3 - although the WebGLRenderer would be restored, none of the shaders, pipelines or textures were correctly re-created. If a context is now lost, Phaser will display an error in the console and all rendering will halt. It will no longer try to re-create the context, leading to masses of WebGL errors in the console. Instead, it will die gracefully and require a page reload. 2022-11-17 18:04:51 +00:00
Richard Davey
7d594dd49a Clarify snapshot docs 2022-10-31 22:46:44 +00:00
Richard Davey
22eae26007 WebRenderer.snapshotFramebuffer and by extension, the snapshot methods in Dynamic Textures and Render Textures, has been updated to ensure that the width and height never exceed the framebuffer dimensions, or it'll cause a runtime error. The method snapshotArea has had this limitation removed as a result, allowing you to snapshot areas that are larger than the Canvas. Fix #5707 2022-10-31 22:17:27 +00:00
Richard Davey
ba6af3a920 Conditionally set DEBUG 2022-10-31 16:17:16 +00:00
Richard Davey
4f0029c03c Added captureFrame, captureNextFrame, getFps, startCapture and stopCapture methods 2022-10-28 18:23:24 +01:00
Richard Davey
e44a148882 Store actual WebGLTextures 2022-10-09 17:29:29 +01:00