mirror of
				https://github.com/PancakeTAS/lsfg-vk.git
				synced 2025-10-30 07:01:10 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			83 lines
		
	
	
	
		
			2.6 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			83 lines
		
	
	
	
		
			2.6 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <vulkan/vulkan_core.h>
 | |
| 
 | |
| #include <functional>
 | |
| #include <cstdint>
 | |
| #include <string>
 | |
| #include <vector>
 | |
| 
 | |
| namespace LSFG_3_1 {
 | |
| 
 | |
|     ///
 | |
|     /// Initialize the LSFG library.
 | |
|     ///
 | |
|     /// @param deviceUUID The UUID of the Vulkan device to use.
 | |
|     /// @param isHdr Whether the images are in HDR format.
 | |
|     /// @param flowScale Internal flow scale factor.
 | |
|     /// @param generationCount Number of frames to generate.
 | |
|     /// @param forceDisableFp16 Whether to force-disable FP16 optimizations.
 | |
|     /// @param loader Function to load shader source code by name.
 | |
|     ///
 | |
|     /// @throws LSFG::vulkan_error if Vulkan objects fail to initialize.
 | |
|     ///
 | |
|     [[gnu::visibility("default")]]
 | |
|     void initialize(uint64_t deviceUUID,
 | |
|         bool isHdr, float flowScale, uint64_t generationCount,
 | |
|         bool forceDisableFp16,
 | |
|         const std::function<std::vector<uint8_t>(const std::string&, bool)>& loader);
 | |
| 
 | |
| #ifdef LSFGVK_EXCESS_DEBUG
 | |
|     ///
 | |
|     /// Initialize the renderdoc API.
 | |
|     ///
 | |
|     /// @throws LSFG::vulkan_error if the renderdoc API cannot be initialized.
 | |
|     ///
 | |
|     [[gnu::visibility("default")]]
 | |
|     void initializeRenderDoc();
 | |
| #endif // LSFGVK_EXCESS_DEBUG
 | |
| 
 | |
|     ///
 | |
|     /// Create a new LSFG context on a swapchain.
 | |
|     ///
 | |
|     /// @param in0 File descriptor for the first input image.
 | |
|     /// @param in1 File descriptor for the second input image.
 | |
|     /// @param outN File descriptor for each output image. This defines the LSFG level.
 | |
|     /// @param extent The size of the images
 | |
|     /// @param format The format of the images.
 | |
|     /// @return A unique identifier for the created context.
 | |
|     ///
 | |
|     /// @throws LSFG::vulkan_error if the context cannot be created.
 | |
|     ///
 | |
|     [[gnu::visibility("default")]]
 | |
|     int32_t createContext(
 | |
|         int in0, int in1, const std::vector<int>& outN,
 | |
|         VkExtent2D extent, VkFormat format);
 | |
| 
 | |
|     ///
 | |
|     /// Present a context.
 | |
|     ///
 | |
|     /// @param id Unique identifier of the context to present.
 | |
|     /// @param inSem Semaphore to wait on before starting the generation.
 | |
|     /// @param outSem Semaphores to signal once each output image is ready.
 | |
|     ///
 | |
|     /// @throws LSFG::vulkan_error if the context cannot be presented.
 | |
|     ///
 | |
|     [[gnu::visibility("default")]]
 | |
|     void presentContext(int32_t id, int inSem, const std::vector<int>& outSem);
 | |
| 
 | |
|     ///
 | |
|     /// Delete an LSFG context.
 | |
|     ///
 | |
|     /// @param id Unique identifier of the context to delete.
 | |
|     ///
 | |
|     [[gnu::visibility("default")]]
 | |
|     void deleteContext(int32_t id);
 | |
| 
 | |
|     ///
 | |
|     /// Deinitialize the LSFG library.
 | |
|     ///
 | |
|     [[gnu::visibility("default")]]
 | |
|     void finalize();
 | |
| 
 | |
| }
 | 
