Commit graph

73 commits

Author SHA1 Message Date
Sergii Liebodkin
5b46637a3d wg_engine: uniform stage buffers (transform and solid color)
https://github.com/thorvg/thorvg/issues/3505
2025-06-06 14:06:54 +03:00
Sergii Liebodkin
24509b0e41 wg_engine: geometry stage buffers implementation
Some checks are pending
Android / build_x86_64 (push) Waiting to run
Android / build_aarch64 (push) Waiting to run
iOS / build_x86_64 (push) Waiting to run
iOS / build_arm64 (push) Waiting to run
macOS / build (push) Waiting to run
macOS / compact_test (push) Waiting to run
macOS / unit_test (push) Waiting to run
Ubuntu / build (push) Waiting to run
Ubuntu / compact_test (push) Waiting to run
Ubuntu / unit_test (push) Waiting to run
Windows / build (push) Waiting to run
Windows / compact_test (push) Waiting to run
Windows / unit_test (push) Waiting to run
Implemented task-based rendering and geometry stage buffers:
1. Get information about current frame objects
2. Accumulate geometry data into a stage buffer during frame rendering
3. Flush it to the GPU in single call
4. Run rendering process in post render stage

https://github.com/thorvg/thorvg/issues/3489
https://github.com/thorvg/thorvg/issues/3455
2025-05-30 02:21:31 +09:00
Hermet Park
5154e491cc wg_engine: ++optimal logic
avoid using initializer here.
2025-05-13 14:47:40 +09:00
Hermet Park
4cf68b75e5 renderer: code clean++ 2025-04-22 00:13:40 +09:00
Hermet Park
afd780bfa9 wg_engine: set default file permissions 644 for consistency 2025-03-27 22:19:36 +09:00
Sergii Liebodkin
a7efd0f199 wg_engine: crash for empty clips fix
issue: https://github.com/thorvg/thorvg/issues/3289
2025-03-20 11:58:47 +09:00
Hermet Park
f1e9ce0460 common: refactoring the dash pattern
introdced the length to avoid duplicate among engines
2025-03-17 15:28:23 +09:00
Sergii Liebodkin
889710ecee wg_engine: Introduce the stroke clipper
Issue: https://github.com/thorvg/thorvg/issues/3063
2025-02-28 11:34:01 +09:00
Sergii Liebodkin
1f204ffb8d wg_engine: Introduce triton effect for webgpu renderer
Issue: https://github.com/thorvg/thorvg/issues/3054
2025-02-27 20:11:21 +09:00
Sergii Liebodkin
f024c54b87 wg_engine: Introduce tiny effect for webgpu renderer
Issue: https://github.com/thorvg/thorvg/issues/3054
2025-02-27 20:11:21 +09:00
Sergii Liebodkin
9a2d1136de wg_engine: Introduce fill effect for webgpu renderer
Issue: https://github.com/thorvg/thorvg/issues/3054
2025-02-27 12:15:42 +09:00
Sergii Liebodkin
64ed756c2c wg_engine: Introduce drop shadow effect for webgpu renderer
Issue: https://github.com/thorvg/thorvg/issues/3054
Supported color, angle, distance, sigma, quality params
2025-02-25 11:54:04 +09:00
Mira Grudzinska
05a5a7ea0b wg_engine: support trimmed fill
This commit changes the API behavior.

@Issue: https://github.com/thorvg/thorvg/issues/3118
2025-02-24 15:05:59 +09:00
Mira Grudzinska
b939a60bfa api: change api name strokeTrim() -> trimpath()
No changes in behaviour so far.
2025-02-24 15:05:38 +09:00
Mira Grudzinska
4e98f12743 wg_engine: fix stroke update
The stroke was not updated because the update function
handled flags related to the color/gradient only.
2025-02-18 21:10:10 +09:00
Hermet Park
ac08a9d6e7 wg_engine: introduced global vertexbuffer mempool & ++thread safety
Manage the global buffer memory for vertex and indexed vertex buffers,
increase the memory size incrementally twice by default and reduce
the default buffer size, which is not suitable for typical scenarios.

This could reduce the a bit stack memory usage and improve
the portability across systems where has the stack memory
limitation and potentially gaining performance enhancement
by avoiding brutal stack memory usage at the many function calls.

added the internal functions:

- WgVertexBuffer* mpoolReqVertexBuffer(float scale = 1.0f);
- WgIndexedVertexBuffer* mpoolReqIndexedVertexBuffer(float scale = 1.0f);
- void mpoolRetVertexBuffer(WgVertexBuffer* buffer);
- void mpoolRetIndexedVertexBuffer(WgIndexedVertexBuffer* buffer);

issue: https://github.com/thorvg/thorvg/issues/3159
2025-02-17 18:56:31 +09:00
Mira Grudzinska
cb8cadfbba wg_engine: apply common trimming logic
The trim-related implementation has been removed
and replaced with the one available in common.

@Issue: https://github.com/thorvg/thorvg/issues/2854
2025-02-06 22:39:11 +09:00
Mira Grudzinska
669d6dc580 common: introduce TrimPath struct
The first step towards unifying trimming across engines.

@Issue: https://github.com/thorvg/thorvg/issues/2854
2025-02-06 22:39:11 +09:00
Hermet Park
0dd0a3b45c common: neat code++
introduced common BBox structure
2025-02-06 15:40:32 +09:00
Sergii Liebodkin
857f1404e1 wg_engine: gaussian blur basic implementation
Introduce blur effect for webgpu renderer
Issue: https://github.com/thorvg/thorvg/issues/3054
2025-02-06 14:44:08 +09:00
Hermet Park
07e73a9e6f common: code refactoring
use ARRAY_FOREACH() for neat code and
accessing the memory efficiently than normal indexing.
2025-01-15 18:03:46 +09:00
Sergii Liebodkin
222e8a25a1 wg_engine: fix context handle passimg by ref
Use reference insted of value for context passing
2025-01-08 17:21:57 +09:00
Hermet Park
a12accbc93 updated copyright 2025-01-03 14:32:31 +09:00
Sergii Liebodkin
4a38a4d360 wg_engine: simplify shader types
Use universal vec4f type for blend settings and color to pass data as shader parameter
2024-11-29 19:01:47 +09:00
Sergii Liebodkin
163640b3e5 wg_engine: apply texture formats on creation (refactoring)
Apply texture color space on texture creation, instead of shader side
2024-11-29 18:57:57 +09:00
Sergii Liebodkin
77201546dd wg_engine: separate pipelines ans bind group layouts (refactoring)
The main reason of refactoring is to separate bind group sets and pipelines, and change owning of pipelines to compositor
2024-11-27 11:31:35 +02:00
Sergii Liebodkin
6c452c1fd3 wg_engine: fix resources disposing on context destroy
We must to dispose all paints render handles before the context will be destroyed to prevent handles leak
2024-11-26 11:34:42 +09:00
Sergii Liebodkin
3805f26aff wg_engine: multicanvas support
Added multicanas support
Issue https://github.com/thorvg/thorvg/issues/2745
2024-11-22 12:34:26 +09:00
Hermet Park
d3d085de15 renderer: code refactoring
- introduced RenderColor
- internal name changes to avoid conflicts
2024-11-20 22:13:27 +09:00
Sergii Liebodkin
8b27efc99f wg_engine: fix cubic splines and circles tesselation quality
Tesseletion factor now depends on scale matix of the shape
2024-10-31 20:24:35 +07:00
Sergii Liebodkin
40cff2d6f5 wg_engine: fix long path support
created a singe shared instance of stoke generator in heap, instead of stack. No performace impact
2024-10-16 00:52:07 +09:00
Sergii Liebodkin
c926eebba1 wg_engine: fix empty shape aabb handling
see https://github.com/thorvg/thorvg/issues/2843:
2024-10-16 00:52:07 +09:00
Hermet Park
630cbc48ae api: revise the api for v1.0
- refactored the Fill matrix to hold internal data statically.
- refactored for clean & neat the raster engine / svg loader logic.

API Modification:
 - Matrix Fill::transform() const -> Matrix& Fill::transform() const

issue: https://github.com/thorvg/thorvg/issues/1372
2024-10-14 23:32:55 +09:00
Sergii Liebodkin
3afb7be255 wg_engine: fix picture memory leak
picture mesh data was not released
2024-10-04 03:40:57 +09:00
Mira Grudzinska
2fc0aad2d1 wg_engine: fix stroke trimming
Fix cases when begin < 0 - this require handling the stroke
in two parts: begin - 0 and 0 - end.
Improve trimming for simultaneous=true.
2024-09-26 16:13:05 +09:00
Mira Grudzinska
fa17fcde81 wg_engine: fix stroke trimming
Prevent crash for begin == end;
2024-09-25 23:45:38 +09:00
Sergii Liebodkin
ee6a7214d4 wg_engine: geometry generating optimization
Streaming model for massive vertex and index creations: minimize memory allocations, range checks and other conditions
Reduce number of segments length calculations (sqrt) and bbox (min and max).
Update distances and bboxes on a whole buffer and only if necessary. For shapes without strokes compute distances not necessary at all. bbox can be updated only on the final stage of geometry workflow, but not on the each stage.
Using stack memory instead of heap. its more cache friendly and did not fragment memory, faster memory allocations (weak place of realization)
Using cache for points distances and whole path length. Updates only if necessary
Validation of geometry consistency executes only on the final stage of path life cicle. It more friendly for data streaming: no any conditions and branches.
Using binary search for strokes trimming
Pre-cached circles geometry for caps and joints
Refactored strokes elements generation functions. Code is more readable and modifiable in general. Can be easily fixed if some geometry issues will be finded
2024-09-25 17:09:29 +09:00
Hermet Park
0e2d1dfcfa common: code refactoring
Properly renamed internal interfaces.
No logical changes.

- Compositor -> RenderCompositor
- Surface -> RenderSurface
2024-09-21 16:37:37 +09:00
Sergii Liebodkin
79d4d64e4a wg_engine: fix strokes triangulation artifacts
Fixed detection of close vertices using comparison with epsilon and related artifacts in stencil buffer as extra pixels.
Fixed incorrect tessellation of curves using scaling.
2024-09-19 16:51:41 +09:00
Sergii Liebodkin
7a6a89cf26
wg_engine: wrong gradient transformation fixed
issue: https://github.com/thorvg/thorvg/issues/2620
2024-09-13 13:36:21 +09:00
Sergii Liebodkin
0787e46635 wg_engine: aabb based masking optimization
* used fragment shaders for mask applience instead of compute shaders
* less render targets swithing
* shape aabb based on transformed shape bbox
2024-08-20 16:23:31 +09:00
Hermet Park
5332876fe8 common: spec out TexMap
Spec out this incomplete experimental feature,
this is a still promising one, we will reintroduce
this officially after 1.0 release

size: -2kb

issue: https://github.com/thorvg/thorvg/issues/1372
2024-08-20 11:14:54 +09:00
Sergii Liebodkin
88b4f75e4f webgpu: shaders refactoring
Deep shader refactoring for the following purposes:
* used pre-calculated gradient texture instead of per-pixel gradient map computation
* used HW wrap samples for fill spread setting
* unified gradient shader types
* used single shader module for composition instead of signle module per composition type
* used single shader module for blending for each of fill type (solid, gradient, image) instaed of signle module per blend type
* much easier add new composition and blend equations
* get rided std::string uasge
* shaders code is more readable
2024-08-13 11:52:45 +03:00
Sergii Liebodkin
a4bbf14371 wg_engine: composition and blend optimization
* bind groups creation in real time removed - performance boost
* blend and composition shaders decomposed - performance boost
* shader modules and pipeline layouts generalized - less memory usage
* shared single stencil buffer used - less memory usage
* bind groups usage simplified
* general context API simplified and generalized
* all rendering logic moved into new composition class
* ready for hardware MSAA (in next steps)
* ready for direct mask applience (in next steps)
2024-08-09 14:30:17 +09:00
Sergii Liebodkin
25d1fc8bee
wg_engine: introduce simultaneous flag support for strokes trimming
https://github.com/thorvg/thorvg/issues/2435
2024-08-01 12:07:20 +09:00
Hermet Park
036ae3c2af renderer: code refactoring
Replaced the transformation with
a strong associated data field.

This helps to reduce the binary size (-1k).
2024-07-29 23:27:19 +09:00
Hermet Park
c4d89d0983 common: code refactoring
Trimming the transform data pass,
from RenderTransform to Matrix.

No logical changes.
2024-07-29 12:16:58 +09:00
Sergii Liebodkin
2c948a33d3 wg_engine: ClipPath support
[issues 1479: ClipPath](#1479)

Supports ClipPath composition.
Clip path composition is an only composition type who doesn't ignore blend method.
Clip path is a combination of composition approach and blend approach using compute shader
2024-07-16 00:01:47 +09:00
Hermet Park
889d1d1fa2 API: revise the APIs.
deprecate the `identifier()` APIs by replacing them with `type()`.

ThorVG is going to introduce an instance `id()`,
and this could be confused with the `identifier()` methods.

with this new type() method can reduce the memory size
by removing unncessary type data.

New Experimental C APIs:
- enum Tvg_Type
- Tvg_Result tvg_paint_get_type(const Tvg_Paint* paint, Tvg_Type* type)
- Tvg_Result tvg_gradient_get_type(const Tvg_Gradient* grad, Tvg_Type* type)

New Experimental C++ APIs:
- Type Paint::type() const
- Type Fill::type() const
- Type LinearGradient::type() const
- Type RadialGradient::type() const
- Type Shape::type() const
- Type Scene::type() const
- Type Picture::type() const
- Type Text::type() const

Deprecated C APIs:
- enum Tvg_Identifier
- Tvg_Result tvg_paint_get_identifier(const Tvg_Paint* paint, Tvg_Identifier* identifier)
- Tvg_Result tvg_gradient_get_identifier(const Tvg_Gradient* grad, Tvg_Identifier* identifier)

Deprecated C++ APIs:
- enum class Type
- uint32_t Paint::identifier() const
- uint32_t Fill::identifier() const
- static uint32_t Picture::identifier()
- static uint32_t Scene::identifier()
- static uint32_t Shape::identifier()
- static uint32_t LinearGradient:identifier()
- static uint32_T RadialGradient::identfier()

Removed Experimental APIs:
- static uint32_t Text::identifier()

issue: https://github.com/thorvg/thorvg/issues/1372
2024-07-05 21:25:58 +09:00
Hermet Park
53a570e680 common: Fix a compilation failure on VS 2017
issue: https://github.com/thorvg/thorvg/issues/2512
2024-07-03 22:45:29 +09:00