From 7d271cea1d561752386995adff3c40769d78f6c5 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 18 Dec 2024 15:13:58 -0800 Subject: [PATCH] remove backend deprecated and unused APIs --- .../include/private/backend/DriverAPI.inc | 11 ------ filament/backend/src/metal/MetalDriver.mm | 4 --- filament/backend/src/noop/NoopDriver.cpp | 6 ---- filament/backend/src/opengl/OpenGLDriver.cpp | 35 +++++++------------ filament/backend/src/vulkan/VulkanDriver.cpp | 7 ---- 5 files changed, 13 insertions(+), 50 deletions(-) diff --git a/filament/backend/include/private/backend/DriverAPI.inc b/filament/backend/include/private/backend/DriverAPI.inc index 66556b0f41f3..9aaf381fc003 100644 --- a/filament/backend/include/private/backend/DriverAPI.inc +++ b/filament/backend/include/private/backend/DriverAPI.inc @@ -399,17 +399,6 @@ DECL_DRIVER_API_N(update3DImage, DECL_DRIVER_API_N(generateMipmaps, backend::TextureHandle, th) -// Deprecated -DECL_DRIVER_API_N(setExternalImage, - backend::TextureHandle, th, - void*, image) - -// Deprecated -DECL_DRIVER_API_N(setExternalImagePlane, - backend::TextureHandle, th, - void*, image, - uint32_t, plane) - DECL_DRIVER_API_N(setExternalStream, backend::TextureHandle, th, backend::StreamHandle, sh) diff --git a/filament/backend/src/metal/MetalDriver.mm b/filament/backend/src/metal/MetalDriver.mm index 5bc2002ec7ed..0972f3491e8c 100644 --- a/filament/backend/src/metal/MetalDriver.mm +++ b/filament/backend/src/metal/MetalDriver.mm @@ -1191,10 +1191,6 @@ CVPixelBufferRetain(pixelBuffer); } -void MetalDriver::setExternalImage(Handle th, void* image) {} - -void MetalDriver::setExternalImagePlane(Handle th, void* image, uint32_t plane) {} - void MetalDriver::setExternalStream(Handle th, Handle sh) { } diff --git a/filament/backend/src/noop/NoopDriver.cpp b/filament/backend/src/noop/NoopDriver.cpp index afc5ac808dfc..4f26222dc30a 100644 --- a/filament/backend/src/noop/NoopDriver.cpp +++ b/filament/backend/src/noop/NoopDriver.cpp @@ -265,12 +265,6 @@ TimerQueryResult NoopDriver::getTimerQueryValue(Handle tqh, uint64 return TimerQueryResult::ERROR; } -void NoopDriver::setExternalImage(Handle th, void* image) { -} - -void NoopDriver::setExternalImagePlane(Handle th, void* image, uint32_t plane) { -} - void NoopDriver::setExternalStream(Handle th, Handle sh) { } diff --git a/filament/backend/src/opengl/OpenGLDriver.cpp b/filament/backend/src/opengl/OpenGLDriver.cpp index 79580fc7c46e..7ee4f5a3abca 100644 --- a/filament/backend/src/opengl/OpenGLDriver.cpp +++ b/filament/backend/src/opengl/OpenGLDriver.cpp @@ -1054,15 +1054,25 @@ void OpenGLDriver::createTextureViewSwizzleR(Handle th, Handle th, backend::TextureFormat format, uint32_t width, uint32_t height, backend::TextureUsage usage, void* image) { + DEBUG_MARKER() createTextureR(th, SamplerType::SAMPLER_EXTERNAL, 1, format, 1, width, height, 1, usage); - setExternalImage(th, image); + + GLTexture* t = handle_cast(th); + assert_invariant(t); + assert_invariant(t->target == SamplerType::SAMPLER_EXTERNAL); + + bindTexture(OpenGLContext::DUMMY_TEXTURE_BINDING, t); + if (mPlatform.setExternalImage(image, t->externalTexture)) { + // the target and id can be reset each time + t->gl.target = t->externalTexture->target; + t->gl.id = t->externalTexture->id; + } } void OpenGLDriver::createTextureExternalImagePlaneR(Handle th, backend::TextureFormat format, uint32_t width, uint32_t height, backend::TextureUsage usage, void* image, uint32_t plane) { - createTextureR(th, SamplerType::SAMPLER_EXTERNAL, 1, format, 1, width, height, 1, usage); - setExternalImagePlane(th, image, plane); + // not relevant for the OpenGL backend } void OpenGLDriver::importTextureR(Handle th, intptr_t id, @@ -2774,25 +2784,6 @@ void OpenGLDriver::setupExternalImage(void* image) { mPlatform.retainExternalImage(image); } -void OpenGLDriver::setExternalImage(Handle th, void* image) { - DEBUG_MARKER() - GLTexture* t = handle_cast(th); - assert_invariant(t); - assert_invariant(t->target == SamplerType::SAMPLER_EXTERNAL); - - bindTexture(OpenGLContext::DUMMY_TEXTURE_BINDING, t); - if (mPlatform.setExternalImage(image, t->externalTexture)) { - // the target and id can be reset each time - t->gl.target = t->externalTexture->target; - t->gl.id = t->externalTexture->id; - bindTexture(OpenGLContext::DUMMY_TEXTURE_BINDING, t); - } -} - -void OpenGLDriver::setExternalImagePlane(Handle th, void* image, uint32_t plane) { - DEBUG_MARKER() -} - void OpenGLDriver::setExternalStream(Handle th, Handle sh) { auto& gl = mContext; if (gl.ext.OES_EGL_image_external_essl3) { diff --git a/filament/backend/src/vulkan/VulkanDriver.cpp b/filament/backend/src/vulkan/VulkanDriver.cpp index 25a2448b2918..3e7238c1e56f 100644 --- a/filament/backend/src/vulkan/VulkanDriver.cpp +++ b/filament/backend/src/vulkan/VulkanDriver.cpp @@ -1189,13 +1189,6 @@ TimerQueryResult VulkanDriver::getTimerQueryValue(Handle tqh, uint return TimerQueryResult::AVAILABLE; } -void VulkanDriver::setExternalImage(Handle th, void* image) { - -} - -void VulkanDriver::setExternalImagePlane(Handle th, void* image, uint32_t plane) { -} - void VulkanDriver::setExternalStream(Handle th, Handle sh) { }