* Use utils::Status in MaterialParser
* Use utils::sstream instead of std::stringstream
* Remove remaining std::cerr and dep; update MaterialParser::reflectParameters
* make error message in utils::Status more generic
---------
Co-authored-by: Powei Feng <powei@google.com>
- Fix the magnifier positioning for both compare and standalone
mode. Simplified a lot of the logic and streamlined passing
of states between components.
- Slight css adjustments
ImmutableCString is a string class similar to CString except it's
immutable. ImmutableCString occupies 16 bytes instead of 8 for CString.
However, ImmutableCString is able to avoid memory allocation when
constructed from a string literal, and in that way it us similar
to StaticString.
ImmutableCString can be auto converted from StaticString.
The backend tag tracking is updated to use ImmutableCString and
the FrameGraph resource manager us updated to use StaticString.
Together these changes significantly cut down heap allocations due to
internal tagging.
We also add optional tracking to {Immutable}CString.
* Minor changes in utils::Status
- << operator doesn't have to be friend
- simplify getErrorMessage to not use strlen internally
* Replace std::ostream to utils::io::ostream
* utils: RefCountedInternPool/RefCountedMap
First, introduce RefCountedInternPool, a reference counted intern pool of
Slice<const T>. Just acquire() a slice that you want and you're guaranteed to
get exactly one canonical value-equal Slice<const T> back.
Additionally, introduce the concept of NullValue to RefCountedMap. A NullValue
defines what should be considered an uninitialized value; by default, it's the
default value of that type (0 for ints, nullptr for pointers, etc). This allows
us to lazily-initialize values in the map. A client can acquire() a bunch of
different resources which will be initialized only when get(factory) is called.
If a client attempts to get() a value without specifying a factory, and the
value is not initialized (i.e. equal to NullValue{}()), RefCountedMap will
panic.
* utils: add unit tests for ref-counted collections
* utils: remove C++20 features, fix memory issue
* utils: remove RefCounted from InternPool
* engine: change spec constants to simple list
For a shader program cache to be keyed on the set of spec constants that a
program has set, we need to know full exact list of constants, including their
default values. If we're going to always hold a list of all constants all the
time, then we may as well store them as a simple list where each index is the ID
number of the spec constant.
As part of this change, we now write the default values of spec constants into
the material file metadata.
* fix indent
* engine: fix sRGB swapchain emulation
* slice: fix memory semantics
* slice: prefer passing slice by value
This lets us do nice things like coercing Slice<T> to Slice<const T>, etc.
* slice: fix unit tests
* slice: fix copy/assignment, hash function
Don't attempt to define a copy constructor/assignment operator which would
convert a constant type to a mutable type.
Additionally, fix the hash function such that we're hashing U instead of const
U.
* new utility AsyncJobQueue
this is a very simple job queue, it spawns a thread and runs the jobs
pushed to the queue in sequence.
* use AsyncJobQueue in OpenGLTimerQuery
The viewer supports pulling artifacts based on PR number, and now
we support providing Run ID as an alternative to identify the
renderdiff run on Github CI.
In the current implementation, the function std::cout is used inside a signal handler. This is problematic because std::cout is not
async-signal-safe. According to POSIX standards, only a small set of
functions are guaranteed to be safe when called from signal handlers,
and std::cout is not one of them. Using non-async-signal-safe functions
inside signal handlers leads to undefined behavior and can cause
crashes, deadlocks, or other unpredictable issues.
By making these changes, we avoid undefined behavior and ensure the
program can handle signals safely.
* new fenceWait() API in the backend
* correct implementation of fenceWait() for GL and WebGPU
- fenceWait() now works correctly if called before the fence is
created on the backend side
- the STL's condition wait_for() is actually a wait_until, which
means we have to make sure now() + timeout doesn't overflow.
- also we make sure to keep a reference to the fence internal state
while we wait so that we're safe if it's destroyed during that time.
* Implement fenceWait() properly on vulkan
On Vulkan, unfortunately, the implementation is complicated, as we
need three levels of "wait".
First we need to wait using a mutex/condition that the shared fence
is created (this is because on vulkan, all HwFence share the same
"state" associated to the same command buffer).
Once we have that, we need to wait for the VkFence to be submitted,
this is done using a read/write lock and condition variable. The
read/write lock is not needed at this stage, but in the next.
Once the fence is submitted, we can now wait using vkWaitForFences,
however, external host synchronization is needed. Multiple
vkWaitForFences can be issued together (and use the read lock), but
must be mutually exclusive with vkResetFences and vkQueueSubmit.
By construction, we know that this can't happen during vkQueueSubmit
due to the "2nd level" of wait, however we need to prevent
simultaneous calls to vkResetFences, this is done using a write lock.
By construction, we're guaranteed that when vkResetFences is called,
the fence has signaled, we just need to wait for all vkWaitForFences to
return.
A side effect of this change is that fenceGetStatus() has a better
implementation, since it's just a wait with timeout of 0.
* Update filament/backend/src/vulkan/VulkanDriver.cpp
Co-authored-by: Powei Feng <powei@google.com>
---------
Co-authored-by: Powei Feng <powei@google.com>
The parser object was accessed to generate a key after being passed to
the lambda using std::move(). This led to a crash on certain platforms
(at least on Windows).
This change fixes it by creating key first before moving the parser
object into the lambda.
Since #9259, CString in VulkanPlatform fall into the literal
constructor path. But we really want the null-terminated
(char const*) path. So we cast the strings to (char const*)
to enforce null-teriminated behavior.
RDIFF_BRANCH=pf/renderdiff-add-tolerance
Since #9259, CString in VulkanPlatform fall into the literal
constructor path. But we really want the null-terminated
(char const*) path. So we cast the strings to (char const*)
to enforce null-teriminated behavior.
* VK: Allow memcpy of vertex/index buffers in UMA
- Renamed VulkanBufferUsage to VulkanBufferBinding
to avoid confusion with the BufferUsage enum.
- In UMA all buffers are persistently memory mapped.
- In the case of static buffers that are memory mapped
use memcpy directly to update their contents.
* PR Comments
The corruption seems to be triggered with a combination of using:
- spirv-opt
- RGBA16F (as opposed to e.g. RGBA8)
- framebuffer_fetch
In this CL we disable framebuffer_fetch for drivers we know have the
issue.
FIXES=[445721121]
Fix#7794
- Add a VulkanSemaphore ref-counted class to track the references
of a semamphore - i.e. in a command buffer or in a present.
- Add a VulkanSemaphoreManager class to keep a pool of
VkSempahores for better re-use.
This fixes a validation error where we were re-using a semaphore
that is associated with a command buffer while its being used
in a present (as a wait signal).
Error ris VUID-vkQueueSubmit-pSignalSemaphores-00067
* material cache: address comments
* material cache: simplify CRC32 comparison
* material cache: == if same address
* material cache: use plain type for cached crc32
Allow returning a list of supported shader languages
instead of only one.
Notify the backend which is the preferred language.
In the case of metal, the preferred language will be
the first element in the list.
This change will allow a backend to support multiple
languages as needed, in the case of the noop driver,
it will support a material with any shader languages.