Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Version 0.4.13 #75

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.12
0.4.13
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ public static void main(String[] args) throws UltralightLoadException {
// Load the native libraries from the given directory. This method makes sure everything is loaded in the
// correct order. If you want to manually load all natives, either don't use this function or pass 'false' as
// the second parameter.
UltralightGPUDriverNativeUtil.load(nativesDir);
UltralightJava.load(nativesDir);
// Note that this order matters, as the libraries needed for the GPU Driver in the Ultralight SDK
// need to be loaded before the GPU driver.
UltralightJava.load(nativesDir);
UltralightGPUDriverNativeUtil.load(nativesDir);

// Create and run a simple test application
ExampleApplication application = new ExampleApplication();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@ public interface UltralightGPUDriverNative {

void bindTexture(long textureId, long texture);

int getGlTextureId(long texture);

void setActiveWindow(long window);
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ JNIEXPORT void JNICALL Java_com_labymedia_ultralight_gpu_UltralightGPUDriverNati
JNIEXPORT void JNICALL Java_com_labymedia_ultralight_gpu_UltralightGPUDriverNativeUtil_bindTexture(
JNIEnv *, jobject, jlong handle, jlong textureId, jlong texture);

/*
* Class: com_labymedia_ultralight_gpu_UltralightGPUDriverNativeUtil
* Method: getGlTextureId
* Signature: (JJ)I
*/
JNIEXPORT jint JNICALL
Java_com_labymedia_ultralight_gpu_UltralightGPUDriverNativeUtil_getGlTextureId(JNIEnv *, jobject, jlong handle, jlong texture);

# ifdef __cplusplus
}
# endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ namespace ultralight {
virtual void DrawCommandList() override;

void BindUltralightTexture(uint32_t ultralight_texture_id);
uint32_t GetGlTextureId(uint32_t ultralight_texture_id);

void LoadPrograms();
void DestroyPrograms();
Expand Down
6 changes: 6 additions & 0 deletions ultralight-java-gpu-native/src/gpudriver/gl/GPUDriverGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ namespace ultralight {
CHECK_GL();
}

uint32_t GPUDriverGL::GetGlTextureId(uint32_t ultralight_texture_id) {
TextureEntry &entry = texture_map[ultralight_texture_id];
ResolveIfNeeded(entry.render_buffer_id);
return entry.tex_id;
}

void GPUDriverGL::DestroyTexture(uint32_t texture_id) {
TextureEntry &entry = texture_map[texture_id];
glDeleteTextures(1, &entry.tex_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,8 @@ JNIEXPORT void JNICALL Java_com_labymedia_ultralight_gpu_UltralightGPUDriverNati
auto *driver = (ultralight::GPUDriverGL *) handle;
driver->BindTexture(textureId, texture);
}

JNIEXPORT jint JNICALL Java_com_labymedia_ultralight_gpu_UltralightGPUDriverNativeUtil_getGlTextureId (JNIEnv *, jobject, jlong handle, jlong texture) {
auto *driver = (ultralight::GPUDriverGL *) handle;
return (jint) driver->GetGlTextureId(texture);
}
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,16 @@ public static UltralightGPUDriverNativeUtil getInstance() {
*/
public native void bindTexture(long handle, long textureId, long texture);

/**
* Get the OpenGL texture id for a given driver-specific texture index.
*
* @param handle OpenGL context handle
* @param texture Ultralight renderTarget texture id
*
* @return OpenGL texture id
*/
public native int getGlTextureId(long handle, long texture);

/**
* Set which GLFW context should be active.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ public void bindTexture(long textureId, long texture) {
this.util.bindTexture(this.driverHandle, textureId, texture);
}

@Override
public int getGlTextureId(long texture) {
return this.util.getGlTextureId(this.driverHandle, texture);
}

/**
* Set which GLFW context should be active.
*
Expand Down