Comments (7)
nanovg itself is not thread safe as mentioned in memononen/nanovg#292.
s_framebuffer
is only a weak reference to the currently binded framebuffer through mnvgBindFramebuffer()
. Users should call mnvgBindFramebuffer(NULL)
manually afterward. The logic behind mnvgCreateFramebuffer()
, mnvgDeleteFramebuffer()
and mnvgBindFramebuffer()
basically follow the corresponded functions defined in nanovg_gl_utils.h
.
from metalnanovg.
How unfortunate. Where is the global state in nanovg?
from metalnanovg.
I couldn't find any global state in nanovg itself. Perhaps it is ok to use different nanovg contexts on different threads? Obviously, you can't use a single context in multiple threads.
from metalnanovg.
I didn't test multithreading environment. But I think it's ok to move the global s_framebuffer
into MNVGcontext
and renamed to bindedFramebuffer
.
from metalnanovg.
boundFramebuffer
would be the grammatically correct name :)
from metalnanovg.
Thanks for correction. Do you have multithreading environment to test the result? There may need an additional mnvgUnbindFramebuffer()
function to make the changes work. However, that would break the consistency of original nanovg APIs. Or, can you test the GL backend with multithreading environment? If it doesn't work anyway. Then no bother to make the changes.
from metalnanovg.
I'm only rendering on a single thread at a time.
The way I did it, calling mnvgBindFramebuffer(nvg, 0)
unbinds.
Here's my change: wtholliday@e2c9b99
I think it's ok for the backend APIs to differ a little.
from metalnanovg.
Related Issues (20)
- Memory leaks on MacOS Mojave HOT 10
- MetalNanoVG changes drawable pixel format to MTLPixelFormatBGRA8Unorm HOT 4
- With stencil strokes enabled, strokewidth = 1. is invisible on non-retina screen HOT 12
- mtlnvg__renderDelete crash (old version) HOT 9
- Option to present drawable? HOT 6
- objc_release taking significant cpu time in profile HOT 13
- could path tessellation be done using the GPU? HOT 2
- Why is ARC not supported? HOT 8
- block implicitly retains self HOT 3
- Crash: Blending enabled for render target 0, pixelformat MTLPixelFormatInvalid HOT 2
- Procedural Text without generating new textures?
- Metal shader to bit code HOT 2
- Possibility for variable-width strokes?
- VisionOS support?
- Hangs on High Sierra HOT 21
- The possibility of partnership with the Avalonia project
- mtlnvg__renderCreate: MTLLibrary leaked HOT 2
- static analyzer reports spurious memory leak HOT 3
- Flicker on drawableSizeWillChange HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metalnanovg.