fix normal morph target
This commit is contained in:
@@ -16,16 +16,16 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_BUFFERDESCRIPTOR_H
|
||||
#define TNT_FILAMENT_DRIVER_BUFFERDESCRIPTOR_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_BUFFERDESCRIPTOR_H
|
||||
#define TNT_FILAMENT_BACKEND_BUFFERDESCRIPTOR_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/ostream.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
/**
|
||||
* A CPU memory-buffer descriptor, typically used to transfer data from the CPU to the GPU.
|
||||
@@ -91,6 +91,56 @@ public:
|
||||
: buffer(const_cast<void*>(buffer)), size(size), callback(callback), user(user) {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Helper to create a BufferDescriptor that uses a KNOWN method pointer w/ object passed
|
||||
* by pointer as the callback. e.g.:
|
||||
* auto bd = BufferDescriptor::make(buffer, size, &Foo::method, foo);
|
||||
*
|
||||
* @param buffer Memory address of the CPU buffer to reference
|
||||
* @param size Size of the CPU buffer in bytes
|
||||
* @return a new BufferDescriptor
|
||||
*/
|
||||
template<typename T, void(T::*method)(void const* buffer, size_t size)>
|
||||
static BufferDescriptor make(
|
||||
void const* buffer, size_t size, T* data) noexcept {
|
||||
return {
|
||||
buffer, size,
|
||||
[](void* b, size_t s, void* u) {
|
||||
(*static_cast<T**>(u)->*method)(b, s);
|
||||
}, data
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to create a BufferDescriptor that uses a functor as the callback.
|
||||
*
|
||||
* Caveats:
|
||||
* - DO NOT CALL setCallback() when using this helper.
|
||||
* - This make a heap allocation
|
||||
*
|
||||
* @param buffer Memory address of the CPU buffer to reference
|
||||
* @param size Size of the CPU buffer in bytes
|
||||
* @param functor functor of type f(void const* buffer, size_t size)
|
||||
* @return a new BufferDescriptor
|
||||
*/
|
||||
template<typename T>
|
||||
static BufferDescriptor make(
|
||||
void const* buffer, size_t size, T&& functor) noexcept {
|
||||
return {
|
||||
buffer, size,
|
||||
[](void* b, size_t s, void* u) {
|
||||
T& that = *static_cast<T*>(u);
|
||||
that(b, s);
|
||||
delete &that;
|
||||
},
|
||||
new T(std::forward<T>(functor))
|
||||
};
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set or replace the release callback function
|
||||
* @param callback The new callback function
|
||||
@@ -126,7 +176,10 @@ private:
|
||||
void* user = nullptr;
|
||||
};
|
||||
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_BUFFERDESCRIPTOR_H
|
||||
#if !defined(NDEBUG)
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::BufferDescriptor& b);
|
||||
#endif
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_BUFFERDESCRIPTOR_H
|
||||
|
||||
@@ -16,14 +16,16 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_DRIVERENUMS_H
|
||||
#define TNT_FILAMENT_DRIVER_DRIVERENUMS_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_DRIVERENUMS_H
|
||||
#define TNT_FILAMENT_BACKEND_DRIVERENUMS_H
|
||||
|
||||
#include <utils/BitmaskEnum.h>
|
||||
#include <utils/unwindows.h> // Because we define ERROR in the FenceStatus enum.
|
||||
|
||||
#include <backend/PresentCallable.h>
|
||||
|
||||
#include <utils/ostream.h>
|
||||
|
||||
#include <math/vec4.h>
|
||||
|
||||
#include <array> // FIXME: STL headers are not allowed in public headers
|
||||
@@ -318,7 +320,7 @@ enum class PixelDataType : uint8_t {
|
||||
BYTE, //!< signed byte
|
||||
USHORT, //!< unsigned short (16-bit)
|
||||
SHORT, //!< signed short (16-bit)
|
||||
UINT, //!< unsigned int (16-bit)
|
||||
UINT, //!< unsigned int (32-bit)
|
||||
INT, //!< signed int (32-bit)
|
||||
HALF, //!< half-float (16-bit float)
|
||||
FLOAT, //!< float (32-bits float)
|
||||
@@ -561,6 +563,48 @@ static constexpr bool isDepthFormat(TextureFormat format) noexcept {
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr bool isUnsignedIntFormat(TextureFormat format) {
|
||||
switch (format) {
|
||||
case TextureFormat::R8UI:
|
||||
case TextureFormat::R16UI:
|
||||
case TextureFormat::R32UI:
|
||||
case TextureFormat::RG8UI:
|
||||
case TextureFormat::RG16UI:
|
||||
case TextureFormat::RG32UI:
|
||||
case TextureFormat::RGB8UI:
|
||||
case TextureFormat::RGB16UI:
|
||||
case TextureFormat::RGB32UI:
|
||||
case TextureFormat::RGBA8UI:
|
||||
case TextureFormat::RGBA16UI:
|
||||
case TextureFormat::RGBA32UI:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr bool isSignedIntFormat(TextureFormat format) {
|
||||
switch (format) {
|
||||
case TextureFormat::R8I:
|
||||
case TextureFormat::R16I:
|
||||
case TextureFormat::R32I:
|
||||
case TextureFormat::RG8I:
|
||||
case TextureFormat::RG16I:
|
||||
case TextureFormat::RG32I:
|
||||
case TextureFormat::RGB8I:
|
||||
case TextureFormat::RGB16I:
|
||||
case TextureFormat::RGB32I:
|
||||
case TextureFormat::RGBA8I:
|
||||
case TextureFormat::RGBA16I:
|
||||
case TextureFormat::RGBA32I:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//! returns whether this format a compressed format
|
||||
static constexpr bool isCompressedFormat(TextureFormat format) noexcept {
|
||||
return format >= TextureFormat::EAC_R11;
|
||||
@@ -917,6 +961,9 @@ using FrameScheduledCallback = void(*)(PresentCallable callable, void* user);
|
||||
|
||||
using FrameCompletedCallback = void(*)(void* user);
|
||||
|
||||
enum class Workaround : uint16_t {
|
||||
SPLIT_EASU
|
||||
};
|
||||
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
@@ -926,4 +973,36 @@ template<> struct utils::EnableBitMaskOperators<filament::backend::TargetBufferF
|
||||
template<> struct utils::EnableBitMaskOperators<filament::backend::TextureUsage>
|
||||
: public std::true_type {};
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_DRIVERENUMS_H
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
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::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::TargetBufferFlags f);
|
||||
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::BufferObjectBinding binding);
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::TextureSwizzle swizzle);
|
||||
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::RasterState& rs);
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::RenderPassParams& b);
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::Viewport& v);
|
||||
#endif
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_DRIVERENUMS_H
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_HANDLE_H
|
||||
#define TNT_FILAMENT_DRIVER_HANDLE_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_HANDLE_H
|
||||
#define TNT_FILAMENT_BACKEND_HANDLE_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#include <utils/Log.h>
|
||||
@@ -113,4 +113,4 @@ using VertexBufferHandle = Handle<HwVertexBuffer>;
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_HANDLE_H
|
||||
#endif // TNT_FILAMENT_BACKEND_HANDLE_H
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_PIPELINESTATE_H
|
||||
#define TNT_FILAMENT_DRIVER_PIPELINESTATE_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_PIPELINESTATE_H
|
||||
#define TNT_FILAMENT_BACKEND_PIPELINESTATE_H
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include <backend/Handle.h>
|
||||
@@ -24,8 +24,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
//! \privatesection
|
||||
|
||||
@@ -39,8 +38,10 @@ struct PipelineState {
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace filament::backend
|
||||
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
#if !defined(NDEBUG)
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::PipelineState& ps);
|
||||
#endif
|
||||
|
||||
#endif //TNT_FILAMENT_DRIVER_PIPELINESTATE_H
|
||||
#endif //TNT_FILAMENT_BACKEND_PIPELINESTATE_H
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_PIXEL_BUFFERDESCRIPTOR_H
|
||||
#define TNT_FILAMENT_DRIVER_PIXEL_BUFFERDESCRIPTOR_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_PIXELBUFFERDESCRIPTOR_H
|
||||
#define TNT_FILAMENT_BACKEND_PIXELBUFFERDESCRIPTOR_H
|
||||
|
||||
#include <backend/BufferDescriptor.h>
|
||||
#include <backend/DriverEnums.h>
|
||||
@@ -105,6 +105,71 @@ public:
|
||||
alignment(1) {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
template<typename T, void(T::*method)(void const* buffer, size_t size)>
|
||||
static PixelBufferDescriptor make(void const* buffer, size_t size,
|
||||
PixelDataFormat format, PixelDataType type, uint8_t alignment,
|
||||
uint32_t left, uint32_t top, uint32_t stride, T* data) noexcept {
|
||||
return { buffer, size, format, type, alignment, left, top, stride,
|
||||
[](void* b, size_t s, void* u) {
|
||||
(*static_cast<T**>(u)->*method)(b, s); }, data };
|
||||
}
|
||||
|
||||
template<typename T, void(T::*method)(void const* buffer, size_t size)>
|
||||
static PixelBufferDescriptor make(void const* buffer, size_t size,
|
||||
PixelDataFormat format, PixelDataType type, T* data) noexcept {
|
||||
return { buffer, size, format, type, [](void* b, size_t s, void* u) {
|
||||
(*static_cast<T**>(u)->*method)(b, s); }, data };
|
||||
}
|
||||
|
||||
template<typename T, void(T::*method)(void const* buffer, size_t size)>
|
||||
static PixelBufferDescriptor make(void const* buffer, size_t size,
|
||||
backend::CompressedPixelDataType format, uint32_t imageSize, T* data) noexcept {
|
||||
return { buffer, size, format, imageSize, [](void* b, size_t s, void* u) {
|
||||
(*static_cast<T**>(u)->*method)(b, s); }, data
|
||||
};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static PixelBufferDescriptor make(void const* buffer, size_t size,
|
||||
PixelDataFormat format, PixelDataType type, uint8_t alignment,
|
||||
uint32_t left, uint32_t top, uint32_t stride, T&& functor) noexcept {
|
||||
return { buffer, size, format, type, alignment, left, top, stride,
|
||||
[](void* b, size_t s, void* u) {
|
||||
T& that = *static_cast<T*>(u);
|
||||
that(b, s);
|
||||
delete &that;
|
||||
}, new T(std::forward<T>(functor))
|
||||
};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static PixelBufferDescriptor make(void const* buffer, size_t size,
|
||||
PixelDataFormat format, PixelDataType type, T&& functor) noexcept {
|
||||
return { buffer, size, format, type,
|
||||
[](void* b, size_t s, void* u) {
|
||||
T& that = *static_cast<T*>(u);
|
||||
that(b, s);
|
||||
delete &that;
|
||||
}, new T(std::forward<T>(functor))
|
||||
};
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static PixelBufferDescriptor make(void const* buffer, size_t size,
|
||||
backend::CompressedPixelDataType format, uint32_t imageSize, T&& functor) noexcept {
|
||||
return { buffer, size, format, imageSize,
|
||||
[](void* b, size_t s, void* u) {
|
||||
T& that = *static_cast<T*>(u);
|
||||
that(b, s);
|
||||
delete &that;
|
||||
}, new T(std::forward<T>(functor))
|
||||
};
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Computes the size in bytes needed to fit an image of given dimensions and format
|
||||
*
|
||||
@@ -213,4 +278,8 @@ public:
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_PIXEL_BUFFERDESCRIPTOR_H
|
||||
#if !defined(NDEBUG)
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::PixelBufferDescriptor& b);
|
||||
#endif
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_PIXELBUFFERDESCRIPTOR_H
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_PLATFORM_H
|
||||
#define TNT_FILAMENT_DRIVER_PLATFORM_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_PLATFORM_H
|
||||
#define TNT_FILAMENT_BACKEND_PLATFORM_H
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
|
||||
@@ -100,4 +100,4 @@ public:
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_DRIVER_PLATFORM_H
|
||||
#endif // TNT_FILAMENT_BACKEND_PLATFORM_H
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef TNT_FILAMENT_BACKEND_PRESENT_CALLABLE
|
||||
#define TNT_FILAMENT_BACKEND_PRESENT_CALLABLE
|
||||
#ifndef TNT_FILAMENT_BACKEND_PRESENTCALLABLE
|
||||
#define TNT_FILAMENT_BACKEND_PRESENTCALLABLE
|
||||
|
||||
#include <utils/compiler.h>
|
||||
|
||||
@@ -101,4 +101,4 @@ using FrameFinishedCallback UTILS_DEPRECATED = void(*)(PresentCallable callable,
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_PRESENT_FRAME_CALLABLE
|
||||
#endif // TNT_FILAMENT_BACKEND_PRESENTCALLABLE
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TNT_FILAMENT_DRIVER_TARGETBUFFERINFO_H
|
||||
#define TNT_FILAMENT_DRIVER_TARGETBUFFERINFO_H
|
||||
#ifndef TNT_FILAMENT_BACKEND_TARGETBUFFERINFO_H
|
||||
#define TNT_FILAMENT_BACKEND_TARGETBUFFERINFO_H
|
||||
|
||||
#include <backend/DriverEnums.h>
|
||||
#include <backend/Handle.h>
|
||||
@@ -104,4 +104,9 @@ public:
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
|
||||
#endif //TNT_FILAMENT_DRIVER_TARGETBUFFERINFO_H
|
||||
#if !defined(NDEBUG)
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::TargetBufferInfo& tbi);
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::MRT& mrt);
|
||||
#endif
|
||||
|
||||
#endif //TNT_FILAMENT_BACKEND_TARGETBUFFERINFO_H
|
||||
|
||||
Reference in New Issue
Block a user