builders now accept StaticString names
The const char* version of name is node [[deprecated]]. This change is only cosmetic, no implementation is changed. This is a first step toward eliminating non literal tags.
This commit is contained in:
committed by
Mathias Agopian
parent
653b2e859c
commit
ded1cb1b09
@@ -25,6 +25,7 @@
|
||||
#include <backend/BufferDescriptor.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
@@ -90,9 +91,21 @@ public:
|
||||
* @param name A string to identify this BufferObject
|
||||
* @param len Length of name, should be less than or equal to 128
|
||||
* @return This Builder, for chaining calls.
|
||||
* @deprecated Use name(utils::StaticString const&) instead.
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
Builder& name(const char* UTILS_NONNULL name, size_t len) noexcept;
|
||||
|
||||
/**
|
||||
* Associate an optional name with this BufferObject for debugging purposes.
|
||||
*
|
||||
* name will show in error messages and should be kept as short as possible.
|
||||
*
|
||||
* @param name A string literal to identify this BufferObject
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& name(utils::StaticString const& name) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the BufferObject and returns a pointer to it. After creation, the buffer
|
||||
* object is uninitialized. Use BufferObject::setBuffer() to initialize it.
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/PrivateImplementation.h>
|
||||
#include <utils/CString.h>
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
@@ -61,11 +62,17 @@ UTILS_PUBLIC void builderMakeName(utils::CString& outName, const char* name, siz
|
||||
template <typename Builder>
|
||||
class UTILS_PUBLIC BuilderNameMixin {
|
||||
public:
|
||||
UTILS_DEPRECATED
|
||||
Builder& name(const char* name, size_t len) noexcept {
|
||||
builderMakeName(mName, name, len);
|
||||
return static_cast<Builder&>(*this);
|
||||
}
|
||||
|
||||
Builder& name(utils::StaticString const& name) noexcept {
|
||||
builderMakeName(mName, name.data(), name.size());
|
||||
return static_cast<Builder&>(*this);
|
||||
}
|
||||
|
||||
utils::CString const& getName() const noexcept { return mName; }
|
||||
|
||||
private:
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <backend/BufferDescriptor.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
@@ -95,9 +96,21 @@ public:
|
||||
* @param name A string to identify this IndexBuffer
|
||||
* @param len Length of name, should be less than or equal to 128
|
||||
* @return This Builder, for chaining calls.
|
||||
* @deprecated Use name(utils::StaticString const&) instead.
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
Builder& name(const char* UTILS_NONNULL name, size_t len) noexcept;
|
||||
|
||||
/**
|
||||
* Associate an optional name with this IndexBuffer for debugging purposes.
|
||||
*
|
||||
* name will show in error messages and should be kept as short as possible.
|
||||
*
|
||||
* @param name A string literal to identify this IndexBuffer
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& name(utils::StaticString const& name) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the IndexBuffer object and returns a pointer to it. After creation, the index
|
||||
* buffer is uninitialized. Use IndexBuffer::setBuffer() to initialize the IndexBuffer.
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <filament/Engine.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
@@ -82,9 +83,21 @@ public:
|
||||
* @param name A string to identify this InstanceBuffer
|
||||
* @param len Length of name, should be less than or equal to 128
|
||||
* @return This Builder, for chaining calls.
|
||||
* @deprecated Use name(utils::StaticString const&) instead.
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
Builder& name(const char* UTILS_NONNULL name, size_t len) noexcept;
|
||||
|
||||
/**
|
||||
* Associate an optional name with this InstanceBuffer for debugging purposes.
|
||||
*
|
||||
* name will show in error messages and should be kept as short as possible.
|
||||
*
|
||||
* @param name A string literal to identify this InstanceBuffer
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& name(utils::StaticString const& name) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the InstanceBuffer object and returns a pointer to it.
|
||||
*/
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <filament/Engine.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
@@ -75,9 +76,21 @@ public:
|
||||
* @param name A string to identify this MorphTargetBuffer
|
||||
* @param len Length of name, should be less than or equal to 128
|
||||
* @return This Builder, for chaining calls.
|
||||
* @deprecated Use name(utils::StaticString const&) instead.
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
Builder& name(const char* UTILS_NONNULL name, size_t len) noexcept;
|
||||
|
||||
/**
|
||||
* Associate an optional name with this MorphTargetBuffer for debugging purposes.
|
||||
*
|
||||
* name will show in error messages and should be kept as short as possible.
|
||||
*
|
||||
* @param name A string literal to identify this MorphTargetBuffer
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& name(utils::StaticString const& name) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the MorphTargetBuffer object and returns a pointer to it.
|
||||
*
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <filament/RenderableManager.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
#include <math/mathfwd.h>
|
||||
|
||||
@@ -81,9 +82,21 @@ public:
|
||||
* @param name A string to identify this SkinningBuffer
|
||||
* @param len Length of name, should be less than or equal to 128
|
||||
* @return This Builder, for chaining calls.
|
||||
* @deprecated Use name(utils::StaticString const&) instead.
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
Builder& name(const char* UTILS_NONNULL name, size_t len) noexcept;
|
||||
|
||||
/**
|
||||
* Associate an optional name with this SkinningBuffer for debugging purposes.
|
||||
*
|
||||
* name will show in error messages and should be kept as short as possible.
|
||||
*
|
||||
* @param name A string literal to identify this SkinningBuffer
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& name(utils::StaticString const& name) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the SkinningBuffer object and returns a pointer to it.
|
||||
*
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <backend/CallbackHandler.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
#include <math/mat3.h>
|
||||
|
||||
@@ -150,9 +151,21 @@ public:
|
||||
* @param name A string to identify this Stream
|
||||
* @param len Length of name, should be less than or equal to 128
|
||||
* @return This Builder, for chaining calls.
|
||||
* @deprecated Use name(utils::StaticString const&) instead.
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
Builder& name(const char* UTILS_NONNULL name, size_t len) noexcept;
|
||||
|
||||
/**
|
||||
* Associate an optional name with this Stream for debugging purposes.
|
||||
*
|
||||
* name will show in error messages and should be kept as short as possible.
|
||||
*
|
||||
* @param name A string literal to identify this Stream
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& name(utils::StaticString const& name) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the Stream object and returns a pointer to it.
|
||||
*
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <backend/Platform.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
@@ -229,8 +230,20 @@ public:
|
||||
* @param name A string to identify this Texture
|
||||
* @param len Length of name, should be less than or equal to 128
|
||||
* @return This Builder, for chaining calls.
|
||||
* @deprecated Use name(utils::StaticString const&) instead.
|
||||
*/
|
||||
Builder& name(const char* UTILS_NONNULL name, size_t len) noexcept;
|
||||
UTILS_DEPRECATED
|
||||
Builder& name(const char* UTILS_NONNULL name, size_t len) noexcept;
|
||||
|
||||
/**
|
||||
* Associate an optional name with this Texture for debugging purposes.
|
||||
*
|
||||
* name will show in error messages and should be kept as short as possible.
|
||||
*
|
||||
* @param name A string literal to identify this Texture
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& name(utils::StaticString const& name) noexcept;
|
||||
|
||||
/**
|
||||
* Creates an external texture. The content must be set using setExternalImage().
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
@@ -170,9 +171,21 @@ public:
|
||||
* @param name A string to identify this VertexBuffer
|
||||
* @param len Length of name, should be less than or equal to 128
|
||||
* @return This Builder, for chaining calls.
|
||||
* @deprecated Use name(utils::StaticString const&) instead.
|
||||
*/
|
||||
UTILS_DEPRECATED
|
||||
Builder& name(const char* UTILS_NONNULL name, size_t len) noexcept;
|
||||
|
||||
/**
|
||||
* Associate an optional name with this VertexBuffer for debugging purposes.
|
||||
*
|
||||
* name will show in error messages and should be kept as short as possible.
|
||||
*
|
||||
* @param name A string literal to identify this VertexBuffer
|
||||
* @return This Builder, for chaining calls.
|
||||
*/
|
||||
Builder& name(utils::StaticString const& name) noexcept;
|
||||
|
||||
/**
|
||||
* Creates the VertexBuffer object and returns a pointer to it.
|
||||
*
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "FilamentAPI-impl.h"
|
||||
|
||||
#include <utils/CString.h>
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
@@ -51,6 +52,10 @@ BufferObject::Builder& BufferObject::Builder::name(const char* name, size_t cons
|
||||
return BuilderNameMixin::name(name, len);
|
||||
}
|
||||
|
||||
BufferObject::Builder& BufferObject::Builder::name(utils::StaticString const& name) noexcept {
|
||||
return BuilderNameMixin::name(name);
|
||||
}
|
||||
|
||||
BufferObject* BufferObject::Builder::build(Engine& engine) {
|
||||
return downcast(engine).createBufferObject(*this);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "FilamentAPI-impl.h"
|
||||
|
||||
#include <utils/CString.h>
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
@@ -51,6 +52,10 @@ IndexBuffer::Builder& IndexBuffer::Builder::name(const char* name, size_t const
|
||||
return BuilderNameMixin::name(name, len);
|
||||
}
|
||||
|
||||
IndexBuffer::Builder& IndexBuffer::Builder::name(utils::StaticString const& name) noexcept {
|
||||
return BuilderNameMixin::name(name);
|
||||
}
|
||||
|
||||
IndexBuffer* IndexBuffer::Builder::build(Engine& engine) {
|
||||
return downcast(engine).createIndexBuffer(*this);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "FilamentAPI-impl.h"
|
||||
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
#include <math/mat3.h>
|
||||
#include <math/vec3.h>
|
||||
|
||||
@@ -54,6 +56,10 @@ InstanceBuffer::Builder& InstanceBuffer::Builder::name(const char* name, size_t
|
||||
return BuilderNameMixin::name(name, len);
|
||||
}
|
||||
|
||||
InstanceBuffer::Builder& InstanceBuffer::Builder::name(utils::StaticString const& name) noexcept {
|
||||
return BuilderNameMixin::name(name);
|
||||
}
|
||||
|
||||
InstanceBuffer* InstanceBuffer::Builder::build(Engine& engine) {
|
||||
FILAMENT_CHECK_PRECONDITION(mImpl->mInstanceCount >= 1) << "instanceCount must be >= 1.";
|
||||
FILAMENT_CHECK_PRECONDITION(mImpl->mInstanceCount <= engine.getMaxAutomaticInstances())
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <math/norm.h>
|
||||
|
||||
#include <utils/CString.h>
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
namespace filament {
|
||||
|
||||
@@ -59,6 +60,10 @@ MorphTargetBuffer::Builder& MorphTargetBuffer::Builder::name(const char* name, s
|
||||
return BuilderNameMixin::name(name, len);
|
||||
}
|
||||
|
||||
MorphTargetBuffer::Builder& MorphTargetBuffer::Builder::name(utils::StaticString const& name) noexcept {
|
||||
return BuilderNameMixin::name(name);
|
||||
}
|
||||
|
||||
MorphTargetBuffer* MorphTargetBuffer::Builder::build(Engine& engine) {
|
||||
return downcast(engine).createMorphTargetBuffer(*this);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <math/mat4.h>
|
||||
|
||||
#include <utils/CString.h>
|
||||
#include <utils/StaticString.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
@@ -64,6 +65,10 @@ SkinningBuffer::Builder& SkinningBuffer::Builder::name(const char* name, size_t
|
||||
return BuilderNameMixin::name(name, len);
|
||||
}
|
||||
|
||||
SkinningBuffer::Builder& SkinningBuffer::Builder::name(utils::StaticString const& name) noexcept {
|
||||
return BuilderNameMixin::name(name);
|
||||
}
|
||||
|
||||
SkinningBuffer* SkinningBuffer::Builder::build(Engine& engine) {
|
||||
return downcast(engine).createSkinningBuffer(*this);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <backend/PixelBufferDescriptor.h>
|
||||
|
||||
#include <utils/CString.h>
|
||||
#include <utils/StaticString.h>
|
||||
#include <utils/Panic.h>
|
||||
#include <filament/Stream.h>
|
||||
|
||||
@@ -65,6 +66,10 @@ Stream::Builder& Stream::Builder::name(const char* name, size_t const len) noexc
|
||||
return BuilderNameMixin::name(name, len);
|
||||
}
|
||||
|
||||
Stream::Builder& Stream::Builder::name(utils::StaticString const& name) noexcept {
|
||||
return BuilderNameMixin::name(name);
|
||||
}
|
||||
|
||||
Stream* Stream::Builder::build(Engine& engine) {
|
||||
return downcast(engine).createStream(*this);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/BitmaskEnum.h>
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/CString.h>
|
||||
#include <utils/StaticString.h>
|
||||
#include <utils/debug.h>
|
||||
#include <utils/FixedCapacityVector.h>
|
||||
#include <utils/Panic.h>
|
||||
@@ -152,6 +154,10 @@ Texture::Builder& Texture::Builder::name(const char* name, size_t const len) noe
|
||||
return BuilderNameMixin::name(name, len);
|
||||
}
|
||||
|
||||
Texture::Builder& Texture::Builder::name(StaticString const& name) noexcept {
|
||||
return BuilderNameMixin::name(name);
|
||||
}
|
||||
|
||||
Texture* Texture::Builder::build(Engine& engine) {
|
||||
if (mImpl->mTarget != SamplerType::SAMPLER_EXTERNAL) {
|
||||
FILAMENT_CHECK_PRECONDITION(Texture::isTextureFormatSupported(engine, mImpl->mFormat))
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <utils/bitset.h>
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/CString.h>
|
||||
#include <utils/StaticString.h>
|
||||
#include <utils/debug.h>
|
||||
#include <utils/Log.h>
|
||||
#include <utils/ostream.h>
|
||||
@@ -152,6 +153,10 @@ VertexBuffer::Builder& VertexBuffer::Builder::name(const char* name, size_t cons
|
||||
return BuilderNameMixin::name(name, len);
|
||||
}
|
||||
|
||||
VertexBuffer::Builder& VertexBuffer::Builder::name(utils::StaticString const& name) noexcept {
|
||||
return BuilderNameMixin::name(name);
|
||||
}
|
||||
|
||||
VertexBuffer* VertexBuffer::Builder::build(Engine& engine) {
|
||||
FILAMENT_CHECK_PRECONDITION(mImpl->mVertexCount > 0) << "vertexCount cannot be 0";
|
||||
FILAMENT_CHECK_PRECONDITION(mImpl->mBufferCount > 0) << "bufferCount cannot be 0";
|
||||
|
||||
Reference in New Issue
Block a user