File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
filament/backend/src/vulkan Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,11 @@ struct PushConstantDescription {
6363 uint32_t mRangeCount ;
6464};
6565
66+ // Encapsulates a VkShaderModule. Note: this is a ThreadSafeResource
67+ // because we may use parallel compilation, in which case ref counts may
68+ // be modified on multiple backend threads. This is simply to avoid
69+ // destroying a VkShaderModule mid-compilation of a pipeline. It is
70+ // still assumed that all calls will originate from the backend.
6671struct VulkanProgram : public HwProgram , fvkmemory::ThreadSafeResource {
6772 using BindingList = fvkutils::StaticVector<uint16_t , MAX_SAMPLER_COUNT>;
6873
Original file line number Diff line number Diff line change 3636#include < atomic>
3737#include < chrono>
3838#include < list>
39+ #include < type_traits>
3940#include < utility>
4041#include < variant>
4142
@@ -72,11 +73,11 @@ struct VulkanCommandBuffer {
7273
7374 ~VulkanCommandBuffer ();
7475
75- inline void acquire (fvkmemory::resource_ptr<fvkmemory::Resource> resource) {
76- mResources . push_back (resource);
77- }
78-
79- inline void acquire (fvkmemory::resource_ptr<fvkmemory::ThreadSafeResource > resource) {
76+ template < typename T,
77+ typename = std:: enable_if_t <
78+ std::is_same_v<T, fvkmemory::Resource> ||
79+ std::is_same_v<T, fvkmemory::ThreadSafeResource>>>
80+ inline void acquire (fvkmemory::resource_ptr<T > resource) {
8081 mResources .push_back (resource);
8182 }
8283
You can’t perform that action at this time.
0 commit comments