diff --git a/android/filament-android/src/main/cpp/IndexBuffer.cpp b/android/filament-android/src/main/cpp/IndexBuffer.cpp index 33492221dd..e7f92d1fdd 100644 --- a/android/filament-android/src/main/cpp/IndexBuffer.cpp +++ b/android/filament-android/src/main/cpp/IndexBuffer.cpp @@ -26,7 +26,7 @@ #include "NioUtils.h" using namespace filament; -using namespace driver; +using namespace backend; extern "C" JNIEXPORT jlong JNICALL Java_com_google_android_filament_IndexBuffer_nCreateBuilder(JNIEnv *env, jclass type) { diff --git a/android/filament-android/src/main/cpp/Renderer.cpp b/android/filament-android/src/main/cpp/Renderer.cpp index 43498e3078..c9483b1e8c 100644 --- a/android/filament-android/src/main/cpp/Renderer.cpp +++ b/android/filament-android/src/main/cpp/Renderer.cpp @@ -26,7 +26,7 @@ #include "NioUtils.h" using namespace filament; -using namespace driver; +using namespace backend; extern "C" JNIEXPORT jboolean JNICALL Java_com_google_android_filament_Renderer_nBeginFrame(JNIEnv *, jclass, jlong nativeRenderer, @@ -87,8 +87,8 @@ Java_com_google_android_filament_Renderer_nReadPixels(JNIEnv *env, jclass, void *buffer = nioBuffer.getData(); auto *callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer)); - PixelBufferDescriptor desc(buffer, sizeInBytes, (driver::PixelDataFormat) format, - (driver::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) top, + PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format, + (backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) top, (uint32_t) stride, &JniBufferCallback::invoke, callback); renderer->readPixels(uint32_t(xoffset), uint32_t(yoffset), uint32_t(width), uint32_t(height), diff --git a/android/filament-android/src/main/cpp/Stream.cpp b/android/filament-android/src/main/cpp/Stream.cpp index 143cffd8e5..135f038e52 100644 --- a/android/filament-android/src/main/cpp/Stream.cpp +++ b/android/filament-android/src/main/cpp/Stream.cpp @@ -25,7 +25,7 @@ #include "CallbackUtils.h" using namespace filament; -using namespace driver; +using namespace backend; class StreamBuilder { public: @@ -145,8 +145,8 @@ Java_com_google_android_filament_Stream_nReadPixels(JNIEnv *env, jclass, void *buffer = nioBuffer.getData(); auto *callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer)); - PixelBufferDescriptor desc(buffer, sizeInBytes, (driver::PixelDataFormat) format, - (driver::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) top, + PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format, + (backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) top, (uint32_t) stride, &JniBufferCallback::invoke, callback); stream->readPixels(uint32_t(xoffset), uint32_t(yoffset), uint32_t(width), uint32_t(height), diff --git a/android/filament-android/src/main/cpp/Texture.cpp b/android/filament-android/src/main/cpp/Texture.cpp index c22ce2feeb..2f50b340ef 100644 --- a/android/filament-android/src/main/cpp/Texture.cpp +++ b/android/filament-android/src/main/cpp/Texture.cpp @@ -32,7 +32,7 @@ #include "NioUtils.h" using namespace filament; -using namespace driver; +using namespace backend; static size_t getTextureDataSize(const Texture *texture, size_t level, Texture::Format format, Texture::Type type, size_t stride, size_t alignment) { @@ -191,8 +191,8 @@ Java_com_google_android_filament_Texture_nSetImage(JNIEnv* env, jclass, jlong na void *buffer = nioBuffer.getData(); auto *callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer)); - Texture::PixelBufferDescriptor desc(buffer, sizeInBytes, (driver::PixelDataFormat) format, - (driver::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) bottom, + Texture::PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format, + (backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) bottom, (uint32_t) stride, &JniBufferCallback::invoke, callback); texture->setImage(*engine, (size_t) level, (uint32_t) xoffset, (uint32_t) yoffset, @@ -223,7 +223,7 @@ Java_com_google_android_filament_Texture_nSetImageCompressed(JNIEnv *env, jclass auto *callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer)); Texture::PixelBufferDescriptor desc(buffer, sizeInBytes, - (driver::CompressedPixelDataType) compressedFormat, (uint32_t) compressedSizeInBytes, + (backend::CompressedPixelDataType) compressedFormat, (uint32_t) compressedSizeInBytes, &JniBufferCallback::invoke, callback); texture->setImage(*engine, (size_t) level, (uint32_t) xoffset, (uint32_t) yoffset, @@ -258,8 +258,8 @@ Java_com_google_android_filament_Texture_nSetImageCubemap(JNIEnv *env, jclass, void *buffer = nioBuffer.getData(); auto *callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer)); - Texture::PixelBufferDescriptor desc(buffer, sizeInBytes, (driver::PixelDataFormat) format, - (driver::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) bottom, + Texture::PixelBufferDescriptor desc(buffer, sizeInBytes, (backend::PixelDataFormat) format, + (backend::PixelDataType) type, (uint8_t) alignment, (uint32_t) left, (uint32_t) bottom, (uint32_t) stride, &JniBufferCallback::invoke, callback); texture->setImage(*engine, (size_t) level, std::move(desc), faceOffsets); @@ -294,7 +294,7 @@ Java_com_google_android_filament_Texture_nSetImageCubemapCompressed(JNIEnv *env, auto *callback = JniBufferCallback::make(engine, env, handler, runnable, std::move(nioBuffer)); Texture::PixelBufferDescriptor desc(buffer, sizeInBytes, - (driver::CompressedPixelDataType) compressedFormat, (uint32_t) compressedSizeInBytes, + (backend::CompressedPixelDataType) compressedFormat, (uint32_t) compressedSizeInBytes, &JniBufferCallback::invoke, callback); texture->setImage(*engine, (size_t) level, std::move(desc), faceOffsets); diff --git a/android/filament-android/src/main/cpp/VertexBuffer.cpp b/android/filament-android/src/main/cpp/VertexBuffer.cpp index c60380472c..e53fdeff6e 100644 --- a/android/filament-android/src/main/cpp/VertexBuffer.cpp +++ b/android/filament-android/src/main/cpp/VertexBuffer.cpp @@ -29,7 +29,7 @@ using namespace filament; using namespace filament::math; -using namespace driver; +using namespace backend; extern "C" JNIEXPORT jlong JNICALL Java_com_google_android_filament_VertexBuffer_nCreateBuilder(JNIEnv *env, jclass type) { diff --git a/filament/backend/include/backend/BufferDescriptor.h b/filament/backend/include/backend/BufferDescriptor.h index ba1f7020d8..bdb8ba7f03 100644 --- a/filament/backend/include/backend/BufferDescriptor.h +++ b/filament/backend/include/backend/BufferDescriptor.h @@ -23,7 +23,7 @@ #include namespace filament { -namespace driver { +namespace backend { class UTILS_PUBLIC BufferDescriptor { public: @@ -98,7 +98,7 @@ private: void* user = nullptr; }; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_BUFFERDESCRIPTOR_H diff --git a/filament/backend/include/backend/DriverEnums.h b/filament/backend/include/backend/DriverEnums.h index 0e77b76c2b..4728f98e16 100644 --- a/filament/backend/include/backend/DriverEnums.h +++ b/filament/backend/include/backend/DriverEnums.h @@ -37,7 +37,7 @@ namespace filament { * internal redeclaration of these types. * For e.g. Use Texture::Sampler instead of filament::SamplerType. */ -namespace driver { +namespace backend { static constexpr uint64_t SWAP_CHAIN_CONFIG_TRANSPARENT = 0x1; static constexpr uint64_t SWAP_CHAIN_CONFIG_READABLE = 0x2; @@ -689,7 +689,7 @@ struct RasterState { }; }; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_DRIVERENUMS_H diff --git a/filament/backend/include/backend/PipelineState.h b/filament/backend/include/backend/PipelineState.h index 9e4d405cf1..0a3d212ad6 100644 --- a/filament/backend/include/backend/PipelineState.h +++ b/filament/backend/include/backend/PipelineState.h @@ -24,7 +24,7 @@ #include namespace filament { -namespace driver { +namespace backend { struct PipelineState { Handle program; @@ -33,7 +33,7 @@ struct PipelineState { }; -} // namespace driver +} // namespace backend } // namespace filament #endif //TNT_FILAMENT_DRIVER_PIPELINESTATE_H diff --git a/filament/backend/include/backend/PixelBufferDescriptor.h b/filament/backend/include/backend/PixelBufferDescriptor.h index 75031867f2..752c263eb3 100644 --- a/filament/backend/include/backend/PixelBufferDescriptor.h +++ b/filament/backend/include/backend/PixelBufferDescriptor.h @@ -28,12 +28,12 @@ #include namespace filament { -namespace driver { +namespace backend { class UTILS_PUBLIC PixelBufferDescriptor : public BufferDescriptor { public: - using PixelDataFormat = driver::PixelDataFormat; - using PixelDataType = driver::PixelDataType; + using PixelDataFormat = backend::PixelDataFormat; + using PixelDataType = backend::PixelDataType; PixelBufferDescriptor(void const* buffer, size_t size, PixelDataFormat format, PixelDataType type, uint8_t alignment = 1, @@ -52,7 +52,7 @@ public: } PixelBufferDescriptor(void const* buffer, size_t size, - driver::CompressedPixelDataType format, uint32_t imageSize, + backend::CompressedPixelDataType format, uint32_t imageSize, Callback callback, void* user = nullptr) noexcept : BufferDescriptor(buffer, size, callback, user), imageSize(imageSize), compressedFormat(format), type(PixelDataType::COMPRESSED), @@ -124,14 +124,14 @@ public: }; struct { uint32_t imageSize; - driver::CompressedPixelDataType compressedFormat; + backend::CompressedPixelDataType compressedFormat; }; }; PixelDataType type : 4; uint8_t alignment : 4; }; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_PIXEL_BUFFERDESCRIPTOR_H diff --git a/filament/backend/include/backend/Platform.h b/filament/backend/include/backend/Platform.h index 9733d4d01c..eafce28e5f 100644 --- a/filament/backend/include/backend/Platform.h +++ b/filament/backend/include/backend/Platform.h @@ -22,7 +22,7 @@ #include namespace filament { -namespace driver { +namespace backend { class Driver; @@ -54,7 +54,7 @@ public: * * @return nullptr on failure, or a pointer to the newly created driver. */ - virtual driver::Driver* createDriver(void* sharedContext) noexcept = 0; + virtual backend::Driver* createDriver(void* sharedContext) noexcept = 0; }; @@ -73,7 +73,7 @@ public: * * @see destroy */ - static DefaultPlatform* create(driver::Backend* backendHint) noexcept; + static DefaultPlatform* create(backend::Backend* backendHint) noexcept; /** * Destroys a Platform object returned by create() @@ -86,7 +86,7 @@ public: static void destroy(DefaultPlatform** platform) noexcept; }; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_PLATFORM_H diff --git a/filament/backend/include/backend/TargetBufferInfo.h b/filament/backend/include/backend/TargetBufferInfo.h index b274f7a03d..8e9ff907da 100644 --- a/filament/backend/include/backend/TargetBufferInfo.h +++ b/filament/backend/include/backend/TargetBufferInfo.h @@ -24,7 +24,7 @@ #include namespace filament { -namespace driver { +namespace backend { class TargetBufferInfo { public: @@ -51,7 +51,7 @@ public: TargetBufferInfo() noexcept { } }; -} // namespace driver +} // namespace backend } // namespace filament #endif //TNT_FILAMENT_DRIVER_TARGETBUFFERINFO_H diff --git a/filament/backend/include/private/backend/CircularBuffer.h b/filament/backend/include/private/backend/CircularBuffer.h index 53f09a30fe..8b84745d26 100644 --- a/filament/backend/include/private/backend/CircularBuffer.h +++ b/filament/backend/include/private/backend/CircularBuffer.h @@ -23,7 +23,7 @@ #include namespace filament { -namespace driver { +namespace backend { class CircularBuffer { public: @@ -84,7 +84,7 @@ private: void* mHead = nullptr; }; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_CIRCULARBUFFER_H diff --git a/filament/backend/include/private/backend/CommandBufferQueue.h b/filament/backend/include/private/backend/CommandBufferQueue.h index 13ab6aac61..c95799202d 100644 --- a/filament/backend/include/private/backend/CommandBufferQueue.h +++ b/filament/backend/include/private/backend/CommandBufferQueue.h @@ -26,7 +26,7 @@ #include namespace filament { -namespace driver { +namespace backend { /* * A producer-consumer command queue that uses a CircularBuffer as main storage @@ -75,7 +75,7 @@ public: void requestExit(); }; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_COMMANDBUFFERQUEUE_H diff --git a/filament/backend/include/private/backend/CommandStream.h b/filament/backend/include/private/backend/CommandStream.h index 07ae77f957..ab29fadf2f 100644 --- a/filament/backend/include/private/backend/CommandStream.h +++ b/filament/backend/include/private/backend/CommandStream.h @@ -52,7 +52,7 @@ #define DEBUG_COMMAND_STREAM false namespace filament { -namespace driver { +namespace backend { class Driver; class CommandBase; @@ -317,7 +317,7 @@ PodType* CommandStream::allocatePod(size_t count, size_t alignment) noexcept { return static_cast(allocate(count * sizeof(PodType), alignment)); } -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_COMMANDSTREAM_H diff --git a/filament/backend/include/private/backend/Driver.h b/filament/backend/include/private/backend/Driver.h index 78db4132d5..b3bc96e528 100644 --- a/filament/backend/include/private/backend/Driver.h +++ b/filament/backend/include/private/backend/Driver.h @@ -35,7 +35,7 @@ #include namespace filament { -namespace driver { +namespace backend { template class ConcreteDispatcher; @@ -79,41 +79,41 @@ public: #include "private/backend/DriverAPI.inc" }; -} // namespace driver +} // namespace backend } // namespace filament #if !defined(NDEBUG) -utils::io::ostream& operator<<(utils::io::ostream& out, const filament::driver::AttributeArray& type); -utils::io::ostream& operator<<(utils::io::ostream& out, const filament::driver::FaceOffsets& type); -utils::io::ostream& operator<<(utils::io::ostream& out, const filament::driver::PolygonOffset& po); -utils::io::ostream& operator<<(utils::io::ostream& out, const filament::driver::PipelineState& ps); -utils::io::ostream& operator<<(utils::io::ostream& out, const filament::driver::RasterState& rs); -utils::io::ostream& operator<<(utils::io::ostream& out, const filament::driver::TargetBufferInfo& tbi); +utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::AttributeArray& type); +utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::FaceOffsets& type); +utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::PolygonOffset& po); +utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::PipelineState& ps); +utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::RasterState& rs); +utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::TargetBufferInfo& tbi); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::BufferDescriptor const& b); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::BufferUsage usage); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::CullingMode mode); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::ElementType type); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::PixelBufferDescriptor const& b); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::PixelDataFormat format); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::PixelDataType type); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::Precision precision); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::PrimitiveType type); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::RenderPassParams const& b); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::SamplerCompareFunc func); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::SamplerCompareMode mode); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::SamplerFormat format); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::SamplerMagFilter filter); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::SamplerMinFilter filter); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::SamplerParams params); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::SamplerType type); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::SamplerWrapMode wrap); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::ShaderModel model); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::TextureCubemapFace face); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::TextureFormat format); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::TextureUsage usage); -utils::io::ostream& operator<<(utils::io::ostream& out, filament::driver::Viewport const& v); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::BufferDescriptor const& b); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::BufferUsage usage); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::CullingMode mode); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::ElementType type); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::PixelBufferDescriptor const& b); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::PixelDataFormat format); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::PixelDataType type); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::Precision precision); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::PrimitiveType type); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::RenderPassParams const& b); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerCompareFunc func); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerCompareMode mode); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerFormat format); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerMagFilter filter); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerMinFilter filter); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerParams params); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerType type); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::SamplerWrapMode wrap); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::ShaderModel model); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TextureCubemapFace face); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TextureFormat format); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TextureUsage usage); +utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::Viewport const& v); #endif #endif // TNT_FILAMENT_DRIVER_DRIVER_H diff --git a/filament/backend/include/private/backend/DriverAPI.inc b/filament/backend/include/private/backend/DriverAPI.inc index 72075dd327..5570a9cdd9 100644 --- a/filament/backend/include/private/backend/DriverAPI.inc +++ b/filament/backend/include/private/backend/DriverAPI.inc @@ -223,73 +223,73 @@ DECL_DRIVER_API_0(flush) * ----------------------- */ -DECL_DRIVER_API_R_5(driver::VertexBufferHandle, createVertexBuffer, +DECL_DRIVER_API_R_5(backend::VertexBufferHandle, createVertexBuffer, uint8_t, bufferCount, uint8_t, attributeCount, uint32_t, vertexCount, - driver::AttributeArray, attributes, - driver::BufferUsage, usage) + backend::AttributeArray, attributes, + backend::BufferUsage, usage) -DECL_DRIVER_API_R_3(driver::IndexBufferHandle, createIndexBuffer, - driver::ElementType, elementType, +DECL_DRIVER_API_R_3(backend::IndexBufferHandle, createIndexBuffer, + backend::ElementType, elementType, uint32_t, indexCount, - driver::BufferUsage, usage) + backend::BufferUsage, usage) -DECL_DRIVER_API_R_8(driver::TextureHandle, createTexture, - driver::SamplerType, target, +DECL_DRIVER_API_R_8(backend::TextureHandle, createTexture, + backend::SamplerType, target, uint8_t, levels, - driver::TextureFormat, format, + backend::TextureFormat, format, uint8_t, samples, uint32_t, width, uint32_t, height, uint32_t, depth, - driver::TextureUsage, usage) + backend::TextureUsage, usage) -DECL_DRIVER_API_R_1(driver::SamplerGroupHandle, createSamplerGroup, +DECL_DRIVER_API_R_1(backend::SamplerGroupHandle, createSamplerGroup, size_t, size) -DECL_DRIVER_API_R_2(driver::UniformBufferHandle, createUniformBuffer, +DECL_DRIVER_API_R_2(backend::UniformBufferHandle, createUniformBuffer, size_t, size, - driver::BufferUsage, usage) + backend::BufferUsage, usage) -DECL_DRIVER_API_R_0(driver::RenderPrimitiveHandle, createRenderPrimitive) +DECL_DRIVER_API_R_0(backend::RenderPrimitiveHandle, createRenderPrimitive) -DECL_DRIVER_API_R_1(driver::ProgramHandle, createProgram, - driver::Program&&, program) +DECL_DRIVER_API_R_1(backend::ProgramHandle, createProgram, + backend::Program&&, program) -DECL_DRIVER_API_R_0(driver::RenderTargetHandle, createDefaultRenderTarget) +DECL_DRIVER_API_R_0(backend::RenderTargetHandle, createDefaultRenderTarget) -DECL_DRIVER_API_R_8(driver::RenderTargetHandle, createRenderTarget, - driver::TargetBufferFlags, targetBufferFlags, +DECL_DRIVER_API_R_8(backend::RenderTargetHandle, createRenderTarget, + backend::TargetBufferFlags, targetBufferFlags, uint32_t, width, uint32_t, height, uint8_t, samples, - driver::TextureFormat, format, - driver::TargetBufferInfo, color, - driver::TargetBufferInfo, depth, - driver::TargetBufferInfo, stencil) + backend::TextureFormat, format, + backend::TargetBufferInfo, color, + backend::TargetBufferInfo, depth, + backend::TargetBufferInfo, stencil) -DECL_DRIVER_API_R_0(driver::FenceHandle, createFence) +DECL_DRIVER_API_R_0(backend::FenceHandle, createFence) -DECL_DRIVER_API_R_2(driver::SwapChainHandle, createSwapChain, void*, nativeWindow, uint64_t, flags) +DECL_DRIVER_API_R_2(backend::SwapChainHandle, createSwapChain, void*, nativeWindow, uint64_t, flags) -DECL_DRIVER_API_R_3(driver::StreamHandle, createStreamFromTextureId, intptr_t, externalTextureId, uint32_t, width, uint32_t, height) +DECL_DRIVER_API_R_3(backend::StreamHandle, createStreamFromTextureId, intptr_t, externalTextureId, uint32_t, width, uint32_t, height) /* * Destroying driver objects * ------------------------- */ -DECL_DRIVER_API_1(destroyVertexBuffer, driver::VertexBufferHandle, vbh) -DECL_DRIVER_API_1(destroyIndexBuffer, driver::IndexBufferHandle, ibh) -DECL_DRIVER_API_1(destroyRenderPrimitive, driver::RenderPrimitiveHandle, rph) -DECL_DRIVER_API_1(destroyProgram, driver::ProgramHandle, ph) -DECL_DRIVER_API_1(destroySamplerGroup, driver::SamplerGroupHandle, sbh) -DECL_DRIVER_API_1(destroyUniformBuffer, driver::UniformBufferHandle, ubh) -DECL_DRIVER_API_1(destroyTexture, driver::TextureHandle, th) -DECL_DRIVER_API_1(destroyRenderTarget, driver::RenderTargetHandle, rth) -DECL_DRIVER_API_1(destroySwapChain, driver::SwapChainHandle, sch) -DECL_DRIVER_API_1(destroyStream, driver::StreamHandle, sh) +DECL_DRIVER_API_1(destroyVertexBuffer, backend::VertexBufferHandle, vbh) +DECL_DRIVER_API_1(destroyIndexBuffer, backend::IndexBufferHandle, ibh) +DECL_DRIVER_API_1(destroyRenderPrimitive, backend::RenderPrimitiveHandle, rph) +DECL_DRIVER_API_1(destroyProgram, backend::ProgramHandle, ph) +DECL_DRIVER_API_1(destroySamplerGroup, backend::SamplerGroupHandle, sbh) +DECL_DRIVER_API_1(destroyUniformBuffer, backend::UniformBufferHandle, ubh) +DECL_DRIVER_API_1(destroyTexture, backend::TextureHandle, th) +DECL_DRIVER_API_1(destroyRenderTarget, backend::RenderTargetHandle, rth) +DECL_DRIVER_API_1(destroySwapChain, backend::SwapChainHandle, sch) +DECL_DRIVER_API_1(destroyStream, backend::StreamHandle, sh) /* * Synchronous APIs @@ -298,21 +298,21 @@ DECL_DRIVER_API_1(destroyStream, driver::StreamHandle, sh) DECL_DRIVER_API_SYNCHRONOUS_0(void, terminate) -DECL_DRIVER_API_SYNCHRONOUS_1(driver::StreamHandle, createStream, void*, stream) +DECL_DRIVER_API_SYNCHRONOUS_1(backend::StreamHandle, createStream, void*, stream) -DECL_DRIVER_API_SYNCHRONOUS_3(void, setStreamDimensions, driver::StreamHandle, stream, uint32_t, width, uint32_t, height) +DECL_DRIVER_API_SYNCHRONOUS_3(void, setStreamDimensions, backend::StreamHandle, stream, uint32_t, width, uint32_t, height) -DECL_DRIVER_API_SYNCHRONOUS_1(int64_t, getStreamTimestamp, driver::StreamHandle, stream) +DECL_DRIVER_API_SYNCHRONOUS_1(int64_t, getStreamTimestamp, backend::StreamHandle, stream) -DECL_DRIVER_API_SYNCHRONOUS_1(void, updateStreams, driver::DriverApi*, driver) +DECL_DRIVER_API_SYNCHRONOUS_1(void, updateStreams, backend::DriverApi*, driver) -DECL_DRIVER_API_SYNCHRONOUS_1(void, destroyFence, driver::FenceHandle, fh) +DECL_DRIVER_API_SYNCHRONOUS_1(void, destroyFence, backend::FenceHandle, fh) -DECL_DRIVER_API_SYNCHRONOUS_2(driver::FenceStatus, wait, driver::FenceHandle, fh, uint64_t, timeout) +DECL_DRIVER_API_SYNCHRONOUS_2(backend::FenceStatus, wait, backend::FenceHandle, fh, uint64_t, timeout) -DECL_DRIVER_API_SYNCHRONOUS_1(bool, isTextureFormatSupported, driver::TextureFormat, format) +DECL_DRIVER_API_SYNCHRONOUS_1(bool, isTextureFormatSupported, backend::TextureFormat, format) -DECL_DRIVER_API_SYNCHRONOUS_1(bool, isRenderTargetFormatSupported, driver::TextureFormat, format) +DECL_DRIVER_API_SYNCHRONOUS_1(bool, isRenderTargetFormatSupported, backend::TextureFormat, format) DECL_DRIVER_API_SYNCHRONOUS_0(bool, isFrameTimeSupported) @@ -324,78 +324,78 @@ DECL_DRIVER_API_SYNCHRONOUS_0(bool, canGenerateMipmaps) */ DECL_DRIVER_API_4(updateVertexBuffer, - driver::VertexBufferHandle, vbh, + backend::VertexBufferHandle, vbh, size_t, index, - driver::BufferDescriptor&&, data, + backend::BufferDescriptor&&, data, uint32_t, byteOffset) DECL_DRIVER_API_3(updateIndexBuffer, - driver::IndexBufferHandle, ibh, - driver::BufferDescriptor&&, data, + backend::IndexBufferHandle, ibh, + backend::BufferDescriptor&&, data, uint32_t, byteOffset) DECL_DRIVER_API_2(updateUniformBuffer, - driver::UniformBufferHandle, ubh, - driver::BufferDescriptor&&, buffer) + backend::UniformBufferHandle, ubh, + backend::BufferDescriptor&&, buffer) DECL_DRIVER_API_2(updateSamplerGroup, - driver::SamplerGroupHandle, ubh, - driver::SamplerGroup&&, samplerGroup) + backend::SamplerGroupHandle, ubh, + backend::SamplerGroup&&, samplerGroup) DECL_DRIVER_API_7(update2DImage, - driver::TextureHandle, th, + backend::TextureHandle, th, uint32_t, level, uint32_t, xoffset, uint32_t, yoffset, uint32_t, width, uint32_t, height, - driver::PixelBufferDescriptor&&, data) + backend::PixelBufferDescriptor&&, data) DECL_DRIVER_API_4(updateCubeImage, - driver::TextureHandle, th, + backend::TextureHandle, th, uint32_t, level, - driver::PixelBufferDescriptor&&, data, - driver::FaceOffsets, faceOffsets) + backend::PixelBufferDescriptor&&, data, + backend::FaceOffsets, faceOffsets) DECL_DRIVER_API_1(generateMipmaps, - driver::TextureHandle, th) + backend::TextureHandle, th) DECL_DRIVER_API_2(setExternalImage, - driver::TextureHandle, th, + backend::TextureHandle, th, void*, image) DECL_DRIVER_API_2(setExternalStream, - driver::TextureHandle, th, - driver::StreamHandle, sh) + backend::TextureHandle, th, + backend::StreamHandle, sh) DECL_DRIVER_API_2(beginRenderPass, - driver::RenderTargetHandle, rth, - const driver::RenderPassParams&, params) + backend::RenderTargetHandle, rth, + const backend::RenderPassParams&, params) DECL_DRIVER_API_0(endRenderPass) DECL_DRIVER_API_6(discardSubRenderTargetBuffers, - driver::RenderTargetHandle, rth, - driver::TargetBufferFlags, targetBufferFlags, + backend::RenderTargetHandle, rth, + backend::TargetBufferFlags, targetBufferFlags, uint32_t, left, uint32_t, bottom, uint32_t, width, uint32_t, height) DECL_DRIVER_API_3(resizeRenderTarget, - driver::RenderTargetHandle, rth, + backend::RenderTargetHandle, rth, uint32_t, width, uint32_t, height) DECL_DRIVER_API_4(setRenderPrimitiveBuffer, - driver::RenderPrimitiveHandle, rph, - driver::VertexBufferHandle, vbh, - driver::IndexBufferHandle, ibh, + backend::RenderPrimitiveHandle, rph, + backend::VertexBufferHandle, vbh, + backend::IndexBufferHandle, ibh, uint32_t, enabledAttributes) DECL_DRIVER_API_6(setRenderPrimitiveRange, - driver::RenderPrimitiveHandle, rph, - driver::PrimitiveType, pt, + backend::RenderPrimitiveHandle, rph, + backend::PrimitiveType, pt, uint32_t, offset, uint32_t, minIndex, uint32_t, maxIndex, @@ -413,12 +413,12 @@ DECL_DRIVER_API_4(setViewportScissor, */ DECL_DRIVER_API_2(makeCurrent, - driver::SwapChainHandle, schDraw, - driver::SwapChainHandle, schRead) + backend::SwapChainHandle, schDraw, + backend::SwapChainHandle, schRead) DECL_DRIVER_API_1(commit, - driver::SwapChainHandle, sch) + backend::SwapChainHandle, sch) /* * Setting rendering state @@ -427,17 +427,17 @@ DECL_DRIVER_API_1(commit, DECL_DRIVER_API_2(bindUniformBuffer, size_t, index, - driver::UniformBufferHandle, ubh) + backend::UniformBufferHandle, ubh) DECL_DRIVER_API_4(bindUniformBufferRange, size_t, index, - driver::UniformBufferHandle, ubh, + backend::UniformBufferHandle, ubh, size_t, offset, size_t, size) DECL_DRIVER_API_2(bindSamplers, size_t, index, - driver::SamplerGroupHandle, sbh) + backend::SamplerGroupHandle, sbh) DECL_DRIVER_API_2(insertEventMarker, const char*, string, @@ -456,20 +456,20 @@ DECL_DRIVER_API_0(popGroupMarker) */ DECL_DRIVER_API_6(readPixels, - driver::RenderTargetHandle, src, + backend::RenderTargetHandle, src, uint32_t, x, uint32_t, y, uint32_t, width, uint32_t, height, - driver::PixelBufferDescriptor&&, data) + backend::PixelBufferDescriptor&&, data) DECL_DRIVER_API_6(readStreamPixels, - driver::StreamHandle, sh, + backend::StreamHandle, sh, uint32_t, x, uint32_t, y, uint32_t, width, uint32_t, height, - driver::PixelBufferDescriptor&&, data) + backend::PixelBufferDescriptor&&, data) /* * Rendering operations @@ -477,16 +477,16 @@ DECL_DRIVER_API_6(readStreamPixels, */ DECL_DRIVER_API_6(blit, - driver::TargetBufferFlags, buffers, - driver::RenderTargetHandle, dst, - driver::Viewport, dstRect, - driver::RenderTargetHandle, src, - driver::Viewport, srcRect, - driver::SamplerMagFilter, filter) + backend::TargetBufferFlags, buffers, + backend::RenderTargetHandle, dst, + backend::Viewport, dstRect, + backend::RenderTargetHandle, src, + backend::Viewport, srcRect, + backend::SamplerMagFilter, filter) DECL_DRIVER_API_2(draw, - driver::PipelineState, state, - driver::RenderPrimitiveHandle, rph) + backend::PipelineState, state, + backend::RenderPrimitiveHandle, rph) #pragma clang diagnostic pop diff --git a/filament/backend/include/private/backend/DriverApiForward.h b/filament/backend/include/private/backend/DriverApiForward.h index ac6c54a5e5..727d2bff07 100644 --- a/filament/backend/include/private/backend/DriverApiForward.h +++ b/filament/backend/include/private/backend/DriverApiForward.h @@ -19,13 +19,13 @@ namespace filament { -namespace driver { +namespace backend { class CommandStream; using DriverApi = CommandStream; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_DRIVERAPIFORWARD_H diff --git a/filament/backend/include/private/backend/Handle.h b/filament/backend/include/private/backend/Handle.h index 85e188b918..580a4db153 100644 --- a/filament/backend/include/private/backend/Handle.h +++ b/filament/backend/include/private/backend/Handle.h @@ -27,7 +27,7 @@ #include namespace filament { -namespace driver { +namespace backend { struct HwVertexBuffer; struct HwFence; @@ -114,7 +114,7 @@ using TextureHandle = Handle; using UniformBufferHandle = Handle; using VertexBufferHandle = Handle; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_HANDLE_H diff --git a/filament/backend/include/private/backend/Program.h b/filament/backend/include/private/backend/Program.h index d9ea794418..395e5e5bbe 100644 --- a/filament/backend/include/private/backend/Program.h +++ b/filament/backend/include/private/backend/Program.h @@ -25,7 +25,7 @@ #include namespace filament { -namespace driver { +namespace backend { class Program { public: @@ -111,7 +111,7 @@ private: uint8_t mVariant; }; -} // namespace driver; +} // namespace backend; } // namespace filament; #endif // TNT_FILAMENT_DRIVER_PROGRAM_H diff --git a/filament/backend/include/private/backend/SamplerGroup.h b/filament/backend/include/private/backend/SamplerGroup.h index 08d7dff83f..2f7d3b8579 100644 --- a/filament/backend/include/private/backend/SamplerGroup.h +++ b/filament/backend/include/private/backend/SamplerGroup.h @@ -29,12 +29,12 @@ #include "private/backend/Handle.h" namespace filament { -namespace driver { +namespace backend { class SamplerGroup { public: - using SamplerParams = driver::SamplerParams; + using SamplerParams = backend::SamplerParams; struct Sampler { // we use a no-init default ctor so that the mBuffer array doesn't initializes itself @@ -91,12 +91,12 @@ private: friend utils::io::ostream& operator<<(utils::io::ostream& out, const SamplerGroup& rhs); #endif - std::array mBuffer; // 128 bytes + std::array mBuffer; // 128 bytes mutable utils::bitset32 mDirty; uint8_t mSize = 0; }; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_SAMPLERGROUP_H diff --git a/filament/backend/src/CircularBuffer.cpp b/filament/backend/src/CircularBuffer.cpp index 3b9c7aa403..9cf87ee624 100644 --- a/filament/backend/src/CircularBuffer.cpp +++ b/filament/backend/src/CircularBuffer.cpp @@ -33,7 +33,7 @@ using namespace utils; namespace filament { -namespace driver { +namespace backend { CircularBuffer::CircularBuffer(size_t size) { #if HAS_MMAP @@ -153,5 +153,5 @@ void CircularBuffer::circularize() noexcept { mTail = mHead; } -} // namespace driver +} // namespace backend } // namespace filament diff --git a/filament/backend/src/CommandBufferQueue.cpp b/filament/backend/src/CommandBufferQueue.cpp index 1d1f558c60..2cc5bb8456 100644 --- a/filament/backend/src/CommandBufferQueue.cpp +++ b/filament/backend/src/CommandBufferQueue.cpp @@ -26,7 +26,7 @@ using namespace utils; namespace filament { -namespace driver { +namespace backend { CommandBufferQueue::CommandBufferQueue(size_t requiredSize, size_t bufferSize) : mRequiredSize((requiredSize + CircularBuffer::BLOCK_MASK) & ~CircularBuffer::BLOCK_MASK), @@ -120,5 +120,5 @@ void CommandBufferQueue::releaseBuffer(CommandBufferQueue::Slice const& buffer) mCondition.notify_one(); } -} // namespace driver +} // namespace backend } // namespace filament diff --git a/filament/backend/src/CommandStream.cpp b/filament/backend/src/CommandStream.cpp index 19ef3ae910..1f6d5bc418 100644 --- a/filament/backend/src/CommandStream.cpp +++ b/filament/backend/src/CommandStream.cpp @@ -26,7 +26,7 @@ using namespace utils; namespace filament { -namespace driver { +namespace backend { // ------------------------------------------------------------------------------------------------ // A few utility functions for debugging... @@ -43,7 +43,7 @@ static void printParameterPack(io::ostream& out, const FIRST& first, const REMAI } static UTILS_NOINLINE UTILS_UNUSED std::string extractMethodName(std::string& command) noexcept { - constexpr const char startPattern[] = "::Command<&(filament::driver::Driver::"; + constexpr const char startPattern[] = "::Command<&(filament::backend::Driver::"; auto pos = command.rfind(startPattern); auto end = command.rfind('('); pos += sizeof(startPattern) - 1; @@ -139,7 +139,7 @@ void CustomCommand::execute(Driver&, CommandBase* base, intptr_t* next) noexcept static_cast(base)->~CustomCommand(); } -} // namespace driver +} // namespace backend } // namespace filament @@ -149,7 +149,7 @@ void CustomCommand::execute(Driver&, CommandBase* base, intptr_t* next) noexcept // ------------------------------------------------------------------------------------------------ using namespace filament; -using namespace driver; +using namespace backend; #if !defined(NDEBUG) && (DEBUG_COMMAND_STREAM != false) @@ -552,7 +552,7 @@ io::ostream& operator<<(io::ostream& out, PixelBufferDescriptor const& b) { } UTILS_PRIVATE -io::ostream& operator<<(io::ostream& out, filament::driver::Viewport const& viewport) { +io::ostream& operator<<(io::ostream& out, filament::backend::Viewport const& viewport) { out << "Viewport{" << ", left=" << viewport.left << ", bottom=" << viewport.bottom diff --git a/filament/backend/src/CommandStreamDispatcher.h b/filament/backend/src/CommandStreamDispatcher.h index d85d10e7b2..e2646fad63 100644 --- a/filament/backend/src/CommandStreamDispatcher.h +++ b/filament/backend/src/CommandStreamDispatcher.h @@ -44,7 +44,7 @@ #endif namespace filament { -namespace driver { +namespace backend { template class ConcreteDispatcher final : public Dispatcher { @@ -75,7 +75,7 @@ private: #include "private/backend/DriverAPI.inc" }; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_COMMANDSTREAM_DISPATCHER_H diff --git a/filament/backend/src/DataReshaper.h b/filament/backend/src/DataReshaper.h index 36cdaba79f..e62289d6db 100644 --- a/filament/backend/src/DataReshaper.h +++ b/filament/backend/src/DataReshaper.h @@ -20,7 +20,7 @@ #include namespace filament { -namespace driver { +namespace backend { // This little utility adds padding to multi-channel interleaved data by inserting dummy values. // This is very useful for platforms that only accept 4-component data, since users often wish to @@ -46,7 +46,7 @@ public: } }; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_DATARESHAPER_H diff --git a/filament/backend/src/Driver.cpp b/filament/backend/src/Driver.cpp index 81a641211e..f9997e0004 100644 --- a/filament/backend/src/Driver.cpp +++ b/filament/backend/src/Driver.cpp @@ -31,7 +31,7 @@ using namespace utils; namespace filament { -namespace driver { +namespace backend { DriverBase::DriverBase(Dispatcher* dispatcher) noexcept : mDispatcher(dispatcher) { @@ -88,5 +88,5 @@ size_t Driver::getElementTypeSize(ElementType type) noexcept { } } -} // namespace driver +} // namespace backend } // namespace filament diff --git a/filament/backend/src/DriverBase.h b/filament/backend/src/DriverBase.h index 987ebcae39..c1d1f72e30 100644 --- a/filament/backend/src/DriverBase.h +++ b/filament/backend/src/DriverBase.h @@ -35,7 +35,7 @@ #include namespace filament { -namespace driver { +namespace backend { class Dispatcher; @@ -102,7 +102,7 @@ struct HwUniformBuffer : public HwBase { }; struct HwTexture : public HwBase { - HwTexture(driver::SamplerType target, uint8_t levels, uint8_t samples, + HwTexture(backend::SamplerType target, uint8_t levels, uint8_t samples, uint32_t width, uint32_t height, uint32_t depth, TextureFormat fmt) noexcept : width(width), height(height), depth(depth), target(target), levels(levels), samples(samples), format(fmt) { } @@ -173,7 +173,7 @@ private: }; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_DRIVERBASE_H diff --git a/filament/backend/src/Handle.cpp b/filament/backend/src/Handle.cpp index a5f49c46cc..014fa7a4fd 100644 --- a/filament/backend/src/Handle.cpp +++ b/filament/backend/src/Handle.cpp @@ -25,7 +25,7 @@ using namespace utils; namespace filament { -namespace driver { +namespace backend { #ifndef NDEBUG @@ -71,5 +71,5 @@ template io::ostream& operator<<(io::ostream& out, const Handle& h) no #endif -} // namespace driver +} // namespace backend } // namespace filament diff --git a/filament/backend/src/Platform.cpp b/filament/backend/src/Platform.cpp index a6cec6b563..e44100fb70 100644 --- a/filament/backend/src/Platform.cpp +++ b/filament/backend/src/Platform.cpp @@ -66,7 +66,7 @@ #include "noop/PlatformNoop.h" namespace filament { -namespace driver { +namespace backend { // this generates the vtable in this translation unit Platform::~Platform() noexcept = default; @@ -136,5 +136,5 @@ void DefaultPlatform::destroy(DefaultPlatform** platform) noexcept { DefaultPlatform::~DefaultPlatform() noexcept = default; -} // namespace driver +} // namespace backend } // namespace filament diff --git a/filament/backend/src/Program.cpp b/filament/backend/src/Program.cpp index 762f410637..8a8e7d27a9 100644 --- a/filament/backend/src/Program.cpp +++ b/filament/backend/src/Program.cpp @@ -19,7 +19,7 @@ using namespace utils; namespace filament { -namespace driver { +namespace backend { // We want these in the .cpp file so they're not inlined (not worth it) Program::Program() noexcept = default; @@ -70,5 +70,5 @@ io::ostream& operator<<(io::ostream& out, const Program& builder) { #endif -} // namespace driver +} // namespace backend } // namespace filament diff --git a/filament/backend/src/SamplerGroup.cpp b/filament/backend/src/SamplerGroup.cpp index 2d6812cecd..d1c057121e 100644 --- a/filament/backend/src/SamplerGroup.cpp +++ b/filament/backend/src/SamplerGroup.cpp @@ -17,7 +17,7 @@ #include "private/backend/SamplerGroup.h" namespace filament { -namespace driver { +namespace backend { // create a sampler buffer SamplerGroup::SamplerGroup(size_t count) noexcept : mSize(uint8_t(count)) { @@ -92,5 +92,5 @@ utils::io::ostream& operator<<(utils::io::ostream& out, const SamplerGroup& rhs) } #endif -} // namespace driver +} // namespace backend } // namespace filament diff --git a/filament/backend/src/TextureReshaper.cpp b/filament/backend/src/TextureReshaper.cpp index 0088ed4dfd..abe0a248f3 100644 --- a/filament/backend/src/TextureReshaper.cpp +++ b/filament/backend/src/TextureReshaper.cpp @@ -21,7 +21,7 @@ #include namespace filament { -namespace driver { +namespace backend { TextureReshaper::TextureReshaper(TextureFormat requestedFormat) noexcept { const auto freeDeleter = [](void* buffer) { free(buffer); }; @@ -68,5 +68,5 @@ bool TextureReshaper::canReshapeTextureFormat(TextureFormat format) noexcept { return format == TextureFormat::RGB16F || format == TextureFormat::RGB8; } -} // namespace driver +} // namespace backend } // namespace filament diff --git a/filament/backend/src/TextureReshaper.h b/filament/backend/src/TextureReshaper.h index 1d9e0a25ef..d92063d7db 100644 --- a/filament/backend/src/TextureReshaper.h +++ b/filament/backend/src/TextureReshaper.h @@ -20,7 +20,7 @@ #include namespace filament { -namespace driver { +namespace backend { class TextureReshaper { @@ -67,7 +67,7 @@ private: }; -} // namespace driver +} // namespace backend } // namespace filament #endif //TNT_TEXTURERESHAPER_H diff --git a/filament/backend/src/android/ExternalStreamManagerAndroid.cpp b/filament/backend/src/android/ExternalStreamManagerAndroid.cpp index 3b2e411113..26b9e0eff0 100644 --- a/filament/backend/src/android/ExternalStreamManagerAndroid.cpp +++ b/filament/backend/src/android/ExternalStreamManagerAndroid.cpp @@ -25,7 +25,7 @@ using namespace utils; namespace filament { -using namespace driver; +using namespace backend; using EGLStream = Platform::Stream; diff --git a/filament/backend/src/android/ExternalStreamManagerAndroid.h b/filament/backend/src/android/ExternalStreamManagerAndroid.h index 214877d5ab..ec6cc69c30 100644 --- a/filament/backend/src/android/ExternalStreamManagerAndroid.h +++ b/filament/backend/src/android/ExternalStreamManagerAndroid.h @@ -33,7 +33,7 @@ namespace filament { class ExternalStreamManagerAndroid { public: - using EGLStream = driver::Platform::Stream; + using EGLStream = backend::Platform::Stream; ExternalStreamManagerAndroid() noexcept; static ExternalStreamManagerAndroid& get() noexcept; diff --git a/filament/backend/src/android/ExternalTextureManagerAndroid.cpp b/filament/backend/src/android/ExternalTextureManagerAndroid.cpp index 9539fe8e16..a52fb71ebd 100644 --- a/filament/backend/src/android/ExternalTextureManagerAndroid.cpp +++ b/filament/backend/src/android/ExternalTextureManagerAndroid.cpp @@ -25,7 +25,7 @@ using namespace utils; namespace filament { -using namespace driver; +using namespace backend; template static void loadSymbol(T*& pfn, const char *symbol) noexcept { @@ -112,7 +112,7 @@ ExternalTextureManagerAndroid::~ExternalTextureManagerAndroid() noexcept { } // called on gl thread -driver::Platform::ExternalTexture* ExternalTextureManagerAndroid::create() noexcept { +backend::Platform::ExternalTexture* ExternalTextureManagerAndroid::create() noexcept { #ifndef PLATFORM_HAS_HARDWAREBUFFER if (!AHardwareBuffer_allocate) { // initialize java stuff on-demand @@ -134,21 +134,21 @@ driver::Platform::ExternalTexture* ExternalTextureManagerAndroid::create() noexc // called on app thread void ExternalTextureManagerAndroid::reallocate( - driver::Platform::ExternalTexture* ets, uint32_t w, uint32_t h, - driver::TextureFormat format, uint64_t usage) noexcept { + backend::Platform::ExternalTexture* ets, uint32_t w, uint32_t h, + backend::TextureFormat format, uint64_t usage) noexcept { destroyStorage(ets); alloc(ets, w, h, format, usage); } // called on gl thread -void ExternalTextureManagerAndroid::destroy(driver::Platform::ExternalTexture* ets) noexcept { +void ExternalTextureManagerAndroid::destroy(backend::Platform::ExternalTexture* ets) noexcept { destroyStorage(ets); delete static_cast(ets); } // called on app thread void ExternalTextureManagerAndroid::alloc( - driver::Platform::ExternalTexture* t, + backend::Platform::ExternalTexture* t, uint32_t w, uint32_t h, TextureFormat format, uint64_t usage) noexcept { EGLExternalTexture* ets = static_cast(t); @@ -206,7 +206,7 @@ void ExternalTextureManagerAndroid::alloc( } // called on gl thread -void ExternalTextureManagerAndroid::destroyStorage(driver::Platform::ExternalTexture* t) noexcept { +void ExternalTextureManagerAndroid::destroyStorage(backend::Platform::ExternalTexture* t) noexcept { EGLExternalTexture* ets = static_cast(t); #ifndef PLATFORM_HAS_HARDWAREBUFFER diff --git a/filament/backend/src/android/ExternalTextureManagerAndroid.h b/filament/backend/src/android/ExternalTextureManagerAndroid.h index 15ee12be48..9b7efc4dbb 100644 --- a/filament/backend/src/android/ExternalTextureManagerAndroid.h +++ b/filament/backend/src/android/ExternalTextureManagerAndroid.h @@ -34,7 +34,7 @@ namespace filament { class ExternalTextureManagerAndroid { public: - struct ExternalTexture : public driver::Platform::ExternalTexture { + struct ExternalTexture : public backend::Platform::ExternalTexture { void* clientBuffer = nullptr; AHardwareBuffer* hardwareBuffer = nullptr; }; @@ -48,23 +48,23 @@ public: ~ExternalTextureManagerAndroid() noexcept; // called on gl thread - driver::Platform::ExternalTexture* create() noexcept; + backend::Platform::ExternalTexture* create() noexcept; // called on app thread void reallocate( - driver::Platform::ExternalTexture* ets, uint32_t w, uint32_t h, - driver::TextureFormat format, uint64_t usage) noexcept; + backend::Platform::ExternalTexture* ets, uint32_t w, uint32_t h, + backend::TextureFormat format, uint64_t usage) noexcept; // called on gl thread - void destroy(driver::Platform::ExternalTexture* ets) noexcept; + void destroy(backend::Platform::ExternalTexture* ets) noexcept; private: // called on app thread - void alloc(driver::Platform::ExternalTexture* ets, - uint32_t w, uint32_t h, driver::TextureFormat format, uint64_t usage) noexcept; + void alloc(backend::Platform::ExternalTexture* ets, + uint32_t w, uint32_t h, backend::TextureFormat format, uint64_t usage) noexcept; // called on gl thread - void destroyStorage(driver::Platform::ExternalTexture* ets) noexcept; + void destroyStorage(backend::Platform::ExternalTexture* ets) noexcept; VirtualMachineEnv& mVm; diff --git a/filament/backend/src/metal/MetalContext.h b/filament/backend/src/metal/MetalContext.h index 9ead5ff7a3..c1fc0541e4 100644 --- a/filament/backend/src/metal/MetalContext.h +++ b/filament/backend/src/metal/MetalContext.h @@ -23,7 +23,7 @@ #include "MetalState.h" namespace filament { -namespace driver { +namespace backend { namespace metal { class MetalRenderTarget; @@ -74,7 +74,7 @@ struct MetalContext { id acquireDrawable(MetalContext* context); } // namespace metal -} // namespace driver +} // namespace backend } // namespace filament #endif //TNT_METALCONTEXT_H diff --git a/filament/backend/src/metal/MetalContext.mm b/filament/backend/src/metal/MetalContext.mm index 1b1055604d..35da4719b4 100644 --- a/filament/backend/src/metal/MetalContext.mm +++ b/filament/backend/src/metal/MetalContext.mm @@ -21,7 +21,7 @@ #include namespace filament { -namespace driver { +namespace backend { namespace metal { id acquireDrawable(MetalContext* context) { @@ -33,5 +33,5 @@ id acquireDrawable(MetalContext* context) { } } // namespace metal -} // namespace driver +} // namespace backend } // namespace filament diff --git a/filament/backend/src/metal/MetalDriver.h b/filament/backend/src/metal/MetalDriver.h index a4ad618f61..5360d420c4 100644 --- a/filament/backend/src/metal/MetalDriver.h +++ b/filament/backend/src/metal/MetalDriver.h @@ -28,7 +28,7 @@ #include namespace filament { -namespace driver { +namespace backend { class MetalPlatform; @@ -39,15 +39,15 @@ struct MetalContext; struct MetalProgram; class MetalDriver final : public DriverBase { - MetalDriver(driver::MetalPlatform* platform) noexcept; + MetalDriver(backend::MetalPlatform* platform) noexcept; virtual ~MetalDriver() noexcept; public: - static Driver* create(driver::MetalPlatform* platform); + static Driver* create(backend::MetalPlatform* platform); private: - driver::MetalPlatform& mPlatform; + backend::MetalPlatform& mPlatform; MetalContext* mContext; @@ -62,7 +62,7 @@ private: */ template - friend class driver::ConcreteDispatcher; + friend class backend::ConcreteDispatcher; #define DECL_DRIVER_API(methodName, paramsDecl, params) \ UTILS_ALWAYS_INLINE void methodName(paramsDecl); @@ -146,7 +146,7 @@ private: }; } // namespace metal -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_METALDRIVER_H diff --git a/filament/backend/src/metal/MetalDriver.mm b/filament/backend/src/metal/MetalDriver.mm index 630586bc11..8d697c7b8e 100644 --- a/filament/backend/src/metal/MetalDriver.mm +++ b/filament/backend/src/metal/MetalDriver.mm @@ -33,7 +33,7 @@ #pragma ide diagnostic ignored "HidingNonVirtualFunction" namespace filament { -namespace driver { +namespace backend { namespace metal { Driver* MetalDriver::create(MetalPlatform* const platform) { @@ -41,7 +41,7 @@ Driver* MetalDriver::create(MetalPlatform* const platform) { return new MetalDriver(platform); } -MetalDriver::MetalDriver(driver::MetalPlatform* platform) noexcept +MetalDriver::MetalDriver(backend::MetalPlatform* platform) noexcept : DriverBase(new ConcreteDispatcher()), mPlatform(*platform), mContext(new MetalContext) { @@ -313,7 +313,7 @@ int64_t MetalDriver::getStreamTimestamp(Handle stream) { return 0; } -void MetalDriver::updateStreams(driver::DriverApi* driver) { +void MetalDriver::updateStreams(backend::DriverApi* driver) { } @@ -584,13 +584,13 @@ void MetalDriver::readStreamPixels(Handle sh, uint32_t x, uint32_t y, } void MetalDriver::blit(TargetBufferFlags buffers, - Handle dst, driver::Viewport dstRect, - Handle src, driver::Viewport srcRect, + Handle dst, backend::Viewport dstRect, + Handle src, backend::Viewport srcRect, SamplerMagFilter filter) { ASSERT_POSTCONDITION(false, "Blitting not implemented."); } -void MetalDriver::draw(driver::PipelineState ps, Handle rph) { +void MetalDriver::draw(backend::PipelineState ps, Handle rph) { ASSERT_PRECONDITION(mContext->currentCommandEncoder != nullptr, "Attempted to draw without a valid command encoder."); auto primitive = handle_cast(mHandleMap, rph); @@ -775,7 +775,7 @@ void MetalDriver::enumerateSamplerGroups( // explicit instantiation of the Dispatcher template class ConcreteDispatcher; -} // namespace driver +} // namespace backend } // namespace filament #pragma clang diagnostic pop diff --git a/filament/backend/src/metal/MetalEnums.h b/filament/backend/src/metal/MetalEnums.h index a46b45f643..ecde187816 100644 --- a/filament/backend/src/metal/MetalEnums.h +++ b/filament/backend/src/metal/MetalEnums.h @@ -26,7 +26,7 @@ #include namespace filament { -namespace driver { +namespace backend { constexpr inline MTLCompareFunction getMetalCompareFunction(RasterState::DepthFunc func) noexcept { @@ -375,7 +375,7 @@ constexpr inline MTLCompareFunction getCompareFunction(SamplerCompareFunc compar } } -} // namespace driver +} // namespace backend } // namespace filament #endif //TNT_FILAMENT_DRIVER_METALENUMS_H diff --git a/filament/backend/src/metal/MetalHandles.h b/filament/backend/src/metal/MetalHandles.h index ddf647b27f..5d899acc55 100644 --- a/filament/backend/src/metal/MetalHandles.h +++ b/filament/backend/src/metal/MetalHandles.h @@ -32,7 +32,7 @@ #include namespace filament { -namespace driver { +namespace backend { namespace metal { struct MetalSwapChain : public HwSwapChain { @@ -101,7 +101,7 @@ struct MetalProgram : public HwProgram { }; struct MetalTexture : public HwTexture { - MetalTexture(id device, driver::SamplerType target, uint8_t levels, + MetalTexture(id device, backend::SamplerType target, uint8_t levels, TextureFormat format, uint8_t samples, uint32_t width, uint32_t height, uint32_t depth, TextureUsage usage) noexcept; ~MetalTexture(); @@ -154,7 +154,7 @@ private: }; } // namespace metal -} // namespace driver +} // namespace backend } // namespace filament #endif //TNT_FILAMENT_DRIVER_METALHANDLES_H diff --git a/filament/backend/src/metal/MetalHandles.mm b/filament/backend/src/metal/MetalHandles.mm index f6120e7ed0..0e23a4189e 100644 --- a/filament/backend/src/metal/MetalHandles.mm +++ b/filament/backend/src/metal/MetalHandles.mm @@ -24,7 +24,7 @@ #include namespace filament { -namespace driver { +namespace backend { namespace metal { static inline MTLTextureUsage getMetalTextureUsage(TextureUsage usage) { @@ -230,7 +230,7 @@ MetalProgram::~MetalProgram() { [fragmentFunction release]; } -MetalTexture::MetalTexture(id device, driver::SamplerType target, uint8_t levels, +MetalTexture::MetalTexture(id device, backend::SamplerType target, uint8_t levels, TextureFormat format, uint8_t samples, uint32_t width, uint32_t height, uint32_t depth, TextureUsage usage) noexcept : HwTexture(target, levels, samples, width, height, depth, format), reshaper(format) { @@ -247,14 +247,14 @@ MetalTexture::MetalTexture(id device, driver::SamplerType target, uin const BOOL mipmapped = levels > 1; MTLTextureDescriptor* descriptor; - if (target == driver::SamplerType::SAMPLER_2D) { + if (target == backend::SamplerType::SAMPLER_2D) { descriptor = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:pixelFormat width:width height:height mipmapped:mipmapped]; descriptor.mipmapLevelCount = levels; descriptor.textureType = MTLTextureType2D; - } else if (target == driver::SamplerType::SAMPLER_CUBEMAP) { + } else if (target == backend::SamplerType::SAMPLER_CUBEMAP) { ASSERT_POSTCONDITION(width == height, "Cubemap faces must be square."); descriptor = [MTLTextureDescriptor textureCubeDescriptorWithPixelFormat:pixelFormat size:width @@ -387,5 +387,5 @@ id MetalRenderTarget::createMultisampledTexture(id device } } // namespace metal -} // namespace driver +} // namespace backend } // namespace filament diff --git a/filament/backend/src/metal/MetalState.h b/filament/backend/src/metal/MetalState.h index 31e0eeed50..84856174f9 100644 --- a/filament/backend/src/metal/MetalState.h +++ b/filament/backend/src/metal/MetalState.h @@ -29,17 +29,17 @@ #include namespace filament { -namespace driver { +namespace backend { -inline bool operator==(const driver::SamplerParams& lhs, const driver::SamplerParams& rhs) { +inline bool operator==(const backend::SamplerParams& lhs, const backend::SamplerParams& rhs) { return lhs.u == rhs.u; } namespace metal { -static constexpr uint32_t MAX_VERTEX_ATTRIBUTE_COUNT = driver::MAX_VERTEX_ATTRIBUTE_COUNT; +static constexpr uint32_t MAX_VERTEX_ATTRIBUTE_COUNT = backend::MAX_VERTEX_ATTRIBUTE_COUNT; static constexpr uint32_t SAMPLER_GROUP_COUNT = Program::UNIFORM_BINDING_COUNT; -static constexpr uint32_t SAMPLER_BINDING_COUNT = driver::MAX_SAMPLER_COUNT; +static constexpr uint32_t SAMPLER_BINDING_COUNT = backend::MAX_SAMPLER_COUNT; static constexpr uint32_t VERTEX_BUFFER_START = Program::UNIFORM_BINDING_COUNT; // Forward declarations necessary here, definitions at end of file. @@ -288,11 +288,11 @@ using UniformBufferStateTracker = StateTracker; // Sampler states struct SamplerStateCreator { - id operator()(id device, const driver::SamplerParams& state) + id operator()(id device, const backend::SamplerParams& state) noexcept; }; -using SamplerStateCache = StateCache, +using SamplerStateCache = StateCache, SamplerStateCreator>; // Raster-related state @@ -300,7 +300,7 @@ using SamplerStateCache = StateCache, using CullModeStateTracker = StateTracker; } // namespace metal -} // namespace driver +} // namespace backend } // namespace filament #endif //TNT_METAL_STATE_H diff --git a/filament/backend/src/metal/MetalState.mm b/filament/backend/src/metal/MetalState.mm index 3af7a8e347..6c7421c1c8 100644 --- a/filament/backend/src/metal/MetalState.mm +++ b/filament/backend/src/metal/MetalState.mm @@ -23,7 +23,7 @@ #include namespace filament { -namespace driver { +namespace backend { namespace metal { id PipelineStateCreator::operator()(id device, @@ -98,7 +98,7 @@ id DepthStateCreator::operator()(id device, } id SamplerStateCreator::operator()(id device, - const driver::SamplerParams& state) noexcept { + const backend::SamplerParams& state) noexcept { MTLSamplerDescriptor* samplerDescriptor = [[MTLSamplerDescriptor new] autorelease]; samplerDescriptor.minFilter = getFilter(state.filterMin); samplerDescriptor.magFilter = getFilter(state.filterMag); @@ -114,5 +114,5 @@ id SamplerStateCreator::operator()(id device, } } // namespace metal -} // namespace driver +} // namespace backend } // namespace filament diff --git a/filament/backend/src/metal/PlatformMetal.h b/filament/backend/src/metal/PlatformMetal.h index 464f9761b5..a65d52182d 100644 --- a/filament/backend/src/metal/PlatformMetal.h +++ b/filament/backend/src/metal/PlatformMetal.h @@ -23,18 +23,18 @@ #include namespace filament { -namespace driver { +namespace backend { class MetalPlatform : public DefaultPlatform { public: ~MetalPlatform() override; }; -} // namespace driver +} // namespace backend -class PlatformMetal final : public driver::MetalPlatform { +class PlatformMetal final : public backend::MetalPlatform { public: - driver::Driver* createDriver(void* sharedContext) noexcept override; + backend::Driver* createDriver(void* sharedContext) noexcept override; int getOSVersion() const noexcept override { return 0; } ~PlatformMetal() override; }; diff --git a/filament/backend/src/metal/PlatformMetal.mm b/filament/backend/src/metal/PlatformMetal.mm index 81a0c1fff8..9515893f19 100644 --- a/filament/backend/src/metal/PlatformMetal.mm +++ b/filament/backend/src/metal/PlatformMetal.mm @@ -19,12 +19,12 @@ namespace filament { -namespace driver { +namespace backend { MetalPlatform::~MetalPlatform() = default; -} // namespace driver +} // namespace backend -using namespace driver; +using namespace backend; Driver* PlatformMetal::createDriver(void* sharedContext) noexcept { return metal::MetalDriver::create(this); diff --git a/filament/backend/src/noop/NoopDriver.cpp b/filament/backend/src/noop/NoopDriver.cpp index f39a924fc5..cd0fc4d45f 100644 --- a/filament/backend/src/noop/NoopDriver.cpp +++ b/filament/backend/src/noop/NoopDriver.cpp @@ -19,7 +19,7 @@ namespace filament { -using namespace driver; +using namespace backend; Driver* NoopDriver::create() { return new NoopDriver(); @@ -30,15 +30,15 @@ NoopDriver::NoopDriver() noexcept : DriverBase(new ConcreteDispatcher; +template class backend::ConcreteDispatcher; } // namespace filament diff --git a/filament/backend/src/noop/NoopDriver.h b/filament/backend/src/noop/NoopDriver.h index 5e1dc337a6..18d44f5646 100644 --- a/filament/backend/src/noop/NoopDriver.h +++ b/filament/backend/src/noop/NoopDriver.h @@ -24,22 +24,22 @@ namespace filament { -class NoopDriver final : public driver::DriverBase { +class NoopDriver final : public backend::DriverBase { NoopDriver() noexcept; ~NoopDriver() noexcept override; public: - static driver::Driver* create(); + static backend::Driver* create(); private: - driver::ShaderModel getShaderModel() const noexcept final; + backend::ShaderModel getShaderModel() const noexcept final; /* * Driver interface */ template - friend class driver::ConcreteDispatcher; + friend class backend::ConcreteDispatcher; #define DECL_DRIVER_API(methodName, paramsDecl, params) \ UTILS_ALWAYS_INLINE void methodName(paramsDecl) { } diff --git a/filament/backend/src/noop/PlatformNoop.cpp b/filament/backend/src/noop/PlatformNoop.cpp index 0afefd9df0..d3cd75664c 100644 --- a/filament/backend/src/noop/PlatformNoop.cpp +++ b/filament/backend/src/noop/PlatformNoop.cpp @@ -20,7 +20,7 @@ namespace filament { -driver::Driver* PlatformNoop::createDriver(void* const sharedGLContext) noexcept { +backend::Driver* PlatformNoop::createDriver(void* const sharedGLContext) noexcept { return NoopDriver::create(); } diff --git a/filament/backend/src/noop/PlatformNoop.h b/filament/backend/src/noop/PlatformNoop.h index 4ceb4448e3..145aa09c47 100644 --- a/filament/backend/src/noop/PlatformNoop.h +++ b/filament/backend/src/noop/PlatformNoop.h @@ -22,7 +22,7 @@ namespace filament { -class PlatformNoop final : public driver::DefaultPlatform { +class PlatformNoop final : public backend::DefaultPlatform { public: int getOSVersion() const noexcept final { return 0; } @@ -31,7 +31,7 @@ public: protected: - driver::Driver* createDriver(void* sharedContext) noexcept override; + backend::Driver* createDriver(void* sharedContext) noexcept override; }; } // namespace filament diff --git a/filament/backend/src/opengl/GLUtils.cpp b/filament/backend/src/opengl/GLUtils.cpp index 0e2367c8d8..9f1d5d073f 100644 --- a/filament/backend/src/opengl/GLUtils.cpp +++ b/filament/backend/src/opengl/GLUtils.cpp @@ -22,7 +22,7 @@ namespace filament { -using namespace driver; +using namespace backend; using namespace utils; namespace GLUtils { diff --git a/filament/backend/src/opengl/GLUtils.h b/filament/backend/src/opengl/GLUtils.h index 11e36d6303..0472ea9079 100644 --- a/filament/backend/src/opengl/GLUtils.h +++ b/filament/backend/src/opengl/GLUtils.h @@ -38,8 +38,8 @@ void checkFramebufferStatus(utils::io::ostream& out, const char* function, size_ #define CHECK_GL_FRAMEBUFFER_STATUS(out) { GLUtils::checkFramebufferStatus(out, __PRETTY_FUNCTION__, __LINE__); } #endif -constexpr inline GLuint getComponentCount(filament::driver::ElementType type) noexcept { - using ElementType = filament::driver::ElementType; +constexpr inline GLuint getComponentCount(filament::backend::ElementType type) noexcept { + using ElementType = filament::backend::ElementType; switch (type) { case ElementType::BYTE: case ElementType::UBYTE: @@ -78,12 +78,12 @@ constexpr inline GLuint getComponentCount(filament::driver::ElementType type) no // Our enums to GLenum conversions // ------------------------------------------------------------------------------------------------ -constexpr inline GLenum getBufferUsage(filament::driver::BufferUsage usage) noexcept { +constexpr inline GLenum getBufferUsage(filament::backend::BufferUsage usage) noexcept { switch (usage) { - case driver::STATIC: + case backend::STATIC: return GL_STATIC_DRAW; - case driver::DYNAMIC: - case driver::STREAM: + case backend::DYNAMIC: + case backend::STREAM: return GL_DYNAMIC_DRAW; } } @@ -92,8 +92,8 @@ constexpr inline GLboolean getNormalization(bool normalized) noexcept { return GLboolean(normalized ? GL_TRUE : GL_FALSE); } -constexpr inline GLenum getComponentType(filament::driver::ElementType type) noexcept { - using ElementType = filament::driver::ElementType; +constexpr inline GLenum getComponentType(filament::backend::ElementType type) noexcept { + using ElementType = filament::backend::ElementType; switch (type) { case ElementType::BYTE: case ElementType::BYTE2: @@ -132,12 +132,12 @@ constexpr inline GLenum getComponentType(filament::driver::ElementType type) noe } } -constexpr inline GLenum getCubemapTarget(filament::driver::TextureCubemapFace face) noexcept { +constexpr inline GLenum getCubemapTarget(filament::backend::TextureCubemapFace face) noexcept { return GL_TEXTURE_CUBE_MAP_POSITIVE_X + GLenum(face); } -constexpr inline GLenum getWrapMode(filament::driver::SamplerWrapMode mode) noexcept { - using SamplerWrapMode = filament::driver::SamplerWrapMode; +constexpr inline GLenum getWrapMode(filament::backend::SamplerWrapMode mode) noexcept { + using SamplerWrapMode = filament::backend::SamplerWrapMode; switch (mode) { case SamplerWrapMode::REPEAT: return GL_REPEAT; @@ -148,8 +148,8 @@ constexpr inline GLenum getWrapMode(filament::driver::SamplerWrapMode mode) noex } } -constexpr inline GLenum getTextureFilter(filament::driver::SamplerMinFilter filter) noexcept { - using SamplerMinFilter = filament::driver::SamplerMinFilter; +constexpr inline GLenum getTextureFilter(filament::backend::SamplerMinFilter filter) noexcept { + using SamplerMinFilter = filament::backend::SamplerMinFilter; switch (filter) { case SamplerMinFilter::NEAREST: case SamplerMinFilter::LINEAR: @@ -163,13 +163,13 @@ constexpr inline GLenum getTextureFilter(filament::driver::SamplerMinFilter filt } } -constexpr inline GLenum getTextureFilter(filament::driver::SamplerMagFilter filter) noexcept { +constexpr inline GLenum getTextureFilter(filament::backend::SamplerMagFilter filter) noexcept { return GL_NEAREST + GLenum(filter); } -constexpr inline GLenum getBlendEquationMode(filament::driver::BlendEquation mode) noexcept { - using BlendEquation = filament::driver::BlendEquation; +constexpr inline GLenum getBlendEquationMode(filament::backend::BlendEquation mode) noexcept { + using BlendEquation = filament::backend::BlendEquation; switch (mode) { case BlendEquation::ADD: return GL_FUNC_ADD; case BlendEquation::SUBTRACT: return GL_FUNC_SUBTRACT; @@ -179,8 +179,8 @@ constexpr inline GLenum getBlendEquationMode(filament::driver::BlendEquation mod } } -constexpr inline GLenum getBlendFunctionMode(filament::driver::BlendFunction mode) noexcept { - using BlendFunction = filament::driver::BlendFunction; +constexpr inline GLenum getBlendFunctionMode(filament::backend::BlendFunction mode) noexcept { + using BlendFunction = filament::backend::BlendFunction; switch (mode) { case BlendFunction::ZERO: return GL_ZERO; case BlendFunction::ONE: return GL_ONE; @@ -196,13 +196,13 @@ constexpr inline GLenum getBlendFunctionMode(filament::driver::BlendFunction mod } } -constexpr inline GLenum getTextureCompareMode(filament::driver::SamplerCompareMode mode) noexcept { - return mode == filament::driver::SamplerCompareMode::NONE ? +constexpr inline GLenum getTextureCompareMode(filament::backend::SamplerCompareMode mode) noexcept { + return mode == filament::backend::SamplerCompareMode::NONE ? GL_NONE : GL_COMPARE_REF_TO_TEXTURE; } -constexpr inline GLenum getTextureCompareFunc(filament::driver::SamplerCompareFunc func) noexcept { - using SamplerCompareFunc = filament::driver::SamplerCompareFunc; +constexpr inline GLenum getTextureCompareFunc(filament::backend::SamplerCompareFunc func) noexcept { + using SamplerCompareFunc = filament::backend::SamplerCompareFunc; switch (func) { case SamplerCompareFunc::LE: return GL_LEQUAL; case SamplerCompareFunc::GE: return GL_GEQUAL; @@ -215,12 +215,12 @@ constexpr inline GLenum getTextureCompareFunc(filament::driver::SamplerCompareFu } } -constexpr inline GLenum getDepthFunc(driver::SamplerCompareFunc func) noexcept { +constexpr inline GLenum getDepthFunc(backend::SamplerCompareFunc func) noexcept { return getTextureCompareFunc(func); } -constexpr inline GLenum getFormat(filament::driver::PixelDataFormat format) noexcept { - using PixelDataFormat = filament::driver::PixelDataFormat; +constexpr inline GLenum getFormat(filament::backend::PixelDataFormat format) noexcept { + using PixelDataFormat = filament::backend::PixelDataFormat; switch (format) { case PixelDataFormat::R: return GL_RED; case PixelDataFormat::R_INTEGER: return GL_RED_INTEGER; @@ -237,8 +237,8 @@ constexpr inline GLenum getFormat(filament::driver::PixelDataFormat format) noex } } -constexpr inline GLenum getType(filament::driver::PixelDataType type) noexcept { - using PixelDataType = filament::driver::PixelDataType; +constexpr inline GLenum getType(filament::backend::PixelDataType type) noexcept { + using PixelDataType = filament::backend::PixelDataType; switch (type) { case PixelDataType::UBYTE: return GL_UNSIGNED_BYTE; case PixelDataType::BYTE: return GL_BYTE; @@ -255,8 +255,8 @@ constexpr inline GLenum getType(filament::driver::PixelDataType type) noexcept { // clang looses it on this one, and generates a huge jump table when // inlined. So we don't mark it as inline (only constexpr) which solves the problem, // strangely, when not inlined, clang simply generates an array lookup. -constexpr /* inline */ GLenum getInternalFormat(filament::driver::TextureFormat format) noexcept { - using TextureFormat = filament::driver::TextureFormat; +constexpr /* inline */ GLenum getInternalFormat(filament::backend::TextureFormat format) noexcept { + using TextureFormat = filament::backend::TextureFormat; switch (format) { // 8-bits per element case TextureFormat::R8: return GL_R8; diff --git a/filament/backend/src/opengl/OpenGLDriver.cpp b/filament/backend/src/opengl/OpenGLDriver.cpp index c6bb83fc42..4462b2b9fc 100644 --- a/filament/backend/src/opengl/OpenGLDriver.cpp +++ b/filament/backend/src/opengl/OpenGLDriver.cpp @@ -57,7 +57,7 @@ using namespace utils; namespace filament { -using namespace driver; +using namespace backend; using namespace GLUtils; Driver* OpenGLDriver::create( @@ -1044,7 +1044,7 @@ void OpenGLDriver::createTextureR(Handle th, SamplerType target, uint CHECK_GL_ERROR(utils::slog.e) } -void OpenGLDriver::framebufferTexture(driver::TargetBufferInfo& binfo, +void OpenGLDriver::framebufferTexture(backend::TargetBufferInfo& binfo, GLRenderTarget* rt, GLenum attachment) noexcept { GLTexture const* t = handle_cast(binfo.handle); @@ -2940,6 +2940,6 @@ void OpenGLDriver::draw(PipelineState state, Handle rph) { } // explicit instantiation of the Dispatcher -template class driver::ConcreteDispatcher; +template class backend::ConcreteDispatcher; } // namespace filament diff --git a/filament/backend/src/opengl/OpenGLDriver.h b/filament/backend/src/opengl/OpenGLDriver.h index 041d5a59f1..6d57a74f79 100644 --- a/filament/backend/src/opengl/OpenGLDriver.h +++ b/filament/backend/src/opengl/OpenGLDriver.h @@ -35,21 +35,21 @@ namespace filament { -namespace driver { +namespace backend { class OpenGLPlatform; class PixelBufferDescriptor; class TargetBufferInfo; -} // namespace driver +} // namespace backend class OpenGLProgram; class OpenGLBlitter; -class OpenGLDriver final : public driver::DriverBase { - inline explicit OpenGLDriver(driver::OpenGLPlatform* platform) noexcept; +class OpenGLDriver final : public backend::DriverBase { + inline explicit OpenGLDriver(backend::OpenGLPlatform* platform) noexcept; ~OpenGLDriver() noexcept final; public: - static driver::Driver* create(driver::OpenGLPlatform* platform, void* sharedGLContext) noexcept; + static backend::Driver* create(backend::OpenGLPlatform* platform, void* sharedGLContext) noexcept; // OpenGLDriver specific fields struct GLBuffer { @@ -57,25 +57,25 @@ public: uint32_t capacity = 0; uint32_t base = 0; uint32_t size = 0; - driver::BufferUsage usage = {}; + backend::BufferUsage usage = {}; }; - struct GLVertexBuffer : public driver::HwVertexBuffer { + struct GLVertexBuffer : public backend::HwVertexBuffer { using HwVertexBuffer::HwVertexBuffer; struct { - std::array buffers; // 4*6 bytes + std::array buffers; // 4*6 bytes } gl; }; - struct GLIndexBuffer : public driver::HwIndexBuffer { + struct GLIndexBuffer : public backend::HwIndexBuffer { using HwIndexBuffer::HwIndexBuffer; struct { GLuint buffer; } gl; }; - struct GLUniformBuffer : public driver::HwUniformBuffer { - GLUniformBuffer(uint32_t capacity, driver::BufferUsage usage) noexcept { + struct GLUniformBuffer : public backend::HwUniformBuffer { + GLUniformBuffer(uint32_t capacity, backend::BufferUsage usage) noexcept { gl.ubo.capacity = capacity; gl.ubo.usage = usage; } @@ -84,13 +84,13 @@ public: } gl; }; - struct GLSamplerGroup : public driver::HwSamplerGroup { + struct GLSamplerGroup : public backend::HwSamplerGroup { using HwSamplerGroup::HwSamplerGroup; struct { } gl; }; - struct GLRenderPrimitive : public driver::HwRenderPrimitive { + struct GLRenderPrimitive : public backend::HwRenderPrimitive { using HwRenderPrimitive::HwRenderPrimitive; struct { GLuint vao = 0; @@ -100,7 +100,7 @@ public: } gl; }; - struct GLTexture : public driver::HwTexture { + struct GLTexture : public backend::HwTexture { using HwTexture::HwTexture; struct { GLuint texture_id; @@ -129,13 +129,13 @@ public: } }; - struct GLStream : public driver::HwStream { + struct GLStream : public backend::HwStream { static constexpr size_t ROUND_ROBIN_TEXTURE_COUNT = 3; // 3 maximum using HwStream::HwStream; bool isNativeStream() const { return gl.externalTextureId == 0; } struct Info { // storage for the read/write textures below - driver::Platform::ExternalTexture* ets = nullptr; + backend::Platform::ExternalTexture* ets = nullptr; GLuint width = 0; GLuint height = 0; }; @@ -166,7 +166,7 @@ public: } user_thread; }; - struct GLRenderTarget : public driver::HwRenderTarget { + struct GLRenderTarget : public backend::HwRenderTarget { using HwRenderTarget::HwRenderTarget; struct GL { struct RenderBuffer { @@ -180,7 +180,7 @@ public: RenderBuffer stencil; GLuint fbo = 0; GLuint fbo_draw = 0; - driver::TargetBufferFlags resolve = driver::TargetBufferFlags::NONE; // attachments in fbo_draw to resolve + backend::TargetBufferFlags resolve = backend::TargetBufferFlags::NONE; // attachments in fbo_draw to resolve uint8_t samples : 4; uint8_t colorLevel : 4; // Allows up to 15 levels (max texture size of 32768 x 32768) } gl; @@ -192,14 +192,14 @@ public: OpenGLDriver& operator=(OpenGLDriver const&) = delete; private: - driver::ShaderModel getShaderModel() const noexcept final; + backend::ShaderModel getShaderModel() const noexcept final; /* * Driver interface */ template - friend class driver::ConcreteDispatcher; + friend class backend::ConcreteDispatcher; #define DECL_DRIVER_API(methodName, paramsDecl, params) \ UTILS_ALWAYS_INLINE void methodName(paramsDecl); @@ -239,15 +239,15 @@ private: HandleArena mHandleArena; - driver::HandleBase::HandleId allocateHandle(size_t size) noexcept; + backend::HandleBase::HandleId allocateHandle(size_t size) noexcept; template typename std::enable_if::value, D>::type* - construct(driver::Handle const& handle, ARGS&& ... args) noexcept; + construct(backend::Handle const& handle, ARGS&& ... args) noexcept; template::value, D>::type> - void destruct(driver::Handle& handle, D const* p) noexcept; + void destruct(backend::Handle& handle, D const* p) noexcept; /* @@ -261,7 +261,7 @@ private: typename std::enable_if< std::is_pointer::value && std::is_base_of::type>::value, Dp>::type - handle_cast(driver::Handle& handle) noexcept { + handle_cast(backend::Handle& handle) noexcept { char* const base = (char *)mHandleArena.getArea().begin(); size_t offset = handle.getId() << HandleAllocator::MIN_ALIGNMENT_SHIFT; return static_cast(static_cast(base + offset)); @@ -286,7 +286,7 @@ private: /* Misc... */ - void framebufferTexture(driver::TargetBufferInfo& binfo, GLRenderTarget* rt, GLenum attachment) noexcept; + void framebufferTexture(backend::TargetBufferInfo& binfo, GLRenderTarget* rt, GLenum attachment) noexcept; void framebufferRenderbuffer(GLRenderTarget::GL::RenderBuffer* rb, GLenum attachment, GLenum internalformat, uint32_t width, uint32_t height, uint8_t samples, GLuint fbo) noexcept; @@ -294,8 +294,8 @@ private: GLuint framebufferRenderbuffer(uint32_t width, uint32_t height, uint8_t samples, GLenum attachment, GLenum internalformat, GLuint fbo) noexcept; - void setRasterStateSlow(driver::RasterState rs) noexcept; - void setRasterState(driver::RasterState rs) noexcept { + void setRasterStateSlow(backend::RasterState rs) noexcept; + void setRasterState(backend::RasterState rs) noexcept { if (UTILS_UNLIKELY(rs != mRasterState)) { setRasterStateSlow(rs); } @@ -305,13 +305,13 @@ private: uint32_t level, uint32_t xoffset, uint32_t yoffset, uint32_t zoffset, uint32_t width, uint32_t height, uint32_t depth, - driver::PixelBufferDescriptor&& data, driver::FaceOffsets const* faceOffsets); + backend::PixelBufferDescriptor&& data, backend::FaceOffsets const* faceOffsets); void setCompressedTextureData(GLTexture* t, uint32_t level, uint32_t xoffset, uint32_t yoffset, uint32_t zoffset, uint32_t width, uint32_t height, uint32_t depth, - driver::PixelBufferDescriptor&& data, driver::FaceOffsets const* faceOffsets); + backend::PixelBufferDescriptor&& data, backend::FaceOffsets const* faceOffsets); void renderBufferStorage(GLuint rbo, GLenum internalformat, uint32_t width, uint32_t height, uint8_t samples) const noexcept; @@ -365,11 +365,11 @@ private: inline void setClearDepth(GLfloat depth) noexcept; inline void setClearStencil(GLint stencil) noexcept; - void resolve(GLRenderTarget const* rt, driver::TargetBufferFlags discardFlags) noexcept; + void resolve(GLRenderTarget const* rt, backend::TargetBufferFlags discardFlags) noexcept; - GLuint getSamplerSlow(driver::SamplerParams sp) const noexcept; + GLuint getSamplerSlow(backend::SamplerParams sp) const noexcept; - inline GLuint getSampler(driver::SamplerParams sp) const noexcept { + inline GLuint getSampler(backend::SamplerParams sp) const noexcept { auto pos = mSamplerMap.find(sp.u); if (UTILS_UNLIKELY(pos == mSamplerMap.end())) { return getSamplerSlow(sp); @@ -377,7 +377,7 @@ private: return pos->second; } - const std::array& getSamplerBindings() const { + const std::array& getSamplerBindings() const { return mSamplerBindings; } @@ -487,14 +487,14 @@ private: static constexpr const size_t TEXTURE_TARGET_COUNT = sizeof(state.textures.units[0].targets) / sizeof(state.textures.units[0].targets[0]); - driver::RasterState mRasterState; + backend::RasterState mRasterState; GLfloat mMaxAnisotropy = 0.0f; - driver::ShaderModel mShaderModel; + backend::ShaderModel mShaderModel; // state required to represent the current render pass - driver::Handle mRenderPassTarget; - driver::RenderPassParams mRenderPassParams; + backend::Handle mRenderPassTarget; + backend::RenderPassParams mRenderPassParams; // state needed for clearing the viewport "by hand", i.e. with a triangle GLuint mClearVertexShader; @@ -513,7 +513,7 @@ private: bool clearStencil, uint32_t stencil) noexcept; // sampler buffer binding points (nullptr if not used) - std::array mSamplerBindings; // 8 pointers + std::array mSamplerBindings; // 8 pointers mutable tsl::robin_map mSamplerMap; mutable std::vector mExternalStreams; @@ -571,11 +571,11 @@ private: void detachStream(GLTexture* t) noexcept; void replaceStream(GLTexture* t, GLStream* stream) noexcept; - driver::OpenGLPlatform& mPlatform; + backend::OpenGLPlatform& mPlatform; OpenGLBlitter* mOpenGLBlitter = nullptr; - void updateStream(GLTexture* t, driver::DriverApi* driver) noexcept; - void updateBuffer(GLenum target, GLBuffer* buffer, driver::BufferDescriptor const& p, uint32_t alignment = 16) noexcept; + void updateStream(GLTexture* t, backend::DriverApi* driver) noexcept; + void updateBuffer(GLenum target, GLBuffer* buffer, backend::BufferDescriptor const& p, uint32_t alignment = 16) noexcept; }; // ------------------------------------------------------------------------------------------------ diff --git a/filament/backend/src/opengl/OpenGLPlatform.cpp b/filament/backend/src/opengl/OpenGLPlatform.cpp index 0ba6e83fae..48f2b7772f 100644 --- a/filament/backend/src/opengl/OpenGLPlatform.cpp +++ b/filament/backend/src/opengl/OpenGLPlatform.cpp @@ -17,9 +17,9 @@ #include "OpenGLPlatform.h" namespace filament { -namespace driver { +namespace backend { OpenGLPlatform::~OpenGLPlatform() noexcept = default; -} // namespace driver +} // namespace backend } // namespace filament diff --git a/filament/backend/src/opengl/OpenGLPlatform.h b/filament/backend/src/opengl/OpenGLPlatform.h index 209aea92bb..319755b51c 100644 --- a/filament/backend/src/opengl/OpenGLPlatform.h +++ b/filament/backend/src/opengl/OpenGLPlatform.h @@ -20,7 +20,7 @@ #include namespace filament { -namespace driver { +namespace backend { class Driver; @@ -54,7 +54,7 @@ public: virtual bool canCreateFence() noexcept { return false; } virtual Fence* createFence() noexcept = 0; virtual void destroyFence(Fence* fence) noexcept = 0; - virtual driver::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept = 0; + virtual backend::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept = 0; // this is called synchronously in the application thread (NOT the Driver thread) virtual Stream* createStream(void* nativeStream) noexcept = 0; @@ -78,7 +78,7 @@ public: virtual void destroyExternalTextureStorage(ExternalTexture* ets) noexcept = 0; }; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_OPENGL_PLATFORM_H diff --git a/filament/backend/src/opengl/OpenGLProgram.cpp b/filament/backend/src/opengl/OpenGLProgram.cpp index bc1e621c98..78ec2ff17e 100644 --- a/filament/backend/src/opengl/OpenGLProgram.cpp +++ b/filament/backend/src/opengl/OpenGLProgram.cpp @@ -28,7 +28,7 @@ namespace filament { using namespace filament::math; using namespace utils; -using namespace driver; +using namespace backend; OpenGLProgram::OpenGLProgram(OpenGLDriver* gl, const Program& programBuilder) noexcept : HwProgram(programBuilder.getName()), mIsValid(false) { diff --git a/filament/backend/src/opengl/OpenGLProgram.h b/filament/backend/src/opengl/OpenGLProgram.h index 48705f0657..c7f1fb3314 100644 --- a/filament/backend/src/opengl/OpenGLProgram.h +++ b/filament/backend/src/opengl/OpenGLProgram.h @@ -34,10 +34,10 @@ namespace filament { -class OpenGLProgram : public driver::HwProgram { +class OpenGLProgram : public backend::HwProgram { public: - OpenGLProgram(OpenGLDriver* gl, const driver::Program& builder) noexcept; + OpenGLProgram(OpenGLDriver* gl, const backend::Program& builder) noexcept; ~OpenGLProgram() noexcept; bool isValid() const noexcept { return mIsValid; } @@ -61,7 +61,7 @@ public: } struct { - GLuint shaders[driver::Program::SHADER_TYPE_COUNT]; + GLuint shaders[backend::Program::SHADER_TYPE_COUNT]; GLuint program; } gl; // 12 bytes @@ -69,8 +69,8 @@ public: private: static constexpr uint8_t TEXTURE_UNIT_COUNT = OpenGLDriver::MAX_TEXTURE_UNIT_COUNT; - static constexpr uint8_t VERTEX_SHADER_BIT = uint8_t(1) << size_t(driver::Program::Shader::VERTEX); - static constexpr uint8_t FRAGMENT_SHADER_BIT = uint8_t(1) << size_t(driver::Program::Shader::FRAGMENT); + static constexpr uint8_t VERTEX_SHADER_BIT = uint8_t(1) << size_t(backend::Program::Shader::VERTEX); + static constexpr uint8_t FRAGMENT_SHADER_BIT = uint8_t(1) << size_t(backend::Program::Shader::FRAGMENT); struct BlockInfo { uint8_t binding : 3; // binding (i.e.: index in mSamplerBindings) @@ -81,7 +81,7 @@ private: static_assert(TEXTURE_UNIT_COUNT <= 16, "TEXTURE_UNIT_COUNT must be <= 16"); // if SAMPLER_BINDING_COUNT > 8, the binding bitfield must be increased accordingly - static_assert(driver::Program::SAMPLER_BINDING_COUNT <= 8, "SAMPLER_BINDING_COUNT must be <= 8"); + static_assert(backend::Program::SAMPLER_BINDING_COUNT <= 8, "SAMPLER_BINDING_COUNT must be <= 8"); }; uint8_t mUsedBindingsCount = 0; @@ -89,7 +89,7 @@ private: bool mIsValid = false; // information about each USED sampler buffer (no gaps) - std::array mBlockInfos; // 8 bytes + std::array mBlockInfos; // 8 bytes // runs of indices into SamplerGroup -- run start index and size given by BlockInfo std::array mIndicesRuns; // 16 bytes diff --git a/filament/backend/src/opengl/PlatformCocoaGL.h b/filament/backend/src/opengl/PlatformCocoaGL.h index 6e036d4ec2..2f0deba3b7 100644 --- a/filament/backend/src/opengl/PlatformCocoaGL.h +++ b/filament/backend/src/opengl/PlatformCocoaGL.h @@ -27,12 +27,12 @@ namespace filament { struct PlatformCocoaGLImpl; -class PlatformCocoaGL final : public driver::OpenGLPlatform { +class PlatformCocoaGL final : public backend::OpenGLPlatform { public: PlatformCocoaGL(); ~PlatformCocoaGL() noexcept final; - driver::Driver* createDriver(void* sharedContext) noexcept override; + backend::Driver* createDriver(void* sharedContext) noexcept override; void terminate() noexcept final; SwapChain* createSwapChain(void* nativewindow, uint64_t& flags) noexcept final; @@ -42,8 +42,8 @@ public: Fence* createFence() noexcept final { return nullptr; } void destroyFence(Fence* fence) noexcept final {} - driver::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept final { - return driver::FenceStatus::ERROR; + backend::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept final { + return backend::FenceStatus::ERROR; } void setPresentationTime(int64_t presentationTimeInNanosecond) noexcept final {} @@ -56,7 +56,7 @@ public: ExternalTexture* createExternalTextureStorage() noexcept final { return nullptr; } void reallocateExternalStorage(ExternalTexture* ets, - uint32_t w, uint32_t h, driver::TextureFormat format) noexcept final { } + uint32_t w, uint32_t h, backend::TextureFormat format) noexcept final { } void destroyExternalTextureStorage(ExternalTexture* ets) noexcept final { } int getOSVersion() const noexcept final { return 0; } diff --git a/filament/backend/src/opengl/PlatformCocoaGL.mm b/filament/backend/src/opengl/PlatformCocoaGL.mm index 0084ab2f37..9e74b27c28 100644 --- a/filament/backend/src/opengl/PlatformCocoaGL.mm +++ b/filament/backend/src/opengl/PlatformCocoaGL.mm @@ -32,7 +32,7 @@ namespace filament { -using namespace driver; +using namespace backend; struct PlatformCocoaGLImpl { NSOpenGLContext* mGLContext = nullptr; @@ -80,7 +80,7 @@ void PlatformCocoaGL::terminate() noexcept { Platform::SwapChain* PlatformCocoaGL::createSwapChain(void* nativewindow, uint64_t& flags) noexcept { // Transparent swap chain is not supported - flags &= ~driver::SWAP_CHAIN_CONFIG_TRANSPARENT; + flags &= ~backend::SWAP_CHAIN_CONFIG_TRANSPARENT; return (SwapChain*) nativewindow; } diff --git a/filament/backend/src/opengl/PlatformCocoaTouchGL.h b/filament/backend/src/opengl/PlatformCocoaTouchGL.h index 1bfd1e8cc6..96e87d36d9 100644 --- a/filament/backend/src/opengl/PlatformCocoaTouchGL.h +++ b/filament/backend/src/opengl/PlatformCocoaTouchGL.h @@ -27,12 +27,12 @@ namespace filament { struct PlatformCocoaTouchGLImpl; -class PlatformCocoaTouchGL final : public driver::OpenGLPlatform { +class PlatformCocoaTouchGL final : public backend::OpenGLPlatform { public: PlatformCocoaTouchGL(); ~PlatformCocoaTouchGL() noexcept final; - driver::Driver* createDriver(void* sharedGLContext) noexcept override; + backend::Driver* createDriver(void* sharedGLContext) noexcept override; void terminate() noexcept final; SwapChain* createSwapChain(void* nativewindow, uint64_t& flags) noexcept final; @@ -43,8 +43,8 @@ public: uint32_t& depthbuffer) noexcept final; Fence* createFence() noexcept final { return nullptr; } void destroyFence(Fence* fence) noexcept final {} - driver::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept final { - return driver::FenceStatus::ERROR; + backend::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept final { + return backend::FenceStatus::ERROR; } void setPresentationTime(int64_t time) noexcept final override {} @@ -57,7 +57,7 @@ public: ExternalTexture* createExternalTextureStorage() noexcept final { return nullptr; } void reallocateExternalStorage(ExternalTexture* ets, - uint32_t w, uint32_t h, driver::TextureFormat format) noexcept final { } + uint32_t w, uint32_t h, backend::TextureFormat format) noexcept final { } void destroyExternalTextureStorage(ExternalTexture* ets) noexcept final { } int getOSVersion() const noexcept final { return 0; } diff --git a/filament/backend/src/opengl/PlatformCocoaTouchGL.mm b/filament/backend/src/opengl/PlatformCocoaTouchGL.mm index d2b24ab40a..68d536f7fa 100644 --- a/filament/backend/src/opengl/PlatformCocoaTouchGL.mm +++ b/filament/backend/src/opengl/PlatformCocoaTouchGL.mm @@ -32,7 +32,7 @@ namespace filament { -using namespace driver; +using namespace backend; struct PlatformCocoaTouchGLImpl { EAGLContext* mGLContext = nullptr; @@ -87,7 +87,7 @@ void PlatformCocoaTouchGL::terminate() noexcept { Platform::SwapChain* PlatformCocoaTouchGL::createSwapChain(void* nativewindow, uint64_t& flags) noexcept { // Transparent swap chain is not supported - flags &= ~driver::SWAP_CHAIN_CONFIG_TRANSPARENT; + flags &= ~backend::SWAP_CHAIN_CONFIG_TRANSPARENT; return (SwapChain*) nativewindow; } diff --git a/filament/backend/src/opengl/PlatformDummyGL.h b/filament/backend/src/opengl/PlatformDummyGL.h index b11a879b68..27f1b18124 100644 --- a/filament/backend/src/opengl/PlatformDummyGL.h +++ b/filament/backend/src/opengl/PlatformDummyGL.h @@ -25,10 +25,10 @@ namespace filament { -class PlatformDummyGL final : public driver::OpenGLPlatform { +class PlatformDummyGL final : public backend::OpenGLPlatform { public: - driver::Driver* createDriver(void* const sharedGLContext) noexcept override; + backend::Driver* createDriver(void* const sharedGLContext) noexcept override; void terminate() noexcept override { } SwapChain* createSwapChain(void* nativewindow, uint64_t& flags) noexcept final override { @@ -41,8 +41,8 @@ public: Fence* createFence() noexcept final override { return nullptr; } void destroyFence(Fence* fence) noexcept final override {} - driver::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept final override { - return driver::FenceStatus::ERROR; + backend::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept final override { + return backend::FenceStatus::ERROR; } Stream* createStream(void* nativeStream) noexcept final override { return nullptr; } @@ -53,7 +53,7 @@ public: ExternalTexture* createExternalTextureStorage() noexcept final override { return nullptr; } void reallocateExternalStorage(ExternalTexture* ets, - uint32_t w, uint32_t h, driver::TextureFormat format) noexcept final override { } + uint32_t w, uint32_t h, backend::TextureFormat format) noexcept final override { } void destroyExternalTextureStorage(ExternalTexture* ets) noexcept final override { } int getOSVersion() const noexcept final override { return 0; } diff --git a/filament/backend/src/opengl/PlatformEGL.cpp b/filament/backend/src/opengl/PlatformEGL.cpp index 2f141dccce..e4aa44ff5e 100644 --- a/filament/backend/src/opengl/PlatformEGL.cpp +++ b/filament/backend/src/opengl/PlatformEGL.cpp @@ -46,7 +46,7 @@ using namespace utils; namespace filament { -using namespace driver; +using namespace backend; // The Android NDK doesn't exposes extensions, fake it with eglGetProcAddress namespace glext { @@ -326,7 +326,7 @@ void PlatformEGL::terminate() noexcept { Platform::SwapChain* PlatformEGL::createSwapChain( void* nativeWindow, uint64_t& flags) noexcept { EGLSurface sur = eglCreateWindowSurface(mEGLDisplay, - (flags & driver::SWAP_CHAIN_CONFIG_TRANSPARENT) ? mEGLTransparentConfig : mEGLConfig, + (flags & backend::SWAP_CHAIN_CONFIG_TRANSPARENT) ? mEGLTransparentConfig : mEGLConfig, (EGLNativeWindowType)nativeWindow, nullptr); if (UTILS_UNLIKELY(sur == EGL_NO_SURFACE)) { logEglError("eglCreateWindowSurface"); @@ -396,7 +396,7 @@ void PlatformEGL::destroyFence(Platform::Fence* fence) noexcept { #endif } -driver::FenceStatus PlatformEGL::waitFence( +backend::FenceStatus PlatformEGL::waitFence( Platform::Fence* fence, uint64_t timeout) noexcept { #ifdef EGL_KHR_reusable_sync EGLSyncKHR sync = (EGLSyncKHR) fence; @@ -439,7 +439,7 @@ Platform::ExternalTexture* PlatformEGL::createExternalTextureStorage() noexcept void PlatformEGL::reallocateExternalStorage( Platform::ExternalTexture* externalTexture, - uint32_t w, uint32_t h, driver::TextureFormat format) noexcept { + uint32_t w, uint32_t h, backend::TextureFormat format) noexcept { if (externalTexture) { if ((EGLImageKHR)externalTexture->image != EGL_NO_IMAGE_KHR) { eglDestroyImageKHR(mEGLDisplay, (EGLImageKHR)externalTexture->image); diff --git a/filament/backend/src/opengl/PlatformEGL.h b/filament/backend/src/opengl/PlatformEGL.h index f577dcc8dc..d2f0818ed8 100644 --- a/filament/backend/src/opengl/PlatformEGL.h +++ b/filament/backend/src/opengl/PlatformEGL.h @@ -34,12 +34,12 @@ class VirtualMachineEnv; class ExternalStreamManagerAndroid; class ExternalTextureManagerAndroid; -class PlatformEGL final : public driver::OpenGLPlatform { +class PlatformEGL final : public backend::OpenGLPlatform { public: PlatformEGL() noexcept; - driver::Driver* createDriver(void* sharedContext) noexcept override; + backend::Driver* createDriver(void* sharedContext) noexcept override; void terminate() noexcept override; SwapChain* createSwapChain(void* nativewindow, uint64_t& flags) noexcept final; @@ -52,7 +52,7 @@ public: bool canCreateFence() noexcept final { return true; } Fence* createFence() noexcept final; void destroyFence(Fence* fence) noexcept final; - driver::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept final; + backend::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept final; Stream* createStream(void* nativeStream) noexcept final; void destroyStream(Stream* stream) noexcept final; @@ -62,7 +62,7 @@ public: ExternalTexture* createExternalTextureStorage() noexcept final; void reallocateExternalStorage(ExternalTexture* ets, - uint32_t w, uint32_t h, driver::TextureFormat format) noexcept final; + uint32_t w, uint32_t h, backend::TextureFormat format) noexcept final; void destroyExternalTextureStorage(ExternalTexture* ets) noexcept final; int getOSVersion() const noexcept final; diff --git a/filament/backend/src/opengl/PlatformGLX.cpp b/filament/backend/src/opengl/PlatformGLX.cpp index 45a044c3fd..1eace18f30 100644 --- a/filament/backend/src/opengl/PlatformGLX.cpp +++ b/filament/backend/src/opengl/PlatformGLX.cpp @@ -99,7 +99,7 @@ static bool loadLibraries() { namespace filament { -using namespace driver; +using namespace backend; Driver* PlatformGLX::createDriver(void* const sharedGLContext) noexcept { loadLibraries(); @@ -163,7 +163,7 @@ Platform::SwapChain* PlatformGLX::createSwapChain( void* nativeWindow, uint64_t& flags) noexcept { // Transparent swap chain is not supported - flags &= ~driver::SWAP_CHAIN_CONFIG_TRANSPARENT; + flags &= ~backend::SWAP_CHAIN_CONFIG_TRANSPARENT; return (SwapChain*) nativeWindow; } @@ -190,8 +190,8 @@ void PlatformGLX::destroyFence(Fence* fence) noexcept { delete fence; } -driver::FenceStatus PlatformGLX::waitFence(Fence* fence, uint64_t timeout) noexcept { - return driver::FenceStatus::CONDITION_SATISFIED; +backend::FenceStatus PlatformGLX::waitFence(Fence* fence, uint64_t timeout) noexcept { + return backend::FenceStatus::CONDITION_SATISFIED; } } // namespace filament diff --git a/filament/backend/src/opengl/PlatformGLX.h b/filament/backend/src/opengl/PlatformGLX.h index 70e1943f59..034ef255b8 100644 --- a/filament/backend/src/opengl/PlatformGLX.h +++ b/filament/backend/src/opengl/PlatformGLX.h @@ -28,10 +28,10 @@ namespace filament { -class PlatformGLX final : public driver::OpenGLPlatform { +class PlatformGLX final : public backend::OpenGLPlatform { public: - driver::Driver* createDriver(void* const sharedGLContext) noexcept override; + backend::Driver* createDriver(void* const sharedGLContext) noexcept override; void terminate() noexcept override; @@ -42,7 +42,7 @@ public: Fence* createFence() noexcept override; void destroyFence(Fence* fence) noexcept override; - driver::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept override; + backend::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept override; void setPresentationTime(int64_t time) noexcept final override {} @@ -54,7 +54,7 @@ public: ExternalTexture* createExternalTextureStorage() noexcept final override { return nullptr; } void reallocateExternalStorage(ExternalTexture* ets, - uint32_t w, uint32_t h, driver::TextureFormat format) noexcept final override { } + uint32_t w, uint32_t h, backend::TextureFormat format) noexcept final override { } void destroyExternalTextureStorage(ExternalTexture* ets) noexcept final override { } int getOSVersion() const noexcept final override { return 0; } diff --git a/filament/backend/src/opengl/PlatformWGL.cpp b/filament/backend/src/opengl/PlatformWGL.cpp index 480075fd1f..0891c6d88c 100644 --- a/filament/backend/src/opengl/PlatformWGL.cpp +++ b/filament/backend/src/opengl/PlatformWGL.cpp @@ -59,7 +59,7 @@ void reportLastWindowsError() { namespace filament { -using namespace driver; +using namespace backend; Driver* PlatformWGL::createDriver(void* const sharedGLContext) noexcept { mPfd = { @@ -210,8 +210,8 @@ Platform::Fence* PlatformWGL::createFence() noexcept { void PlatformWGL::destroyFence(Fence* fence) noexcept { } -driver::FenceStatus PlatformWGL::waitFence(Fence* fence, uint64_t timeout) noexcept { - return driver::FenceStatus::ERROR; +backend::FenceStatus PlatformWGL::waitFence(Fence* fence, uint64_t timeout) noexcept { + return backend::FenceStatus::ERROR; } } // namespace filament diff --git a/filament/backend/src/opengl/PlatformWGL.h b/filament/backend/src/opengl/PlatformWGL.h index b6c528cafe..568e54396a 100644 --- a/filament/backend/src/opengl/PlatformWGL.h +++ b/filament/backend/src/opengl/PlatformWGL.h @@ -28,9 +28,9 @@ namespace filament { -class PlatformWGL final : public driver::OpenGLPlatform { +class PlatformWGL final : public backend::OpenGLPlatform { public: - driver::Driver* createDriver(void* const sharedGLContext) noexcept override; + backend::Driver* createDriver(void* const sharedGLContext) noexcept override; void terminate() noexcept override; SwapChain* createSwapChain(void* nativewindow, uint64_t& flags) noexcept override; @@ -40,7 +40,7 @@ public: Fence* createFence() noexcept override; void destroyFence(Fence* fence) noexcept override; - driver::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept override; + backend::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept override; void setPresentationTime(int64_t time) noexcept final override {} @@ -52,7 +52,7 @@ public: ExternalTexture* createExternalTextureStorage() noexcept final override { return nullptr; } void reallocateExternalStorage(ExternalTexture* ets, - uint32_t w, uint32_t h, driver::TextureFormat format) noexcept final override { } + uint32_t w, uint32_t h, backend::TextureFormat format) noexcept final override { } void destroyExternalTextureStorage(ExternalTexture* ets) noexcept final override { } int getOSVersion() const noexcept final override { return 0; } diff --git a/filament/backend/src/opengl/PlatformWebGL.cpp b/filament/backend/src/opengl/PlatformWebGL.cpp index 2a3ebd27bf..6a178fc423 100644 --- a/filament/backend/src/opengl/PlatformWebGL.cpp +++ b/filament/backend/src/opengl/PlatformWebGL.cpp @@ -19,7 +19,7 @@ namespace filament { -using namespace driver; +using namespace backend; Driver* PlatformWebGL::createDriver(void* const sharedGLContext) noexcept { return OpenGLDriver::create(this, sharedGLContext); @@ -52,8 +52,8 @@ void PlatformWebGL::destroyFence(Fence* fence) noexcept { delete fence; } -driver::FenceStatus PlatformWebGL::waitFence(Fence* fence, uint64_t timeout) noexcept { - return driver::FenceStatus::CONDITION_SATISFIED; +backend::FenceStatus PlatformWebGL::waitFence(Fence* fence, uint64_t timeout) noexcept { + return backend::FenceStatus::CONDITION_SATISFIED; } } // namespace filament diff --git a/filament/backend/src/opengl/PlatformWebGL.h b/filament/backend/src/opengl/PlatformWebGL.h index ab174e8a75..acc12cef94 100644 --- a/filament/backend/src/opengl/PlatformWebGL.h +++ b/filament/backend/src/opengl/PlatformWebGL.h @@ -28,10 +28,10 @@ namespace filament { -class PlatformWebGL final : public driver::OpenGLPlatform { +class PlatformWebGL final : public backend::OpenGLPlatform { public: - driver::Driver* createDriver(void* const sharedGLContext) noexcept override; + backend::Driver* createDriver(void* const sharedGLContext) noexcept override; void terminate() noexcept override; SwapChain* createSwapChain(void* nativewindow, uint64_t& flags) noexcept final override; @@ -41,7 +41,7 @@ public: Fence* createFence() noexcept final override; void destroyFence(Fence* fence) noexcept final override; - driver::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept final override; + backend::FenceStatus waitFence(Fence* fence, uint64_t timeout) noexcept final override; void setPresentationTime(int64_t time) noexcept final override {} @@ -53,7 +53,7 @@ public: ExternalTexture* createExternalTextureStorage() noexcept final override { return nullptr; } void reallocateExternalStorage(ExternalTexture* ets, - uint32_t w, uint32_t h, driver::TextureFormat format) noexcept final override { } + uint32_t w, uint32_t h, backend::TextureFormat format) noexcept final override { } void destroyExternalTextureStorage(ExternalTexture* ets) noexcept final override { } int getOSVersion() const noexcept final override { return 0; } diff --git a/filament/backend/src/vulkan/PlatformVkAndroid.cpp b/filament/backend/src/vulkan/PlatformVkAndroid.cpp index 130a5330fa..889d4d8e2c 100644 --- a/filament/backend/src/vulkan/PlatformVkAndroid.cpp +++ b/filament/backend/src/vulkan/PlatformVkAndroid.cpp @@ -26,7 +26,7 @@ namespace filament { -using namespace driver; +using namespace backend; Driver* PlatformVkAndroid::createDriver(void* const sharedContext) noexcept { ASSERT_PRECONDITION(sharedContext == nullptr, "Vulkan does not support shared contexts."); diff --git a/filament/backend/src/vulkan/PlatformVkAndroid.h b/filament/backend/src/vulkan/PlatformVkAndroid.h index f027ab3311..d5a581ede5 100644 --- a/filament/backend/src/vulkan/PlatformVkAndroid.h +++ b/filament/backend/src/vulkan/PlatformVkAndroid.h @@ -24,10 +24,10 @@ namespace filament { -class PlatformVkAndroid final : public driver::VulkanPlatform { +class PlatformVkAndroid final : public backend::VulkanPlatform { public: - driver::Driver* createDriver(void* const sharedContext) noexcept override; + backend::Driver* createDriver(void* const sharedContext) noexcept override; void* createVkSurfaceKHR(void* nativeWindow, void* instance, uint32_t* width, uint32_t* height) noexcept override; diff --git a/filament/backend/src/vulkan/PlatformVkCocoa.h b/filament/backend/src/vulkan/PlatformVkCocoa.h index e6114bef9d..7264872274 100644 --- a/filament/backend/src/vulkan/PlatformVkCocoa.h +++ b/filament/backend/src/vulkan/PlatformVkCocoa.h @@ -24,9 +24,9 @@ namespace filament { -class PlatformVkCocoa final : public driver::VulkanPlatform { +class PlatformVkCocoa final : public backend::VulkanPlatform { public: - driver::Driver* createDriver(void* sharedContext) noexcept override; + backend::Driver* createDriver(void* sharedContext) noexcept override; void* createVkSurfaceKHR(void* nativeWindow, void* instance, uint32_t* width, uint32_t* height) noexcept override; int getOSVersion() const noexcept override { return 0; } diff --git a/filament/backend/src/vulkan/PlatformVkCocoa.mm b/filament/backend/src/vulkan/PlatformVkCocoa.mm index 4f15e61334..f6e78d89a1 100644 --- a/filament/backend/src/vulkan/PlatformVkCocoa.mm +++ b/filament/backend/src/vulkan/PlatformVkCocoa.mm @@ -31,7 +31,7 @@ namespace filament { -using namespace driver; +using namespace backend; Driver* PlatformVkCocoa::createDriver(void* sharedContext) noexcept { ASSERT_PRECONDITION(sharedContext == nullptr, "Vulkan does not support shared contexts."); diff --git a/filament/backend/src/vulkan/PlatformVkCocoaTouch.h b/filament/backend/src/vulkan/PlatformVkCocoaTouch.h index 6c6a31fc25..dc0fa63778 100644 --- a/filament/backend/src/vulkan/PlatformVkCocoaTouch.h +++ b/filament/backend/src/vulkan/PlatformVkCocoaTouch.h @@ -24,9 +24,9 @@ namespace filament { -class PlatformVkCocoaTouch final : public driver::VulkanPlatform { +class PlatformVkCocoaTouch final : public backend::VulkanPlatform { public: - driver::Driver* createDriver(void* const sharedContext) noexcept override; + backend::Driver* createDriver(void* const sharedContext) noexcept override; void* createVkSurfaceKHR(void* nativeWindow, void* instance, uint32_t* width, uint32_t* height) noexcept override; int getOSVersion() const noexcept override { return 0; } diff --git a/filament/backend/src/vulkan/PlatformVkCocoaTouch.mm b/filament/backend/src/vulkan/PlatformVkCocoaTouch.mm index eb3e2a2198..f2af56cf07 100644 --- a/filament/backend/src/vulkan/PlatformVkCocoaTouch.mm +++ b/filament/backend/src/vulkan/PlatformVkCocoaTouch.mm @@ -37,7 +37,7 @@ namespace filament { -using namespace driver; +using namespace backend; Driver* PlatformVkCocoaTouch::createDriver(void* const sharedContext) noexcept { ASSERT_PRECONDITION(sharedContext == nullptr, "Vulkan does not support shared contexts."); diff --git a/filament/backend/src/vulkan/PlatformVkLinux.cpp b/filament/backend/src/vulkan/PlatformVkLinux.cpp index 90fb364846..bb069b35ae 100644 --- a/filament/backend/src/vulkan/PlatformVkLinux.cpp +++ b/filament/backend/src/vulkan/PlatformVkLinux.cpp @@ -26,7 +26,7 @@ namespace filament { -using namespace driver; +using namespace backend; static const char* LIBRARY_X11 = "libX11.so.6"; diff --git a/filament/backend/src/vulkan/PlatformVkLinux.h b/filament/backend/src/vulkan/PlatformVkLinux.h index 562af05bc7..a6a5b588ee 100644 --- a/filament/backend/src/vulkan/PlatformVkLinux.h +++ b/filament/backend/src/vulkan/PlatformVkLinux.h @@ -26,10 +26,10 @@ namespace filament { -class PlatformVkLinux final : public driver::VulkanPlatform { +class PlatformVkLinux final : public backend::VulkanPlatform { public: - driver::Driver* createDriver(void* const sharedContext) noexcept override; + backend::Driver* createDriver(void* const sharedContext) noexcept override; void* createVkSurfaceKHR(void* nativeWindow, void* instance, uint32_t* width, uint32_t* height) noexcept override; diff --git a/filament/backend/src/vulkan/PlatformVkWindows.cpp b/filament/backend/src/vulkan/PlatformVkWindows.cpp index 7c5ea259fb..31fa1a5201 100644 --- a/filament/backend/src/vulkan/PlatformVkWindows.cpp +++ b/filament/backend/src/vulkan/PlatformVkWindows.cpp @@ -24,7 +24,7 @@ namespace filament { -using namespace driver; +using namespace backend; Driver* PlatformVkWindows::createDriver(void* const sharedContext) noexcept { ASSERT_PRECONDITION(sharedContext == nullptr, "Vulkan does not support shared contexts."); diff --git a/filament/backend/src/vulkan/PlatformVkWindows.h b/filament/backend/src/vulkan/PlatformVkWindows.h index 3dcf7140e7..9377635d84 100644 --- a/filament/backend/src/vulkan/PlatformVkWindows.h +++ b/filament/backend/src/vulkan/PlatformVkWindows.h @@ -24,10 +24,10 @@ namespace filament { -class PlatformVkWindows final : public driver::VulkanPlatform { +class PlatformVkWindows final : public backend::VulkanPlatform { public: - driver::Driver* createDriver(void* const sharedContext) noexcept override; + backend::Driver* createDriver(void* const sharedContext) noexcept override; void* createVkSurfaceKHR(void* nativeWindow, void* instance, uint32_t* width, uint32_t* height) noexcept override; diff --git a/filament/backend/src/vulkan/VulkanBinder.cpp b/filament/backend/src/vulkan/VulkanBinder.cpp index 43ebf10e8f..5bec49ad37 100644 --- a/filament/backend/src/vulkan/VulkanBinder.cpp +++ b/filament/backend/src/vulkan/VulkanBinder.cpp @@ -27,7 +27,7 @@ #pragma clang diagnostic ignored "-Wreturn-stack-address" namespace filament { -namespace driver { +namespace backend { // All vkCreate* and vkDestroy functions take an optional allocator. For now we select the default // allocator by passing in a null pointer, and we pinpoint the argument by using the VKALLOC macro. @@ -660,6 +660,6 @@ static VulkanBinder::RasterState createDefaultRasterState() { } } // namespace filament -} // namespace driver +} // namespace backend #pragma clang diagnostic pop diff --git a/filament/backend/src/vulkan/VulkanBinder.h b/filament/backend/src/vulkan/VulkanBinder.h index ef6ebd4dfe..153125be23 100644 --- a/filament/backend/src/vulkan/VulkanBinder.h +++ b/filament/backend/src/vulkan/VulkanBinder.h @@ -28,7 +28,7 @@ #include namespace filament { -namespace driver { +namespace backend { // VulkanBinder manages a cache of descriptor sets and pipelines. // @@ -72,9 +72,9 @@ namespace driver { class VulkanBinder { public: static constexpr uint32_t UBUFFER_BINDING_COUNT = Program::UNIFORM_BINDING_COUNT; - static constexpr uint32_t SAMPLER_BINDING_COUNT = driver::MAX_SAMPLER_COUNT; + static constexpr uint32_t SAMPLER_BINDING_COUNT = backend::MAX_SAMPLER_COUNT; static constexpr uint32_t SHADER_MODULE_COUNT = 2; - static constexpr uint32_t VERTEX_ATTRIBUTE_COUNT = driver::MAX_VERTEX_ATTRIBUTE_COUNT; + static constexpr uint32_t VERTEX_ATTRIBUTE_COUNT = backend::MAX_VERTEX_ATTRIBUTE_COUNT; // The VertexArray POD is an array of buffer targets and an array of attributes that refer to // those targets. It does not include any references to actual buffers, so you can think of it @@ -282,6 +282,6 @@ private: }; } // namespace filament -} // namespace driver +} // namespace backend #endif // TNT_FILAMENT_DRIVER_VULKANBINDER_H diff --git a/filament/backend/src/vulkan/VulkanBuffer.cpp b/filament/backend/src/vulkan/VulkanBuffer.cpp index b3c54f4630..74aad5f593 100644 --- a/filament/backend/src/vulkan/VulkanBuffer.cpp +++ b/filament/backend/src/vulkan/VulkanBuffer.cpp @@ -19,7 +19,7 @@ #include namespace filament { -namespace driver { +namespace backend { VulkanBuffer::VulkanBuffer(VulkanContext& context, VulkanStagePool& stagePool, VkBufferUsageFlags usage, uint32_t numBytes) : mContext(context), mStagePool(stagePool) { @@ -79,4 +79,4 @@ void VulkanBuffer::loadFromCpu(const void* cpuData, uint32_t byteOffset, uint32_ } } // namespace filament -} // namespace driver +} // namespace backend diff --git a/filament/backend/src/vulkan/VulkanBuffer.h b/filament/backend/src/vulkan/VulkanBuffer.h index 844be8216c..e76521a891 100644 --- a/filament/backend/src/vulkan/VulkanBuffer.h +++ b/filament/backend/src/vulkan/VulkanBuffer.h @@ -21,7 +21,7 @@ #include "VulkanStagePool.h" namespace filament { -namespace driver { +namespace backend { // Encapsulates a Vulkan buffer, its attached DeviceMemory and a staging area. class VulkanBuffer { @@ -39,6 +39,6 @@ private: }; } // namespace filament -} // namespace driver +} // namespace backend #endif // TNT_FILAMENT_DRIVER_VULKANBUFFER_H diff --git a/filament/backend/src/vulkan/VulkanContext.cpp b/filament/backend/src/vulkan/VulkanContext.cpp index fbc4e8d79e..eecc8c1498 100644 --- a/filament/backend/src/vulkan/VulkanContext.cpp +++ b/filament/backend/src/vulkan/VulkanContext.cpp @@ -33,7 +33,7 @@ #include namespace filament { -namespace driver { +namespace backend { VulkanCmdFence::VulkanCmdFence(VkDevice device, bool signaled) : device(device) { VkFenceCreateInfo fenceCreateInfo { .sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO }; @@ -550,4 +550,4 @@ void flushWorkCommandBuffer(VulkanContext& context) { } } // namespace filament -} // namespace driver +} // namespace backend diff --git a/filament/backend/src/vulkan/VulkanContext.h b/filament/backend/src/vulkan/VulkanContext.h index 8b258cb2fb..8c2142a437 100644 --- a/filament/backend/src/vulkan/VulkanContext.h +++ b/filament/backend/src/vulkan/VulkanContext.h @@ -32,7 +32,7 @@ #include namespace filament { -namespace driver { +namespace backend { // All vkCreate* functions take an optional allocator. For now we select the default allocator by // passing in a null pointer, and we highlight the argument by using the VKALLOC constant. @@ -132,6 +132,6 @@ VkCommandBuffer acquireWorkCommandBuffer(VulkanContext& context); void flushWorkCommandBuffer(VulkanContext& context); } // namespace filament -} // namespace driver +} // namespace backend #endif // TNT_FILAMENT_DRIVER_VULKANCONTEXT_H diff --git a/filament/backend/src/vulkan/VulkanDisposer.cpp b/filament/backend/src/vulkan/VulkanDisposer.cpp index 67fc4d8258..98e2cfca43 100644 --- a/filament/backend/src/vulkan/VulkanDisposer.cpp +++ b/filament/backend/src/vulkan/VulkanDisposer.cpp @@ -17,7 +17,7 @@ #include "vulkan/VulkanDisposer.h" namespace filament { -namespace driver { +namespace backend { void VulkanDisposer::createDisposable(Key resource, std::function destructor) noexcept { mDisposables[resource].destructor = destructor; @@ -63,4 +63,4 @@ void VulkanDisposer::reset() noexcept { } } // namespace filament -} // namespace driver +} // namespace backend diff --git a/filament/backend/src/vulkan/VulkanDisposer.h b/filament/backend/src/vulkan/VulkanDisposer.h index ffe928dbe8..8f73777e10 100644 --- a/filament/backend/src/vulkan/VulkanDisposer.h +++ b/filament/backend/src/vulkan/VulkanDisposer.h @@ -25,7 +25,7 @@ #include namespace filament { -namespace driver { +namespace backend { // VulkanDisposer tracks resources (such as textures or vertex buffers) that need deferred // destruction due to potential use by one or more reference holders. An example of a reference @@ -69,6 +69,6 @@ private: }; } // namespace filament -} // namespace driver +} // namespace backend #endif // TNT_FILAMENT_DRIVER_VULKANDISPOSER_H diff --git a/filament/backend/src/vulkan/VulkanDriver.cpp b/filament/backend/src/vulkan/VulkanDriver.cpp index 994de2d8d6..9be07558ae 100644 --- a/filament/backend/src/vulkan/VulkanDriver.cpp +++ b/filament/backend/src/vulkan/VulkanDriver.cpp @@ -35,7 +35,7 @@ #pragma clang diagnostic ignored "-Wunused-parameter" namespace filament { -namespace driver { +namespace backend { VulkanDriver::VulkanDriver(VulkanPlatform* platform, const char* const* ppEnabledExtensions, uint32_t enabledExtensionCount) noexcept : @@ -899,8 +899,8 @@ void VulkanDriver::readStreamPixels(Handle sh, uint32_t x, uint32_t y, } void VulkanDriver::blit(TargetBufferFlags buffers, - Handle dst, driver::Viewport dstRect, - Handle src, driver::Viewport srcRect, + Handle dst, backend::Viewport dstRect, + Handle src, backend::Viewport srcRect, SamplerMagFilter filter) { auto dstTarget = handle_cast(mHandleMap, dst); auto srcTarget = handle_cast(mHandleMap, src); @@ -1125,7 +1125,7 @@ void VulkanDriver::debugCommand(const char* methodName) { // explicit instantiation of the Dispatcher template class ConcreteDispatcher; -} // namespace driver +} // namespace backend } // namespace filament #pragma clang diagnostic pop diff --git a/filament/backend/src/vulkan/VulkanDriver.h b/filament/backend/src/vulkan/VulkanDriver.h index 6c124f7d3e..ad74ecfb29 100644 --- a/filament/backend/src/vulkan/VulkanDriver.h +++ b/filament/backend/src/vulkan/VulkanDriver.h @@ -35,7 +35,7 @@ #include namespace filament { -namespace driver { +namespace backend { class VulkanPlatform; struct VulkanRenderTarget; @@ -43,7 +43,7 @@ struct VulkanSamplerGroup; class VulkanDriver final : public DriverBase { public: - static Driver* create(driver::VulkanPlatform* platform, + static Driver* create(backend::VulkanPlatform* platform, const char* const* ppEnabledExtensions, uint32_t enabledExtensionCount) noexcept; private: @@ -52,7 +52,7 @@ private: void debugCommand(const char* methodName) override; #endif - inline VulkanDriver(driver::VulkanPlatform* platform, + inline VulkanDriver(backend::VulkanPlatform* platform, const char* const* ppEnabledExtensions, uint32_t enabledExtensionCount) noexcept; ~VulkanDriver() noexcept override; @@ -60,7 +60,7 @@ private: ShaderModel getShaderModel() const noexcept final; template - friend class driver::ConcreteDispatcher; + friend class backend::ConcreteDispatcher; #define DECL_DRIVER_API(methodName, paramsDecl, params) \ UTILS_ALWAYS_INLINE void methodName(paramsDecl); @@ -78,7 +78,7 @@ private: VulkanDriver& operator = (VulkanDriver const&) = delete; private: - driver::VulkanPlatform& mContextManager; + backend::VulkanPlatform& mContextManager; // For now we're not bothering to store handles in pools, just simple on-demand allocation. // We have a little map from integer handles to "blobs" which get replaced with the Hw objects. @@ -152,7 +152,7 @@ private: VkDebugReportCallbackEXT mDebugCallback = VK_NULL_HANDLE; }; -} // namespace driver +} // namespace backend } // namespace filament #endif // TNT_FILAMENT_DRIVER_VULKANDRIVER_H diff --git a/filament/backend/src/vulkan/VulkanFboCache.cpp b/filament/backend/src/vulkan/VulkanFboCache.cpp index e10a51692f..4bc1aee6c5 100644 --- a/filament/backend/src/vulkan/VulkanFboCache.cpp +++ b/filament/backend/src/vulkan/VulkanFboCache.cpp @@ -19,7 +19,7 @@ #include namespace filament { -namespace driver { +namespace backend { bool VulkanFboCache::RenderPassEq::operator()(const RenderPassKey& k1, const RenderPassKey& k2) const { @@ -206,4 +206,4 @@ void VulkanFboCache::gc() noexcept { } } // namespace filament -} // namespace driver +} // namespace backend diff --git a/filament/backend/src/vulkan/VulkanFboCache.h b/filament/backend/src/vulkan/VulkanFboCache.h index 94cb090338..e946978323 100644 --- a/filament/backend/src/vulkan/VulkanFboCache.h +++ b/filament/backend/src/vulkan/VulkanFboCache.h @@ -24,7 +24,7 @@ #include namespace filament { -namespace driver { +namespace backend { // Simple manager for VkFramebuffer and VkRenderPass objects. // @@ -36,7 +36,7 @@ class VulkanFboCache { public: // RenderPassKey is a small POD representing the immutable state that is used to construct // a VkRenderPass. It is hashed and used as a lookup key. Portions of this are extracted - // from driver::RenderPassParams. + // from backend::RenderPassParams. struct alignas(8) RenderPassKey { VkImageLayout finalLayout; // 4 bytes VkFormat colorFormat; // 4 bytes @@ -108,6 +108,6 @@ private: }; } // namespace filament -} // namespace driver +} // namespace backend #endif // TNT_FILAMENT_DRIVER_VULKANFBOCACHE_H diff --git a/filament/backend/src/vulkan/VulkanHandles.cpp b/filament/backend/src/vulkan/VulkanHandles.cpp index 21cc59fb19..4ef0e2516c 100644 --- a/filament/backend/src/vulkan/VulkanHandles.cpp +++ b/filament/backend/src/vulkan/VulkanHandles.cpp @@ -23,7 +23,7 @@ #define FILAMENT_VULKAN_VERBOSE 0 namespace filament { -namespace driver { +namespace backend { static void flipVertically(VkRect2D* rect, uint32_t framebufferHeight) { rect->offset.y = framebufferHeight - rect->offset.y - rect->extent.height; @@ -312,7 +312,7 @@ VulkanVertexBuffer::VulkanVertexBuffer(VulkanContext& context, VulkanStagePool& } VulkanUniformBuffer::VulkanUniformBuffer(VulkanContext& context, VulkanStagePool& stagePool, - uint32_t numBytes, driver::BufferUsage usage) + uint32_t numBytes, backend::BufferUsage usage) : mContext(context), mStagePool(stagePool) { // Create the VkBuffer. VkBufferCreateInfo bufferInfo { @@ -625,17 +625,17 @@ void VulkanTexture::copyBufferToImage(VkCommandBuffer cmd, VkBuffer buffer, VkIm vkCmdCopyBufferToImage(cmd, buffer, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion); } -void VulkanRenderPrimitive::setPrimitiveType(driver::PrimitiveType pt) { +void VulkanRenderPrimitive::setPrimitiveType(backend::PrimitiveType pt) { this->type = pt; switch (pt) { - case driver::PrimitiveType::NONE: - case driver::PrimitiveType::POINTS: + case backend::PrimitiveType::NONE: + case backend::PrimitiveType::POINTS: primitiveTopology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST; break; - case driver::PrimitiveType::LINES: + case backend::PrimitiveType::LINES: primitiveTopology = VK_PRIMITIVE_TOPOLOGY_LINE_LIST; break; - case driver::PrimitiveType::TRIANGLES: + case backend::PrimitiveType::TRIANGLES: primitiveTopology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; break; } @@ -685,4 +685,4 @@ void VulkanRenderPrimitive::setBuffers(VulkanVertexBuffer* vertexBuffer, } } // namespace filament -} // namespace driver +} // namespace backend diff --git a/filament/backend/src/vulkan/VulkanHandles.h b/filament/backend/src/vulkan/VulkanHandles.h index 1dea9e50ff..64bf74f6b7 100644 --- a/filament/backend/src/vulkan/VulkanHandles.h +++ b/filament/backend/src/vulkan/VulkanHandles.h @@ -22,7 +22,7 @@ #include "VulkanBuffer.h" namespace filament { -namespace driver { +namespace backend { struct VulkanProgram : public HwProgram { VulkanProgram(VulkanContext& context, const Program& builder) noexcept; @@ -99,7 +99,7 @@ struct VulkanIndexBuffer : public HwIndexBuffer { struct VulkanUniformBuffer : public HwUniformBuffer { VulkanUniformBuffer(VulkanContext& context, VulkanStagePool& stagePool, uint32_t numBytes, - driver::BufferUsage usage); + backend::BufferUsage usage); ~VulkanUniformBuffer(); void loadFromCpu(const void* cpuData, uint32_t numBytes); VkBuffer getGpuBuffer() const { return mGpuBuffer; } @@ -146,7 +146,7 @@ private: struct VulkanRenderPrimitive : public HwRenderPrimitive { explicit VulkanRenderPrimitive(VulkanContext& context) {} - void setPrimitiveType(driver::PrimitiveType pt); + void setPrimitiveType(backend::PrimitiveType pt); void setBuffers(VulkanVertexBuffer* vertexBuffer, VulkanIndexBuffer* indexBuffer, uint32_t enabledAttributes); VulkanVertexBuffer* vertexBuffer = nullptr; @@ -166,6 +166,6 @@ struct VulkanFence : public HwFence { }; } // namespace filament -} // namespace driver +} // namespace backend #endif // TNT_FILAMENT_DRIVER_VULKANHANDLES_H diff --git a/filament/backend/src/vulkan/VulkanPlatform.cpp b/filament/backend/src/vulkan/VulkanPlatform.cpp index a111956c52..f476737e07 100644 --- a/filament/backend/src/vulkan/VulkanPlatform.cpp +++ b/filament/backend/src/vulkan/VulkanPlatform.cpp @@ -17,9 +17,9 @@ #include "VulkanPlatform.h" namespace filament { -namespace driver { +namespace backend { VulkanPlatform::~VulkanPlatform() = default; -} // namespace driver +} // namespace backend } // namespace filament diff --git a/filament/backend/src/vulkan/VulkanPlatform.h b/filament/backend/src/vulkan/VulkanPlatform.h index 4cd1525a6d..25ebe30748 100644 --- a/filament/backend/src/vulkan/VulkanPlatform.h +++ b/filament/backend/src/vulkan/VulkanPlatform.h @@ -21,11 +21,11 @@ namespace filament { -namespace driver { +namespace backend { class Driver; -} // namespace driver +} // namespace backend -namespace driver { +namespace backend { class VulkanPlatform : public DefaultPlatform { public: @@ -36,7 +36,7 @@ public: ~VulkanPlatform() override; }; -} // namespace driver +} // namespace backend } // namespace filament #endif //TNT_FILAMENT_DRIVER_VULKANPLATFORM_H diff --git a/filament/backend/src/vulkan/VulkanSamplerCache.cpp b/filament/backend/src/vulkan/VulkanSamplerCache.cpp index 753d8addca..7452196c39 100644 --- a/filament/backend/src/vulkan/VulkanSamplerCache.cpp +++ b/filament/backend/src/vulkan/VulkanSamplerCache.cpp @@ -19,7 +19,7 @@ #include namespace filament { -namespace driver { +namespace backend { constexpr inline VkSamplerAddressMode getWrapMode(SamplerWrapMode mode) noexcept { switch (mode) { @@ -97,7 +97,7 @@ constexpr inline VkBool32 getCompareEnable(SamplerCompareMode mode) noexcept { VulkanSamplerCache::VulkanSamplerCache(VulkanContext& context) : mContext(context) {} -VkSampler VulkanSamplerCache::getSampler(driver::SamplerParams params) noexcept { +VkSampler VulkanSamplerCache::getSampler(backend::SamplerParams params) noexcept { auto iter = mCache.find(params.u); if (UTILS_LIKELY(iter != mCache.end())) { return iter->second; @@ -134,4 +134,4 @@ void VulkanSamplerCache::reset() noexcept { } } // namespace filament -} // namespace driver +} // namespace backend diff --git a/filament/backend/src/vulkan/VulkanSamplerCache.h b/filament/backend/src/vulkan/VulkanSamplerCache.h index 4301f3479e..0fd6c6dd5c 100644 --- a/filament/backend/src/vulkan/VulkanSamplerCache.h +++ b/filament/backend/src/vulkan/VulkanSamplerCache.h @@ -23,13 +23,13 @@ #include namespace filament { -namespace driver { +namespace backend { // Simple manager for VkSampler objects. class VulkanSamplerCache { public: explicit VulkanSamplerCache(VulkanContext&); - VkSampler getSampler(driver::SamplerParams params) noexcept; + VkSampler getSampler(backend::SamplerParams params) noexcept; void reset() noexcept; private: VulkanContext& mContext; @@ -37,6 +37,6 @@ private: }; } // namespace filament -} // namespace driver +} // namespace backend #endif // TNT_FILAMENT_DRIVER_VULKANSAMPLERCACHE_H diff --git a/filament/backend/src/vulkan/VulkanStagePool.cpp b/filament/backend/src/vulkan/VulkanStagePool.cpp index ccce093b19..a3cf48bf12 100644 --- a/filament/backend/src/vulkan/VulkanStagePool.cpp +++ b/filament/backend/src/vulkan/VulkanStagePool.cpp @@ -19,7 +19,7 @@ #include namespace filament { -namespace driver { +namespace backend { VulkanStage const* VulkanStagePool::acquireStage(uint32_t numBytes) { // First check if a stage exists whose capacity is greater than or equal to the requested size. @@ -98,4 +98,4 @@ void VulkanStagePool::reset() noexcept { } } // namespace filament -} // namespace driver +} // namespace backend diff --git a/filament/backend/src/vulkan/VulkanStagePool.h b/filament/backend/src/vulkan/VulkanStagePool.h index 10050896fc..1310973a87 100644 --- a/filament/backend/src/vulkan/VulkanStagePool.h +++ b/filament/backend/src/vulkan/VulkanStagePool.h @@ -25,7 +25,7 @@ #include namespace filament { -namespace driver { +namespace backend { // Immutable POD representing a shared CPU-GPU staging area. struct VulkanStage { @@ -72,6 +72,6 @@ private: }; } // namespace filament -} // namespace driver +} // namespace backend #endif // TNT_FILAMENT_DRIVER_VULKANSTAGEPOOL_H diff --git a/filament/backend/src/vulkan/VulkanUtility.cpp b/filament/backend/src/vulkan/VulkanUtility.cpp index 4343b58b54..e0cfc01a3e 100644 --- a/filament/backend/src/vulkan/VulkanUtility.cpp +++ b/filament/backend/src/vulkan/VulkanUtility.cpp @@ -21,7 +21,7 @@ #include
// for FTexture::getFormatSize namespace filament { -namespace driver { +namespace backend { void createSemaphore(VkDevice device, VkSemaphore *semaphore) { VkSemaphoreCreateInfo createInfo = {}; @@ -232,7 +232,7 @@ uint32_t getBytesPerPixel(TextureFormat format) { } VkCompareOp getCompareOp(SamplerCompareFunc func) { - using Compare = driver::SamplerCompareFunc; + using Compare = backend::SamplerCompareFunc; switch (func) { case Compare::LE: return VK_COMPARE_OP_LESS_OR_EQUAL; case Compare::GE: return VK_COMPARE_OP_GREATER_OR_EQUAL; @@ -246,7 +246,7 @@ VkCompareOp getCompareOp(SamplerCompareFunc func) { } VkBlendFactor getBlendFactor(BlendFunction mode) { - using BlendFunction = filament::driver::BlendFunction; + using BlendFunction = filament::backend::BlendFunction; switch (mode) { case BlendFunction::ZERO: return VK_BLEND_FACTOR_ZERO; case BlendFunction::ONE: return VK_BLEND_FACTOR_ONE; @@ -263,7 +263,7 @@ VkBlendFactor getBlendFactor(BlendFunction mode) { } VkCullModeFlags getCullMode(CullingMode mode) { - using CullingMode = filament::driver::CullingMode; + using CullingMode = filament::backend::CullingMode; switch (mode) { case CullingMode::NONE: return VK_CULL_MODE_NONE; case CullingMode::FRONT: return VK_CULL_MODE_FRONT_BIT; @@ -278,4 +278,4 @@ VkFrontFace getFrontFace(bool inverseFrontFaces) { } } // namespace filament -} // namespace driver +} // namespace backend diff --git a/filament/backend/src/vulkan/VulkanUtility.h b/filament/backend/src/vulkan/VulkanUtility.h index 15cf81de24..1cff95b5da 100644 --- a/filament/backend/src/vulkan/VulkanUtility.h +++ b/filament/backend/src/vulkan/VulkanUtility.h @@ -22,7 +22,7 @@ #include namespace filament { -namespace driver { +namespace backend { void createSemaphore(VkDevice device, VkSemaphore* semaphore); VkFormat getVkFormat(ElementType type, bool normalized); @@ -34,6 +34,6 @@ VkCullModeFlags getCullMode(CullingMode mode); VkFrontFace getFrontFace(bool inverseFrontFaces); } // namespace filament -} // namespace driver +} // namespace backend #endif // TNT_FILAMENT_DRIVER_VULKANUTILITY_H diff --git a/filament/include/filament/Engine.h b/filament/include/filament/Engine.h index 6d4844c0fd..4d98b9c00f 100644 --- a/filament/include/filament/Engine.h +++ b/filament/include/filament/Engine.h @@ -142,8 +142,8 @@ class TransformManager; */ class UTILS_PUBLIC Engine { public: - using Platform = driver::Platform; - using Backend = driver::Backend; + using Platform = backend::Platform; + using Backend = backend::Backend; /** * Creates an instance of Engine diff --git a/filament/include/filament/Fence.h b/filament/include/filament/Fence.h index dd12258c7d..c021cbad6a 100644 --- a/filament/include/filament/Fence.h +++ b/filament/include/filament/Fence.h @@ -37,10 +37,10 @@ namespace filament { class UTILS_PUBLIC Fence : public FilamentAPI { public: //! Special \p timeout value to disable wait()'s timeout. - static constexpr uint64_t FENCE_WAIT_FOR_EVER = driver::FENCE_WAIT_FOR_EVER; + static constexpr uint64_t FENCE_WAIT_FOR_EVER = backend::FENCE_WAIT_FOR_EVER; //! Error codes for Fence::wait() - using FenceStatus = driver::FenceStatus; + using FenceStatus = backend::FenceStatus; //! Type of the Fence being created enum class Type : uint8_t { diff --git a/filament/include/filament/IndexBuffer.h b/filament/include/filament/IndexBuffer.h index a6cc0947e0..378c966d70 100644 --- a/filament/include/filament/IndexBuffer.h +++ b/filament/include/filament/IndexBuffer.h @@ -50,14 +50,14 @@ class UTILS_PUBLIC IndexBuffer : public FilamentAPI { struct BuilderDetails; public: - using BufferDescriptor = driver::BufferDescriptor; + using BufferDescriptor = backend::BufferDescriptor; /** * Type of the index buffer */ enum class IndexType : uint8_t { - USHORT = uint8_t(driver::ElementType::USHORT), //!< 16-bit indices - UINT = uint8_t(driver::ElementType::UINT), //!< 32-bit indices + USHORT = uint8_t(backend::ElementType::USHORT), //!< 16-bit indices + UINT = uint8_t(backend::ElementType::UINT), //!< 32-bit indices }; class Builder : public BuilderBase { diff --git a/filament/include/filament/Material.h b/filament/include/filament/Material.h index bb0491ba8e..67111336fb 100644 --- a/filament/include/filament/Material.h +++ b/filament/include/filament/Material.h @@ -51,12 +51,12 @@ public: using VertexDomain = filament::VertexDomain; using TransparencyMode = filament::TransparencyMode; - using ParameterType = filament::driver::UniformType; - using Precision = filament::driver::Precision; - using SamplerType = filament::driver::SamplerType; - using SamplerFormat = filament::driver::SamplerFormat; - using CullingMode = filament::driver::CullingMode; - using ShaderModel = filament::driver::ShaderModel; + using ParameterType = filament::backend::UniformType; + using Precision = filament::backend::Precision; + using SamplerType = filament::backend::SamplerType; + using SamplerFormat = filament::backend::SamplerFormat; + using CullingMode = filament::backend::CullingMode; + using ShaderModel = filament::backend::ShaderModel; /** * Holds information about a material parameter. diff --git a/filament/include/filament/RenderableManager.h b/filament/include/filament/RenderableManager.h index caac4069ff..762156cfe8 100644 --- a/filament/include/filament/RenderableManager.h +++ b/filament/include/filament/RenderableManager.h @@ -47,7 +47,7 @@ class UTILS_PUBLIC RenderableManager : public FilamentAPI { public: using Instance = utils::EntityInstance; - using PrimitiveType = driver::PrimitiveType; + using PrimitiveType = backend::PrimitiveType; bool hasComponent(utils::Entity e) const noexcept; diff --git a/filament/include/filament/Renderer.h b/filament/include/filament/Renderer.h index 180de93f9c..0d7aff9058 100644 --- a/filament/include/filament/Renderer.h +++ b/filament/include/filament/Renderer.h @@ -32,9 +32,9 @@ class Engine; class SwapChain; class View; -namespace driver { +namespace backend { class PixelBufferDescriptor; -} // namespace driver +} // namespace backend /** * A Renderer instance represents an operating system's window. @@ -197,14 +197,14 @@ public: * @param buffer Client-side buffer where the read-back will be written. * * The following format are always supported: - * - driver::PixelDataFormat::RGBA - * - driver::PixelDataFormat::RGBA_INTEGER + * - backend::PixelDataFormat::RGBA + * - backend::PixelDataFormat::RGBA_INTEGER * * The following types are always supported: - * - driver::PixelDataType::UBYTE - * - driver::PixelDataType::UINT - * - driver::PixelDataType::INT - * - driver::PixelDataType::FLOAT + * - backend::PixelDataType::UBYTE + * - backend::PixelDataType::UINT + * - backend::PixelDataType::INT + * - backend::PixelDataType::FLOAT * * Other combination of format/type may be supported. If a combination is * not supported, this operation may fail silently. Use a DEBUG build @@ -243,7 +243,7 @@ public: * */ void readPixels(uint32_t xoffset, uint32_t yoffset, uint32_t width, uint32_t height, - driver::PixelBufferDescriptor&& buffer); + backend::PixelBufferDescriptor&& buffer); /** * Set-up a frame for this Renderer. diff --git a/filament/include/filament/Stream.h b/filament/include/filament/Stream.h index 4472e3c57f..3c7c398526 100644 --- a/filament/include/filament/Stream.h +++ b/filament/include/filament/Stream.h @@ -134,14 +134,14 @@ public: * @param buffer Client-side buffer where the read-back will be written. * * The following format are always supported: - * - driver::PixelDataFormat::RGBA - * - driver::PixelDataFormat::RGBA_INTEGER + * - backend::PixelDataFormat::RGBA + * - backend::PixelDataFormat::RGBA_INTEGER * * The following types are always supported: - * - driver::PixelDataType::UBYTE - * - driver::PixelDataType::UINT - * - driver::PixelDataType::INT - * - driver::PixelDataType::FLOAT + * - backend::PixelDataType::UBYTE + * - backend::PixelDataType::UINT + * - backend::PixelDataType::INT + * - backend::PixelDataType::FLOAT * * Other combination of format/type may be supported. If a combination is * not supported, this operation may fail silently. Use a DEBUG build @@ -176,7 +176,7 @@ public: * readPixels() is intended for debugging and testing. It will impact performance significantly. */ void readPixels(uint32_t xoffset, uint32_t yoffset, uint32_t width, uint32_t height, - driver::PixelBufferDescriptor&& buffer) noexcept; + backend::PixelBufferDescriptor&& buffer) noexcept; /** * Returns the presentation time of the currently displayed frame in nanosecond. diff --git a/filament/include/filament/SwapChain.h b/filament/include/filament/SwapChain.h index aa4b57c5ff..fdcff07c90 100644 --- a/filament/include/filament/SwapChain.h +++ b/filament/include/filament/SwapChain.h @@ -142,7 +142,7 @@ namespace filament { */ class UTILS_PUBLIC SwapChain : public FilamentAPI { public: - static const uint64_t CONFIG_TRANSPARENT = driver::SWAP_CHAIN_CONFIG_TRANSPARENT; + static const uint64_t CONFIG_TRANSPARENT = backend::SWAP_CHAIN_CONFIG_TRANSPARENT; /** * This flag indicates that the swap chain may be used as a source surface * for reading back render results. This config must be set when creating @@ -151,7 +151,7 @@ public: * @see * Renderer.mirrorFrame() */ - static const uint64_t CONFIG_READABLE = driver::SWAP_CHAIN_CONFIG_READABLE; + static const uint64_t CONFIG_READABLE = backend::SWAP_CHAIN_CONFIG_READABLE; void* getNativeWindow() const noexcept; }; diff --git a/filament/include/filament/Texture.h b/filament/include/filament/Texture.h index 13d6ea858e..bffabfa1a5 100644 --- a/filament/include/filament/Texture.h +++ b/filament/include/filament/Texture.h @@ -70,15 +70,15 @@ class UTILS_PUBLIC Texture : public FilamentAPI { public: static constexpr const size_t BASE_LEVEL = 0; - using PixelBufferDescriptor = driver::PixelBufferDescriptor; //!< Geometry of a pixel buffer - using Sampler = driver::SamplerType; //!< Type of sampler - using InternalFormat = driver::TextureFormat; //!< Internal texel format - using CubemapFace = driver::TextureCubemapFace; //!< Cube map faces - using Format = driver::PixelDataFormat; //!< Pixel color format - using Type = driver::PixelDataType; //!< Pixel data format - using CompressedType = driver::CompressedPixelDataType; //!< Compressed pixel data format - using FaceOffsets = driver::FaceOffsets; //!< Cube map faces offsets - using Usage = driver::TextureUsage; //!< Usage affects texel layout + using PixelBufferDescriptor = backend::PixelBufferDescriptor; //!< Geometry of a pixel buffer + using Sampler = backend::SamplerType; //!< Type of sampler + using InternalFormat = backend::TextureFormat; //!< Internal texel format + using CubemapFace = backend::TextureCubemapFace; //!< Cube map faces + using Format = backend::PixelDataFormat; //!< Pixel color format + using Type = backend::PixelDataType; //!< Pixel data format + using CompressedType = backend::CompressedPixelDataType; //!< Compressed pixel data format + using FaceOffsets = backend::FaceOffsets; //!< Cube map faces offsets + using Usage = backend::TextureUsage; //!< Usage affects texel layout static bool isTextureFormatSupported(Engine& engine, InternalFormat format) noexcept; @@ -129,8 +129,8 @@ public: /** * Specifies whether this texture is a cubemap - * @param target either driver::SamplerType::SAMPLER_2D or - * driver::SamplerType::SAMPLER_CUBEMAP + * @param target either backend::SamplerType::SAMPLER_2D or + * backend::SamplerType::SAMPLER_CUBEMAP * @return This Builder, for chaining calls. * @see Sampler */ @@ -192,7 +192,7 @@ public: * Returns the width of a 2D or 3D texture level * @param level texture level. * @return Width in texel of the specified \p level, clamped to 1. - * @attention If this texture is using driver::SamplerType::SAMPLER_EXTERNAL, the dimension + * @attention If this texture is using backend::SamplerType::SAMPLER_EXTERNAL, the dimension * of the texture are unknown and this method always returns whatever was set on the Builder. */ size_t getWidth(size_t level = BASE_LEVEL) const noexcept; @@ -201,7 +201,7 @@ public: * Returns the height of a 2D or 3D texture level * @param level texture level. * @return Height in texel of the specified \p level, clamped to 1. - * @attention If this texture is using driver::SamplerType::SAMPLER_EXTERNAL, the dimension + * @attention If this texture is using backend::SamplerType::SAMPLER_EXTERNAL, the dimension * of the texture are unknown and this method always returns whatever was set on the Builder. */ size_t getHeight(size_t level = BASE_LEVEL) const noexcept; @@ -210,7 +210,7 @@ public: * Returns the depth of a 3D texture level * @param level texture level. * @return Depth in texel of the specified \p level, clamped to 1. - * @attention If this texture is using driver::SamplerType::SAMPLER_EXTERNAL, the dimension + * @attention If this texture is using backend::SamplerType::SAMPLER_EXTERNAL, the dimension * of the texture are unknown and this method always returns whatever was set on the Builder. */ size_t getDepth(size_t level = BASE_LEVEL) const noexcept; @@ -218,7 +218,7 @@ public: /** * Returns the maximum number of levels this texture can have. * @return maximum number of levels this texture can have. - * @attention If this texture is using driver::SamplerType::SAMPLER_EXTERNAL, the dimension + * @attention If this texture is using backend::SamplerType::SAMPLER_EXTERNAL, the dimension * of the texture are unknown and this method always returns whatever was set on the Builder. */ size_t getLevels() const noexcept; @@ -250,9 +250,9 @@ public: * * @attention \p engine must be the instance passed to Builder::build() * @attention \p level must be less than getLevels(). - * @attention \p buffer's driver::PixelDataFormat must match that of getFormat(). - * @attention This Texture instance must use driver::SamplerType::SAMPLER_2D or - * driver::SamplerType::SAMPLER_EXTERNAL. IF the later is specified + * @attention \p buffer's backend::PixelDataFormat must match that of getFormat(). + * @attention This Texture instance must use backend::SamplerType::SAMPLER_2D or + * backend::SamplerType::SAMPLER_EXTERNAL. IF the later is specified * and external textures are supported by the driver implementation, * this method will have no effect, otherwise it will behave as if the * texture was specified with driver::SamplerType::SAMPLER_2D. @@ -280,12 +280,12 @@ public: * * @attention \p engine must be the instance passed to Builder::build() * @attention \p level must be less than getLevels(). - * @attention \p buffer's driver::PixelDataFormat must match that of getFormat(). - * @attention This Texture instance must use driver::SamplerType::SAMPLER_2D or - * driver::SamplerType::SAMPLER_EXTERNAL. IF the later is specified + * @attention \p buffer's backend::PixelDataFormat must match that of getFormat(). + * @attention This Texture instance must use backend::SamplerType::SAMPLER_2D or + * backend::SamplerType::SAMPLER_EXTERNAL. IF the later is specified * and external textures are supported by the driver implementation, * this method will have no effect, otherwise it will behave as if the - * texture was specified with driver::SamplerType::SAMPLER_2D. + * texture was specified with backend::SamplerType::SAMPLER_2D. * * @see Builder::sampler() */ @@ -306,10 +306,10 @@ public: * * @attention \p engine must be the instance passed to Builder::build() * @attention \p level must be less than getLevels(). - * @attention \p buffer's driver::PixelDataFormat must match that of getFormat(). - * @attention This Texture instance must use driver::SamplerType::SAMPLER_CUBEMAP or it has no effect + * @attention \p buffer's backend::PixelDataFormat must match that of getFormat(). + * @attention This Texture instance must use backend::SamplerType::SAMPLER_CUBEMAP or it has no effect * - * @see driver::TextureCubemapFace, Builder::sampler() + * @see backend::TextureCubemapFace, Builder::sampler() */ void setImage(Engine& engine, size_t level, PixelBufferDescriptor&& buffer, const FaceOffsets& faceOffsets) const noexcept; @@ -328,7 +328,7 @@ public: * type is eglImageOES. * * @attention \p engine must be the instance passed to Builder::build() - * @attention This Texture instance must use driver::SamplerType::SAMPLER_EXTERNAL or it has no effect + * @attention This Texture instance must use backend::SamplerType::SAMPLER_EXTERNAL or it has no effect * * @see Builder::sampler() * @@ -348,7 +348,7 @@ public: * @param stream A Stream object * * @attention \p engine must be the instance passed to Builder::build() - * @attention This Texture instance must use driver::SamplerType::SAMPLER_EXTERNAL or it has no effect + * @attention This Texture instance must use backend::SamplerType::SAMPLER_EXTERNAL or it has no effect * * @see Builder::sampler(), Stream * @@ -362,7 +362,7 @@ public: * @param engine Engine this texture is associated to. * * @attention \p engine must be the instance passed to Builder::build() - * @attention This Texture instance must NOT use driver::SamplerType::SAMPLER_CUBEMAP or it has no effect + * @attention This Texture instance must NOT use backend::SamplerType::SAMPLER_CUBEMAP or it has no effect */ void generateMipmaps(Engine& engine) const noexcept; }; diff --git a/filament/include/filament/TextureSampler.h b/filament/include/filament/TextureSampler.h index 9e1bbcf5f8..7ecc67ce88 100644 --- a/filament/include/filament/TextureSampler.h +++ b/filament/include/filament/TextureSampler.h @@ -32,11 +32,11 @@ namespace filament { */ class UTILS_PUBLIC TextureSampler { public: - using WrapMode = driver::SamplerWrapMode; - using MinFilter = driver::SamplerMinFilter; - using MagFilter = driver::SamplerMagFilter; - using CompareMode = driver::SamplerCompareMode; - using CompareFunc = driver::SamplerCompareFunc; + using WrapMode = backend::SamplerWrapMode; + using MinFilter = backend::SamplerMinFilter; + using MagFilter = backend::SamplerMagFilter; + using CompareMode = backend::SamplerCompareMode; + using CompareFunc = backend::SamplerCompareFunc; /** * Creates a default sampler. @@ -168,7 +168,7 @@ public: mSamplerParams.compareFunc = func; } - driver::SamplerParams getSamplerParams() const noexcept { return mSamplerParams; } + backend::SamplerParams getSamplerParams() const noexcept { return mSamplerParams; } MinFilter getMinFilter() const noexcept { return mSamplerParams.filterMin; } MagFilter getMagFilter() const noexcept { return mSamplerParams.filterMag; } @@ -181,7 +181,7 @@ public: private: - driver::SamplerParams mSamplerParams; + backend::SamplerParams mSamplerParams; }; } // namespace filament diff --git a/filament/include/filament/VertexBuffer.h b/filament/include/filament/VertexBuffer.h index 65618a9456..deee9e16ad 100644 --- a/filament/include/filament/VertexBuffer.h +++ b/filament/include/filament/VertexBuffer.h @@ -57,8 +57,8 @@ class UTILS_PUBLIC VertexBuffer : public FilamentAPI { struct BuilderDetails; public: - using AttributeType = driver::ElementType; - using BufferDescriptor = driver::BufferDescriptor; + using AttributeType = backend::ElementType; + using BufferDescriptor = backend::BufferDescriptor; class Builder : public BuilderBase { friend struct BuilderDetails; diff --git a/filament/include/filament/View.h b/filament/include/filament/View.h index f76d95abf1..5269bcee1b 100644 --- a/filament/include/filament/View.h +++ b/filament/include/filament/View.h @@ -60,7 +60,7 @@ class Scene; */ class UTILS_PUBLIC View : public FilamentAPI { public: - using TargetBufferFlags = driver::TargetBufferFlags; + using TargetBufferFlags = backend::TargetBufferFlags; /** * Dynamic resolution can be used to either reach a desired target frame rate diff --git a/filament/include/filament/Viewport.h b/filament/include/filament/Viewport.h index e8926e7676..824aa7d638 100644 --- a/filament/include/filament/Viewport.h +++ b/filament/include/filament/Viewport.h @@ -36,12 +36,12 @@ namespace filament { * * A view port is represented by its left-bottom coordinate, width and height in pixels. */ -class UTILS_PUBLIC Viewport : public driver::Viewport { +class UTILS_PUBLIC Viewport : public backend::Viewport { public: /** * Creates a Viewport of zero width and height at the origin. */ - Viewport() noexcept : driver::Viewport{} {} + Viewport() noexcept : backend::Viewport{} {} Viewport(const Viewport& viewport) noexcept = default; Viewport(Viewport&& viewport) noexcept = default; @@ -57,7 +57,7 @@ public: * @param height height in pixel */ Viewport(int32_t left, int32_t bottom, uint32_t width, uint32_t height) noexcept - : driver::Viewport{ left, bottom, width, height } { + : backend::Viewport{ left, bottom, width, height } { } /** diff --git a/filament/src/DFG.cpp b/filament/src/DFG.cpp index 03b9294a40..2911f39991 100644 --- a/filament/src/DFG.cpp +++ b/filament/src/DFG.cpp @@ -35,7 +35,7 @@ DFG::DFG(FEngine& engine) noexcept : mEngine(engine) { Texture* lut = Texture::Builder() .width(DFG_LUT_SIZE) .height(DFG_LUT_SIZE) - .format(driver::TextureFormat::RGB16F) + .format(backend::TextureFormat::RGB16F) .build(mEngine); Texture::PixelBufferDescriptor buffer(DFG_LUT, byteCount, diff --git a/filament/src/Engine.cpp b/filament/src/Engine.cpp index 582fbf8651..9efc4c3f8b 100644 --- a/filament/src/Engine.cpp +++ b/filament/src/Engine.cpp @@ -63,7 +63,7 @@ using namespace utils; namespace filament { -using namespace driver; +using namespace backend; using namespace filaflat; namespace details { @@ -369,19 +369,19 @@ int FEngine::loop() { mOwnPlatform = true; slog.d << "FEngine resolved backend: "; switch (mBackend) { - case driver::Backend::NOOP: + case backend::Backend::NOOP: slog.d << "Noop"; break; - case driver::Backend::OPENGL: + case backend::Backend::OPENGL: slog.d << "OpenGL"; break; - case driver::Backend::VULKAN: + case backend::Backend::VULKAN: slog.d << "Vulkan"; break; - case driver::Backend::METAL: + case backend::Backend::METAL: slog.d << "Metal"; break; @@ -437,7 +437,7 @@ const FMaterial* FEngine::getSkyboxMaterial(bool rgbm) const noexcept { } -driver::Handle FEngine::createPostProcessProgram(MaterialParser& parser, +backend::Handle FEngine::createPostProcessProgram(MaterialParser& parser, ShaderModel shaderModel, PostProcessStage stage) const noexcept { ShaderBuilder& vShaderBuilder = getVertexShaderBuilder(); ShaderBuilder& fShaderBuilder = getFragmentShaderBuilder(); @@ -487,8 +487,8 @@ driver::Handle FEngine::createPostProcessProgram(MaterialPars return program; } -driver::Handle FEngine::getPostProcessProgramSlow(PostProcessStage stage) const noexcept { - driver::Handle* const postProcessPrograms = mPostProcessPrograms; +backend::Handle FEngine::getPostProcessProgramSlow(PostProcessStage stage) const noexcept { + backend::Handle* const postProcessPrograms = mPostProcessPrograms; if (!postProcessPrograms[(uint8_t)stage]) { ShaderModel shaderModel = getDriver().getShaderModel(); postProcessPrograms[(uint8_t)stage] = createPostProcessProgram(*mPostProcessParser, shaderModel, stage); diff --git a/filament/src/Fence.cpp b/filament/src/Fence.cpp index a3bca20e92..e0b989af32 100644 --- a/filament/src/Fence.cpp +++ b/filament/src/Fence.cpp @@ -24,7 +24,7 @@ namespace filament { -using namespace driver; +using namespace backend; namespace details { diff --git a/filament/src/Froxelizer.cpp b/filament/src/Froxelizer.cpp index bb1c6adf78..2f9f8ce598 100644 --- a/filament/src/Froxelizer.cpp +++ b/filament/src/Froxelizer.cpp @@ -40,7 +40,7 @@ using namespace utils; namespace filament { -using namespace driver; +using namespace backend; namespace details { @@ -522,7 +522,7 @@ std::pair Froxelizer::clipToIndices(float2 const& clip) const no } -void Froxelizer::commit(driver::DriverApi& driverApi) { +void Froxelizer::commit(backend::DriverApi& driverApi) { // send data to GPU mFroxelBuffer.commit(driverApi, mFroxelBufferUser); mRecordsBuffer.commit(driverApi, mRecordBufferUser); diff --git a/filament/src/GPUBuffer.cpp b/filament/src/GPUBuffer.cpp index fa7fa7b6a2..ce0eb2c215 100644 --- a/filament/src/GPUBuffer.cpp +++ b/filament/src/GPUBuffer.cpp @@ -21,7 +21,7 @@ namespace filament { -using namespace driver; +using namespace backend; static size_t dataTypeToSize(GPUBuffer::Element element) noexcept { using ET = GPUBuffer::ElementType; @@ -37,8 +37,8 @@ static size_t dataTypeToSize(GPUBuffer::Element element) noexcept { } } -static driver::TextureFormat dataTypeToTextureFormat(GPUBuffer::Element element) noexcept { - using TF = driver::TextureFormat; +static backend::TextureFormat dataTypeToTextureFormat(GPUBuffer::Element element) noexcept { + using TF = backend::TextureFormat; static const TF formats[8][4] = { { TF::R8UI, TF::RG8UI, TF::RGB8UI, TF::RGBA8UI }, { TF::R8I, TF::RG8I, TF::RGB8I, TF::RGBA8I }, @@ -55,7 +55,7 @@ static driver::TextureFormat dataTypeToTextureFormat(GPUBuffer::Element element) return formats[index][element.size - 1]; } -GPUBuffer::GPUBuffer(driver::DriverApi& driverApi, Element element, size_t rowSize, size_t rowCount) +GPUBuffer::GPUBuffer(backend::DriverApi& driverApi, Element element, size_t rowSize, size_t rowCount) : mElement(element) { size_t size = dataTypeToSize(element) * rowSize * rowCount; mSize = (uint32_t) size; @@ -63,33 +63,33 @@ GPUBuffer::GPUBuffer(driver::DriverApi& driverApi, Element element, size_t rowSi mHeight = (uint16_t) rowCount; mRowSizeInBytes = uint16_t(dataTypeToSize(element) * rowSize); - driver::TextureFormat format = dataTypeToTextureFormat(element); + backend::TextureFormat format = dataTypeToTextureFormat(element); mTexture = driverApi.createTexture(SamplerType::SAMPLER_2D, 1, format, 1, mWidth, mHeight, 1, TextureUsage::DEFAULT); switch (mElement.size) { default: // cannot happen - case 1: mFormat = driver::PixelDataFormat::R; break; - case 2: mFormat = driver::PixelDataFormat::RG; break; - case 3: mFormat = driver::PixelDataFormat::RGB; break; - case 4: mFormat = driver::PixelDataFormat::RGBA; break; + case 1: mFormat = backend::PixelDataFormat::R; break; + case 2: mFormat = backend::PixelDataFormat::RG; break; + case 3: mFormat = backend::PixelDataFormat::RGB; break; + case 4: mFormat = backend::PixelDataFormat::RGBA; break; } if (mElement.type != ElementType::FLOAT && mElement.type != ElementType::HALF) { // change R to R_INTEGER, RG to RG_INTEGER, etc. - mFormat = driver::PixelDataFormat(uint8_t(mFormat) + 1); + mFormat = backend::PixelDataFormat(uint8_t(mFormat) + 1); } switch (mElement.type) { - case ElementType::UINT8: mType = driver::PixelDataType::UBYTE; break; - case ElementType::INT8: mType = driver::PixelDataType::BYTE; break; - case ElementType::UINT16: mType = driver::PixelDataType::USHORT; break; - case ElementType::INT16: mType = driver::PixelDataType::SHORT; break; - case ElementType::UINT32: mType = driver::PixelDataType::UINT; break; - case ElementType::INT32: mType = driver::PixelDataType::INT; break; - case ElementType::HALF: mType = driver::PixelDataType::HALF; break; - case ElementType::FLOAT: mType = driver::PixelDataType::FLOAT; break; + case ElementType::UINT8: mType = backend::PixelDataType::UBYTE; break; + case ElementType::INT8: mType = backend::PixelDataType::BYTE; break; + case ElementType::UINT16: mType = backend::PixelDataType::USHORT; break; + case ElementType::INT16: mType = backend::PixelDataType::SHORT; break; + case ElementType::UINT32: mType = backend::PixelDataType::UINT; break; + case ElementType::INT32: mType = backend::PixelDataType::INT; break; + case ElementType::HALF: mType = backend::PixelDataType::HALF; break; + case ElementType::FLOAT: mType = backend::PixelDataType::FLOAT; break; } } @@ -113,11 +113,11 @@ void GPUBuffer::swap(GPUBuffer& rhs) noexcept { std::swap(mType, rhs.mType); } -void GPUBuffer::terminate(driver::DriverApi& driverApi) noexcept { +void GPUBuffer::terminate(backend::DriverApi& driverApi) noexcept { driverApi.destroyTexture(mTexture); } -void GPUBuffer::commitSlow(driver::DriverApi& driverApi, void const* begin, void const* end) noexcept { +void GPUBuffer::commitSlow(backend::DriverApi& driverApi, void const* begin, void const* end) noexcept { const uintptr_t sizeInBytes = uintptr_t(end) - uintptr_t(begin); assert(sizeInBytes <= mRowSizeInBytes * mHeight); driverApi.update2DImage(mTexture, 0, 0, 0, mWidth, mHeight, diff --git a/filament/src/GPUBuffer.h b/filament/src/GPUBuffer.h index ebc0c5d115..a8368e0097 100644 --- a/filament/src/GPUBuffer.h +++ b/filament/src/GPUBuffer.h @@ -50,7 +50,7 @@ public: GPUBuffer() = default; - GPUBuffer(driver::DriverApi& driverApi, Element element, size_t rowSize, size_t rowCount); + GPUBuffer(backend::DriverApi& driverApi, Element element, size_t rowSize, size_t rowCount); GPUBuffer(const GPUBuffer&) = delete; GPUBuffer& operator=(const GPUBuffer&) = delete; @@ -59,24 +59,24 @@ public: // no need to specify a destructor, we're trivially_destructible - void terminate(driver::DriverApi& driverApi) noexcept; + void terminate(backend::DriverApi& driverApi) noexcept; size_t getSize() const noexcept { return mSize; } // source data isn't copied and must stay valid until the command-buffer is executed - void commit(driver::DriverApi& driverApi, void const* begin, void const* end) noexcept { + void commit(backend::DriverApi& driverApi, void const* begin, void const* end) noexcept { commitSlow(driverApi, begin, end); } template - void commit(driver::DriverApi& driverApi, utils::Slice const& data) noexcept { + void commit(backend::DriverApi& driverApi, utils::Slice const& data) noexcept { commit(driverApi, data.cbegin(), data.cend()); } void swap(GPUBuffer& rhs) noexcept; - void setSampler(size_t index, driver::SamplerGroup& group) const noexcept { + void setSampler(size_t index, backend::SamplerGroup& group) const noexcept { group.setSampler(index, { getHandle(), getSamplerParams() }); } @@ -84,20 +84,20 @@ private: // this is really hidden implementation details (the fact we're using a texture should be // exposed as little as possible) friend class SamplerGroup; - driver::Handle getHandle() const noexcept { return mTexture; } - driver::SamplerParams getSamplerParams() const noexcept { return driver::SamplerParams{}; } + backend::Handle getHandle() const noexcept { return mTexture; } + backend::SamplerParams getSamplerParams() const noexcept { return backend::SamplerParams{}; } private: - void commitSlow(driver::DriverApi& driverApi, void const* begin, void const* end) noexcept; + void commitSlow(backend::DriverApi& driverApi, void const* begin, void const* end) noexcept; - driver::Handle mTexture; + backend::Handle mTexture; uint32_t mSize = 0; uint16_t mWidth; uint16_t mHeight; uint16_t mRowSizeInBytes; Element mElement; - driver::PixelDataFormat mFormat; - driver::PixelDataType mType; + backend::PixelDataFormat mFormat; + backend::PixelDataType mType; }; } // namespace filament diff --git a/filament/src/IndexBuffer.cpp b/filament/src/IndexBuffer.cpp index b8db31346f..1e0ed96450 100644 --- a/filament/src/IndexBuffer.cpp +++ b/filament/src/IndexBuffer.cpp @@ -59,9 +59,9 @@ FIndexBuffer::FIndexBuffer(FEngine& engine, const IndexBuffer::Builder& builder) : mIndexCount(builder->mIndexCount) { FEngine::DriverApi& driver = engine.getDriverApi(); mHandle = driver.createIndexBuffer( - (driver::ElementType)builder->mIndexType, + (backend::ElementType)builder->mIndexType, uint32_t(builder->mIndexCount), - driver::BufferUsage::STATIC); + backend::BufferUsage::STATIC); } void FIndexBuffer::terminate(FEngine& engine) { diff --git a/filament/src/Material.cpp b/filament/src/Material.cpp index af2ec376b9..d1e627448c 100644 --- a/filament/src/Material.cpp +++ b/filament/src/Material.cpp @@ -44,7 +44,7 @@ using namespace filaflat; namespace filament { using namespace details; -using namespace driver; +using namespace backend; struct Material::BuilderDetails { @@ -93,15 +93,15 @@ Material* Material::Builder::build(Engine& engine) { utils::bitset32 shaderModels; shaderModels.setValue(v); - driver::ShaderModel shaderModel = upcast(engine).getDriver().getShaderModel(); + backend::ShaderModel shaderModel = upcast(engine).getDriver().getShaderModel(); if (!shaderModels.test(static_cast(shaderModel))) { CString name; materialParser->getName(&name); slog.e << "The material '" << name.c_str_safe() << "' was not built for "; switch (shaderModel) { - case driver::ShaderModel::GL_ES_30: slog.e << "mobile.\n"; break; - case driver::ShaderModel::GL_CORE_41: slog.e << "desktop.\n"; break; - case driver::ShaderModel::UNKNOWN: /* should never happen */ break; + case backend::ShaderModel::GL_ES_30: slog.e << "mobile.\n"; break; + case backend::ShaderModel::GL_CORE_41: slog.e << "desktop.\n"; break; + case backend::ShaderModel::UNKNOWN: /* should never happen */ break; } slog.e << "Compiled material contains shader models 0x" << io::hex << shaderModels.getValue() << io::dec << "." << io::endl; @@ -279,7 +279,7 @@ bool FMaterial::hasParameter(const char* name) const noexcept { return true; } -driver::Handle FMaterial::getProgramSlow(uint8_t variantKey) const noexcept { +backend::Handle FMaterial::getProgramSlow(uint8_t variantKey) const noexcept { const ShaderModel sm = mEngine.getDriver().getShaderModel(); assert(!Variant::isReserved(variantKey)); diff --git a/filament/src/MaterialInstance.cpp b/filament/src/MaterialInstance.cpp index a298335ff1..ebae7d9f3f 100644 --- a/filament/src/MaterialInstance.cpp +++ b/filament/src/MaterialInstance.cpp @@ -32,7 +32,7 @@ using namespace filament::math; namespace filament { -using namespace driver; +using namespace backend; namespace details { @@ -46,7 +46,7 @@ FMaterialInstance::FMaterialInstance(FEngine& engine, FMaterial const* material) if (!material->getUniformInterfaceBlock().isEmpty()) { mUniforms.setUniforms(material->getDefaultInstance()->getUniformBuffer()); - mUbHandle = driver.createUniformBuffer(mUniforms.getSize(), driver::BufferUsage::DYNAMIC); + mUbHandle = driver.createUniformBuffer(mUniforms.getSize(), backend::BufferUsage::DYNAMIC); } if (!material->getSamplerInterfaceBlock().isEmpty()) { @@ -69,7 +69,7 @@ void FMaterialInstance::initDefaultInstance(FEngine& engine, FMaterial const* ma if (!material->getUniformInterfaceBlock().isEmpty()) { mUniforms = UniformBuffer(material->getUniformInterfaceBlock().getSize()); - mUbHandle = driver.createUniformBuffer(mUniforms.getSize(), driver::BufferUsage::STATIC); + mUbHandle = driver.createUniformBuffer(mUniforms.getSize(), backend::BufferUsage::STATIC); } if (!material->getSamplerInterfaceBlock().isEmpty()) { diff --git a/filament/src/MaterialParser.cpp b/filament/src/MaterialParser.cpp index 098f25070c..aa72fc4135 100644 --- a/filament/src/MaterialParser.cpp +++ b/filament/src/MaterialParser.cpp @@ -34,7 +34,7 @@ #include using namespace utils; -using namespace filament::driver; +using namespace filament::backend; using namespace filaflat; using namespace filamat; diff --git a/filament/src/MaterialParser.h b/filament/src/MaterialParser.h index 1912e24948..10d4958e6b 100644 --- a/filament/src/MaterialParser.h +++ b/filament/src/MaterialParser.h @@ -43,7 +43,7 @@ class SamplerInterfaceBlock; class MaterialParser { public: - MaterialParser(driver::Backend backend, const void* data, size_t size); + MaterialParser(backend::Backend backend, const void* data, size_t size); MaterialParser(MaterialParser const& rhs) noexcept = delete; MaterialParser& operator=(MaterialParser const& rhs) noexcept = delete; @@ -64,7 +64,7 @@ public: bool getDepthWrite(bool* value) const noexcept; bool getDoubleSidedSet(bool* value) const noexcept; bool getDoubleSided(bool* value) const noexcept; - bool getCullingMode(driver::CullingMode* value) const noexcept; + bool getCullingMode(backend::CullingMode* value) const noexcept; bool getTransparencyMode(TransparencyMode* value) const noexcept; bool getColorWrite(bool* value) const noexcept; bool getDepthTest(bool* value) const noexcept; @@ -78,12 +78,12 @@ public: bool getRequiredAttributes(AttributeBitset*) const noexcept; bool hasCustomDepthShader(bool* value) const noexcept; - bool getShader(filaflat::ShaderBuilder& shader, driver::ShaderModel shaderModel, - uint8_t variant, driver::ShaderType stage) noexcept; + bool getShader(filaflat::ShaderBuilder& shader, backend::ShaderModel shaderModel, + uint8_t variant, backend::ShaderType stage) noexcept; private: struct MaterialParserDetails { - MaterialParserDetails(driver::Backend backend, const void* data, size_t size); + MaterialParserDetails(backend::Backend backend, const void* data, size_t size); template bool getFromSimpleChunk(filamat::ChunkType type, T* value) const noexcept; diff --git a/filament/src/PostProcessManager.cpp b/filament/src/PostProcessManager.cpp index 8512678ec8..422ff96490 100644 --- a/filament/src/PostProcessManager.cpp +++ b/filament/src/PostProcessManager.cpp @@ -30,7 +30,7 @@ namespace filament { using namespace utils; using namespace math; -using namespace driver; +using namespace backend; using namespace filament::details; void PostProcessManager::init(FEngine& engine) noexcept { @@ -41,24 +41,24 @@ void PostProcessManager::init(FEngine& engine) noexcept { DriverApi& driver = engine.getDriverApi(); mPostProcessSbh = driver.createSamplerGroup(PostProcessSib::SAMPLER_COUNT); mPostProcessUbh = driver.createUniformBuffer(mPostProcessUb.getSize(), - driver::BufferUsage::DYNAMIC); + backend::BufferUsage::DYNAMIC); driver.bindSamplers(BindingPoints::POST_PROCESS, mPostProcessSbh); driver.bindUniformBuffer(BindingPoints::POST_PROCESS, mPostProcessUbh); } -void PostProcessManager::terminate(driver::DriverApi& driver) noexcept { +void PostProcessManager::terminate(backend::DriverApi& driver) noexcept { driver.destroySamplerGroup(mPostProcessSbh); driver.destroyUniformBuffer(mPostProcessUbh); } void PostProcessManager::setSource(uint32_t viewportWidth, uint32_t viewportHeight, - driver::Handle texture, uint32_t textureWidth, uint32_t textureHeight) const noexcept { + backend::Handle texture, uint32_t textureWidth, uint32_t textureHeight) const noexcept { FEngine& engine = *mEngine; DriverApi& driver = engine.getDriverApi(); // FXAA requires linear filtering. The post-processing stage however, doesn't // use samplers. - driver::SamplerParams params; + backend::SamplerParams params; params.filterMag = SamplerMagFilter::LINEAR; params.filterMin = SamplerMinFilter::LINEAR; SamplerGroup group(PostProcessSib::SAMPLER_COUNT); @@ -85,16 +85,16 @@ void PostProcessManager::setSource(uint32_t viewportWidth, uint32_t viewportHeig // ------------------------------------------------------------------------------------------------ FrameGraphResource PostProcessManager::toneMapping(FrameGraph& fg, FrameGraphResource input, - driver::TextureFormat outFormat, bool dithering, bool translucent) noexcept { + backend::TextureFormat outFormat, bool dithering, bool translucent) noexcept { FEngine* engine = mEngine; - driver::Handle const& fullScreenRenderPrimitive = engine->getFullScreenRenderPrimitive(); + backend::Handle const& fullScreenRenderPrimitive = engine->getFullScreenRenderPrimitive(); struct PostProcessToneMapping { FrameGraphResource input; FrameGraphResource output; }; - driver::Handle toneMappingProgram = engine->getPostProcessProgram( + backend::Handle toneMappingProgram = engine->getPostProcessProgram( translucent ? PostProcessStage::TONE_MAPPING_TRANSLUCENT : PostProcessStage::TONE_MAPPING_OPAQUE); @@ -140,17 +140,17 @@ FrameGraphResource PostProcessManager::toneMapping(FrameGraph& fg, FrameGraphRes } FrameGraphResource PostProcessManager::fxaa(FrameGraph& fg, - FrameGraphResource input, driver::TextureFormat outFormat, bool translucent) noexcept { + FrameGraphResource input, backend::TextureFormat outFormat, bool translucent) noexcept { FEngine* engine = mEngine; - driver::Handle const& fullScreenRenderPrimitive = engine->getFullScreenRenderPrimitive(); + backend::Handle const& fullScreenRenderPrimitive = engine->getFullScreenRenderPrimitive(); struct PostProcessFXAA { FrameGraphResource input; FrameGraphResource output; }; - driver::Handle antiAliasingProgram = engine->getPostProcessProgram( + backend::Handle antiAliasingProgram = engine->getPostProcessProgram( translucent ? PostProcessStage::ANTI_ALIASING_TRANSLUCENT : PostProcessStage::ANTI_ALIASING_OPAQUE); @@ -194,7 +194,7 @@ FrameGraphResource PostProcessManager::fxaa(FrameGraph& fg, } FrameGraphResource PostProcessManager::dynamicScaling(FrameGraph& fg, - FrameGraphResource input, driver::TextureFormat outFormat) noexcept { + FrameGraphResource input, backend::TextureFormat outFormat) noexcept { struct PostProcessScaling { FrameGraphResource input; diff --git a/filament/src/PostProcessManager.h b/filament/src/PostProcessManager.h index e869f67a36..7371f87dd5 100644 --- a/filament/src/PostProcessManager.h +++ b/filament/src/PostProcessManager.h @@ -35,27 +35,27 @@ class FView; class PostProcessManager { public: void init(details::FEngine& engine) noexcept; - void terminate(driver::DriverApi& driver) noexcept; - void setSource(uint32_t viewportWidth, uint32_t viewportHeight, driver::Handle texture, + void terminate(backend::DriverApi& driver) noexcept; + void setSource(uint32_t viewportWidth, uint32_t viewportHeight, backend::Handle texture, uint32_t textureWidth, uint32_t textureHeight) const noexcept; FrameGraphResource toneMapping(FrameGraph& fg, FrameGraphResource input, - driver::TextureFormat outFormat, bool dithering, bool translucent) noexcept; + backend::TextureFormat outFormat, bool dithering, bool translucent) noexcept; FrameGraphResource fxaa( - FrameGraph& fg, FrameGraphResource input, driver::TextureFormat outFormat, + FrameGraph& fg, FrameGraphResource input, backend::TextureFormat outFormat, bool translucent) noexcept; FrameGraphResource dynamicScaling( - FrameGraph& fg, FrameGraphResource input, driver::TextureFormat outFormat) noexcept; + FrameGraph& fg, FrameGraphResource input, backend::TextureFormat outFormat) noexcept; private: details::FEngine* mEngine = nullptr; // we need only one of these mutable UniformBuffer mPostProcessUb; - driver::Handle mPostProcessSbh; - driver::Handle mPostProcessUbh; + backend::Handle mPostProcessSbh; + backend::Handle mPostProcessUbh; }; } // namespace filament diff --git a/filament/src/RenderPass.cpp b/filament/src/RenderPass.cpp index 226f813543..b2eed62ec8 100644 --- a/filament/src/RenderPass.cpp +++ b/filament/src/RenderPass.cpp @@ -36,7 +36,7 @@ using namespace filament::math; namespace filament { -using namespace driver; +using namespace backend; namespace details { diff --git a/filament/src/RenderPass.h b/filament/src/RenderPass.h index df3e9db6c7..23bd2be8d9 100644 --- a/filament/src/RenderPass.h +++ b/filament/src/RenderPass.h @@ -174,9 +174,9 @@ public: struct PrimitiveInfo { // 24 bytes FMaterialInstance const* mi = nullptr; // 8 bytes (4) - driver::Handle primitiveHandle; // 4 bytes - driver::Handle perRenderableBones; // 4 bytes - driver::RasterState rasterState; // 4 bytes + backend::Handle primitiveHandle; // 4 bytes + backend::Handle perRenderableBones; // 4 bytes + backend::RasterState rasterState; // 4 bytes uint16_t index = 0; // 2 bytes Variant materialVariant; // 1 byte uint8_t reserved = { }; // 1 byte @@ -218,12 +218,12 @@ private: // Called just before rendering, make sure all needed asynchronous tasks are finished. // Set-up the render-target as needed. At least call driver.beginRenderPass(). virtual void beginRenderPass( - driver::DriverApi& driver, Viewport const& viewport, + backend::DriverApi& driver, Viewport const& viewport, const CameraInfo& camera) noexcept = 0; // Called just after rendering. Do what you have to do, // but at least call driver.endRenderPass(). - virtual void endRenderPass(driver::DriverApi& driver, Viewport const& viewport) noexcept = 0; + virtual void endRenderPass(backend::DriverApi& driver, Viewport const& viewport) noexcept = 0; private: friend class FRenderer; diff --git a/filament/src/RenderPrimitive.cpp b/filament/src/RenderPrimitive.cpp index 865666b018..de5c094f0a 100644 --- a/filament/src/RenderPrimitive.cpp +++ b/filament/src/RenderPrimitive.cpp @@ -24,7 +24,7 @@ namespace filament { namespace details { -void FRenderPrimitive::init(driver::DriverApi& driver, +void FRenderPrimitive::init(backend::DriverApi& driver, const RenderableManager::Builder::Entry& entry) noexcept { assert(entry.materialInstance); diff --git a/filament/src/Renderer.cpp b/filament/src/Renderer.cpp index 230b0d73da..37b42e600d 100644 --- a/filament/src/Renderer.cpp +++ b/filament/src/Renderer.cpp @@ -44,7 +44,7 @@ using namespace utils; namespace filament { -using namespace driver; +using namespace backend; namespace details { @@ -62,8 +62,8 @@ void FRenderer::init() noexcept { DriverApi& driver = mEngine.getDriverApi(); mUserEpoch = mEngine.getEngineEpoch(); mRenderTarget = driver.createDefaultRenderTarget(); - mIsRGB16FSupported = driver.isRenderTargetFormatSupported(driver::TextureFormat::RGB16F); - mIsRGB8Supported = driver.isRenderTargetFormatSupported(driver::TextureFormat::RGB8); + mIsRGB16FSupported = driver.isRenderTargetFormatSupported(backend::TextureFormat::RGB16F); + mIsRGB8Supported = driver.isRenderTargetFormatSupported(backend::TextureFormat::RGB8); if (UTILS_HAS_THREADING) { mFrameInfoManager.run(); } @@ -105,25 +105,25 @@ void FRenderer::resetUserTime() { mUserEpoch = std::chrono::steady_clock::now(); } -driver::TextureFormat FRenderer::getHdrFormat(const View& view) const noexcept { +backend::TextureFormat FRenderer::getHdrFormat(const View& view) const noexcept { const bool translucent = mSwapChain->isTransparent(); - if (translucent) return driver::TextureFormat::RGBA16F; + if (translucent) return backend::TextureFormat::RGBA16F; switch (view.getRenderQuality().hdrColorBuffer) { case View::QualityLevel::LOW: case View::QualityLevel::MEDIUM: - return driver::TextureFormat::R11F_G11F_B10F; + return backend::TextureFormat::R11F_G11F_B10F; case View::QualityLevel::HIGH: case View::QualityLevel::ULTRA: - return !mIsRGB16FSupported ? driver::TextureFormat::RGBA16F - : driver::TextureFormat::RGB16F; + return !mIsRGB16FSupported ? backend::TextureFormat::RGBA16F + : backend::TextureFormat::RGB16F; } } -driver::TextureFormat FRenderer::getLdrFormat() const noexcept { +backend::TextureFormat FRenderer::getLdrFormat() const noexcept { const bool translucent = mSwapChain->isTransparent(); - return (translucent || !mIsRGB8Supported) ? driver::TextureFormat::RGBA8 - : driver::TextureFormat::RGB8; + return (translucent || !mIsRGB8Supported) ? backend::TextureFormat::RGBA8 + : backend::TextureFormat::RGB8; } void FRenderer::render(FView const* view) { @@ -223,7 +223,7 @@ void FRenderer::renderJob(ArenaScope& arena, FView& view) { // so when skipping post-process (which draws directly into it), we can't rely on it. const bool colorPassNeedsDepthBuffer = hasPostProcess; - const driver::Handle viewRenderTarget = getRenderTarget(); + const backend::Handle viewRenderTarget = getRenderTarget(); FrameGraphResource output = fg.importResource("viewRenderTarget", { .viewport = vp }, viewRenderTarget, vp.width, vp.height); @@ -320,7 +320,7 @@ void FRenderer::mirrorFrame(FSwapChain* dstSwapChain, filament::Viewport const& FEngine& engine = getEngine(); FEngine::DriverApi& driver = engine.getDriverApi(); - const driver::Handle viewRenderTarget = getRenderTarget(); + const backend::Handle viewRenderTarget = getRenderTarget(); // Set the current swap chain as the read surface, and the destination // swap chain as the draw surface so that blitting between default render @@ -464,7 +464,7 @@ void FRenderer::endFrame() { } void FRenderer::readPixels(uint32_t xoffset, uint32_t yoffset, uint32_t width, uint32_t height, - driver::PixelBufferDescriptor&& buffer) { + backend::PixelBufferDescriptor&& buffer) { if (!ASSERT_POSTCONDITION_NON_FATAL( buffer.type != PixelDataType::COMPRESSED, @@ -526,7 +526,7 @@ void Renderer::mirrorFrame(SwapChain* dstSwapChain, filament::Viewport const& ds } void Renderer::readPixels(uint32_t xoffset, uint32_t yoffset, uint32_t width, uint32_t height, - driver::PixelBufferDescriptor&& buffer) { + backend::PixelBufferDescriptor&& buffer) { upcast(this)->readPixels(xoffset, yoffset, width, height, std::move(buffer)); } diff --git a/filament/src/Scene.cpp b/filament/src/Scene.cpp index fdbcfaa6bc..81ba41c5fd 100644 --- a/filament/src/Scene.cpp +++ b/filament/src/Scene.cpp @@ -163,7 +163,7 @@ void FScene::prepare(const mat4f& worldOriginTransform) { } } -void FScene::updateUBOs(utils::Range visibleRenderables, driver::Handle renderableUbh) noexcept { +void FScene::updateUBOs(utils::Range visibleRenderables, backend::Handle renderableUbh) noexcept { FEngine::DriverApi& driver = mEngine.getDriverApi(); const size_t size = visibleRenderables.size() * sizeof(PerRenderableUib); @@ -207,7 +207,7 @@ void FScene::terminate(FEngine& engine) { mRenderableViewUbh.clear(); } -void FScene::prepareDynamicLights(const CameraInfo& camera, ArenaScope& rootArena, driver::Handle lightUbh) noexcept { +void FScene::prepareDynamicLights(const CameraInfo& camera, ArenaScope& rootArena, backend::Handle lightUbh) noexcept { FEngine::DriverApi& driver = mEngine.getDriverApi(); FLightManager& lcm = mEngine.getLightManager(); FScene::LightSoa& lightData = getLightData(); diff --git a/filament/src/ShadowMap.cpp b/filament/src/ShadowMap.cpp index 6b74ac792b..c9d38922e5 100644 --- a/filament/src/ShadowMap.cpp +++ b/filament/src/ShadowMap.cpp @@ -32,7 +32,7 @@ using namespace filament::math; using namespace utils; namespace filament { -using namespace driver; +using namespace backend; namespace details { diff --git a/filament/src/Stream.cpp b/filament/src/Stream.cpp index 78adb9d751..65c477c917 100644 --- a/filament/src/Stream.cpp +++ b/filament/src/Stream.cpp @@ -30,7 +30,7 @@ namespace filament { using namespace details; -using namespace driver; +using namespace backend; struct Stream::BuilderDetails { void* mStream = nullptr; @@ -115,7 +115,7 @@ void FStream::setDimensions(uint32_t width, uint32_t height) noexcept { } void FStream::readPixels(uint32_t xoffset, uint32_t yoffset, uint32_t width, uint32_t height, - driver::PixelBufferDescriptor&& buffer) noexcept { + backend::PixelBufferDescriptor&& buffer) noexcept { if (isExternalTextureId()) { // this works only on external texture id streams @@ -159,7 +159,7 @@ void Stream::setDimensions(uint32_t width, uint32_t height) noexcept { } void Stream::readPixels(uint32_t xoffset, uint32_t yoffset, uint32_t width, uint32_t height, - driver::PixelBufferDescriptor&& buffer) noexcept { + backend::PixelBufferDescriptor&& buffer) noexcept { upcast(this)->readPixels(xoffset, yoffset, width, height, std::move(buffer)); } diff --git a/filament/src/Texture.cpp b/filament/src/Texture.cpp index 0926c82d5d..05b237adc1 100644 --- a/filament/src/Texture.cpp +++ b/filament/src/Texture.cpp @@ -26,7 +26,7 @@ namespace filament { using namespace details; -using namespace driver; +using namespace backend; struct Texture::BuilderDetails { uint32_t mWidth = 1; @@ -175,7 +175,7 @@ void FTexture::setExternalStream(FEngine& engine, FStream* stream) noexcept { engine.getDriverApi().setExternalStream(mHandle, stream->getHandle()); } else { mStream = nullptr; - engine.getDriverApi().setExternalStream(mHandle, driver::Handle()); + engine.getDriverApi().setExternalStream(mHandle, backend::Handle()); } } @@ -215,11 +215,11 @@ void FTexture::generateMipmaps(FEngine& engine) const noexcept { uint8_t level = 0; uint32_t srcw = mWidth; uint32_t srch = mHeight; - driver::Handle srcrth = driver.createRenderTarget(TargetBufferFlags::COLOR, + backend::Handle srcrth = driver.createRenderTarget(TargetBufferFlags::COLOR, srcw, srch, mSampleCount, mFormat, { mHandle, level++, layer }, {}, {}); // Perform a blit for all miplevels down to 1x1. - driver::Handle dstrth; + backend::Handle dstrth; do { uint32_t dstw = std::max(srcw >> 1, 1u); uint32_t dsth = std::max(srch >> 1, 1u); diff --git a/filament/src/UniformBuffer.h b/filament/src/UniformBuffer.h index 5ae30857fd..5275062368 100644 --- a/filament/src/UniformBuffer.h +++ b/filament/src/UniformBuffer.h @@ -151,14 +151,14 @@ public: // helper functions - driver::BufferDescriptor toBufferDescriptor(driver::DriverApi& driver) const noexcept { + backend::BufferDescriptor toBufferDescriptor(backend::DriverApi& driver) const noexcept { return toBufferDescriptor(driver, 0, getSize()); } // copy the UBO data and cleans the dirty bits - driver::BufferDescriptor toBufferDescriptor( - driver::DriverApi& driver, size_t offset, size_t size) const noexcept { - driver::BufferDescriptor p; + backend::BufferDescriptor toBufferDescriptor( + backend::DriverApi& driver, size_t offset, size_t size) const noexcept { + backend::BufferDescriptor p; p.size = size; p.buffer = driver.allocate(p.size); // TODO: use out-of-line buffer if too large memcpy(p.buffer, static_cast(getBuffer()) + offset, p.size); diff --git a/filament/src/VertexBuffer.cpp b/filament/src/VertexBuffer.cpp index 89c05a4705..de3d600a00 100644 --- a/filament/src/VertexBuffer.cpp +++ b/filament/src/VertexBuffer.cpp @@ -33,7 +33,7 @@ namespace filament { using namespace details; -using namespace driver; +using namespace backend; using namespace filament::math; struct VertexBuffer::BuilderDetails { @@ -162,7 +162,7 @@ FVertexBuffer::FVertexBuffer(FEngine& engine, const VertexBuffer::Builder& build FEngine::DriverApi& driver = engine.getDriverApi(); mHandle = driver.createVertexBuffer( - mBufferCount, attributeCount, mVertexCount, attributeArray, driver::BufferUsage::STATIC); + mBufferCount, attributeCount, mVertexCount, attributeArray, backend::BufferUsage::STATIC); } void FVertexBuffer::terminate(FEngine& engine) { @@ -175,7 +175,7 @@ size_t FVertexBuffer::getVertexCount() const noexcept { } void FVertexBuffer::setBufferAt(FEngine& engine, uint8_t bufferIndex, - driver::BufferDescriptor&& buffer, uint32_t byteOffset) { + backend::BufferDescriptor&& buffer, uint32_t byteOffset) { if (bufferIndex < mBufferCount) { engine.getDriverApi().updateVertexBuffer(mHandle, bufferIndex, std::move(buffer), byteOffset); @@ -198,7 +198,7 @@ size_t VertexBuffer::getVertexCount() const noexcept { } void VertexBuffer::setBufferAt(Engine& engine, uint8_t bufferIndex, - driver::BufferDescriptor&& buffer, uint32_t byteOffset) { + backend::BufferDescriptor&& buffer, uint32_t byteOffset) { upcast(this)->setBufferAt(upcast(engine), bufferIndex, std::move(buffer), byteOffset); } diff --git a/filament/src/View.cpp b/filament/src/View.cpp index f9d85fd0e1..39fdb7dfc5 100644 --- a/filament/src/View.cpp +++ b/filament/src/View.cpp @@ -46,7 +46,7 @@ using namespace utils; namespace filament { -using namespace driver; +using namespace backend; namespace details { @@ -79,8 +79,8 @@ FView::FView(FEngine& engine) mPerViewSbh = driver.createSamplerGroup(mPerViewSb.getSize()); // allocate ubos - mPerViewUbh = driver.createUniformBuffer(mPerViewUb.getSize(), driver::BufferUsage::DYNAMIC); - mLightUbh = driver.createUniformBuffer(CONFIG_MAX_LIGHT_COUNT * sizeof(LightsUib), driver::BufferUsage::DYNAMIC); + mPerViewUbh = driver.createUniformBuffer(mPerViewUb.getSize(), backend::BufferUsage::DYNAMIC); + mLightUbh = driver.createUniformBuffer(CONFIG_MAX_LIGHT_COUNT * sizeof(LightsUib), backend::BufferUsage::DYNAMIC); mIsDynamicResolutionSupported = driver.isFrameTimeSupported(); } @@ -277,7 +277,7 @@ bool FView::isSkyboxVisible() const noexcept { return skybox != nullptr && (skybox->getLayerMask() & mVisibleLayers); } -void FView::prepareShadowing(FEngine& engine, driver::DriverApi& driver, +void FView::prepareShadowing(FEngine& engine, backend::DriverApi& driver, FScene::RenderableSoa& renderableData, FScene::LightSoa const& lightData) noexcept { SYSTRACE_CALL(); @@ -399,7 +399,7 @@ void FView::prepareLighting(FEngine& engine, FEngine::DriverApi& driver, ArenaSc } } -void FView::prepare(FEngine& engine, driver::DriverApi& driver, ArenaScope& arena, +void FView::prepare(FEngine& engine, backend::DriverApi& driver, ArenaScope& arena, filament::Viewport const& viewport, float4 const& userTime) noexcept { JobSystem& js = engine.getJobSystem(); @@ -540,7 +540,7 @@ void FView::prepare(FEngine& engine, driver::DriverApi& driver, ArenaScope& aren mRenderableUBOSize = uint32_t(count * sizeof(PerRenderableUib)); driver.destroyUniformBuffer(mRenderableUbh); mRenderableUbh = driver.createUniformBuffer(mRenderableUBOSize, - driver::BufferUsage::STREAM); + backend::BufferUsage::STREAM); } else { // TODO: should we shrink the underlying UBO at some point? } @@ -639,7 +639,7 @@ void FView::froxelize(FEngine& engine) const noexcept { } } -void FView::commitUniforms(driver::DriverApi& driver) const noexcept { +void FView::commitUniforms(backend::DriverApi& driver) const noexcept { if (mPerViewUb.isDirty()) { driver.updateUniformBuffer(mPerViewUbh, mPerViewUb.toBufferDescriptor(driver)); } @@ -649,7 +649,7 @@ void FView::commitUniforms(driver::DriverApi& driver) const noexcept { } } -void FView::commitFroxels(driver::DriverApi& driverApi) const noexcept { +void FView::commitFroxels(backend::DriverApi& driverApi) const noexcept { if (mHasDynamicLighting) { mFroxelizer.commit(driverApi); } diff --git a/filament/src/components/LightManager.cpp b/filament/src/components/LightManager.cpp index 10c3fbbcd1..65e30ef4b5 100644 --- a/filament/src/components/LightManager.cpp +++ b/filament/src/components/LightManager.cpp @@ -190,7 +190,7 @@ void FLightManager::create(const FLightManager::Builder& builder, utils::Entity } } -void FLightManager::prepare(driver::DriverApi& driver) const noexcept { +void FLightManager::prepare(backend::DriverApi& driver) const noexcept { } void FLightManager::destroy(utils::Entity e) noexcept { diff --git a/filament/src/components/LightManager.h b/filament/src/components/LightManager.h index 4dc8df05db..0b132a64c1 100644 --- a/filament/src/components/LightManager.h +++ b/filament/src/components/LightManager.h @@ -57,7 +57,7 @@ public: void destroy(utils::Entity e) noexcept; - void prepare(driver::DriverApi& driver) const noexcept; + void prepare(backend::DriverApi& driver) const noexcept; void gc(utils::EntityManager& em) noexcept { mManager.gc(em); diff --git a/filament/src/components/RenderableManager.cpp b/filament/src/components/RenderableManager.cpp index 7db37fee23..bfea47b184 100644 --- a/filament/src/components/RenderableManager.cpp +++ b/filament/src/components/RenderableManager.cpp @@ -294,7 +294,7 @@ void FRenderableManager::create( // large block of bones. bones = std::unique_ptr(new Bones{ driver.createUniformBuffer(CONFIG_MAX_BONE_COUNT * sizeof(PerRenderableUibBone), - driver::BufferUsage::DYNAMIC), + backend::BufferUsage::DYNAMIC), UniformBuffer{ count * sizeof(PerRenderableUibBone) }, count }); @@ -367,7 +367,7 @@ void FRenderableManager::destroyComponentPrimitives( void FRenderableManager::prepare( - driver::DriverApi& UTILS_RESTRICT driver, + backend::DriverApi& UTILS_RESTRICT driver, Instance const* UTILS_RESTRICT instances, utils::Range list) const noexcept { auto& manager = mManager; diff --git a/filament/src/components/RenderableManager.h b/filament/src/components/RenderableManager.h index 826fdaa14f..fdbbdb68a4 100644 --- a/filament/src/components/RenderableManager.h +++ b/filament/src/components/RenderableManager.h @@ -79,7 +79,7 @@ public: // - instances is a list of Instance (typically the list from a given scene) // - list is a list of index in 'instances' (typically the visible ones) - void prepare(driver::DriverApi& driver, + void prepare(backend::DriverApi& driver, RenderableManager::Instance const* instances, utils::Range list) const noexcept; @@ -115,7 +115,7 @@ public: inline uint8_t getLayerMask(Instance instance) const noexcept; inline uint8_t getPriority(Instance instance) const noexcept; - inline driver::Handle getBonesUbh(Instance instance) const noexcept; + inline backend::Handle getBonesUbh(Instance instance) const noexcept; inline size_t getLevelCount(Instance instance) const noexcept { return 1; } @@ -139,7 +139,7 @@ private: utils::Slice& primitives) noexcept; struct Bones { - filament::driver::Handle handle; + filament::backend::Handle handle; UniformBuffer bones; size_t count; }; @@ -289,9 +289,9 @@ Box const& FRenderableManager::getAABB(Instance instance) const noexcept { return mManager[instance].aabb; } -driver::Handle FRenderableManager::getBonesUbh(Instance instance) const noexcept { +backend::Handle FRenderableManager::getBonesUbh(Instance instance) const noexcept { std::unique_ptr const& bones = mManager[instance].bones; - return bones ? bones->handle : driver::Handle{}; + return bones ? bones->handle : backend::Handle{}; } utils::Slice const& FRenderableManager::getRenderPrimitives( diff --git a/filament/src/details/DFG.h b/filament/src/details/DFG.h index 62582ff858..886f4d7ef8 100644 --- a/filament/src/details/DFG.h +++ b/filament/src/details/DFG.h @@ -41,7 +41,7 @@ public: return mLUT != nullptr; } - driver::Handle getTexture() const noexcept { + backend::Handle getTexture() const noexcept { return mLUT->getHwHandle(); } diff --git a/filament/src/details/Engine.h b/filament/src/details/Engine.h index 90fe6bef7d..deb78340ae 100644 --- a/filament/src/details/Engine.h +++ b/filament/src/details/Engine.h @@ -65,7 +65,7 @@ class Renderer; class MaterialParser; -namespace driver { +namespace backend { class Driver; class Program; @@ -99,7 +99,7 @@ public: utils::aligned_free(p); } - using DriverApi = driver::DriverApi; + using DriverApi = backend::DriverApi; using clock = std::chrono::steady_clock; using Epoch = clock::time_point; using duration = clock::duration; @@ -121,7 +121,7 @@ public: ~FEngine() noexcept; - driver::Driver& getDriver() const noexcept { return *mDriver; } + backend::Driver& getDriver() const noexcept { return *mDriver; } DriverApi& getDriverApi() noexcept { return mCommandStream; } DFG* getDFG() const noexcept { return mDFG.get(); } @@ -137,16 +137,16 @@ public: const FMaterial* getSkyboxMaterial(bool rgbm) const noexcept; const FIndirectLight* getDefaultIndirectLight() const noexcept { return mDefaultIbl; } - driver::Handle getPostProcessProgramSlow(PostProcessStage stage) const noexcept; - driver::Handle getPostProcessProgram(PostProcessStage stage) const noexcept { - driver::Handle program = mPostProcessPrograms[uint8_t(stage)]; + backend::Handle getPostProcessProgramSlow(PostProcessStage stage) const noexcept; + backend::Handle getPostProcessProgram(PostProcessStage stage) const noexcept { + backend::Handle program = mPostProcessPrograms[uint8_t(stage)]; if (UTILS_UNLIKELY(!program)) { return getPostProcessProgramSlow(stage); } return program; } - driver::Handle getFullScreenRenderPrimitive() const noexcept { + backend::Handle getFullScreenRenderPrimitive() const noexcept { return mFullScreenTriangleRph; } @@ -273,7 +273,7 @@ private: void init(); int loop(); - void flushCommandBuffer(driver::CommandBufferQueue& commandBufferQueue); + void flushCommandBuffer(backend::CommandBufferQueue& commandBufferQueue); template void terminateAndDestroy(const T* p, ResourceList& list); @@ -281,17 +281,17 @@ private: template void cleanupResourceList(ResourceList& list); - driver::Handle createPostProcessProgram(MaterialParser& parser, - driver::ShaderModel model, PostProcessStage stage) const noexcept; + backend::Handle createPostProcessProgram(MaterialParser& parser, + backend::ShaderModel model, PostProcessStage stage) const noexcept; - driver::Driver* mDriver = nullptr; + backend::Driver* mDriver = nullptr; Backend mBackend; Platform* mPlatform = nullptr; bool mOwnPlatform = false; void* mSharedGLContext = nullptr; bool mTerminated = false; - driver::Handle mFullScreenTriangleRph; + backend::Handle mFullScreenTriangleRph; FVertexBuffer* mFullScreenTriangleVb = nullptr; FIndexBuffer* mFullScreenTriangleIb = nullptr; @@ -324,7 +324,7 @@ private: std::unique_ptr mDFG; std::thread mDriverThread; - driver::CommandBufferQueue mCommandBufferQueue; + backend::CommandBufferQueue mCommandBufferQueue; DriverApi mCommandStream; LinearAllocatorArena mPerRenderPassAllocator; @@ -340,7 +340,7 @@ private: mutable FTexture* mDefaultIblTexture = nullptr; mutable FIndirectLight* mDefaultIbl = nullptr; - mutable driver::Handle mPostProcessPrograms[POST_PROCESS_STAGES_COUNT]; + mutable backend::Handle mPostProcessPrograms[POST_PROCESS_STAGES_COUNT]; mutable std::unique_ptr mPostProcessParser; mutable utils::CountDownLatch mDriverBarrier; diff --git a/filament/src/details/Fence.h b/filament/src/details/Fence.h index 5c2c9b17c9..273ccc15f4 100644 --- a/filament/src/details/Fence.h +++ b/filament/src/details/Fence.h @@ -63,7 +63,7 @@ private: }; FEngine& mEngine; - driver::Handle mFenceHandle; + backend::Handle mFenceHandle; // TODO: use custom allocator for these small objects std::shared_ptr mFenceSignal; }; diff --git a/filament/src/details/Froxelizer.h b/filament/src/details/Froxelizer.h index ac3a401365..618c4fee48 100644 --- a/filament/src/details/Froxelizer.h +++ b/filament/src/details/Froxelizer.h @@ -91,7 +91,7 @@ public: explicit Froxelizer(FEngine& engine); ~Froxelizer(); - void terminate(driver::DriverApi& driverApi) noexcept; + void terminate(backend::DriverApi& driverApi) noexcept; // gpu buffer containing records. valid after construction. GPUBuffer const& getRecordBuffer() const noexcept { return mRecordsBuffer; } @@ -113,7 +113,7 @@ public: * * return true if updateUniforms() needs to be called */ - bool prepare(driver::DriverApi& driverApi, ArenaScope& arena, Viewport const& viewport, + bool prepare(backend::DriverApi& driverApi, ArenaScope& arena, Viewport const& viewport, const math::mat4f& projection, float projectionNear, float projectionFar) noexcept; Froxel getFroxelAt(size_t x, size_t y, size_t z) const noexcept; @@ -135,7 +135,7 @@ public: } // send froxel data to GPU - void commit(driver::DriverApi& driverApi); + void commit(backend::DriverApi& driverApi); /* diff --git a/filament/src/details/IndexBuffer.h b/filament/src/details/IndexBuffer.h index 967afad6b3..ec8552ad7b 100644 --- a/filament/src/details/IndexBuffer.h +++ b/filament/src/details/IndexBuffer.h @@ -37,7 +37,7 @@ public: // frees driver resources, object becomes invalid void terminate(FEngine& engine); - driver::Handle getHwHandle() const noexcept { return mHandle; } + backend::Handle getHwHandle() const noexcept { return mHandle; } size_t getIndexCount() const noexcept { return mIndexCount; } @@ -45,7 +45,7 @@ public: private: friend class IndexBuffer; - driver::Handle mHandle; + backend::Handle mHandle; uint32_t mIndexCount; }; diff --git a/filament/src/details/IndirectLight.h b/filament/src/details/IndirectLight.h index c12fa5f2de..7f688afa8e 100644 --- a/filament/src/details/IndirectLight.h +++ b/filament/src/details/IndirectLight.h @@ -40,8 +40,8 @@ public: void terminate(FEngine& engine); - driver::Handle getReflectionMap() const noexcept { return mReflectionsMapHandle; } - driver::Handle getIrradianceMap() const noexcept { return mIrradianceMapHandle; } + backend::Handle getReflectionMap() const noexcept { return mReflectionsMapHandle; } + backend::Handle getIrradianceMap() const noexcept { return mIrradianceMapHandle; } math::float3 const* getSH() const noexcept{ return mIrradianceCoefs.data(); } float getIntensity() const noexcept { return mIntensity; } void setIntensity(float intensity) noexcept { mIntensity = intensity; } @@ -49,8 +49,8 @@ public: const math::mat3f& getRotation() const { return mRotation; } private: - driver::Handle mReflectionsMapHandle; - driver::Handle mIrradianceMapHandle; + backend::Handle mReflectionsMapHandle; + backend::Handle mIrradianceMapHandle; std::array mIrradianceCoefs; float mIntensity = DEFAULT_INTENSITY; math::mat3f mRotation; diff --git a/filament/src/details/Material.h b/filament/src/details/Material.h index 3695d239e6..2873523cd4 100644 --- a/filament/src/details/Material.h +++ b/filament/src/details/Material.h @@ -73,20 +73,20 @@ public: FEngine& getEngine() const noexcept { return mEngine; } - driver::Handle getProgramSlow(uint8_t variantKey) const noexcept; - driver::Handle getProgram(uint8_t variantKey) const noexcept { + backend::Handle getProgramSlow(uint8_t variantKey) const noexcept; + backend::Handle getProgram(uint8_t variantKey) const noexcept { // filterVariant() has already been applied in generateCommands(), shouldn't be needed here assert( variantKey == Variant::filterVariant(variantKey, isVariantLit()) ); - driver::Handle const entry = mCachedPrograms[variantKey]; + backend::Handle const entry = mCachedPrograms[variantKey]; return UTILS_LIKELY(entry) ? entry : getProgramSlow(variantKey); } bool isVariantLit() const noexcept { return mIsVariantLit; } const utils::CString& getName() const noexcept { return mName; } - driver::RasterState getRasterState() const noexcept { return mRasterState; } + backend::RasterState getRasterState() const noexcept { return mRasterState; } uint32_t getId() const noexcept { return mMaterialId; } Shading getShading() const noexcept { return mShading; } @@ -99,7 +99,7 @@ public: bool isColorWriteEnabled() const noexcept { return mRasterState.colorWrite; } bool isDepthWriteEnabled() const noexcept { return mRasterState.depthWrite; } bool isDepthCullingEnabled() const noexcept { - return mRasterState.depthFunc != driver::RasterState::DepthFunc::A; + return mRasterState.depthFunc != backend::RasterState::DepthFunc::A; } bool isDoubleSided() const noexcept { return mDoubleSided; } float getMaskThreshold() const noexcept { return mMaskThreshold; } @@ -116,9 +116,9 @@ public: private: // try to order by frequency of use - mutable std::array, VARIANT_COUNT> mCachedPrograms; + mutable std::array, VARIANT_COUNT> mCachedPrograms; - driver::RasterState mRasterState; + backend::RasterState mRasterState; BlendingMode mRenderBlendingMode; TransparencyMode mTransparencyMode; bool mIsVariantLit; diff --git a/filament/src/details/MaterialInstance.h b/filament/src/details/MaterialInstance.h index 94d352c887..6fe1002cbe 100644 --- a/filament/src/details/MaterialInstance.h +++ b/filament/src/details/MaterialInstance.h @@ -74,7 +74,7 @@ public: uint64_t getSortingKey() const noexcept { return mMaterialSortingKey; } UniformBuffer const& getUniformBuffer() const noexcept { return mUniforms; } - driver::SamplerGroup const& getSamplerGroup() const noexcept { return mSamplers; } + backend::SamplerGroup const& getSamplerGroup() const noexcept { return mSamplers; } void setScissor(int32_t left, int32_t bottom, uint32_t width, uint32_t height) noexcept { mScissorRect = { left, bottom, @@ -94,7 +94,7 @@ public: mPolygonOffset = { scale, constant }; } - driver::PolygonOffset getPolygonOffset() const noexcept { return mPolygonOffset; } + backend::PolygonOffset getPolygonOffset() const noexcept { return mPolygonOffset; } private: friend class FMaterial; @@ -107,17 +107,17 @@ private: // keep these grouped, they're accessed together in the render-loop FMaterial const* mMaterial = nullptr; - driver::Handle mUbHandle; - driver::Handle mSbHandle; + backend::Handle mUbHandle; + backend::Handle mSbHandle; UniformBuffer mUniforms; - driver::SamplerGroup mSamplers; - driver::PolygonOffset mPolygonOffset; + backend::SamplerGroup mSamplers; + backend::PolygonOffset mPolygonOffset; uint64_t mMaterialSortingKey = 0; // Scissor rectangle is specified as: Left Bottom Width Height. - driver::Viewport mScissorRect = { 0, 0, + backend::Viewport mScissorRect = { 0, 0, (uint32_t)std::numeric_limits::max(), (uint32_t)std::numeric_limits::max() }; diff --git a/filament/src/details/RenderPrimitive.h b/filament/src/details/RenderPrimitive.h index 768d039521..e01ed19bbd 100644 --- a/filament/src/details/RenderPrimitive.h +++ b/filament/src/details/RenderPrimitive.h @@ -37,7 +37,7 @@ class FRenderPrimitive { public: FRenderPrimitive() noexcept = default; - void init(driver::DriverApi& driver, const RenderableManager::Builder::Entry& entry) noexcept; + void init(backend::DriverApi& driver, const RenderableManager::Builder::Entry& entry) noexcept; void set(FEngine& engine, RenderableManager::PrimitiveType type, FVertexBuffer* vertices, FIndexBuffer* indices, size_t offset, @@ -50,8 +50,8 @@ public: void terminate(FEngine& engine); const FMaterialInstance* getMaterialInstance() const noexcept { return mMaterialInstance; } - driver::Handle getHwHandle() const noexcept { return mHandle; } - driver::PrimitiveType getPrimitiveType() const noexcept { return mPrimitiveType; } + backend::Handle getHwHandle() const noexcept { return mHandle; } + backend::PrimitiveType getPrimitiveType() const noexcept { return mPrimitiveType; } AttributeBitset getEnabledAttributes() const noexcept { return mEnabledAttributes; } uint16_t getBlendOrder() const noexcept { return mBlendOrder; } @@ -62,8 +62,8 @@ public: private: FMaterialInstance const* mMaterialInstance = nullptr; - driver::Handle mHandle; - driver::PrimitiveType mPrimitiveType = driver::PrimitiveType::NONE; + backend::Handle mHandle; + backend::PrimitiveType mPrimitiveType = backend::PrimitiveType::NONE; AttributeBitset mEnabledAttributes; uint16_t mBlendOrder = 0; }; diff --git a/filament/src/details/Renderer.h b/filament/src/details/Renderer.h index 905eb807f5..58b7bf192b 100644 --- a/filament/src/details/Renderer.h +++ b/filament/src/details/Renderer.h @@ -39,9 +39,9 @@ namespace filament { -namespace driver { +namespace backend { class Driver; -} // namespace driver +} // namespace backend class View; @@ -78,7 +78,7 @@ public: void resetUserTime(); void readPixels(uint32_t xoffset, uint32_t yoffset, uint32_t width, uint32_t height, - driver::PixelBufferDescriptor&& buffer); + backend::PixelBufferDescriptor&& buffer); // Clean-up everything, this is typically called when the client calls Engine::destroyRenderer() void terminate(FEngine& engine); @@ -89,28 +89,28 @@ private: // this class is defined in RenderPass.cpp class ColorPass final : public RenderPass { - using DriverApi = driver::DriverApi; + using DriverApi = backend::DriverApi; utils::JobSystem& js; utils::JobSystem::Job* jobFroxelize = nullptr; FView const& view; - driver::Handle const rth; - void beginRenderPass(driver::DriverApi& driver, Viewport const& viewport, const CameraInfo& camera) noexcept override; + backend::Handle const rth; + void beginRenderPass(backend::DriverApi& driver, Viewport const& viewport, const CameraInfo& camera) noexcept override; void endRenderPass(DriverApi& driver, Viewport const& viewport) noexcept override; public: ColorPass(const char* name, utils::JobSystem& js, utils::JobSystem::Job* jobFroxelize, - FView& view, driver::Handle rth); + FView& view, backend::Handle rth); static void renderColorPass(FEngine& engine, utils::JobSystem& js, utils::JobSystem::Job* sync, - driver::Handle rth, + backend::Handle rth, FView& view, Viewport const& scaledViewport, utils::GrowingSlice& commands) noexcept; }; // this class is defined in RenderPass.cpp class ShadowPass final : public RenderPass { - using DriverApi = driver::DriverApi; + using DriverApi = backend::DriverApi; ShadowMap const& shadowMap; - void beginRenderPass(driver::DriverApi& driver, Viewport const& viewport, const CameraInfo& camera) noexcept override; + void beginRenderPass(backend::DriverApi& driver, Viewport const& viewport, const CameraInfo& camera) noexcept override; void endRenderPass(DriverApi& driver, Viewport const& viewport) noexcept override; public: ShadowPass(const char* name, ShadowMap const& shadowMap) noexcept; @@ -118,7 +118,7 @@ private: FView& view, utils::GrowingSlice& commands) noexcept; }; - driver::Handle getRenderTarget() const noexcept { return mRenderTarget; } + backend::Handle getRenderTarget() const noexcept { return mRenderTarget; } void recordHighWatermark(utils::Slice const& commands) noexcept { #ifndef NDEBUG @@ -130,8 +130,8 @@ private: return mCommandsHighWatermark * sizeof(RenderPass::Command); } - driver::TextureFormat getHdrFormat(const View& view) const noexcept; - driver::TextureFormat getLdrFormat() const noexcept; + backend::TextureFormat getHdrFormat(const View& view) const noexcept; + backend::TextureFormat getLdrFormat() const noexcept; using clock = std::chrono::steady_clock; using Epoch = clock::time_point; @@ -145,7 +145,7 @@ private: // keep a reference to our engine FEngine& mEngine; FrameSkipper mFrameSkipper; - driver::Handle mRenderTarget; + backend::Handle mRenderTarget; FSwapChain* mSwapChain = nullptr; size_t mCommandsHighWatermark = 0; uint32_t mFrameId = 0; diff --git a/filament/src/details/Scene.h b/filament/src/details/Scene.h index cbfe77aad8..dd4b334e14 100644 --- a/filament/src/details/Scene.h +++ b/filament/src/details/Scene.h @@ -83,11 +83,11 @@ public: void terminate(FEngine& engine); void prepare(const math::mat4f& worldOriginTransform); - void prepareDynamicLights(const CameraInfo& camera, ArenaScope& arena, driver::Handle lightUbh) noexcept; + void prepareDynamicLights(const CameraInfo& camera, ArenaScope& arena, backend::Handle lightUbh) noexcept; void computeBounds(Aabb& castersBox, Aabb& receiversBox, uint32_t visibleLayers) const noexcept; - filament::driver::Handle getRenderableUBO() const noexcept { + filament::backend::Handle getRenderableUBO() const noexcept { return mRenderableViewUbh; } @@ -116,7 +116,7 @@ public: utils::EntityInstance, math::mat4f, FRenderableManager::Visibility, - driver::Handle, + backend::Handle, math::float3, Culler::result_type, uint8_t, @@ -163,7 +163,7 @@ public: LightSoa const& getLightData() const noexcept { return mLightData; } LightSoa& getLightData() noexcept { return mLightData; } - void updateUBOs(utils::Range visibleRenderables, driver::Handle renderableUbh) noexcept; + void updateUBOs(utils::Range visibleRenderables, backend::Handle renderableUbh) noexcept; private: static inline void computeLightRanges(math::float2* zrange, @@ -192,7 +192,7 @@ private: */ RenderableSoa mRenderableData; LightSoa mLightData; - driver::Handle mRenderableViewUbh; // This is actually owned by the view. + backend::Handle mRenderableViewUbh; // This is actually owned by the view. }; FILAMENT_UPCAST(Scene) diff --git a/filament/src/details/ShadowMap.h b/filament/src/details/ShadowMap.h index 5ef33b9e7c..6ca39547b7 100644 --- a/filament/src/details/ShadowMap.h +++ b/filament/src/details/ShadowMap.h @@ -38,7 +38,7 @@ public: explicit ShadowMap(FEngine& engine) noexcept; ~ShadowMap(); - void terminate(driver::DriverApi& driverApi) noexcept; + void terminate(backend::DriverApi& driverApi) noexcept; // Call once per frame if the light, scene (or visible layers) or camera changes. // This computes the light's camera. @@ -50,7 +50,7 @@ public: bool hasVisibleShadows() const noexcept { return mHasVisibleShadows; } // Allocates shadow texture based on user parameters (e.g. dimensions) - void prepare(driver::DriverApi& driver, driver::SamplerGroup& buffer) noexcept; + void prepare(backend::DriverApi& driver, backend::SamplerGroup& buffer) noexcept; // Returns the shadow map's viewport. Valid after prepare(). Viewport const& getViewport() const noexcept { return mViewport; } @@ -69,7 +69,7 @@ public: FCamera const& getCamera() const noexcept { return *mCamera; } // Set-up the render target, call before rendering the shadow map. - void beginRenderPass(driver::DriverApi& driverApi) const noexcept; + void beginRenderPass(backend::DriverApi& driverApi) const noexcept; // use only for debugging FCamera const& getDebugCamera() const noexcept { return *mDebugCamera; } @@ -175,8 +175,8 @@ private: // set-up in prepare() Viewport mViewport; - driver::Handle mShadowMapHandle; - driver::Handle mShadowMapRenderTarget; + backend::Handle mShadowMapHandle; + backend::Handle mShadowMapRenderTarget; // set-up in update() uint32_t mShadowMapDimension = 0; diff --git a/filament/src/details/Stream.h b/filament/src/details/Stream.h index a5756203ec..4b3ee84789 100644 --- a/filament/src/details/Stream.h +++ b/filament/src/details/Stream.h @@ -38,12 +38,12 @@ public: FStream(FEngine& engine, const Builder& builder) noexcept; void terminate(FEngine& engine) noexcept; - driver::Handle getHandle() const noexcept { return mStreamHandle; } + backend::Handle getHandle() const noexcept { return mStreamHandle; } void setDimensions(uint32_t width, uint32_t height) noexcept; void readPixels(uint32_t xoffset, uint32_t yoffset, uint32_t width, uint32_t height, - driver::PixelBufferDescriptor&& buffer) noexcept; + backend::PixelBufferDescriptor&& buffer) noexcept; bool isNativeStream() const noexcept { return mNativeStream != nullptr; } @@ -57,7 +57,7 @@ public: private: FEngine& mEngine; - driver::Handle mStreamHandle; + backend::Handle mStreamHandle; void* mNativeStream = nullptr; intptr_t mExternalTextureId; uint32_t mWidth; diff --git a/filament/src/details/SwapChain.h b/filament/src/details/SwapChain.h index 897c694755..b7d2781d8b 100644 --- a/filament/src/details/SwapChain.h +++ b/filament/src/details/SwapChain.h @@ -35,11 +35,11 @@ public: FSwapChain(FEngine& engine, void* nativeWindow, uint64_t flags); void terminate(FEngine& engine) noexcept; - void makeCurrent(driver::DriverApi& driverApi) noexcept { + void makeCurrent(backend::DriverApi& driverApi) noexcept { driverApi.makeCurrent(mSwapChain, mSwapChain); } - void commit(driver::DriverApi& driverApi) noexcept { + void commit(backend::DriverApi& driverApi) noexcept { driverApi.commit(mSwapChain); } @@ -55,12 +55,12 @@ public: return (mConfigFlags & CONFIG_READABLE) != 0; } - driver::Handle getHwHandle() const noexcept { + backend::Handle getHwHandle() const noexcept { return mSwapChain; } private: - driver::Handle mSwapChain; + backend::Handle mSwapChain; void* mNativeWindow = nullptr; uint64_t mConfigFlags = 0; }; diff --git a/filament/src/details/Texture.h b/filament/src/details/Texture.h index 206413748e..147008be69 100644 --- a/filament/src/details/Texture.h +++ b/filament/src/details/Texture.h @@ -42,7 +42,7 @@ public: // frees driver resources, object becomes invalid void terminate(FEngine& engine); - driver::Handle getHwHandle() const noexcept { return mHandle; } + backend::Handle getHwHandle() const noexcept { return mHandle; } size_t getWidth(size_t level = 0) const noexcept; size_t getHeight(size_t level = 0) const noexcept; @@ -76,7 +76,7 @@ public: private: friend class Texture; - driver::Handle mHandle; + backend::Handle mHandle; uint32_t mWidth = 1; uint32_t mHeight = 1; uint32_t mDepth = 1; diff --git a/filament/src/details/VertexBuffer.h b/filament/src/details/VertexBuffer.h index 679af54778..897e53b8af 100644 --- a/filament/src/details/VertexBuffer.h +++ b/filament/src/details/VertexBuffer.h @@ -42,7 +42,7 @@ public: // frees driver resources, object becomes invalid void terminate(FEngine& engine); - driver::Handle getHwHandle() const noexcept { return mHandle; } + backend::Handle getHwHandle() const noexcept { return mHandle; } size_t getVertexCount() const noexcept; @@ -52,17 +52,17 @@ public: // no-op if bufferIndex out of range void setBufferAt(FEngine& engine, uint8_t bufferIndex, - driver::BufferDescriptor&& buffer, uint32_t byteOffset = 0); + backend::BufferDescriptor&& buffer, uint32_t byteOffset = 0); private: friend class VertexBuffer; - struct AttributeData : driver::Attribute { - AttributeData() : driver::Attribute{ .type = driver::ElementType::FLOAT4 } {} + struct AttributeData : backend::Attribute { + AttributeData() : backend::Attribute{ .type = backend::ElementType::FLOAT4 } {} }; - driver::Handle mHandle; - std::array mAttributes; + backend::Handle mHandle; + std::array mAttributes; AttributeBitset mDeclaredAttributes; uint32_t mVertexCount = 0; uint8_t mBufferCount = 0; diff --git a/filament/src/details/View.h b/filament/src/details/View.h index cc130139bd..81d27e406f 100644 --- a/filament/src/details/View.h +++ b/filament/src/details/View.h @@ -61,7 +61,7 @@ public: void terminate(FEngine& engine); - void prepare(FEngine& engine, driver::DriverApi& driver, ArenaScope& arena, + void prepare(FEngine& engine, backend::DriverApi& driver, ArenaScope& arena, Viewport const& viewport, math::float4 const& userTime) noexcept; void setScene(FScene* scene) { mScene = scene; } @@ -118,13 +118,13 @@ public: } void prepareCamera(const CameraInfo& camera, const Viewport& viewport) const noexcept; - void prepareShadowing(FEngine& engine, driver::DriverApi& driver, + void prepareShadowing(FEngine& engine, backend::DriverApi& driver, FScene::RenderableSoa& renderableData, FScene::LightSoa const& lightData) noexcept; void prepareLighting( FEngine& engine, FEngine::DriverApi& driver, ArenaScope& arena, Viewport const& viewport) noexcept; void froxelize(FEngine& engine) const noexcept; - void commitUniforms(driver::DriverApi& driver) const noexcept; - void commitFroxels(driver::DriverApi& driverApi) const noexcept; + void commitUniforms(backend::DriverApi& driver) const noexcept; + void commitFroxels(backend::DriverApi& driverApi) const noexcept; bool hasDirectionalLight() const noexcept { return mHasDirectionalLight; } bool hasDynamicLighting() const noexcept { return mHasDynamicLighting; } @@ -266,14 +266,14 @@ private: FScene::RenderableSoa::iterator begin, FScene::RenderableSoa::iterator end, uint8_t mask) noexcept; // these are accessed in the render loop, keep together - driver::Handle mPerViewSbh; - driver::Handle mPerViewUbh; - driver::Handle mLightUbh; - driver::Handle mRenderableUbh; + backend::Handle mPerViewSbh; + backend::Handle mPerViewUbh; + backend::Handle mLightUbh; + backend::Handle mRenderableUbh; - driver::Handle getUsh() const noexcept { return mPerViewSbh; } - driver::Handle getUbh() const noexcept { return mPerViewUbh; } - driver::Handle getLightUbh() const noexcept { return mLightUbh; } + backend::Handle getUsh() const noexcept { return mPerViewSbh; } + backend::Handle getUbh() const noexcept { return mPerViewUbh; } + backend::Handle getLightUbh() const noexcept { return mLightUbh; } FScene* mScene = nullptr; FCamera* mCullingCamera = nullptr; @@ -313,7 +313,7 @@ private: RenderQuality mRenderQuality; mutable UniformBuffer mPerViewUb; - mutable driver::SamplerGroup mPerViewSb; + mutable backend::SamplerGroup mPerViewSb; utils::CString mName; diff --git a/filament/src/fg/FrameGraph.cpp b/filament/src/fg/FrameGraph.cpp index 2f6d9e13e9..625a7e9935 100644 --- a/filament/src/fg/FrameGraph.cpp +++ b/filament/src/fg/FrameGraph.cpp @@ -32,7 +32,7 @@ using namespace utils; namespace filament { -using namespace driver; +using namespace backend; using namespace fg; // ------------------------------------------------------------------------------------------------ @@ -88,7 +88,7 @@ struct Resource final : public VirtualResource { // 72 uint32_t refs = 0; // final reference count // set during execute(), as needed - driver::Handle texture; + backend::Handle texture; }; struct ResourceNode { // 24 @@ -152,7 +152,7 @@ struct RenderTargetResource final : public VirtualResource { // 104 // devirtualize our texture handles. By this point these handles have been // remapped to their alias if any. - driver::Handle textures[FrameGraphRenderTarget::Attachments::COUNT]; + backend::Handle textures[FrameGraphRenderTarget::Attachments::COUNT]; for (size_t i = 0, c = desc.attachments.textures.size(); i < c; i++) { FrameGraphResource r = desc.attachments.textures[i]; if (r.isValid()) { @@ -223,7 +223,7 @@ struct RenderTarget { // 32 uint32_t width = 0; uint32_t height = 0; TextureFormat colorFormat = {}; - driver::Handle textures[FrameGraphRenderTarget::Attachments::COUNT]; + backend::Handle textures[FrameGraphRenderTarget::Attachments::COUNT]; static constexpr TargetBufferFlags flags[] = { TargetBufferFlags::COLOR, @@ -561,7 +561,7 @@ FrameGraphPassResources::FrameGraphPassResources(FrameGraph& fg, fg::PassNode co : mFrameGraph(fg), mPass(pass) { } -driver::Handle FrameGraphPassResources::getTexture(FrameGraphResource r) const noexcept { +backend::Handle FrameGraphPassResources::getTexture(FrameGraphResource r) const noexcept { Resource const* const pResource = mFrameGraph.mResourceNodes[r.index].resource; assert(pResource); @@ -751,7 +751,7 @@ bool FrameGraph::equals(FrameGraphRenderTarget::Descriptor const& lhs, FrameGraphResource FrameGraph::importResource(const char* name, FrameGraphRenderTarget::Descriptor descriptor, - driver::Handle target, uint32_t width, uint32_t height, + backend::Handle target, uint32_t width, uint32_t height, TargetBufferFlags discardStart, TargetBufferFlags discardEnd) { // TODO: for now we don't allow imported targets to specify textures @@ -782,7 +782,7 @@ FrameGraphResource FrameGraph::importResource(const char* name, FrameGraphResource FrameGraph::importResource( const char* name, FrameGraphResource::Descriptor const& descriptor, - driver::Handle color) { + backend::Handle color) { Resource* resource = createResource(name, descriptor, true); resource->texture = color; return createResourceNode(resource); diff --git a/filament/src/fg/FrameGraph.h b/filament/src/fg/FrameGraph.h index ad3bf75778..38beb3b486 100644 --- a/filament/src/fg/FrameGraph.h +++ b/filament/src/fg/FrameGraph.h @@ -84,11 +84,11 @@ public: Attachments useRenderTarget(const char* name, FrameGraphRenderTarget::Descriptor const& desc, - driver::TargetBufferFlags clearFlags = {}) noexcept; + backend::TargetBufferFlags clearFlags = {}) noexcept; // helper for single color attachment Attachments useRenderTarget(FrameGraphResource texture, - driver::TargetBufferFlags clearFlags = {}) noexcept; + backend::TargetBufferFlags clearFlags = {}) noexcept; // Declare that this pass has side effects outside the framegraph (i.e. it can't be culled) // Calling write() on an imported resource automatically adds a side-effect. @@ -157,14 +157,14 @@ public: // Import a write-only render target from outside the framegraph and returns a handle to it. FrameGraphResource importResource(const char* name, FrameGraphRenderTarget::Descriptor descriptor, - driver::Handle target, uint32_t width, uint32_t height, - driver::TargetBufferFlags discardStart = driver::TargetBufferFlags::NONE, - driver::TargetBufferFlags discardEnd = driver::TargetBufferFlags::NONE); + backend::Handle target, uint32_t width, uint32_t height, + backend::TargetBufferFlags discardStart = backend::TargetBufferFlags::NONE, + backend::TargetBufferFlags discardEnd = backend::TargetBufferFlags::NONE); // Import a read-only render target from outside the framegraph and returns a handle to it. FrameGraphResource importResource( const char* name, FrameGraphResource::Descriptor const& descriptor, - driver::Handle color); + backend::Handle color); // Moves the resource associated to the handle 'from' to the handle 'to'. After this call, @@ -179,7 +179,7 @@ public: FrameGraph& compile() noexcept; // execute all referenced passes - void execute(driver::DriverApi& driver) noexcept; + void execute(backend::DriverApi& driver) noexcept; // for debugging void export_graphviz(utils::io::ostream& out); diff --git a/filament/src/fg/FrameGraphPass.h b/filament/src/fg/FrameGraphPass.h index ad60e80649..c279bb9b25 100644 --- a/filament/src/fg/FrameGraphPass.h +++ b/filament/src/fg/FrameGraphPass.h @@ -32,7 +32,7 @@ class FrameGraphPassResources; class FrameGraphPassExecutor { friend class FrameGraph; - virtual void execute(FrameGraphPassResources const& resources, driver::DriverApi& driver) noexcept = 0; + virtual void execute(FrameGraphPassResources const& resources, backend::DriverApi& driver) noexcept = 0; public: FrameGraphPassExecutor(); virtual ~FrameGraphPassExecutor(); @@ -51,7 +51,7 @@ class FrameGraphPass final : private FrameGraphPassExecutor { explicit FrameGraphPass(Execute&& execute) noexcept : FrameGraphPassExecutor(), mExecute(std::forward(execute)) { } - void execute(FrameGraphPassResources const& resources, driver::DriverApi& driver) noexcept final { + void execute(FrameGraphPassResources const& resources, backend::DriverApi& driver) noexcept final { mExecute(resources, mData, driver); } Execute mExecute; diff --git a/filament/src/fg/FrameGraphPassResources.h b/filament/src/fg/FrameGraphPassResources.h index 9514a5ddcf..df8063783e 100644 --- a/filament/src/fg/FrameGraphPassResources.h +++ b/filament/src/fg/FrameGraphPassResources.h @@ -35,11 +35,11 @@ class FrameGraphPassResources { public: struct RenderTargetInfo { - driver::Handle target; - driver::RenderPassParams params; + backend::Handle target; + backend::RenderPassParams params; }; - driver::Handle getTexture(FrameGraphResource r) const noexcept; + backend::Handle getTexture(FrameGraphResource r) const noexcept; RenderTargetInfo getRenderTarget(FrameGraphResource r) const noexcept; diff --git a/filament/src/fg/FrameGraphResource.h b/filament/src/fg/FrameGraphResource.h index 9274ccd8da..23fbee8cd0 100644 --- a/filament/src/fg/FrameGraphResource.h +++ b/filament/src/fg/FrameGraphResource.h @@ -63,8 +63,8 @@ public: uint32_t height = 1; // height of resource in pixel uint32_t depth = 1; // # of images for 3D textures uint8_t levels = 1; // # of levels for textures - driver::SamplerType type = driver::SamplerType::SAMPLER_2D; // texture target type - driver::TextureFormat format = driver::TextureFormat::RGBA8; // resource internal format + backend::SamplerType type = backend::SamplerType::SAMPLER_2D; // texture target type + backend::TextureFormat format = backend::TextureFormat::RGBA8; // resource internal format bool relaxed = false; // dimensions can be slightly adjusted }; diff --git a/filament/test/filament_framegraph_test.cpp b/filament/test/filament_framegraph_test.cpp index 6a5d571722..12e92bc13e 100644 --- a/filament/test/filament_framegraph_test.cpp +++ b/filament/test/filament_framegraph_test.cpp @@ -24,11 +24,11 @@ #include "private/backend/CommandStream.h" using namespace filament; -using namespace driver; +using namespace backend; static CircularBuffer buffer(8192); -static Backend backend = Backend::NOOP; -static DefaultPlatform* platform = DefaultPlatform::create(&backend); +static Backend gBackend = Backend::NOOP; +static DefaultPlatform* platform = DefaultPlatform::create(&gBackend); static CommandStream driverApi(*platform->createDriver(nullptr), buffer); TEST(FrameGraphTest, SimpleRenderPass) { @@ -215,7 +215,7 @@ TEST(FrameGraphTest, SimplePassCulling) { [=, &renderPassExecuted]( FrameGraphPassResources const& resources, RenderPassData const& data, - driver::DriverApi& driver) { + backend::DriverApi& driver) { renderPassExecuted = true; auto const& rt = resources.getRenderTarget(data.output); EXPECT_TRUE(rt.target); @@ -238,7 +238,7 @@ TEST(FrameGraphTest, SimplePassCulling) { [=, &postProcessPassExecuted]( FrameGraphPassResources const& resources, PostProcessPassData const& data, - driver::DriverApi& driver) { + backend::DriverApi& driver) { postProcessPassExecuted = true; auto const& rt = resources.getRenderTarget(data.output); EXPECT_TRUE(rt.target); @@ -261,7 +261,7 @@ TEST(FrameGraphTest, SimplePassCulling) { [=, &culledPassExecuted]( FrameGraphPassResources const& resources, CulledPassData const& data, - driver::DriverApi& driver) { + backend::DriverApi& driver) { culledPassExecuted = true; }); diff --git a/libs/filabridge/include/private/filament/SamplerInterfaceBlock.h b/libs/filabridge/include/private/filament/SamplerInterfaceBlock.h index 86297be7c7..799aac1286 100644 --- a/libs/filabridge/include/private/filament/SamplerInterfaceBlock.h +++ b/libs/filabridge/include/private/filament/SamplerInterfaceBlock.h @@ -38,10 +38,10 @@ public: SamplerInterfaceBlock& operator=(SamplerInterfaceBlock&& rhs) /*noexcept*/; ~SamplerInterfaceBlock() noexcept; - using Type = driver::SamplerType; - using Format = driver::SamplerFormat; - using Precision = driver::Precision; - using SamplerParams = driver::SamplerParams; + using Type = backend::SamplerType; + using Format = backend::SamplerFormat; + using Precision = backend::Precision; + using SamplerParams = backend::SamplerParams; class Builder { public: diff --git a/libs/filabridge/include/private/filament/SibGenerator.h b/libs/filabridge/include/private/filament/SibGenerator.h index 2e5e2bd348..32f750ee1b 100644 --- a/libs/filabridge/include/private/filament/SibGenerator.h +++ b/libs/filabridge/include/private/filament/SibGenerator.h @@ -53,16 +53,16 @@ struct PostProcessSib { }; // Returns the binding point of the first sampler for the given backend API. -inline constexpr uint8_t getSamplerBindingsStart(driver::Backend api) noexcept { +inline constexpr uint8_t getSamplerBindingsStart(backend::Backend api) noexcept { switch (api) { default: - case driver::Backend::VULKAN: + case backend::Backend::VULKAN: // The Vulkan backend has single namespace for uniforms and samplers. // To avoid collision, the sampler bindings start after the last UBO binding. return filament::BindingPoints::COUNT; - case driver::Backend::OPENGL: - case driver::Backend::METAL: + case backend::Backend::OPENGL: + case backend::Backend::METAL: // Metal has a separate namespace for uniforms and samplers- collisions aren't an issue. return 0; } diff --git a/libs/filabridge/include/private/filament/UniformInterfaceBlock.h b/libs/filabridge/include/private/filament/UniformInterfaceBlock.h index e21f4bd876..fcdcecb57d 100644 --- a/libs/filabridge/include/private/filament/UniformInterfaceBlock.h +++ b/libs/filabridge/include/private/filament/UniformInterfaceBlock.h @@ -40,8 +40,8 @@ public: UniformInterfaceBlock& operator=(UniformInterfaceBlock&& rhs) /*noexcept*/; ~UniformInterfaceBlock() noexcept; - using Type = driver::UniformType; - using Precision = driver::Precision; + using Type = backend::UniformType; + using Precision = backend::Precision; class Builder { public: diff --git a/libs/filabridge/src/SamplerBindingMap.cpp b/libs/filabridge/src/SamplerBindingMap.cpp index 142fa2ef6b..e14dab8d41 100644 --- a/libs/filabridge/src/SamplerBindingMap.cpp +++ b/libs/filabridge/src/SamplerBindingMap.cpp @@ -27,7 +27,7 @@ namespace filament { void SamplerBindingMap::populate(uint8_t firstSamplerBinding, const SamplerInterfaceBlock* perMaterialSib, const char* materialName) { uint8_t offset = firstSamplerBinding; - size_t maxSamplerIndex = firstSamplerBinding + driver::MAX_SAMPLER_COUNT - 1; + size_t maxSamplerIndex = firstSamplerBinding + backend::MAX_SAMPLER_COUNT - 1; bool overflow = false; for (uint8_t blockIndex = 0; blockIndex < filament::BindingPoints::COUNT; blockIndex++) { mSamplerBlockOffsets[blockIndex] = offset; @@ -57,7 +57,7 @@ void SamplerBindingMap::populate(uint8_t firstSamplerBinding, // If an overflow occurred, go back through and list all sampler names. This is helpful to // material authors who need to understand where the samplers are coming from. if (overflow) { - utils::slog.e << "WARNING: Exceeded max sampler count of " << driver::MAX_SAMPLER_COUNT; + utils::slog.e << "WARNING: Exceeded max sampler count of " << backend::MAX_SAMPLER_COUNT; if (materialName) { utils::slog.e << " (" << materialName << ")"; } diff --git a/libs/filabridge/src/UibGenerator.cpp b/libs/filabridge/src/UibGenerator.cpp index c50bf804b2..52a643eb90 100644 --- a/libs/filabridge/src/UibGenerator.cpp +++ b/libs/filabridge/src/UibGenerator.cpp @@ -23,7 +23,7 @@ namespace filament { -using namespace driver; +using namespace backend; static_assert(sizeof(PerRenderableUib) % 256 == 0, "sizeof(Transform) should be a multiple of 256"); diff --git a/libs/filamat/include/filamat/MaterialBuilder.h b/libs/filamat/include/filamat/MaterialBuilder.h index 0fe7d3afc9..9b791f8702 100644 --- a/libs/filamat/include/filamat/MaterialBuilder.h +++ b/libs/filamat/include/filamat/MaterialBuilder.h @@ -72,7 +72,7 @@ protected: // Looks at platform and target API, then decides on shader models and output formats. void prepare(); - using ShaderModel = filament::driver::ShaderModel; + using ShaderModel = filament::backend::ShaderModel; Platform mPlatform = Platform::DESKTOP; TargetApi mTargetApi = TargetApi::OPENGL; Optimization mOptimization = Optimization::PERFORMANCE; @@ -133,11 +133,11 @@ public: using VertexDomain = filament::VertexDomain; using TransparencyMode = filament::TransparencyMode; - using UniformType = filament::driver::UniformType; - using SamplerType = filament::driver::SamplerType; - using SamplerFormat = filament::driver::SamplerFormat; - using SamplerPrecision = filament::driver::Precision; - using CullingMode = filament::driver::CullingMode; + using UniformType = filament::backend::UniformType; + using SamplerType = filament::backend::SamplerType; + using SamplerFormat = filament::backend::SamplerFormat; + using SamplerPrecision = filament::backend::Precision; + using CullingMode = filament::backend::CullingMode; // set name of this material MaterialBuilder& name(const char* name) noexcept; @@ -278,8 +278,8 @@ public: // Preview the first shader that would generated in the MaterialPackage. // This is used to run Static Code Analysis before generating a package. // Outputs the chosen shader model in the model parameter - const std::string peek(filament::driver::ShaderType type, - filament::driver::ShaderModel& model, const PropertyList& properties) noexcept; + const std::string peek(filament::backend::ShaderType type, + filament::backend::ShaderModel& model, const PropertyList& properties) noexcept; // Returns true if any of the parameter samplers is of type samplerExternal bool hasExternalSampler() const noexcept; diff --git a/libs/filamat/src/GLSLPostProcessor.cpp b/libs/filamat/src/GLSLPostProcessor.cpp index 5c081441e8..a33b517617 100644 --- a/libs/filamat/src/GLSLPostProcessor.cpp +++ b/libs/filamat/src/GLSLPostProcessor.cpp @@ -45,12 +45,12 @@ GLSLPostProcessor::GLSLPostProcessor(MaterialBuilder::Optimization optimization, GLSLPostProcessor::~GLSLPostProcessor() { } -static uint32_t shaderVersionFromModel(filament::driver::ShaderModel model) { +static uint32_t shaderVersionFromModel(filament::backend::ShaderModel model) { switch (model) { - case filament::driver::ShaderModel::UNKNOWN: - case filament::driver::ShaderModel::GL_ES_30: + case filament::backend::ShaderModel::UNKNOWN: + case filament::backend::ShaderModel::GL_ES_30: return 300; - case filament::driver::ShaderModel::GL_CORE_41: + case filament::backend::ShaderModel::GL_CORE_41: return 410; } } @@ -137,7 +137,7 @@ void SpvToMsl(const SpirvBlob* spirv, std::string* outMsl) { } bool GLSLPostProcessor::process(const std::string& inputShader, - filament::driver::ShaderType shaderType, filament::driver::ShaderModel shaderModel, + filament::backend::ShaderType shaderType, filament::backend::ShaderModel shaderModel, std::string* outputGlsl, SpirvBlob* outputSpirv, std::string* outputMsl) { // If TargetApi is Vulkan, then we need post-processing even if there's no optimization. @@ -155,7 +155,7 @@ bool GLSLPostProcessor::process(const std::string& inputShader, mSpirvOutput = outputSpirv; mMslOutput = outputMsl; - if (shaderType == filament::driver::VERTEX) { + if (shaderType == filament::backend::VERTEX) { mShLang = EShLangVertex; } else { mShLang = EShLangFragment; @@ -219,7 +219,7 @@ bool GLSLPostProcessor::process(const std::string& inputShader, } void GLSLPostProcessor::preprocessOptimization(glslang::TShader& tShader, - filament::driver::ShaderModel shaderModel) const { + filament::backend::ShaderModel shaderModel) const { using TargetApi = MaterialBuilder::TargetApi; std::string glsl; @@ -263,7 +263,7 @@ void GLSLPostProcessor::preprocessOptimization(glslang::TShader& tShader, } void GLSLPostProcessor::fullOptimization(const TShader& tShader, - filament::driver::ShaderModel shaderModel) const { + filament::backend::ShaderModel shaderModel) const { SpirvBlob spirv; // Compile GLSL to to SPIR-V @@ -304,7 +304,7 @@ void GLSLPostProcessor::fullOptimization(const TShader& tShader, // Transpile back to GLSL if (mGlslOutput) { CompilerGLSL::Options glslOptions; - glslOptions.es = shaderModel == filament::driver::ShaderModel::GL_ES_30; + glslOptions.es = shaderModel == filament::backend::ShaderModel::GL_ES_30; glslOptions.version = shaderVersionFromModel(shaderModel); glslOptions.enable_420pack_extension = glslOptions.version >= 420; glslOptions.fragment.default_float_precision = glslOptions.es ? diff --git a/libs/filamat/src/GLSLPostProcessor.h b/libs/filamat/src/GLSLPostProcessor.h index a4148ec4f6..9f96eca657 100644 --- a/libs/filamat/src/GLSLPostProcessor.h +++ b/libs/filamat/src/GLSLPostProcessor.h @@ -38,16 +38,16 @@ public: ~GLSLPostProcessor(); - bool process(const std::string& inputShader, filament::driver::ShaderType shaderType, - filament::driver::ShaderModel shaderModel, std::string* outputGlsl, + bool process(const std::string& inputShader, filament::backend::ShaderType shaderType, + filament::backend::ShaderModel shaderModel, std::string* outputGlsl, SpirvBlob* outputSpirv, std::string* outputMsl); private: void fullOptimization(const glslang::TShader& tShader, - filament::driver::ShaderModel shaderModel) const; + filament::backend::ShaderModel shaderModel) const; void preprocessOptimization(glslang::TShader& tShader, - filament::driver::ShaderModel shaderModel) const; + filament::backend::ShaderModel shaderModel) const; void registerSizePasses(spvtools::Optimizer& optimizer) const; void registerPerformancePasses(spvtools::Optimizer& optimizer) const; diff --git a/libs/filamat/src/MaterialBuilder.cpp b/libs/filamat/src/MaterialBuilder.cpp index b2155b40bc..ff23121035 100644 --- a/libs/filamat/src/MaterialBuilder.cpp +++ b/libs/filamat/src/MaterialBuilder.cpp @@ -69,7 +69,7 @@ void MaterialBuilderBase::prepare() { // Build a list of codegen permutations, which is useful across all types of material builders. // The shader model loop starts at 1 to skip ShaderModel::UNKNOWN. - for (uint8_t i = 1; i < filament::driver::SHADER_MODEL_COUNT; i++) { + for (uint8_t i = 1; i < filament::backend::SHADER_MODEL_COUNT; i++) { if (!mShaderModels.test(i)) { continue; // skip this shader model since it was not requested. } @@ -333,7 +333,7 @@ void MaterialBuilder::prepareToBuild(MaterialInfo& info) noexcept { } bool MaterialBuilder::runStaticCodeAnalysis() noexcept { - using namespace filament::driver; + using namespace filament::backend; GLSLTools glslTools; @@ -355,9 +355,9 @@ bool MaterialBuilder::runStaticCodeAnalysis() noexcept { } static void showErrorMessage(const char* materialName, uint8_t variant, - MaterialBuilder::TargetApi targetApi, filament::driver::ShaderType shaderType, + MaterialBuilder::TargetApi targetApi, filament::backend::ShaderType shaderType, const std::string& shaderCode) { - using ShaderType = filament::driver::ShaderType; + using ShaderType = filament::backend::ShaderType; using TargetApi = MaterialBuilder::TargetApi; utils::slog.e << "Error in \"" << materialName << "\"" @@ -509,7 +509,7 @@ Package MaterialBuilder::build() noexcept { // Re-populate the set of sampler bindings for this API. filament::SamplerBindingMap map; - auto backend = static_cast(params.targetApi); + auto backend = static_cast(params.targetApi); uint8_t offset = filament::getSamplerBindingsStart(backend); map.populate(offset, &info.sib, mMaterialName.c_str()); info.samplerBindings = std::move(map); @@ -551,11 +551,11 @@ Package MaterialBuilder::build() noexcept { std::string vs = sg.createVertexProgram( shaderModel, targetApi, codeGenTargetApi, info, k, mInterpolation, mVertexDomain); - bool ok = postProcessor.process(vs, filament::driver::ShaderType::VERTEX, + bool ok = postProcessor.process(vs, filament::backend::ShaderType::VERTEX, shaderModel, &vs, pSpirv, pMsl); if (!ok) { showErrorMessage(mMaterialName.c_str_safe(), k, targetApi, - filament::driver::ShaderType::VERTEX, vs); + filament::backend::ShaderType::VERTEX, vs); errorOccured = true; break; } @@ -565,7 +565,7 @@ Package MaterialBuilder::build() noexcept { sg.fixupExternalSamplers(shaderModel, vs, info); } - glslEntry.stage = filament::driver::ShaderType::VERTEX; + glslEntry.stage = filament::backend::ShaderType::VERTEX; glslEntry.shaderSize = vs.size(); glslEntry.shader = (char*) malloc(glslEntry.shaderSize + 1); strcpy(glslEntry.shader, vs.c_str()); @@ -575,7 +575,7 @@ Package MaterialBuilder::build() noexcept { if (targetApi == TargetApi::VULKAN) { assert(!spirv.empty()); - spirvEntry.stage = filament::driver::ShaderType::VERTEX; + spirvEntry.stage = filament::backend::ShaderType::VERTEX; spirvEntry.dictionaryIndex = spirvDictionary.addBlob(spirv); spirv.clear(); spirvEntries.push_back(spirvEntry); @@ -583,7 +583,7 @@ Package MaterialBuilder::build() noexcept { if (targetApi == TargetApi::METAL) { assert(spirv.size() > 0); assert(msl.length() > 0); - metalEntry.stage = filament::driver::ShaderType::VERTEX; + metalEntry.stage = filament::backend::ShaderType::VERTEX; metalEntry.shaderSize = msl.length(); metalEntry.shader = (char*)malloc(metalEntry.shaderSize + 1); strcpy(metalEntry.shader, msl.c_str()); @@ -599,11 +599,11 @@ Package MaterialBuilder::build() noexcept { std::string fs = sg.createFragmentProgram( shaderModel, targetApi, codeGenTargetApi, info, k, mInterpolation); - bool ok = postProcessor.process(fs, filament::driver::ShaderType::FRAGMENT, + bool ok = postProcessor.process(fs, filament::backend::ShaderType::FRAGMENT, shaderModel, &fs, pSpirv, pMsl); if (!ok) { showErrorMessage(mMaterialName.c_str_safe(), k, targetApi, - filament::driver::ShaderType::FRAGMENT, fs); + filament::backend::ShaderType::FRAGMENT, fs); errorOccured = true; break; } @@ -613,7 +613,7 @@ Package MaterialBuilder::build() noexcept { sg.fixupExternalSamplers(shaderModel, fs, info); } - glslEntry.stage = filament::driver::ShaderType::FRAGMENT; + glslEntry.stage = filament::backend::ShaderType::FRAGMENT; glslEntry.shaderSize = fs.size(); glslEntry.shader = (char*) malloc(glslEntry.shaderSize + 1); strcpy(glslEntry.shader, fs.c_str()); @@ -623,7 +623,7 @@ Package MaterialBuilder::build() noexcept { if (targetApi == TargetApi::VULKAN) { assert(!spirv.empty()); - spirvEntry.stage = filament::driver::ShaderType::FRAGMENT; + spirvEntry.stage = filament::backend::ShaderType::FRAGMENT; spirvEntry.dictionaryIndex = spirvDictionary.addBlob(spirv); spirv.clear(); spirvEntries.push_back(spirvEntry); @@ -631,7 +631,7 @@ Package MaterialBuilder::build() noexcept { if (targetApi == TargetApi::METAL) { assert(spirv.size() > 0); assert(msl.length() > 0); - metalEntry.stage = filament::driver::ShaderType::FRAGMENT; + metalEntry.stage = filament::backend::ShaderType::FRAGMENT; metalEntry.shaderSize = msl.length(); metalEntry.shader = (char*)malloc(metalEntry.shaderSize + 1); strcpy(metalEntry.shader, msl.c_str()); @@ -685,8 +685,8 @@ Package MaterialBuilder::build() noexcept { return package; } -const std::string MaterialBuilder::peek(filament::driver::ShaderType type, - filament::driver::ShaderModel& model, const PropertyList& properties) noexcept { +const std::string MaterialBuilder::peek(filament::backend::ShaderType type, + filament::backend::ShaderModel& model, const PropertyList& properties) noexcept { ShaderGenerator sg(properties, mVariables, mMaterialCode, mMaterialLineOffset, mMaterialVertexCode, mMaterialVertexLineOffset); @@ -701,12 +701,12 @@ const std::string MaterialBuilder::peek(filament::driver::ShaderType type, // Re-populate the set of sampler bindings for this API. filament::SamplerBindingMap map; - auto backend = static_cast(params.targetApi); + auto backend = static_cast(params.targetApi); uint8_t offset = filament::getSamplerBindingsStart(backend); map.populate(offset, &info.sib, mMaterialName.c_str()); info.samplerBindings = std::move(map); - if (type == filament::driver::ShaderType::VERTEX) { + if (type == filament::backend::ShaderType::VERTEX) { return sg.createVertexProgram(model, targetApi, codeGenTargetApi, info, 0, mInterpolation, mVertexDomain); } else { diff --git a/libs/filamat/src/PostprocessMaterialBuilder.cpp b/libs/filamat/src/PostprocessMaterialBuilder.cpp index 8d68baf3a8..bb3b75c72a 100644 --- a/libs/filamat/src/PostprocessMaterialBuilder.cpp +++ b/libs/filamat/src/PostprocessMaterialBuilder.cpp @@ -34,7 +34,7 @@ #include -using namespace filament::driver; +using namespace filament::backend; namespace filamat { @@ -69,7 +69,7 @@ Package PostprocessMaterialBuilder::build() { // Populate a SamplerBindingMap for the sole purpose of finding where the post-process bindings // live within the global namespace of samplers. filament::SamplerBindingMap samplerBindingMap; - auto backend = static_cast(params.targetApi); + auto backend = static_cast(params.targetApi); uint8_t offset = filament::getSamplerBindingsStart(backend); samplerBindingMap.populate(offset); const uint8_t firstSampler = @@ -100,7 +100,7 @@ Package PostprocessMaterialBuilder::build() { shaderModel, targetApi, codeGenTargetApi, filament::PostProcessStage(k), firstSampler); - bool ok = postProcessor.process(vs, filament::driver::ShaderType::VERTEX, shaderModel, + bool ok = postProcessor.process(vs, filament::backend::ShaderType::VERTEX, shaderModel, &vs, pSpirv, pMsl); if (!ok) { // An error occured while postProcessing, aborting. @@ -109,7 +109,7 @@ Package PostprocessMaterialBuilder::build() { } if (targetApi == TargetApi::OPENGL) { - glslEntry.stage = filament::driver::ShaderType::VERTEX; + glslEntry.stage = filament::backend::ShaderType::VERTEX; glslEntry.shaderSize = vs.size(); glslEntry.shader = (char*)malloc(glslEntry.shaderSize + 1); strcpy(glslEntry.shader, vs.c_str()); @@ -118,7 +118,7 @@ Package PostprocessMaterialBuilder::build() { } if (targetApi == TargetApi::VULKAN) { - spirvEntry.stage = filament::driver::ShaderType::VERTEX; + spirvEntry.stage = filament::backend::ShaderType::VERTEX; spirvEntry.dictionaryIndex = spirvDictionary.addBlob(spirv); spirv.clear(); spirvEntries.push_back(spirvEntry); @@ -126,7 +126,7 @@ Package PostprocessMaterialBuilder::build() { if (targetApi == TargetApi::METAL) { assert(spirv.size() > 0); assert(msl.length() > 0); - metalEntry.stage = filament::driver::ShaderType::VERTEX; + metalEntry.stage = filament::backend::ShaderType::VERTEX; metalEntry.shaderSize = msl.length(); metalEntry.shader = (char*)malloc(metalEntry.shaderSize + 1); strcpy(metalEntry.shader, msl.c_str()); @@ -141,7 +141,7 @@ Package PostprocessMaterialBuilder::build() { shaderModel, targetApi, codeGenTargetApi, filament::PostProcessStage(k), firstSampler); - ok = postProcessor.process(fs, filament::driver::ShaderType::FRAGMENT, shaderModel, &fs, + ok = postProcessor.process(fs, filament::backend::ShaderType::FRAGMENT, shaderModel, &fs, pSpirv, pMsl); if (!ok) { // An error occured while postProcessing, aborting. @@ -150,7 +150,7 @@ Package PostprocessMaterialBuilder::build() { } if (targetApi == TargetApi::OPENGL) { - glslEntry.stage = filament::driver::ShaderType::FRAGMENT; + glslEntry.stage = filament::backend::ShaderType::FRAGMENT; glslEntry.shaderSize = fs.size(); glslEntry.shader = (char*) malloc(glslEntry.shaderSize + 1); strcpy(glslEntry.shader, fs.c_str()); @@ -159,7 +159,7 @@ Package PostprocessMaterialBuilder::build() { } if (targetApi == TargetApi::VULKAN) { - spirvEntry.stage = filament::driver::ShaderType::FRAGMENT; + spirvEntry.stage = filament::backend::ShaderType::FRAGMENT; spirvEntry.dictionaryIndex = spirvDictionary.addBlob(spirv); spirv.clear(); spirvEntries.push_back(spirvEntry); @@ -167,7 +167,7 @@ Package PostprocessMaterialBuilder::build() { if (targetApi == TargetApi::METAL) { assert(spirv.size() > 0); assert(msl.length() > 0); - metalEntry.stage = filament::driver::ShaderType::FRAGMENT; + metalEntry.stage = filament::backend::ShaderType::FRAGMENT; metalEntry.shaderSize = msl.length(); metalEntry.shader = (char*)malloc(metalEntry.shaderSize + 1); strcpy(metalEntry.shader, msl.c_str()); diff --git a/libs/filamat/src/sca/GLSLTools.cpp b/libs/filamat/src/sca/GLSLTools.cpp index 48ef6f6806..3db77ab781 100644 --- a/libs/filamat/src/sca/GLSLTools.cpp +++ b/libs/filamat/src/sca/GLSLTools.cpp @@ -38,7 +38,7 @@ using namespace utils; using namespace glslang; using namespace ASTUtils; -using namespace filament::driver; +using namespace filament::backend; namespace filamat { diff --git a/libs/filamat/src/sca/GLSLTools.h b/libs/filamat/src/sca/GLSLTools.h index d14479de4c..5924a8482e 100644 --- a/libs/filamat/src/sca/GLSLTools.h +++ b/libs/filamat/src/sca/GLSLTools.h @@ -121,11 +121,11 @@ public: // The shader features a prepareMaterial() function AND // prepareMaterial() is called at some point in material() call chain. bool analyzeFragmentShader(const std::string& shaderCode, - filament::driver::ShaderModel model, + filament::backend::ShaderModel model, MaterialBuilder::TargetApi targetApi) const noexcept; bool analyzeVertexShader(const std::string& shaderCode, - filament::driver::ShaderModel model, + filament::backend::ShaderModel model, MaterialBuilder::TargetApi targetApi) const noexcept; // Public for unit tests. @@ -136,7 +136,7 @@ public: MaterialBuilder::PropertyList& properties, MaterialBuilder::TargetApi targetApi = MaterialBuilder::TargetApi::OPENGL) const noexcept; - static int glslangVersionFromShaderModel(filament::driver::ShaderModel model); + static int glslangVersionFromShaderModel(filament::backend::ShaderModel model); static EShMessages glslangFlagsFromTargetApi(MaterialBuilder::TargetApi targetApi); diff --git a/libs/filamat/src/shaders/CodeGenerator.cpp b/libs/filamat/src/shaders/CodeGenerator.cpp index bdae48e9a2..2b27ac90f8 100644 --- a/libs/filamat/src/shaders/CodeGenerator.cpp +++ b/libs/filamat/src/shaders/CodeGenerator.cpp @@ -25,7 +25,7 @@ namespace filamat { // From driverEnum namespace using namespace filament; -using namespace driver; +using namespace backend; using namespace utils; std::ostream& CodeGenerator::generateSeparator(std::ostream& out) const { diff --git a/libs/filamat/src/shaders/CodeGenerator.h b/libs/filamat/src/shaders/CodeGenerator.h index a606607a5d..192af81c45 100644 --- a/libs/filamat/src/shaders/CodeGenerator.h +++ b/libs/filamat/src/shaders/CodeGenerator.h @@ -36,10 +36,10 @@ namespace filamat { class UTILS_PRIVATE CodeGenerator { - using ShaderType = filament::driver::ShaderType; + using ShaderType = filament::backend::ShaderType; using TargetApi = MaterialBuilder::TargetApi; public: - CodeGenerator(filament::driver::ShaderModel shaderModel, + CodeGenerator(filament::backend::ShaderModel shaderModel, TargetApi targetApi, TargetApi codeGenTargetApi) noexcept : mShaderModel(shaderModel), mTargetApi(targetApi), mCodeGenTargetApi(codeGenTargetApi) { if (targetApi == TargetApi::ALL) { @@ -48,7 +48,7 @@ public: } } - filament::driver::ShaderModel getShaderModel() const noexcept { return mShaderModel; } + filament::backend::ShaderModel getShaderModel() const noexcept { return mShaderModel; } // insert a separator (can be a new line) std::ostream& generateSeparator(std::ostream& out) const; @@ -113,25 +113,25 @@ public: std::string& shader, filament::SamplerInterfaceBlock const& sib) noexcept; private: - filament::driver::Precision getDefaultPrecision(ShaderType type) const; - filament::driver::Precision getDefaultUniformPrecision() const; + filament::backend::Precision getDefaultPrecision(ShaderType type) const; + filament::backend::Precision getDefaultUniformPrecision() const; - const char* getUniformPrecisionQualifier(filament::driver::UniformType type, - filament::driver::Precision precision, - filament::driver::Precision uniformPrecision, - filament::driver::Precision defaultPrecision) const noexcept; + const char* getUniformPrecisionQualifier(filament::backend::UniformType type, + filament::backend::Precision precision, + filament::backend::Precision uniformPrecision, + filament::backend::Precision defaultPrecision) const noexcept; // return type name of sampler (e.g.: "sampler2D") - char const* getSamplerTypeName(filament::driver::SamplerType type, - filament::driver::SamplerFormat format, bool multisample) const noexcept; + char const* getSamplerTypeName(filament::backend::SamplerType type, + filament::backend::SamplerFormat format, bool multisample) const noexcept; // return name of the material property (e.g.: "ROUGHNESS") static char const* getConstantName(MaterialBuilder::Property property) noexcept; - static char const* getPrecisionQualifier(filament::driver::Precision precision, - filament::driver::Precision defaultPrecision) noexcept; + static char const* getPrecisionQualifier(filament::backend::Precision precision, + filament::backend::Precision defaultPrecision) noexcept; - filament::driver::ShaderModel mShaderModel; + filament::backend::ShaderModel mShaderModel; TargetApi mTargetApi; TargetApi mCodeGenTargetApi; diff --git a/libs/filamat/src/shaders/MaterialInfo.h b/libs/filamat/src/shaders/MaterialInfo.h index b9680dadba..765e4e46a7 100644 --- a/libs/filamat/src/shaders/MaterialInfo.h +++ b/libs/filamat/src/shaders/MaterialInfo.h @@ -27,9 +27,9 @@ namespace filamat { -using UniformType = filament::driver::UniformType; -using SamplerType = filament::driver::SamplerType; -using CullingMode = filament::driver::CullingMode; +using UniformType = filament::backend::UniformType; +using SamplerType = filament::backend::SamplerType; +using CullingMode = filament::backend::CullingMode; struct UTILS_PUBLIC MaterialInfo { bool isLit; diff --git a/libs/filamat/src/shaders/ShaderGenerator.cpp b/libs/filamat/src/shaders/ShaderGenerator.cpp index c9eaa62d69..394cd87547 100644 --- a/libs/filamat/src/shaders/ShaderGenerator.cpp +++ b/libs/filamat/src/shaders/ShaderGenerator.cpp @@ -32,7 +32,7 @@ #include "CodeGenerator.h" using namespace filament; -using namespace filament::driver; +using namespace filament::backend; namespace filamat { @@ -141,7 +141,7 @@ ShaderGenerator::ShaderGenerator( } } -const std::string ShaderGenerator::createVertexProgram(filament::driver::ShaderModel shaderModel, +const std::string ShaderGenerator::createVertexProgram(filament::backend::ShaderModel shaderModel, MaterialBuilder::TargetApi targetApi, MaterialBuilder::TargetApi codeGenTargetApi, MaterialInfo const& material, uint8_t variantKey, filament::Interpolation interpolation, filament::VertexDomain vertexDomain) const noexcept { @@ -229,7 +229,7 @@ bool ShaderGenerator::hasCustomDepthShader() const noexcept { return false; } -const std::string ShaderGenerator::createFragmentProgram(filament::driver::ShaderModel shaderModel, +const std::string ShaderGenerator::createFragmentProgram(filament::backend::ShaderModel shaderModel, MaterialBuilder::TargetApi targetApi, MaterialBuilder::TargetApi codeGenTargetApi, MaterialInfo const& material, uint8_t variantKey, filament::Interpolation interpolation) const noexcept { @@ -341,7 +341,7 @@ const std::string ShaderGenerator::createFragmentProgram(filament::driver::Shade return fs.str(); } -void ShaderGenerator::fixupExternalSamplers(filament::driver::ShaderModel sm, +void ShaderGenerator::fixupExternalSamplers(filament::backend::ShaderModel sm, std::string& shader, MaterialInfo const& material) const noexcept { // External samplers are only supported on GL ES at the moment, we must // skip the fixup on desktop targets @@ -351,7 +351,7 @@ void ShaderGenerator::fixupExternalSamplers(filament::driver::ShaderModel sm, } const std::string ShaderPostProcessGenerator::createPostProcessVertexProgram( - filament::driver::ShaderModel sm, MaterialBuilder::TargetApi targetApi, + filament::backend::ShaderModel sm, MaterialBuilder::TargetApi targetApi, MaterialBuilder::TargetApi codeGenTargetApi, filament::PostProcessStage variant, uint8_t firstSampler) noexcept { const CodeGenerator cg(sm, targetApi, codeGenTargetApi); @@ -374,7 +374,7 @@ const std::string ShaderPostProcessGenerator::createPostProcessVertexProgram( } const std::string ShaderPostProcessGenerator::createPostProcessFragmentProgram( - filament::driver::ShaderModel sm, MaterialBuilder::TargetApi targetApi, + filament::backend::ShaderModel sm, MaterialBuilder::TargetApi targetApi, MaterialBuilder::TargetApi codeGenTargetApi, filament::PostProcessStage variant, uint8_t firstSampler) noexcept { const CodeGenerator cg(sm, targetApi, codeGenTargetApi); diff --git a/libs/filamat/src/shaders/ShaderGenerator.h b/libs/filamat/src/shaders/ShaderGenerator.h index e3d4ff51fc..d6413df810 100644 --- a/libs/filamat/src/shaders/ShaderGenerator.h +++ b/libs/filamat/src/shaders/ShaderGenerator.h @@ -41,12 +41,12 @@ public: utils::CString const& materialVertexCode, size_t vertexLineOffset) noexcept; - const std::string createVertexProgram(filament::driver::ShaderModel sm, + const std::string createVertexProgram(filament::backend::ShaderModel sm, MaterialBuilder::TargetApi targetApi, MaterialBuilder::TargetApi codeGenTargetApi, MaterialInfo const& material, uint8_t variantKey, filament::Interpolation interpolation, filament::VertexDomain vertexDomain) const noexcept; - const std::string createFragmentProgram(filament::driver::ShaderModel sm, + const std::string createFragmentProgram(filament::backend::ShaderModel sm, MaterialBuilder::TargetApi targetApi, MaterialBuilder::TargetApi codeGenTargetApi, MaterialInfo const& material, uint8_t variantKey, filament::Interpolation interpolation) const noexcept; @@ -60,7 +60,7 @@ public: * fixup step can be used to turn the samplers back into external samplers after * the optimizations have been applied. */ - void fixupExternalSamplers(filament::driver::ShaderModel sm, std::string& shader, + void fixupExternalSamplers(filament::backend::ShaderModel sm, std::string& shader, MaterialInfo const& material) const noexcept; private: @@ -73,10 +73,10 @@ private: }; struct ShaderPostProcessGenerator { - static const std::string createPostProcessVertexProgram(filament::driver::ShaderModel sm, + static const std::string createPostProcessVertexProgram(filament::backend::ShaderModel sm, MaterialBuilder::TargetApi targetApi, MaterialBuilder::TargetApi codeGenTargetApi, filament::PostProcessStage variant, uint8_t firstSampler) noexcept; - static const std::string createPostProcessFragmentProgram(filament::driver::ShaderModel sm, + static const std::string createPostProcessFragmentProgram(filament::backend::ShaderModel sm, MaterialBuilder::TargetApi targetApi, MaterialBuilder::TargetApi codeGenTargetApi, filament::PostProcessStage variant, uint8_t firstSampler) noexcept; static void generatePostProcessStageDefines(std::stringstream& vs, CodeGenerator const& cg, diff --git a/libs/gltfio/src/ResourceLoader.cpp b/libs/gltfio/src/ResourceLoader.cpp index 5371f76bef..5bbd573c24 100644 --- a/libs/gltfio/src/ResourceLoader.cpp +++ b/libs/gltfio/src/ResourceLoader.cpp @@ -203,14 +203,14 @@ bool ResourceLoader::createTextures(details::FFilamentAsset* asset) const { .width(w) .height(h) .levels(0xff) - .format(srgb ? driver::TextureFormat::SRGB8_A8 : driver::TextureFormat::RGBA8) + .format(srgb ? Texture::InternalFormat::SRGB8_A8 : Texture::InternalFormat::RGBA8) .build(*mConfig.engine); Texture::PixelBufferDescriptor pbd(texels, size_t(w * h * 4), Texture::Format::RGBA, Texture::Type::UBYTE, - (driver::BufferDescriptor::Callback) &free); + (Texture::PixelBufferDescriptor::Callback) &free); tex->setImage(*mConfig.engine, 0, std::move(pbd)); tex->generateMipmaps(*mConfig.engine); diff --git a/samples/app/MeshAssimp.cpp b/samples/app/MeshAssimp.cpp index ef0881048b..a41803cdae 100644 --- a/samples/app/MeshAssimp.cpp +++ b/samples/app/MeshAssimp.cpp @@ -204,14 +204,14 @@ Texture* MeshAssimp::createOneByOneTexture(uint32_t pixel) { .width(uint32_t(1)) .height(uint32_t(1)) .levels(0xff) - .format(driver::TextureFormat::RGBA8) + .format(Texture::InternalFormat::RGBA8) .build(mEngine); Texture::PixelBufferDescriptor defaultNormalBuffer(textureData, size_t(1 * 1 * 4), Texture::Format::RGBA, Texture::Type::UBYTE, - (driver::BufferDescriptor::Callback) &free); + (Texture::PixelBufferDescriptor::Callback) &free); texturePtr->setImage(mEngine, 0, std::move(defaultNormalBuffer)); texturePtr->generateMipmaps(mEngine); @@ -324,11 +324,11 @@ static void loadTexture(Engine *engine, const std::string &filePath, Texture **m int w, h, n; int numChannels = hasAlpha ? 4 : 3; - driver::TextureFormat inputFormat; + Texture::InternalFormat inputFormat; if (sRGB) { - inputFormat = hasAlpha ? driver::TextureFormat::SRGB8_A8 : driver::TextureFormat::SRGB8; + inputFormat = hasAlpha ? Texture::InternalFormat::SRGB8_A8 : Texture::InternalFormat::SRGB8; } else { - inputFormat = hasAlpha ? driver::TextureFormat::RGBA8 : driver::TextureFormat::RGB8; + inputFormat = hasAlpha ? Texture::InternalFormat::RGBA8 : Texture::InternalFormat::RGB8; } Texture::Format outputFormat = hasAlpha ? Texture::Format::RGBA : Texture::Format::RGB; @@ -346,7 +346,7 @@ static void loadTexture(Engine *engine, const std::string &filePath, Texture **m size_t(w * h * numChannels), outputFormat, Texture::Type::UBYTE, - (driver::BufferDescriptor::Callback) &stbi_image_free); + (Texture::PixelBufferDescriptor::Callback) &stbi_image_free); (*map)->setImage(*engine, 0, std::move(buffer)); (*map)->generateMipmaps(*engine); @@ -365,11 +365,11 @@ void loadEmbeddedTexture(Engine *engine, aiTexture *embeddedTexture, Texture **m int w, h, n; int numChannels = hasAlpha ? 4 : 3; - driver::TextureFormat inputFormat; + Texture::InternalFormat inputFormat; if (sRGB) { - inputFormat = hasAlpha ? driver::TextureFormat::SRGB8_A8 : driver::TextureFormat::SRGB8; + inputFormat = hasAlpha ? Texture::InternalFormat::SRGB8_A8 : Texture::InternalFormat::SRGB8; } else { - inputFormat = hasAlpha ? driver::TextureFormat::RGBA8 : driver::TextureFormat::RGB8; + inputFormat = hasAlpha ? Texture::InternalFormat::RGBA8 : Texture::InternalFormat::RGB8; } Texture::Format outputFormat = hasAlpha ? Texture::Format::RGBA : Texture::Format::RGB; @@ -388,7 +388,7 @@ void loadEmbeddedTexture(Engine *engine, aiTexture *embeddedTexture, Texture **m size_t(w * h * numChannels), outputFormat, Texture::Type::UBYTE, - (driver::BufferDescriptor::Callback) &free); + (Texture::PixelBufferDescriptor::Callback) &free); (*map)->setImage(*engine, 0, std::move(defaultBuffer)); (*map)->generateMipmaps(*engine); diff --git a/samples/frame_generator.cpp b/samples/frame_generator.cpp index 37b0b17748..f2e2e89e62 100644 --- a/samples/frame_generator.cpp +++ b/samples/frame_generator.cpp @@ -375,9 +375,9 @@ static void postRender(Engine*, View* view, Scene*, Renderer* renderer) { int currentFrame = 0; }; - driver::PixelBufferDescriptor buffer(pixels, vp.width * vp.height * 3, - driver::PixelBufferDescriptor::PixelDataFormat::RGB, - driver::PixelBufferDescriptor::PixelDataType::UBYTE, + backend::PixelBufferDescriptor buffer(pixels, vp.width * vp.height * 3, + backend::PixelBufferDescriptor::PixelDataFormat::RGB, + backend::PixelBufferDescriptor::PixelDataType::UBYTE, [](void* buffer, size_t size, void* user) { CaptureState* state = static_cast(user); const Viewport& v = state->view->getViewport(); diff --git a/samples/sample_cloth.cpp b/samples/sample_cloth.cpp index a4f4b5f366..9408b19e46 100644 --- a/samples/sample_cloth.cpp +++ b/samples/sample_cloth.cpp @@ -156,7 +156,7 @@ Texture* loadMap(Engine* engine, const char* name, bool sRGB = true) { .build(*engine); Texture::PixelBufferDescriptor buffer(data, size_t(w * h * 3), Texture::Format::RGB, Texture::Type::UBYTE, - (driver::BufferDescriptor::Callback) &stbi_image_free); + (Texture::PixelBufferDescriptor::Callback) &stbi_image_free); map->setImage(*engine, 0, std::move(buffer)); map->generateMipmaps(*engine); g_maps[name] = map; diff --git a/samples/sample_full_pbr.cpp b/samples/sample_full_pbr.cpp index f9fde5fdd5..dfd3f7d86d 100644 --- a/samples/sample_full_pbr.cpp +++ b/samples/sample_full_pbr.cpp @@ -184,11 +184,11 @@ void loadTexture(Engine* engine, const std::string& filePath, Texture** map, boo .width(uint32_t(w)) .height(uint32_t(h)) .levels(0xff) - .format(sRGB ? driver::TextureFormat::SRGB8 : driver::TextureFormat::RGB8) + .format(sRGB ? Texture::InternalFormat::SRGB8 : Texture::InternalFormat::RGB8) .build(*engine); Texture::PixelBufferDescriptor buffer(data, size_t(w * h * 3), Texture::Format::RGB, Texture::Type::UBYTE, - (driver::BufferDescriptor::Callback) &stbi_image_free); + (Texture::PixelBufferDescriptor::Callback) &stbi_image_free); (*map)->setImage(*engine, 0, std::move(buffer)); (*map)->generateMipmaps(*engine); } else { diff --git a/samples/sample_normal_map.cpp b/samples/sample_normal_map.cpp index 870158d428..1dce38a267 100644 --- a/samples/sample_normal_map.cpp +++ b/samples/sample_normal_map.cpp @@ -176,11 +176,11 @@ void loadNormalMap(Engine* engine, Texture** normalMap, const std::string& path) .width(uint32_t(w)) .height(uint32_t(h)) .levels(0xff) - .format(driver::TextureFormat::RGB8) + .format(Texture::InternalFormat::RGB8) .build(*engine); Texture::PixelBufferDescriptor buffer(data, size_t(w * h * 3), Texture::Format::RGB, Texture::Type::UBYTE, - (driver::BufferDescriptor::Callback)&stbi_image_free); + (Texture::PixelBufferDescriptor::Callback)&stbi_image_free); (*normalMap)->setImage(*engine, 0, std::move(buffer)); (*normalMap)->generateMipmaps(*engine); } else { @@ -203,11 +203,11 @@ void loadBaseColorMap(Engine* engine) { .width(uint32_t(w)) .height(uint32_t(h)) .levels(0xff) - .format(driver::TextureFormat::SRGB8) + .format(Texture::InternalFormat::SRGB8) .build(*engine); Texture::PixelBufferDescriptor buffer(data, size_t(w * h * 3), Texture::Format::RGB, Texture::Type::UBYTE, - (driver::BufferDescriptor::Callback)&stbi_image_free); + (Texture::PixelBufferDescriptor::Callback)&stbi_image_free); g_baseColorMap->setImage(*engine, 0, std::move(buffer)); g_baseColorMap->generateMipmaps(*engine); } else { diff --git a/samples/suzanne.cpp b/samples/suzanne.cpp index 52022f5618..24661ebe83 100644 --- a/samples/suzanne.cpp +++ b/samples/suzanne.cpp @@ -61,11 +61,11 @@ static Texture* loadNormalMap(Engine* engine, const uint8_t* normals, size_t nby .width(uint32_t(w)) .height(uint32_t(h)) .levels(0xff) - .format(driver::TextureFormat::RGB8) + .format(Texture::InternalFormat::RGB8) .build(*engine); Texture::PixelBufferDescriptor buffer(data, size_t(w * h * 3), Texture::Format::RGB, Texture::Type::UBYTE, - (driver::BufferDescriptor::Callback) &stbi_image_free); + (Texture::PixelBufferDescriptor::Callback) &stbi_image_free); normalMap->setImage(*engine, 0, std::move(buffer)); normalMap->generateMipmaps(*engine); return normalMap; diff --git a/samples/vk_texturedquad.cpp b/samples/vk_texturedquad.cpp index 997f91af2d..c663cb07f4 100644 --- a/samples/vk_texturedquad.cpp +++ b/samples/vk_texturedquad.cpp @@ -93,13 +93,13 @@ int main(int argc, char** argv) { std::cout << "Loaded texture: " << w << "x" << h << std::endl; Texture::PixelBufferDescriptor buffer(data, size_t(w * h * 4), Texture::Format::RGBA, Texture::Type::UBYTE, - (driver::BufferDescriptor::Callback) &stbi_image_free); + (Texture::PixelBufferDescriptor::Callback) &stbi_image_free); app.tex = Texture::Builder() .width(uint32_t(w)) .height(uint32_t(h)) .levels(1) .sampler(Texture::Sampler::SAMPLER_2D) - .format(driver::TextureFormat::RGBA8) + .format(Texture::InternalFormat::RGBA8) .build(*engine); app.tex->setImage(*engine, 0, std::move(buffer)); TextureSampler sampler(MinFilter::LINEAR, MagFilter::LINEAR); diff --git a/tools/matinfo/src/main.cpp b/tools/matinfo/src/main.cpp index f995dfae60..96e0a941d1 100644 --- a/tools/matinfo/src/main.cpp +++ b/tools/matinfo/src/main.cpp @@ -40,7 +40,7 @@ using namespace filaflat; using namespace filamat; using namespace filament; -using namespace driver; +using namespace backend; using namespace utils; static const int alignment = 24;