add BackendTexture and Image.adoptTextureFrom#1030
add BackendTexture and Image.adoptTextureFrom#1030igordmn merged 10 commits intoJetBrains:masterfrom
Conversation
…re", add function "BackendTexture.makeGL", add function "Image.adoptTextureFrom"
…ure.makeGL", "BackendRenderTarget.makeGL", add function "BackendTexture->GLTextureParametersModified", small changes to previous commit
|
Besides already implemented above, at the moment I am working on these new bindings: BackendTexture.backend // allows to check which backend is texture created on We can also getDirect3DInfo for DirectX backend, getMetalInfo for Metal, etc I will submit another PR when all the upcoming bindigs are implemented |
|
Hi, Is any progress on it ? |
igordmn
left a comment
There was a problem hiding this comment.
Thanks! Sorry for a long review.
It needs small corrections, and it is good to merge.
skiko/src/commonMain/kotlin/org/jetbrains/skia/BackendTexture.kt
Outdated
Show resolved
Hide resolved
- also changed native impl parameters for nativeJS BackendTexture.cc
- also changed native impl parameters for jvm BackendTexture.cc 2. fix little slip up from previous commit in gradle properties
|
Corrections applied! |
| SKIKO_EXPORT KNativePointer org_jetbrains_skia_BackendTexture__1nMakeGL | ||
| (KInt width, KInt height, KBoolean isMipmapped, KInt textureId, KInt target, KInt format) { | ||
| GrGLTextureInfo textureInfo; | ||
| textureInfo.fID = static_cast<GrGLuint>(textureId); |
There was a problem hiding this comment.
AFAIK WebGL textures have no ids, so emscripten provides the mapping for skia. This means that without registering a texture in the emscripten internal map it is not possible to adopt textures created outside skia (e.g. using js interop). Should we include a workaround for this to allow registering external webgl textures?
It probably should be done as a separate PR, just bringing this up as it would be useful for my use case (adopting textures created using js interop).
There was a problem hiding this comment.
This workaround looks like a code that should be called outside of Skia, not in Skia itself. Skia only provides an API which can be used, including requiring an id that can be obtained by the API you provided.
New:
(related #1019)
Changes in build scripts:
(related #742)
Use-case:
Allows skia to draw images, rendered externally on gpu.
Compose would benefit greatly, allowing to embed VideoPlayer or Browser without any friction or need to use Swing.