-
Notifications
You must be signed in to change notification settings - Fork 164
Implement SkImages::AdoptTextureFrom bindings #1019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Tested-by: Lunasa <[email protected]>
MatkovIvan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from JNI, it should contain K/N bindings to work outside JVM too
|
I've implemented the requested changes. |
MatkovIvan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for implementing the missing part.
Currently I'm not sure that creating a new GrBackendTexture should be a part of Image API, but I'm OK to leave this part as TODO for later.
PS I'll be on vacation next week so cc @igordmn for taking care of it
| GrBackendTexture backendTexture = GrBackendTextures::MakeGL( | ||
| width, | ||
| height, | ||
| skgpu::Mipmapped::kYes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such a thing shouldn't be hardcoded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's provide it as a parameter (boolean suffice if it has 2 options)
| textureInfo.fTarget = static_cast<GrGLenum>(target); | ||
| textureInfo.fFormat = static_cast<GrGLenum>(format); | ||
|
|
||
| GrBackendTexture backendTexture = GrBackendTextures::MakeGL( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that we need to expose this separately and pass it as an argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a GL object that is used in a non-GL method. Because of that we have to move it out of this method and create a real BackendTexture kotlin class with BackendTexture.MakeGL function.
|
@igordmn Any idea when this will be reviewed? |
| GrBackendTexture backendTexture = GrBackendTextures::MakeGL( | ||
| width, | ||
| height, | ||
| skgpu::Mipmapped::kYes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's provide it as a parameter (boolean suffice if it has 2 options)
| textureInfo.fTarget = static_cast<GrGLenum>(target); | ||
| textureInfo.fFormat = static_cast<GrGLenum>(format); | ||
|
|
||
| GrBackendTexture backendTexture = GrBackendTextures::MakeGL( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a GL object that is used in a non-GL method. Because of that we have to move it out of this method and create a real BackendTexture kotlin class with BackendTexture.MakeGL function.
| return Image(ptr) | ||
| } | ||
|
|
||
| /** Creates GPU-backed [org.jetbrains.skia.Image] from backendTexture associated with context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please use KDoc format of the comment:
/**
*
*
*/
- describe the parameters as in the original documentation in Skia
### New: (related #1019) 1. Adds bindings to GrBackendTextures::MakeGL 2. Adds bindings to SkImages::AdoptTextureFrom 3. Adds bindings to GrBackendTextures::GLTextureParametersModdified ### Changes in build scripts: (related #742) 1. Add file paths treating if building on Windows machine 2. Use "emcc.bat" instead of "emcc" if building on Windows machine, as described on Emscripten website ### 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.
I've tested it and it works completely fine under OpenGL.