upgrade to Filament 1.21.0
This commit is contained in:
@@ -49,7 +49,9 @@ static constexpr uint64_t SWAP_CHAIN_CONFIG_ENABLE_XCB = 0x4;
|
||||
static constexpr uint64_t SWAP_CHAIN_CONFIG_APPLE_CVPIXELBUFFER = 0x8;
|
||||
|
||||
static constexpr size_t MAX_VERTEX_ATTRIBUTE_COUNT = 16; // This is guaranteed by OpenGL ES.
|
||||
static constexpr size_t MAX_SAMPLER_COUNT = 16; // Matches the Adreno Vulkan driver.
|
||||
static constexpr size_t MAX_VERTEX_SAMPLER_COUNT = 16; // This is guaranteed by OpenGL ES.
|
||||
static constexpr size_t MAX_FRAGMENT_SAMPLER_COUNT = 16; // This is guaranteed by OpenGL ES.
|
||||
static constexpr size_t MAX_SAMPLER_COUNT = 32; // This is guaranteed by OpenGL ES.
|
||||
static constexpr size_t MAX_VERTEX_BUFFER_COUNT = 16; // Max number of bound buffer objects.
|
||||
|
||||
static_assert(MAX_VERTEX_BUFFER_COUNT <= MAX_VERTEX_ATTRIBUTE_COUNT,
|
||||
@@ -638,6 +640,10 @@ enum class TextureCubemapFace : uint8_t {
|
||||
NEGATIVE_Z = 5, //!< -z face
|
||||
};
|
||||
|
||||
inline constexpr int operator +(TextureCubemapFace rhs) noexcept {
|
||||
return int(rhs);
|
||||
}
|
||||
|
||||
//! Face offsets for all faces of a cubemap
|
||||
struct FaceOffsets {
|
||||
using size_type = size_t;
|
||||
@@ -900,6 +906,16 @@ enum ShaderType : uint8_t {
|
||||
};
|
||||
static constexpr size_t PIPELINE_STAGE_COUNT = 2;
|
||||
|
||||
struct ShaderStageFlags {
|
||||
bool vertex : 1;
|
||||
bool fragment : 1;
|
||||
bool hasShaderType(ShaderType type) const {
|
||||
return (vertex && type == ShaderType::VERTEX) ||
|
||||
(fragment && type == ShaderType::FRAGMENT);
|
||||
}
|
||||
};
|
||||
static constexpr ShaderStageFlags ALL_SHADER_STAGE_FLAGS = { .vertex = true, .fragment = true };
|
||||
|
||||
/**
|
||||
* Selects which buffers to clear at the beginning of the render pass, as well as which buffers
|
||||
* can be discarded at the beginning and end of the render pass.
|
||||
@@ -948,10 +964,20 @@ struct RenderPassParams {
|
||||
* subpass. If this is zero, the render pass has only one subpass. The least significant bit
|
||||
* specifies that the first color attachment in the render target is a subpass input.
|
||||
*
|
||||
* For now only 2 subpasses are supported, so only the lower 4 bits are used, one for each color
|
||||
* attachment (see MRT::TARGET_COUNT).
|
||||
* For now only 2 subpasses are supported, so only the lower 8 bits are used, one for each color
|
||||
* attachment (see MRT::MAX_SUPPORTED_RENDER_TARGET_COUNT).
|
||||
*/
|
||||
uint32_t subpassMask = 0;
|
||||
uint16_t subpassMask = 0;
|
||||
|
||||
/**
|
||||
* This mask makes a promise to the backend about read-only usage of the depth attachment (bit
|
||||
* 0) and the stencil attachment (bit 1). Some backends need to know if writes are disabled in
|
||||
* order to allow sampling from the depth attachment.
|
||||
*/
|
||||
uint16_t readOnlyDepthStencil = 0;
|
||||
|
||||
static constexpr uint16_t READONLY_DEPTH = 1 << 0;
|
||||
static constexpr uint16_t READONLY_STENCIL = 1 << 1;
|
||||
};
|
||||
|
||||
struct PolygonOffset {
|
||||
@@ -965,7 +991,11 @@ using FrameScheduledCallback = void(*)(PresentCallable callable, void* user);
|
||||
using FrameCompletedCallback = void(*)(void* user);
|
||||
|
||||
enum class Workaround : uint16_t {
|
||||
SPLIT_EASU
|
||||
// The EASU pass must split because shader compiler flattens early-exit branch
|
||||
SPLIT_EASU,
|
||||
// Backend allows feedback loop with ancillary buffers (depth/stencil) as long as they're read-only for
|
||||
// the whole render pass.
|
||||
ALLOW_READ_ONLY_ANCILLARY_FEEDBACK_LOOP
|
||||
};
|
||||
|
||||
} // namespace backend
|
||||
@@ -1006,6 +1036,7 @@ utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend:
|
||||
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);
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, filament::backend::ShaderStageFlags stageFlags);
|
||||
#endif
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_DRIVERENUMS_H
|
||||
|
||||
@@ -18,13 +18,16 @@
|
||||
#define TNT_FILAMENT_BACKEND_HANDLE_H
|
||||
|
||||
#include <utils/compiler.h>
|
||||
#if !defined(NDEBUG)
|
||||
#include <utils/Log.h>
|
||||
#endif
|
||||
#include <utils/debug.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
struct HwBufferObject;
|
||||
struct HwFence;
|
||||
@@ -41,7 +44,9 @@ struct HwTimerQuery;
|
||||
struct HwVertexBuffer;
|
||||
|
||||
/*
|
||||
* A type handle to a h/w resource
|
||||
* A handle to a backend resource. HandleBase is for internal use only.
|
||||
* HandleBase *must* be a trivial for the purposes of calls, that is, it cannot have user-defined
|
||||
* copy or move constructors.
|
||||
*/
|
||||
|
||||
//! \privatesection
|
||||
@@ -53,41 +58,54 @@ public:
|
||||
|
||||
constexpr HandleBase() noexcept: object(nullid) {}
|
||||
|
||||
explicit HandleBase(HandleId id) noexcept : object(id) {
|
||||
assert_invariant(object != nullid); // usually means an uninitialized handle is used
|
||||
}
|
||||
|
||||
HandleBase(HandleBase const& rhs) noexcept = default;
|
||||
HandleBase(HandleBase&& rhs) noexcept : object(rhs.object) {
|
||||
rhs.object = nullid;
|
||||
}
|
||||
|
||||
HandleBase& operator=(HandleBase const& rhs) noexcept = default;
|
||||
HandleBase& operator=(HandleBase&& rhs) noexcept {
|
||||
std::swap(object, rhs.object);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// whether this Handle is initialized
|
||||
explicit operator bool() const noexcept { return object != nullid; }
|
||||
|
||||
// clear the handle, this doesn't free associated resources
|
||||
void clear() noexcept { object = nullid; }
|
||||
|
||||
// compare handles
|
||||
bool operator==(const HandleBase& rhs) const noexcept { return object == rhs.object; }
|
||||
bool operator!=(const HandleBase& rhs) const noexcept { return object != rhs.object; }
|
||||
bool operator<(const HandleBase& rhs) const noexcept { return object < rhs.object; }
|
||||
bool operator<=(const HandleBase& rhs) const noexcept { return object <= rhs.object; }
|
||||
bool operator>(const HandleBase& rhs) const noexcept { return object > rhs.object; }
|
||||
bool operator>=(const HandleBase& rhs) const noexcept { return object >= rhs.object; }
|
||||
|
||||
// get this handle's handleId
|
||||
HandleId getId() const noexcept { return object; }
|
||||
|
||||
// initialize a handle, for internal use only.
|
||||
explicit HandleBase(HandleId id) noexcept : object(id) {
|
||||
assert_invariant(object != nullid); // usually means an uninitialized handle is used
|
||||
}
|
||||
|
||||
protected:
|
||||
HandleBase(HandleBase const& rhs) noexcept = default;
|
||||
HandleBase& operator=(HandleBase const& rhs) noexcept = default;
|
||||
|
||||
private:
|
||||
HandleId object;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
/**
|
||||
* Type-safe handle to backend resources
|
||||
* @tparam T Type of the resource
|
||||
*/
|
||||
template<typename T>
|
||||
struct Handle : public HandleBase {
|
||||
using HandleBase::HandleBase;
|
||||
|
||||
Handle() noexcept = default;
|
||||
|
||||
Handle(Handle const& rhs) noexcept = default;
|
||||
|
||||
Handle& operator=(Handle const& rhs) noexcept = default;
|
||||
|
||||
explicit Handle(HandleId id) noexcept : HandleBase(id) { }
|
||||
|
||||
// type-safe Handle cast
|
||||
template<typename B, typename = std::enable_if_t<std::is_base_of<T, B>::value> >
|
||||
Handle(Handle<B> const& base) noexcept : HandleBase(base) { } // NOLINT(hicpp-explicit-conversions)
|
||||
Handle(Handle<B> const& base) noexcept : HandleBase(base) { } // NOLINT(hicpp-explicit-conversions,google-explicit-constructor)
|
||||
|
||||
private:
|
||||
#if !defined(NDEBUG)
|
||||
@@ -112,7 +130,6 @@ using TextureHandle = Handle<HwTexture>;
|
||||
using TimerQueryHandle = Handle<HwTimerQuery>;
|
||||
using VertexBufferHandle = Handle<HwVertexBuffer>;
|
||||
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
#endif // TNT_FILAMENT_BACKEND_HANDLE_H
|
||||
|
||||
@@ -22,38 +22,19 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace filament {
|
||||
namespace backend {
|
||||
namespace filament::backend {
|
||||
|
||||
//! \privatesection
|
||||
|
||||
class TargetBufferInfo {
|
||||
public:
|
||||
// ctor for 2D textures
|
||||
TargetBufferInfo(Handle<HwTexture> h, uint8_t level = 0) noexcept // NOLINT(google-explicit-constructor)
|
||||
: handle(h), level(level) { }
|
||||
// ctor for cubemaps
|
||||
TargetBufferInfo(Handle<HwTexture> h, uint8_t level, TextureCubemapFace face) noexcept
|
||||
: handle(h), level(level), face(face) { }
|
||||
// ctor for 3D textures
|
||||
TargetBufferInfo(Handle<HwTexture> h, uint8_t level, uint16_t layer) noexcept
|
||||
: handle(h), level(level), layer(layer) { }
|
||||
|
||||
explicit TargetBufferInfo(TextureCubemapFace face) noexcept : face(face) {}
|
||||
|
||||
explicit TargetBufferInfo(uint16_t layer) noexcept : layer(layer) {}
|
||||
|
||||
struct TargetBufferInfo {
|
||||
// texture to be used as render target
|
||||
Handle<HwTexture> handle;
|
||||
|
||||
// level to be used
|
||||
uint8_t level = 0;
|
||||
union {
|
||||
// face if texture is a cubemap
|
||||
TextureCubemapFace face;
|
||||
// for 3D textures
|
||||
uint16_t layer = 0;
|
||||
};
|
||||
TargetBufferInfo() noexcept { }
|
||||
|
||||
// for cubemaps and 3D textures. See TextureCubemapFace for the face->layer mapping
|
||||
uint16_t layer = 0;
|
||||
};
|
||||
|
||||
class MRT {
|
||||
@@ -96,13 +77,12 @@ public:
|
||||
}
|
||||
|
||||
// this is here for backward compatibility
|
||||
MRT(Handle<HwTexture> h, uint8_t level, uint16_t layer) noexcept
|
||||
: mInfos{{ h, level, layer }} {
|
||||
MRT(Handle<HwTexture> handle, uint8_t level, uint16_t layer) noexcept
|
||||
: mInfos{{ handle, level, layer }} {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace backend
|
||||
} // namespace filament
|
||||
} // namespace filament::backend
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
utils::io::ostream& operator<<(utils::io::ostream& out, const filament::backend::TargetBufferInfo& tbi);
|
||||
|
||||
Reference in New Issue
Block a user