Skip to content

Conversation

@LunasaVT
Copy link

@LunasaVT LunasaVT commented Feb 3, 2025

I've tested it and it works completely fine under OpenGL.

Copy link
Member

@MatkovIvan MatkovIvan left a 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

@LunasaVT
Copy link
Author

LunasaVT commented Feb 4, 2025

I've implemented the requested changes.

Copy link
Member

@MatkovIvan MatkovIvan left a 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,
Copy link
Member

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

Copy link
Collaborator

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(
Copy link
Member

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

Copy link
Collaborator

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.

@MatkovIvan MatkovIvan dismissed their stale review February 4, 2025 11:41

Addressed

@MatkovIvan MatkovIvan requested a review from igordmn February 4, 2025 11:41
@LunasaVT
Copy link
Author

LunasaVT commented Feb 9, 2025

@igordmn Any idea when this will be reviewed?

GrBackendTexture backendTexture = GrBackendTextures::MakeGL(
width,
height,
skgpu::Mipmapped::kYes,
Copy link
Collaborator

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(
Copy link
Collaborator

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.
Copy link
Collaborator

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

igordmn pushed a commit that referenced this pull request Jul 2, 2025
### 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.
@LunasaVT LunasaVT closed this Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants