From 6163340f580990ff8a2a2f7d7dccf9c8139743b6 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Fri, 27 Jul 2018 00:53:07 +0100 Subject: [PATCH] Updated log --- CHANGELOG.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74ca505ca..d67e39033 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,36 @@ ## Version 3.12.0 - Silica - in development +### FlatTintPipeline Updates + +In 3.11 I overhauled the TextureTintPipeline, the WebGL batch used to render all texture based Game Objects, such as Sprites. In this release I did the same to the FlatTintPipeline. This pipeline was used exclusively by the Graphics Game Object to draw filled and stroked primitives in WebGL. It was also used by classes such as the Camera in order to draw their colored backgrounds and flash / fade effects. + +When I looked closely at the shaders being used by the texture and graphics pipelines I noticed they were virtually identical. Yet if you were to mix Graphics objects and Sprites in your game, it would cause a complete batch flush as it switched between the them as it rebound the shaders, adding to both the draw calls and gl ops per frame. + +The more I looked through the graphics pipeline, the more I saw the same kind of things the texture one previously had: duplicate vars, in-line matrix operations and so on. So I worked through the process of refactoring it, boiling it down to just a handful of core methods and re-using methods the texture pipeline already had. The end result is that I've been able to remove the FlatTintPipeline entirely. This saves 42.3KB (unminifed) and removes 1000 lines of code from the build. Of course, lots of the methods were added to the texture pipeline, but that only increased from 730 sloc to 1087 sloc, a fraction of the amount before! And the benefits don't end there. + +If you had any custom pipelines that extended the FlatTintPipeline please update them to extend the TextureTintPipeline instead. You'll likely need to remap a few methods, but most of them remain the same. Double-check the method signatures though. + +The same pipeline can now draw both graphics and sprites, with the same shader and no texture swapping either. This means you can happily mix Graphics objects alongside Sprites and it won't cost any extra overhead at all. There are more benefits too, which are outlined in the list below. + +* The TextureTintPipeline now has 100% jsdoc coverage. +* The removal of the FlatTintPipeline shaves 42.3KB and 1000 sloc from the bundle size. +* The Graphics fill and line styles are now cached in the pipeline, rather than being re-calculated for every primitive drawn. +* The new `batchTri` method will add a triangle to the vertex batch, either textured or filled. +* `drawFillRect` is a new method that will add an untransformed rectangle to the batch. These are used by things like Cameras to fill in background colors. +* `batchFillRect` has been moved to the TextureTintPipeline and has a new much more concise method signature. +* `batchFillTriangle` has been moved to the TextureTintPipeline and has a new much more concise method signature. +* `batchFillPath` has been moved to the TextureTintPipeline and has a new much more concise method signature. +* `batchLine` has been moved to the TextureTintPipeline. +* When drawing Graphics paths with a line width of 1 it will no longer spend any time drawing the line joins, speeding-up the rendering of 1px lines. + +### WebGL Scissor Update + +The process of managing scissors in the WebGLRenderer has been completely rewritten. Previously, the gl scissor was being constantly enabled and disabled for every Camera in your game, leading to pointless gl operations. + +* Cameras have a new internal method `updateSystem` which is automatically called if you change any Camera viewport values. This in turn tells the Scene Manager if there are any cameras with custom viewports, in any Scene of your game. If there are not then the scissor is never even enabled or set, meaning zero gl ops! If your game uses full sized Cameras it now doesn't cost anything at all with regard to scissoring. +* If a new scissor is set it will now check to see if it's the same size and position as the current scissor, and if so, it'll skip setting it at all. + ### New Features * `Camera.resolution` is a new read-only property that holds the current game config resolution that the camera is using. This is used internally for viewport calculations. @@ -9,6 +39,9 @@ * `TransformMatrix.getCSSMatrix` will return a CSS transform matrix formatted string from the current matrix values. * `CacheManager` now creates a new cache called `html` which is used to store all loaded HTML snippets. * `FileType.HTML` is a new file type loader that will load an HTML snippet and store it in the new `html` cache. Access it via `load.html` (this method was previously used to load html to textures, please see `load.htmlTexture` for this feature now) +* `TransformMatrix.getX` is a new method that return the x component from the given x and y values based on the current matrix. This is used heavily in the pipelines. +* `TransformMatrix.getY` is a new method that return the y component from the given x and y values based on the current matrix. This is used heavily in the pipelines. +* `TransformMatrix.copyToArray` is a new method that will copy the matrix values to the given array. It's the counter-part of `copyFromArray`. ### Updates @@ -18,6 +51,8 @@ * `GameObject.willRender` now takes a Camera as its only argument and uses it within the check. This has allowed me to remove 23 duplicate checks spread across the various Game Objects, all of which did the same thing, saving both KB and CPU time as the flags were being checked twice in most cases. * The file type loader `HTML` has been renamed to `HTMLTexture`. If you were using this then please change your calls from `load.html` to `load.htmlTexture`. The arguments remain the same. * The `setBlendMode` method in the WebGL Renderer now returns a boolean. True if a new blend mode was set, otherwise false. Previously in returned a reference to the renderer instance. +* The `load.html` method has been renamed to `load.htmlTexture`. +* The method `batchVertices` in the TextureTintPipeline has been renamed to `batchQuad` which more accurately describes what it does. ### Game Config Resolution Specific Bug Fixes @@ -37,6 +72,7 @@ Setting the `resolution` property in the Game Config to a value other than 1 wou * Particles using a blend mode wouldn't render correctly after the updates in 3.11. If the blend mode changes during the processing of an emitter manager it'll now correctly rebind the texture, stopping the particles from vanishing. Fix #3851 (thanks @maxailloud) * Adding an array of children to a Group would cause it to mistakenly think you were passing a config object. Fix #3854 (thanks @pedro-w) * Graphics paths in WebGL would not render the line join between the final and the first path if the path was closed, leaving a noticeable gap if you used particularly thick strokes. If the path is closed it will now render the final line join properly. +* If a Mesh caused a batch flush it would fail to render as its texture was lost. It's now rebound correctly after the flush. ### Examples, Documentation and TypeScript