diff --git a/filament/backend/include/private/backend/DriverAPI.inc b/filament/backend/include/private/backend/DriverAPI.inc index 30abcea013..bb5a23cec8 100644 --- a/filament/backend/include/private/backend/DriverAPI.inc +++ b/filament/backend/include/private/backend/DriverAPI.inc @@ -108,12 +108,16 @@ DECL_DRIVER_API_RETURN(R, N, PAIR_ARGS_N(ARG, ##__VA_ARGS__), PAIR_ARGS_N(PARAM, ##__VA_ARGS__)) #define DECL_DRIVER_API_TAGGED_R_N(R, N, ...) \ - DECL_DRIVER_API_RETURN(R, N, PAIR_ARGS_N(ARG, ##__VA_ARGS__, utils::CString, tag = {}), \ - PAIR_ARGS_N(PARAM, ##__VA_ARGS__, utils::CString, tag)) + DECL_DRIVER_API_RETURN(R, N, PAIR_ARGS_N(ARG, ##__VA_ARGS__, utils::CString&&, tag = {}), \ + PAIR_ARGS_N(PARAM, ##__VA_ARGS__, utils::CString&&, tag)) #define DECL_DRIVER_API_SYNCHRONOUS_N(R, N, ...) \ DECL_DRIVER_API_SYNCHRONOUS(R, N, PAIR_ARGS_N(ARG, ##__VA_ARGS__), PAIR_ARGS_N(PARAM, ##__VA_ARGS__)) +#define DECL_DRIVER_API_SYNCHRONOUS_TAGGED_N(R, N, ...) \ + DECL_DRIVER_API_SYNCHRONOUS(R, N, PAIR_ARGS_N(ARG, ##__VA_ARGS__, utils::CString, tag = {}), \ + PAIR_ARGS_N(PARAM, ##__VA_ARGS__, utils::CString, tag)) + // on some compilers the ##__VA_ARGS__ hack is not supported, so we can't handle 0-parameter APIs // with DECL_DRIVER_API_SYNCHRONOUS_N #define DECL_DRIVER_API_SYNCHRONOUS_0(R, N) \ @@ -340,8 +344,8 @@ DECL_DRIVER_API_N(destroyDescriptorSet, backend::DescriptorSetHandle, ds */ DECL_DRIVER_API_SYNCHRONOUS_0(void, terminate) -DECL_DRIVER_API_SYNCHRONOUS_N(backend::StreamHandle, createStreamNative, void*, stream, utils::CString, tag) -DECL_DRIVER_API_SYNCHRONOUS_N(backend::StreamHandle, createStreamAcquired, utils::CString, tag) +DECL_DRIVER_API_SYNCHRONOUS_TAGGED_N(backend::StreamHandle, createStreamNative, void*, stream) +DECL_DRIVER_API_SYNCHRONOUS_TAGGED_N(backend::StreamHandle, createStreamAcquired) DECL_DRIVER_API_SYNCHRONOUS_N(void, setAcquiredImage, backend::StreamHandle, stream, void*, image, const math::mat3f&, transform, backend::CallbackHandler*, handler, backend::StreamCallback, cb, void*, userData) DECL_DRIVER_API_SYNCHRONOUS_N(void, setStreamDimensions, backend::StreamHandle, stream, uint32_t, width, uint32_t, height) DECL_DRIVER_API_SYNCHRONOUS_N(int64_t, getStreamTimestamp, backend::StreamHandle, stream) diff --git a/filament/backend/src/metal/MetalDriver.mm b/filament/backend/src/metal/MetalDriver.mm index 9ab6312424..0f0a3f053a 100644 --- a/filament/backend/src/metal/MetalDriver.mm +++ b/filament/backend/src/metal/MetalDriver.mm @@ -418,14 +418,14 @@ void MetalDriver::finish(int) { } void MetalDriver::createVertexBufferInfoR(Handle vbih, uint8_t bufferCount, - uint8_t attributeCount, AttributeArray attributes, utils::CString tag) { + uint8_t attributeCount, AttributeArray attributes, utils::CString&& tag) { construct_handle(vbih, *mContext, bufferCount, attributeCount, attributes); mHandleAllocator.associateTagToHandle(vbih.getId(), std::move(tag)); } void MetalDriver::createVertexBufferR(Handle vbh, - uint32_t vertexCount, Handle vbih, utils::CString tag) { + uint32_t vertexCount, Handle vbih, utils::CString&& tag) { MetalVertexBufferInfo const* const vbi = handle_cast(vbih); construct_handle(vbh, *mContext, vertexCount, vbi->bufferCount, vbih); mHandleAllocator.associateTagToHandle(vbh.getId(), std::move(tag)); @@ -433,7 +433,7 @@ void MetalDriver::createVertexBufferR(Handle vbh, } void MetalDriver::createIndexBufferR(Handle ibh, ElementType elementType, - uint32_t indexCount, BufferUsage usage, utils::CString tag) { + uint32_t indexCount, BufferUsage usage, utils::CString&& tag) { auto elementSize = (uint8_t)getElementTypeSize(elementType); auto* indexBuffer = construct_handle(ibh, *mContext, usage, elementSize, indexCount); @@ -445,7 +445,7 @@ void MetalDriver::createIndexBufferR(Handle ibh, ElementType elem } void MetalDriver::createBufferObjectR(Handle boh, uint32_t byteCount, - BufferObjectBinding bindingType, BufferUsage usage, utils::CString tag) { + BufferObjectBinding bindingType, BufferUsage usage, utils::CString&& tag) { auto* bufferObject = construct_handle(boh, *mContext, bindingType, usage, byteCount); FILAMENT_CHECK_POSTCONDITION(bufferObject->getBuffer()->wasAllocationSuccessful()) @@ -486,7 +486,7 @@ inline const char* stringify(SamplerType samplerType) { void MetalDriver::createTextureR(Handle th, SamplerType target, uint8_t levels, TextureFormat format, uint8_t samples, uint32_t width, uint32_t height, - uint32_t depth, TextureUsage usage, utils::CString tag) { + uint32_t depth, TextureUsage usage, utils::CString&& tag) { // Clamp sample count to what the device supports. auto& sc = mContext->sampleCountLookup; samples = sc[std::min(MAX_SAMPLE_COUNT, samples)]; @@ -503,7 +503,7 @@ void MetalDriver::createTextureR(Handle th, SamplerType target, uint8 } void MetalDriver::createTextureViewR(Handle th, Handle srch, - uint8_t baseLevel, uint8_t levelCount, utils::CString tag) { + uint8_t baseLevel, uint8_t levelCount, utils::CString&& tag) { MetalTexture const* src = handle_cast(srch); mContext->textures.insert( construct_handle(th, *mContext, src, baseLevel, levelCount)); @@ -512,7 +512,7 @@ void MetalDriver::createTextureViewR(Handle th, Handle src void MetalDriver::createTextureViewSwizzleR(Handle th, Handle srch, backend::TextureSwizzle r, backend::TextureSwizzle g, backend::TextureSwizzle b, - backend::TextureSwizzle a, utils::CString tag) { + backend::TextureSwizzle a, utils::CString&& tag) { MetalTexture const* src = handle_cast(srch); mContext->textures.insert(construct_handle(th, *mContext, src, r, g, b, a)); mHandleAllocator.associateTagToHandle(th.getId(), std::move(tag)); @@ -522,13 +522,13 @@ void MetalDriver::createTextureExternalImage2R(Handle th, backend::SamplerType target, backend::TextureFormat format, uint32_t width, uint32_t height, backend::TextureUsage usage, - Platform::ExternalImageHandleRef image, utils::CString tag) { + Platform::ExternalImageHandleRef image, utils::CString&& tag) { // FIXME: implement createTextureExternalImage2R } void MetalDriver::createTextureExternalImageR(Handle th, backend::SamplerType target, backend::TextureFormat format, uint32_t width, uint32_t height, backend::TextureUsage usage, - void* image, utils::CString tag) { + void* image, utils::CString&& tag) { mContext->textures.insert(construct_handle( th, *mContext, format, width, height, usage, (CVPixelBufferRef)image)); // This release matches the retain call in setupExternalImage. The MetalTexture will have @@ -539,7 +539,7 @@ void MetalDriver::createTextureExternalImageR(Handle th, backend::Sam void MetalDriver::createTextureExternalImagePlaneR(Handle th, backend::TextureFormat format, uint32_t width, uint32_t height, backend::TextureUsage usage, - void* image, uint32_t plane, utils::CString tag) { + void* image, uint32_t plane, utils::CString&& tag) { mContext->textures.insert(construct_handle( th, *mContext, format, width, height, usage, (CVPixelBufferRef)image, plane)); // This release matches the retain call in setupExternalImage. The MetalTexture will have @@ -551,7 +551,7 @@ void MetalDriver::createTextureExternalImagePlaneR(Handle th, void MetalDriver::importTextureR(Handle th, intptr_t i, SamplerType target, uint8_t levels, TextureFormat format, uint8_t samples, uint32_t width, uint32_t height, - uint32_t depth, TextureUsage usage, utils::CString tag) { + uint32_t depth, TextureUsage usage, utils::CString&& tag) { id metalTexture = (id) CFBridgingRelease((void*) i); FILAMENT_CHECK_PRECONDITION(metalTexture.width == width) << "Imported id width (" << metalTexture.width @@ -573,13 +573,13 @@ void MetalDriver::importTextureR(Handle th, intptr_t i, void MetalDriver::createRenderPrimitiveR(Handle rph, Handle vbh, Handle ibh, - PrimitiveType pt, utils::CString tag) { + PrimitiveType pt, utils::CString&& tag) { construct_handle(rph); MetalDriver::setRenderPrimitiveBuffer(rph, pt, vbh, ibh); mHandleAllocator.associateTagToHandle(rph.getId(), std::move(tag)); } -void MetalDriver::createProgramR(Handle rph, Program&& program, utils::CString tag) { +void MetalDriver::createProgramR(Handle rph, Program&& program, utils::CString&& tag) { #if FILAMENT_METAL_DEBUG_LOG auto handleId = rph.getId(); DEBUG_LOG("createProgramR(rph = %d, program = ", handleId); @@ -589,7 +589,7 @@ void MetalDriver::createProgramR(Handle rph, Program&& program, utils mHandleAllocator.associateTagToHandle(rph.getId(), std::move(tag)); } -void MetalDriver::createDefaultRenderTargetR(Handle rth, utils::CString tag) { +void MetalDriver::createDefaultRenderTargetR(Handle rth, utils::CString&& tag) { construct_handle(rth, mContext); mHandleAllocator.associateTagToHandle(rth.getId(), std::move(tag)); } @@ -597,7 +597,7 @@ void MetalDriver::createDefaultRenderTargetR(Handle rth, utils:: void MetalDriver::createRenderTargetR(Handle rth, TargetBufferFlags targetBufferFlags, uint32_t width, uint32_t height, uint8_t samples, uint8_t layerCount, MRT color, - TargetBufferInfo depth, TargetBufferInfo stencil, utils::CString tag) { + TargetBufferInfo depth, TargetBufferInfo stencil, utils::CString&& tag) { FILAMENT_CHECK_PRECONDITION(!isInRenderPass(mContext)) << "createRenderTarget must be called outside of a render pass."; // Clamp sample count to what the device supports. @@ -644,14 +644,14 @@ void MetalDriver::createRenderTargetR(Handle rth, mHandleAllocator.associateTagToHandle(rth.getId(), std::move(tag)); } -void MetalDriver::createFenceR(Handle fh, utils::CString tag) { +void MetalDriver::createFenceR(Handle fh, utils::CString&& tag) { auto* fence = handle_cast(fh); fence->encode(); mHandleAllocator.associateTagToHandle(fh.getId(), std::move(tag)); } void MetalDriver::createSwapChainR(Handle sch, void* nativeWindow, uint64_t flags, - utils::CString tag) { + utils::CString&& tag) { // TODO: support MSAA swapchain if (UTILS_UNLIKELY(flags & SWAP_CHAIN_CONFIG_APPLE_CVPIXELBUFFER)) { @@ -668,18 +668,18 @@ void MetalDriver::createSwapChainR(Handle sch, void* nativeWindow, } void MetalDriver::createSwapChainHeadlessR(Handle sch, - uint32_t width, uint32_t height, uint64_t flags, utils::CString tag) { + uint32_t width, uint32_t height, uint64_t flags, utils::CString&& tag) { construct_handle(sch, *mContext, mPlatform, width, height, flags); mHandleAllocator.associateTagToHandle(sch.getId(), std::move(tag)); } -void MetalDriver::createSyncR(Handle sh, utils::CString tag) { +void MetalDriver::createSyncR(Handle sh, utils::CString&& tag) { // TODO: Ensure sync is active, and then invoke and clear all pending // callbacks. mHandleAllocator.associateTagToHandle(sh.getId(), std::move(tag)); } -void MetalDriver::createTimerQueryR(Handle tqh, utils::CString tag) { +void MetalDriver::createTimerQueryR(Handle tqh, utils::CString&& tag) { // nothing to do, timer query was constructed in createTimerQueryS mHandleAllocator.associateTagToHandle(tqh.getId(), std::move(tag)); } @@ -718,7 +718,7 @@ const char* toString(DescriptorFlags flags) { } void MetalDriver::createDescriptorSetLayoutR( - Handle dslh, DescriptorSetLayout&& info, utils::CString tag) { + Handle dslh, DescriptorSetLayout&& info, utils::CString&& tag) { #if FILAMENT_METAL_DEBUG_LOG == 1 const char* labelStr = ""; std::visit([&labelStr](auto&& arg) { @@ -743,7 +743,7 @@ void MetalDriver::createDescriptorSetLayoutR( } void MetalDriver::createDescriptorSetR( - Handle dsh, Handle dslh, utils::CString tag) { + Handle dsh, Handle dslh, utils::CString&& tag) { DEBUG_LOG("createDescriptorSetR(dsh = %d, dslh = %d)\n", dsh.getId(), dslh.getId()); MetalDescriptorSetLayout* layout = handle_cast(dslh); construct_handle(dsh, layout); diff --git a/filament/backend/src/opengl/OpenGLDriver.cpp b/filament/backend/src/opengl/OpenGLDriver.cpp index 991a655cec..e55ecb21c5 100644 --- a/filament/backend/src/opengl/OpenGLDriver.cpp +++ b/filament/backend/src/opengl/OpenGLDriver.cpp @@ -655,7 +655,7 @@ void OpenGLDriver::createVertexBufferInfoR( uint8_t bufferCount, uint8_t attributeCount, AttributeArray attributes, - CString tag) { + CString&& tag) { DEBUG_MARKER() construct(vbih, bufferCount, attributeCount, attributes); mHandleAllocator.associateTagToHandle(vbih.getId(), std::move(tag)); @@ -665,7 +665,7 @@ void OpenGLDriver::createVertexBufferR( Handle vbh, uint32_t vertexCount, Handle vbih, - CString tag) { + CString&& tag) { DEBUG_MARKER() construct(vbh, vertexCount, vbih); mHandleAllocator.associateTagToHandle(vbh.getId(), std::move(tag)); @@ -676,7 +676,7 @@ void OpenGLDriver::createIndexBufferR( ElementType const elementType, uint32_t indexCount, BufferUsage const usage, - CString tag) { + CString&& tag) { DEBUG_MARKER() auto& gl = mContext; @@ -692,7 +692,7 @@ void OpenGLDriver::createIndexBufferR( } void OpenGLDriver::createBufferObjectR(Handle boh, uint32_t byteCount, - BufferObjectBinding bindingType, BufferUsage usage, CString tag) { + BufferObjectBinding bindingType, BufferUsage usage, CString&& tag) { DEBUG_MARKER() assert_invariant(byteCount > 0); @@ -719,7 +719,7 @@ void OpenGLDriver::createBufferObjectR(Handle boh, uint32_t byte void OpenGLDriver::createRenderPrimitiveR(Handle rph, Handle vbh, Handle ibh, - PrimitiveType const pt, CString tag) { + PrimitiveType const pt, CString&& tag) { DEBUG_MARKER() auto& gl = mContext; @@ -755,7 +755,7 @@ void OpenGLDriver::createRenderPrimitiveR(Handle rph, mHandleAllocator.associateTagToHandle(rph.getId(), std::move(tag)); } -void OpenGLDriver::createProgramR(Handle ph, Program&& program, CString tag) { +void OpenGLDriver::createProgramR(Handle ph, Program&& program, CString&& tag) { DEBUG_MARKER() @@ -888,7 +888,7 @@ void OpenGLDriver::textureStorage(GLTexture* t, void OpenGLDriver::createTextureR(Handle th, SamplerType target, uint8_t levels, TextureFormat format, uint8_t samples, uint32_t width, uint32_t height, uint32_t depth, - TextureUsage usage, CString tag) { + TextureUsage usage, CString&& tag) { DEBUG_MARKER() GLenum internalFormat = getInternalFormat(format); @@ -981,7 +981,7 @@ void OpenGLDriver::createTextureR(Handle th, SamplerType target, uint } void OpenGLDriver::createTextureViewR(Handle th, - Handle srch, uint8_t const baseLevel, uint8_t const levelCount, CString tag) { + Handle srch, uint8_t const baseLevel, uint8_t const levelCount, CString&& tag) { DEBUG_MARKER() GLTexture const* const src = handle_cast(srch); @@ -1029,7 +1029,7 @@ void OpenGLDriver::createTextureViewR(Handle th, void OpenGLDriver::createTextureViewSwizzleR(Handle th, Handle srch, TextureSwizzle const r, TextureSwizzle const g, TextureSwizzle const b, TextureSwizzle const a, - CString tag) { + CString&& tag) { DEBUG_MARKER() GLTexture const* const src = handle_cast(srch); @@ -1095,7 +1095,7 @@ void OpenGLDriver::createTextureViewSwizzleR(Handle th, Handle th, SamplerType target, TextureFormat format, uint32_t width, uint32_t height, TextureUsage usage, - Platform::ExternalImageHandleRef image, CString tag) { + Platform::ExternalImageHandleRef image, CString&& tag) { DEBUG_MARKER() usage |= TextureUsage::SAMPLEABLE; @@ -1147,7 +1147,7 @@ void OpenGLDriver::createTextureExternalImage2R(Handle th, SamplerTyp void OpenGLDriver::createTextureExternalImageR(Handle th, SamplerType target, TextureFormat format, uint32_t width, uint32_t height, TextureUsage usage, void* image, - CString tag) { + CString&& tag) { DEBUG_MARKER() usage |= TextureUsage::SAMPLEABLE; @@ -1198,13 +1198,13 @@ void OpenGLDriver::createTextureExternalImageR(Handle th, SamplerType void OpenGLDriver::createTextureExternalImagePlaneR(Handle th, TextureFormat format, uint32_t width, uint32_t height, TextureUsage usage, - void* image, uint32_t plane, CString tag) { + void* image, uint32_t plane, CString&&) { // not relevant for the OpenGL backend } void OpenGLDriver::importTextureR(Handle th, intptr_t const id, SamplerType target, uint8_t levels, TextureFormat format, uint8_t samples, - uint32_t width, uint32_t height, uint32_t depth, TextureUsage usage, CString tag) { + uint32_t width, uint32_t height, uint32_t depth, TextureUsage usage, CString&& tag) { DEBUG_MARKER() auto const& gl = mContext; @@ -1659,7 +1659,7 @@ void OpenGLDriver::renderBufferStorage(GLuint const rbo, GLenum internalformat, } void OpenGLDriver::createDefaultRenderTargetR( - Handle rth, CString tag) { + Handle rth, CString&& tag) { DEBUG_MARKER() construct(rth, 0, 0); // FIXME: we don't know the width/height @@ -1682,7 +1682,7 @@ void OpenGLDriver::createRenderTargetR(Handle rth, MRT color, TargetBufferInfo depth, TargetBufferInfo stencil, - CString tag) { + CString&& tag) { DEBUG_MARKER() GLRenderTarget* rt = construct(rth, width, height); @@ -1798,7 +1798,7 @@ void OpenGLDriver::createRenderTargetR(Handle rth, mHandleAllocator.associateTagToHandle(rth.getId(), std::move(tag)); } -void OpenGLDriver::createFenceR(Handle fh, CString tag) { +void OpenGLDriver::createFenceR(Handle fh, CString&& tag) { DEBUG_MARKER() GLFence* f = handle_cast(fh); @@ -1822,7 +1822,7 @@ void OpenGLDriver::createFenceR(Handle fh, CString tag) { mHandleAllocator.associateTagToHandle(fh.getId(), std::move(tag)); } -void OpenGLDriver::createSyncR(Handle sh, CString tag) { +void OpenGLDriver::createSyncR(Handle sh, CString&& tag) { DEBUG_MARKER() GLSyncFence* s = handle_cast(sh); @@ -1841,7 +1841,7 @@ void OpenGLDriver::createSyncR(Handle sh, CString tag) { } void OpenGLDriver::createSwapChainR(Handle sch, void* nativeWindow, uint64_t const flags, - CString tag) { + CString&& tag) { DEBUG_MARKER() GLSwapChain* sc = handle_cast(sch); @@ -1863,7 +1863,7 @@ void OpenGLDriver::createSwapChainR(Handle sch, void* nativeWindow, } void OpenGLDriver::createSwapChainHeadlessR(Handle sch, - uint32_t const width, uint32_t const height, uint64_t const flags, CString tag) { + uint32_t const width, uint32_t const height, uint64_t const flags, CString&& tag) { DEBUG_MARKER() GLSwapChain* sc = handle_cast(sch); @@ -1885,7 +1885,7 @@ void OpenGLDriver::createSwapChainHeadlessR(Handle sch, mHandleAllocator.associateTagToHandle(sch.getId(), std::move(tag)); } -void OpenGLDriver::createTimerQueryR(Handle tqh, CString tag) { +void OpenGLDriver::createTimerQueryR(Handle tqh, CString&& tag) { DEBUG_MARKER() GLTimerQuery* tq = handle_cast(tqh); mContext.createTimerQuery(tq); @@ -1893,14 +1893,14 @@ void OpenGLDriver::createTimerQueryR(Handle tqh, CString tag) { } void OpenGLDriver::createDescriptorSetLayoutR(Handle dslh, - DescriptorSetLayout&& info, CString tag) { + DescriptorSetLayout&& info, CString&& tag) { DEBUG_MARKER() construct(dslh, std::move(info)); mHandleAllocator.associateTagToHandle(dslh.getId(), std::move(tag)); } void OpenGLDriver::createDescriptorSetR(Handle dsh, - Handle dslh, CString tag) { + Handle dslh, CString&& tag) { DEBUG_MARKER() GLDescriptorSetLayout const* dsl = handle_cast(dslh); construct(dsh, mContext, dslh, dsl); diff --git a/filament/backend/src/vulkan/VulkanDriver.cpp b/filament/backend/src/vulkan/VulkanDriver.cpp index 1517a1a8cd..cee5344436 100644 --- a/filament/backend/src/vulkan/VulkanDriver.cpp +++ b/filament/backend/src/vulkan/VulkanDriver.cpp @@ -502,7 +502,7 @@ void VulkanDriver::finish(int dummy) { void VulkanDriver::createRenderPrimitiveR(Handle rph, Handle vbh, Handle ibh, - PrimitiveType pt, utils::CString tag) { + PrimitiveType pt, utils::CString&& tag) { FVK_SYSTRACE_SCOPE(); auto vb = resource_ptr::cast(&mResourceManager, vbh); auto ib = resource_ptr::cast(&mResourceManager, ibh); @@ -521,7 +521,7 @@ void VulkanDriver::destroyRenderPrimitive(Handle rph) { } void VulkanDriver::createVertexBufferInfoR(Handle vbih, uint8_t bufferCount, - uint8_t attributeCount, AttributeArray attributes, utils::CString tag) { + uint8_t attributeCount, AttributeArray attributes, utils::CString&& tag) { FVK_SYSTRACE_SCOPE(); auto vbi = resource_ptr::make(&mResourceManager, vbih, bufferCount, attributeCount, attributes); @@ -539,7 +539,7 @@ void VulkanDriver::destroyVertexBufferInfo(Handle vbih) { } void VulkanDriver::createVertexBufferR(Handle vbh, uint32_t vertexCount, - Handle vbih, utils::CString tag) { + Handle vbih, utils::CString&& tag) { FVK_SYSTRACE_SCOPE(); auto vbi = resource_ptr::cast(&mResourceManager, vbih); auto vb = resource_ptr::make(&mResourceManager, vbh, mContext, mStagePool, @@ -558,7 +558,7 @@ void VulkanDriver::destroyVertexBuffer(Handle vbh) { } void VulkanDriver::createIndexBufferR(Handle ibh, ElementType elementType, - uint32_t indexCount, BufferUsage usage, utils::CString tag) { + uint32_t indexCount, BufferUsage usage, utils::CString&& tag) { FVK_SYSTRACE_SCOPE(); auto elementSize = (uint8_t) getElementTypeSize(elementType); auto ib = resource_ptr::make(&mResourceManager, ibh, mContext, mAllocator, @@ -577,7 +577,7 @@ void VulkanDriver::destroyIndexBuffer(Handle ibh) { } void VulkanDriver::createBufferObjectR(Handle boh, uint32_t byteCount, - BufferObjectBinding bindingType, BufferUsage usage, utils::CString tag) { + BufferObjectBinding bindingType, BufferUsage usage, utils::CString&& tag) { FVK_SYSTRACE_SCOPE(); auto bo = resource_ptr::make(&mResourceManager, boh, mContext, mAllocator, mStagePool, mBufferCache, byteCount, bindingType); @@ -596,7 +596,7 @@ void VulkanDriver::destroyBufferObject(Handle boh) { void VulkanDriver::createTextureR(Handle th, SamplerType target, uint8_t levels, TextureFormat format, uint8_t samples, uint32_t w, uint32_t h, uint32_t depth, - TextureUsage usage, utils::CString tag) { + TextureUsage usage, utils::CString&& tag) { FVK_SYSTRACE_SCOPE(); auto texture = resource_ptr::make(&mResourceManager, th, mPlatform->getDevice(), mPlatform->getPhysicalDevice(), mContext, mAllocator, &mResourceManager, &mCommands, @@ -613,7 +613,7 @@ void VulkanDriver::createTextureR(Handle th, SamplerType target, uint } void VulkanDriver::createTextureViewR(Handle th, Handle srch, - uint8_t baseLevel, uint8_t levelCount, utils::CString tag) { + uint8_t baseLevel, uint8_t levelCount, utils::CString&& tag) { auto src = resource_ptr::cast(&mResourceManager, srch); auto texture = resource_ptr::make(&mResourceManager, th, mPlatform->getDevice(), mPlatform->getPhysicalDevice(), mContext, mAllocator, &mCommands, src, baseLevel, @@ -624,7 +624,7 @@ void VulkanDriver::createTextureViewR(Handle th, Handle sr void VulkanDriver::createTextureViewSwizzleR(Handle th, Handle srch, backend::TextureSwizzle r, backend::TextureSwizzle g, backend::TextureSwizzle b, - backend::TextureSwizzle a, utils::CString tag) { + backend::TextureSwizzle a, utils::CString&& tag) { TextureSwizzle const swizzleArray[] = { r, g, b, a }; VkComponentMapping const swizzle = fvkutils::getSwizzleMap(swizzleArray); auto src = resource_ptr::cast(&mResourceManager, srch); @@ -636,7 +636,7 @@ void VulkanDriver::createTextureViewSwizzleR(Handle th, Handle th, backend::SamplerType target, backend::TextureFormat format, uint32_t width, uint32_t height, backend::TextureUsage usage, - Platform::ExternalImageHandleRef externalImage, utils::CString tag) { + Platform::ExternalImageHandleRef externalImage, utils::CString&& tag) { FVK_SYSTRACE_SCOPE(); auto metadata = mPlatform->extractExternalImageMetadata(externalImage); @@ -687,7 +687,7 @@ void VulkanDriver::createTextureExternalImage2R(Handle th, backend::S void VulkanDriver::createTextureExternalImageR(Handle th, backend::SamplerType target, backend::TextureFormat format, uint32_t width, uint32_t height, backend::TextureUsage usage, - void* externalImage, utils::CString tag) { + void* externalImage, utils::CString&& tag) { FVK_SYSTRACE_SCOPE(); assert_invariant(false && "Not supported in Vulkan backend"); // not supported in this backend @@ -695,14 +695,14 @@ void VulkanDriver::createTextureExternalImageR(Handle th, backend::Sa void VulkanDriver::createTextureExternalImagePlaneR(Handle th, backend::TextureFormat format, uint32_t width, uint32_t height, backend::TextureUsage usage, - void* image, uint32_t plane, utils::CString tag) { + void* image, uint32_t plane, utils::CString&& tag) { assert_invariant(false && "Not supported in Vulkan backend"); } void VulkanDriver::importTextureR(Handle th, intptr_t id, SamplerType target, uint8_t levels, TextureFormat format, uint8_t samples, uint32_t w, uint32_t h, uint32_t depth, - TextureUsage usage, utils::CString tag) { + TextureUsage usage, utils::CString&& tag) { // not supported in this backend assert_invariant(false && "Not supported in Vulkan backend"); mResourceManager.associateHandle(th.getId(), std::move(tag)); @@ -718,7 +718,7 @@ void VulkanDriver::destroyTexture(Handle th) { mExternalImageManager.removeExternallySampledTexture(texture); } -void VulkanDriver::createProgramR(Handle ph, Program&& program, utils::CString tag) { +void VulkanDriver::createProgramR(Handle ph, Program&& program, utils::CString&& tag) { FVK_SYSTRACE_SCOPE(); auto vprogram = resource_ptr::make(&mResourceManager, ph, mPlatform->getDevice(), program); @@ -734,7 +734,7 @@ void VulkanDriver::destroyProgram(Handle ph) { vprogram.dec(); } -void VulkanDriver::createDefaultRenderTargetR(Handle rth, utils::CString tag) { +void VulkanDriver::createDefaultRenderTargetR(Handle rth, utils::CString&& tag) { assert_invariant(mDefaultRenderTarget); // Default render target should already exist. auto renderTarget = resource_ptr::make(&mResourceManager, rth, @@ -747,7 +747,7 @@ void VulkanDriver::createDefaultRenderTargetR(Handle rth, utils: void VulkanDriver::createRenderTargetR(Handle rth, TargetBufferFlags targets, uint32_t width, uint32_t height, uint8_t samples, uint8_t layerCount, MRT color, TargetBufferInfo depth, TargetBufferInfo stencil, - utils::CString tag) { + utils::CString&& tag) { FVK_SYSTRACE_SCOPE(); @@ -824,7 +824,7 @@ void VulkanDriver::destroyRenderTarget(Handle rth) { } } -void VulkanDriver::createFenceR(Handle fh, utils::CString tag) { +void VulkanDriver::createFenceR(Handle fh, utils::CString&& tag) { VulkanCommandBuffer* cmdbuf; if (mCurrentRenderPass.commandBuffer) { cmdbuf = mCurrentRenderPass.commandBuffer; @@ -839,7 +839,7 @@ void VulkanDriver::createFenceR(Handle fh, utils::CString tag) { mResourceManager.associateHandle(fh.getId(), std::move(tag)); } -void VulkanDriver::createSyncR(Handle sh, utils::CString tag) { +void VulkanDriver::createSyncR(Handle sh, utils::CString&& tag) { auto sync = resource_ptr::cast(&mResourceManager, sh); VkFence fence = VK_NULL_HANDLE; std::shared_ptr fenceStatus; @@ -870,7 +870,7 @@ void VulkanDriver::createSyncR(Handle sh, utils::CString tag) { } void VulkanDriver::createSwapChainR(Handle sch, void* nativeWindow, uint64_t flags, - utils::CString tag) { + utils::CString&& tag) { FVK_SYSTRACE_SCOPE(); // Running gc() to guard against an edge case where the old swapchains need to have been // destroyed before the new swapchain can be created. Otherwise, we would fail @@ -899,7 +899,7 @@ void VulkanDriver::createSwapChainR(Handle sch, void* nativeWindow, } void VulkanDriver::createSwapChainHeadlessR(Handle sch, uint32_t width, - uint32_t height, uint64_t flags, utils::CString tag) { + uint32_t height, uint64_t flags, utils::CString&& tag) { if ((flags & backend::SWAP_CHAIN_CONFIG_SRGB_COLORSPACE) != 0 && !isSRGBSwapChainSupported()) { FVK_LOGW << "sRGB swapchain requested, but Platform does not support it"; flags = flags | ~(backend::SWAP_CHAIN_CONFIG_SRGB_COLORSPACE); @@ -912,13 +912,13 @@ void VulkanDriver::createSwapChainHeadlessR(Handle sch, uint32_t wi mResourceManager.associateHandle(sch.getId(), std::move(tag)); } -void VulkanDriver::createTimerQueryR(Handle tqh, utils::CString tag) { +void VulkanDriver::createTimerQueryR(Handle tqh, utils::CString&& tag) { // nothing to do, timer query was constructed in createTimerQueryS mResourceManager.associateHandle(tqh.getId(), std::move(tag)); } void VulkanDriver::createDescriptorSetLayoutR(Handle dslh, - backend::DescriptorSetLayout&& info, utils::CString tag) { + backend::DescriptorSetLayout&& info, utils::CString&& tag) { FVK_SYSTRACE_SCOPE(); auto layout = mDescriptorSetLayoutCache.createLayout(dslh, std::move(info)); layout.inc(); @@ -926,7 +926,7 @@ void VulkanDriver::createDescriptorSetLayoutR(Handle dslh } void VulkanDriver::createDescriptorSetR(Handle dsh, - Handle dslh, utils::CString tag) { + Handle dslh, utils::CString&& tag) { FVK_SYSTRACE_SCOPE(); fvkmemory::resource_ptr layout = fvkmemory::resource_ptr::cast(&mResourceManager, dslh); diff --git a/filament/backend/src/webgpu/WebGPUDriver.cpp b/filament/backend/src/webgpu/WebGPUDriver.cpp index d11cdf922c..0ba256dd58 100644 --- a/filament/backend/src/webgpu/WebGPUDriver.cpp +++ b/filament/backend/src/webgpu/WebGPUDriver.cpp @@ -450,7 +450,7 @@ Handle WebGPUDriver::createTextureExternalImagePlaneS() noexcept { // ------------------------------------------------------------------------------------------------ void WebGPUDriver::createSwapChainR(Handle sch, void* nativeWindow, - const uint64_t flags, utils::CString tag) { + const uint64_t flags, utils::CString&& tag) { FWGPU_SYSTRACE_SCOPE(); // TODO: support MSAA swapchain @@ -480,7 +480,7 @@ void WebGPUDriver::createSwapChainR(Handle sch, void* nativeWindow, } void WebGPUDriver::createSwapChainHeadlessR(Handle sch, uint32_t width, - uint32_t height, uint64_t flags, utils::CString tag) { + uint32_t height, uint64_t flags, utils::CString&& tag) { wgpu::Extent2D extent = { .width = width, .height = height }; mSwapChain = constructHandle(sch, extent, mAdapter, mDevice, flags); @@ -493,7 +493,7 @@ void WebGPUDriver::createSwapChainHeadlessR(Handle sch, uint32_t wi void WebGPUDriver::createVertexBufferInfoR(Handle vertexBufferInfoHandle, const uint8_t bufferCount, const uint8_t attributeCount, const AttributeArray attributes, - utils::CString tag) { + utils::CString&& tag) { FWGPU_SYSTRACE_SCOPE(); constructHandle(vertexBufferInfoHandle, bufferCount, attributeCount, attributes, mDeviceLimits); @@ -502,7 +502,7 @@ void WebGPUDriver::createVertexBufferInfoR(Handle vertexBuff void WebGPUDriver::createVertexBufferR(Handle vertexBufferHandle, const uint32_t vertexCount, Handle vertexBufferInfoHandle, - utils::CString tag) { + utils::CString&& tag) { FWGPU_SYSTRACE_SCOPE(); const auto vertexBufferInfo = handleCast(vertexBufferInfoHandle); constructHandle(vertexBufferHandle, vertexCount, @@ -512,7 +512,7 @@ void WebGPUDriver::createVertexBufferR(Handle vertexBufferHandle void WebGPUDriver::createIndexBufferR(Handle indexBufferHandle, const ElementType elementType, const uint32_t indexCount, const BufferUsage usage, - utils::CString tag) { + utils::CString&& tag) { FWGPU_SYSTRACE_SCOPE(); const auto elementSize = static_cast(getElementTypeSize(elementType)); constructHandle(indexBufferHandle, mDevice, elementSize, indexCount); @@ -521,7 +521,7 @@ void WebGPUDriver::createIndexBufferR(Handle indexBufferHandle, void WebGPUDriver::createBufferObjectR(Handle bufferObjectHandle, const uint32_t byteCount, const BufferObjectBinding bindingType, const BufferUsage usage, - utils::CString tag) { + utils::CString&& tag) { FWGPU_SYSTRACE_SCOPE(); constructHandle(bufferObjectHandle, mDevice, bindingType, byteCount); setDebugTag(bufferObjectHandle.getId(), std::move(tag)); @@ -530,7 +530,7 @@ void WebGPUDriver::createBufferObjectR(Handle bufferObjectHandle void WebGPUDriver::createTextureR(Handle textureHandle, const SamplerType target, const uint8_t levels, const TextureFormat format, const uint8_t samples, const uint32_t width, const uint32_t height, const uint32_t depth, - const TextureUsage usage, utils::CString tag) { + const TextureUsage usage, utils::CString&& tag) { FWGPU_SYSTRACE_SCOPE(); constructHandle(textureHandle, target, levels, format, samples, width, height, depth, usage, mDevice); @@ -539,7 +539,7 @@ void WebGPUDriver::createTextureR(Handle textureHandle, const Sampler void WebGPUDriver::createTextureViewR(Handle textureHandle, Handle sourceTextureHandle, const uint8_t baseLevel, const uint8_t levelCount, - utils::CString tag) { + utils::CString&& tag) { auto source = handleCast(sourceTextureHandle); constructHandle(textureHandle, source, baseLevel, levelCount); @@ -550,7 +550,7 @@ void WebGPUDriver::createTextureViewR(Handle textureHandle, void WebGPUDriver::createTextureViewSwizzleR(Handle textureHandle, Handle sourceTextureHandle, const backend::TextureSwizzle r, const backend::TextureSwizzle g, const backend::TextureSwizzle b, - const backend::TextureSwizzle a, utils::CString tag) { + const backend::TextureSwizzle a, utils::CString&& tag) { if (!isTextureSwizzleSupported()) { FWGPU_LOGW << "WebGPUDriver::createTextureViewSwizzleR called while texture swizzling is " @@ -577,7 +577,7 @@ void WebGPUDriver::createTextureViewSwizzleR(Handle textureHandle, void WebGPUDriver::createTextureExternalImage2R(Handle textureHandle, const backend::SamplerType target, const backend::TextureFormat format, const uint32_t width, const uint32_t height, const backend::TextureUsage usage, - Platform::ExternalImageHandleRef externalImage, utils::CString tag) { + Platform::ExternalImageHandleRef externalImage, utils::CString&& tag) { FWGPU_SYSTRACE_SCOPE(); PANIC_POSTCONDITION("External WebGPU Texture is not supported"); } @@ -585,27 +585,27 @@ void WebGPUDriver::createTextureExternalImage2R(Handle textureHandle, void WebGPUDriver::createTextureExternalImageR(Handle textureHandle, const backend::SamplerType target, const backend::TextureFormat format, const uint32_t width, const uint32_t height, const backend::TextureUsage usage, - void* externalImage, utils::CString tag) { + void* externalImage, utils::CString&& tag) { FWGPU_SYSTRACE_SCOPE(); PANIC_POSTCONDITION("External WebGPU Texture is not supported"); } void WebGPUDriver::createTextureExternalImagePlaneR(Handle textureHandle, const backend::TextureFormat format, const uint32_t width, const uint32_t height, - const backend::TextureUsage usage, void* image, const uint32_t plane, utils::CString tag) { + const backend::TextureUsage usage, void* image, const uint32_t plane, utils::CString&& tag) { PANIC_POSTCONDITION("External WebGPU Texture is not supported"); } void WebGPUDriver::importTextureR(Handle textureHandle, const intptr_t id, const SamplerType target, const uint8_t levels, const TextureFormat format, const uint8_t samples, const uint32_t width, const uint32_t height, const uint32_t depth, - const TextureUsage usage, utils::CString tag) { + const TextureUsage usage, utils::CString&& tag) { PANIC_POSTCONDITION("Import WebGPU Texture is not supported"); } void WebGPUDriver::createRenderPrimitiveR(Handle renderPrimitiveHandle, Handle vertexBufferHandle, Handle indexBufferHandle, - const PrimitiveType primitiveType, utils::CString tag) { + const PrimitiveType primitiveType, utils::CString&& tag) { FWGPU_SYSTRACE_SCOPE(); assert_invariant(mDevice); const auto renderPrimitive = constructHandle(renderPrimitiveHandle); @@ -618,14 +618,14 @@ void WebGPUDriver::createRenderPrimitiveR(Handle renderPrimit } void WebGPUDriver::createProgramR(Handle programHandle, Program&& program, - utils::CString tag) { + utils::CString&& tag) { FWGPU_SYSTRACE_SCOPE(); constructHandle(programHandle, mDevice, program); setDebugTag(programHandle.getId(), std::move(tag)); } void WebGPUDriver::createDefaultRenderTargetR(Handle renderTargetHandle, - utils::CString tag) { + utils::CString&& tag) { assert_invariant(!mDefaultRenderTarget); mDefaultRenderTarget = constructHandle(renderTargetHandle); assert_invariant(mDefaultRenderTarget); @@ -638,7 +638,7 @@ void WebGPUDriver::createDefaultRenderTargetR(Handle renderTarge void WebGPUDriver::createRenderTargetR(Handle renderTargetHandle, const TargetBufferFlags targetFlags, const uint32_t width, const uint32_t height, const uint8_t samples, const uint8_t layerCount, const MRT color, - const TargetBufferInfo depth, const TargetBufferInfo stencil, utils::CString tag) { + const TargetBufferInfo depth, const TargetBufferInfo stencil, utils::CString&& tag) { FWGPU_SYSTRACE_SCOPE(); constructHandle( renderTargetHandle, width, height, samples, layerCount, color, depth, stencil, @@ -650,7 +650,7 @@ void WebGPUDriver::createRenderTargetR(Handle renderTargetHandle setDebugTag(renderTargetHandle.getId(), std::move(tag)); } -void WebGPUDriver::createFenceR(Handle fenceHandle, utils::CString tag) { +void WebGPUDriver::createFenceR(Handle fenceHandle, utils::CString&& tag) { // The handle is constructed synchronously in createFenceS. const auto fence = handleCast(fenceHandle); assert_invariant(mQueue); @@ -658,24 +658,24 @@ void WebGPUDriver::createFenceR(Handle fenceHandle, utils::CString tag) setDebugTag(fenceHandle.getId(), std::move(tag)); } -void WebGPUDriver::createSyncR(Handle syncHandle, utils::CString tag) { +void WebGPUDriver::createSyncR(Handle syncHandle, utils::CString&& tag) { // TODO: Ensure sync is active, and then invoke and clear all pending // callbacks. setDebugTag(syncHandle.getId(), std::move(tag)); } -void WebGPUDriver::createTimerQueryR(Handle tqh, utils::CString tag) {} +void WebGPUDriver::createTimerQueryR(Handle tqh, utils::CString&& tag) {} void WebGPUDriver::createDescriptorSetLayoutR( Handle descriptorSetLayoutHandle, - backend::DescriptorSetLayout&& info, utils::CString tag) { + backend::DescriptorSetLayout&& info, utils::CString&& tag) { FWGPU_SYSTRACE_SCOPE(); constructHandle(descriptorSetLayoutHandle, std::move(info), mDevice); setDebugTag(descriptorSetLayoutHandle.getId(), std::move(tag)); } void WebGPUDriver::createDescriptorSetR(Handle descriptorSetHandle, - Handle descriptorSetLayoutHandle, utils::CString tag) { + Handle descriptorSetLayoutHandle, utils::CString&& tag) { FWGPU_SYSTRACE_SCOPE(); auto layout = handleCast(descriptorSetLayoutHandle); constructHandle(descriptorSetHandle, layout->getLayout(), @@ -2091,7 +2091,7 @@ void WebGPUDriver::bindDescriptorSet(Handle descriptorSetHandle .offsets = std::move(offsets) }; } -void WebGPUDriver::setDebugTag(HandleBase::HandleId handleId, utils::CString tag) { +void WebGPUDriver::setDebugTag(HandleBase::HandleId handleId, utils::CString&& tag) { //todo } diff --git a/filament/backend/src/webgpu/WebGPUDriver.h b/filament/backend/src/webgpu/WebGPUDriver.h index aefb0eb331..ef9dd40746 100644 --- a/filament/backend/src/webgpu/WebGPUDriver.h +++ b/filament/backend/src/webgpu/WebGPUDriver.h @@ -68,7 +68,7 @@ private: [[nodiscard]] ShaderLanguage getShaderLanguage() const noexcept final; [[nodiscard]] wgpu::Sampler makeSampler(SamplerParams const& params); [[nodiscard]] static wgpu::AddressMode fWrapModeToWAddressMode(const filament::backend::SamplerWrapMode& fUsage); - void setDebugTag(HandleBase::HandleId handleId, utils::CString tag); + void setDebugTag(HandleBase::HandleId handleId, utils::CString&& tag); // The platform (e.g. OS) specific aspects of the WebGPU backend are strictly only // handled in the WebGPUPlatform. diff --git a/filament/src/details/BufferObject.cpp b/filament/src/details/BufferObject.cpp index 8449c0cc13..a3c35f1177 100644 --- a/filament/src/details/BufferObject.cpp +++ b/filament/src/details/BufferObject.cpp @@ -76,7 +76,7 @@ FBufferObject::FBufferObject(FEngine& engine, const Builder& builder) : mByteCount(builder->mByteCount), mBindingType(builder->mBindingType) { FEngine::DriverApi& driver = engine.getDriverApi(); mHandle = driver.createBufferObject(builder->mByteCount, builder->mBindingType, - backend::BufferUsage::STATIC, builder.getName()); + backend::BufferUsage::STATIC, utils::CString{ builder.getName() }); } void FBufferObject::terminate(FEngine& engine) { diff --git a/filament/src/details/Material.cpp b/filament/src/details/Material.cpp index 36a10dd076..4bf5348106 100644 --- a/filament/src/details/Material.cpp +++ b/filament/src/details/Material.cpp @@ -686,7 +686,7 @@ void FMaterial::createAndCacheProgram(Program&& p, Variant const variant) const } } - auto const program = driverApi.createProgram(std::move(p), mName); + auto const program = driverApi.createProgram(std::move(p), CString{ mName }); assert_invariant(program); mCachedPrograms[variant.key] = program; diff --git a/filament/src/details/MaterialInstance.cpp b/filament/src/details/MaterialInstance.cpp index 70f4e38061..0265535cab 100644 --- a/filament/src/details/MaterialInstance.cpp +++ b/filament/src/details/MaterialInstance.cpp @@ -81,7 +81,7 @@ FMaterialInstance::FMaterialInstance(FEngine& engine, FMaterial const* material, size_t const uboSize = std::max(size_t(16), material->getUniformInterfaceBlock().getSize()); mUniforms = UniformBuffer(uboSize); mUbHandle = driver.createBufferObject(mUniforms.getSize(), BufferObjectBinding::UNIFORM, - BufferUsage::STATIC, material->getName()); + BufferUsage::STATIC, utils::CString{ material->getName() }); // set the UBO, always descriptor 0 mDescriptorSet.setBuffer(material->getDescriptorSetLayout(), @@ -148,7 +148,7 @@ FMaterialInstance::FMaterialInstance(FEngine& engine, mUniforms.setUniforms(other->getUniformBuffer()); mUbHandle = driver.createBufferObject(mUniforms.getSize(), BufferObjectBinding::UNIFORM, - BufferUsage::DYNAMIC, material->getName()); + BufferUsage::DYNAMIC, CString{ material->getName() }); // set the UBO, always descriptor 0 mDescriptorSet.setBuffer(mMaterial->getDescriptorSetLayout(), diff --git a/filament/src/details/MorphTargetBuffer.cpp b/filament/src/details/MorphTargetBuffer.cpp index cf0e5f1777..cda888c33f 100644 --- a/filament/src/details/MorphTargetBuffer.cpp +++ b/filament/src/details/MorphTargetBuffer.cpp @@ -128,7 +128,7 @@ FMorphTargetBuffer::FMorphTargetBuffer(FEngine& engine, const Builder& builder) getHeight(mVertexCount), mCount, TextureUsage::DEFAULT, - builder.getName()); + utils::CString{ builder.getName() }); mTbHandle = driver.createTexture(SamplerType::SAMPLER_2D_ARRAY, 1, TextureFormat::RGBA16I, 1, @@ -136,7 +136,7 @@ FMorphTargetBuffer::FMorphTargetBuffer(FEngine& engine, const Builder& builder) getHeight(mVertexCount), mCount, TextureUsage::DEFAULT, - builder.getName()); + utils::CString{ builder.getName() }); } void FMorphTargetBuffer::terminate(FEngine& engine) { diff --git a/filament/src/details/RenderTarget.cpp b/filament/src/details/RenderTarget.cpp index 93333b9937..a424df1dc8 100644 --- a/filament/src/details/RenderTarget.cpp +++ b/filament/src/details/RenderTarget.cpp @@ -221,7 +221,7 @@ FRenderTarget::FRenderTarget(FEngine& engine, const Builder& builder) FEngine::DriverApi& driver = engine.getDriverApi(); mHandle = driver.createRenderTarget(mAttachmentMask, builder.mImpl->mWidth, builder.mImpl->mHeight, builder.mImpl->mSamples, - builder.mImpl->mLayerCount, mrt, dinfo, {}, builder.getName()); + builder.mImpl->mLayerCount, mrt, dinfo, {}, utils::CString{ builder.getName() }); } void FRenderTarget::terminate(FEngine& engine) { diff --git a/filament/src/details/SkinningBuffer.cpp b/filament/src/details/SkinningBuffer.cpp index 547fd862cd..746be19b33 100644 --- a/filament/src/details/SkinningBuffer.cpp +++ b/filament/src/details/SkinningBuffer.cpp @@ -91,7 +91,7 @@ FSkinningBuffer::FSkinningBuffer(FEngine& engine, const Builder& builder) getPhysicalBoneCount(mBoneCount) * sizeof(PerRenderableBoneUib::BoneData), BufferObjectBinding::UNIFORM, BufferUsage::DYNAMIC, - builder.getName()); + utils::CString{ builder.getName() }); if (builder->mInitialize) { // initialize the bones to identity (before rounding up) diff --git a/filament/src/details/Texture.cpp b/filament/src/details/Texture.cpp index fc76e1549d..e23e94076f 100644 --- a/filament/src/details/Texture.cpp +++ b/filament/src/details/Texture.cpp @@ -313,7 +313,7 @@ FTexture::FTexture(FEngine& engine, const Builder& builder) return; } - auto tag = builder.getName(); + CString tag{ builder.getName() }; if (tag.empty()) { tag = CString{"FTexture"}; } diff --git a/filament/src/details/VertexBuffer.cpp b/filament/src/details/VertexBuffer.cpp index 5c0899168a..dcbcc144ba 100644 --- a/filament/src/details/VertexBuffer.cpp +++ b/filament/src/details/VertexBuffer.cpp @@ -280,7 +280,8 @@ FVertexBuffer::FVertexBuffer(FEngine& engine, const Builder& builder) mVertexBufferInfoHandle = engine.getVertexBufferInfoFactory().create(driver, mBufferCount, mDeclaredAttributes.count(), mAttributes); - mHandle = driver.createVertexBuffer(mVertexCount, mVertexBufferInfoHandle, builder.getName()); + mHandle = driver.createVertexBuffer(mVertexCount, mVertexBufferInfoHandle, + utils::CString{ builder.getName() }); // calculate buffer sizes size_t bufferSizes[MAX_VERTEX_BUFFER_COUNT] = {}; @@ -307,7 +308,8 @@ FVertexBuffer::FVertexBuffer(FEngine& engine, const Builder& builder) assert_invariant(bufferSizes[i] > 0); if (!mBufferObjects[i]) { BufferObjectHandle const bo = driver.createBufferObject(bufferSizes[i], - BufferObjectBinding::VERTEX, BufferUsage::STATIC, builder.getName()); + BufferObjectBinding::VERTEX, BufferUsage::STATIC, + utils::CString{ builder.getName() }); driver.setVertexBufferObject(mHandle, i, bo); mBufferObjects[i] = bo; } @@ -323,7 +325,8 @@ FVertexBuffer::FVertexBuffer(FEngine& engine, const Builder& builder) assert_invariant(bufferSizes[i] > 0); if (!mBufferObjects[i]) { BufferObjectHandle const bo = driver.createBufferObject(bufferSizes[i], - BufferObjectBinding::VERTEX, BufferUsage::STATIC, builder.getName()); + BufferObjectBinding::VERTEX, BufferUsage::STATIC, + utils::CString{ builder.getName() }); driver.setVertexBufferObject(mHandle, i, bo); mBufferObjects[i] = bo; }