initial present rewrite
	
		
			
	
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
					Details
				
			
		
	
				
					
				
			
				
	
				continuous-integration/drone/push Build is passing
				
					Details
				
			
		
	
							parent
							
								
									d22bed8b76
								
							
						
					
					
						commit
						4c73c6c200
					
				|  | @ -58,7 +58,6 @@ typedef struct Refresh_Device Refresh_Device; | |||
| typedef struct Refresh_Buffer Refresh_Buffer; | ||||
| typedef struct Refresh_Texture Refresh_Texture; | ||||
| typedef struct Refresh_Sampler Refresh_Sampler; | ||||
| typedef struct Refresh_RenderTarget Refresh_RenderTarget; | ||||
| typedef struct Refresh_ShaderModule Refresh_ShaderModule; | ||||
| typedef struct Refresh_ComputePipeline Refresh_ComputePipeline; | ||||
| typedef struct Refresh_GraphicsPipeline Refresh_GraphicsPipeline; | ||||
|  | @ -113,6 +112,7 @@ typedef enum Refresh_TextureFormat | |||
| { | ||||
| 	/* Color Formats */ | ||||
| 	REFRESH_TEXTUREFORMAT_R8G8B8A8, | ||||
| 	REFRESH_TEXTUREFORMAT_B8G8R8A8, | ||||
| 	REFRESH_TEXTUREFORMAT_R5G6B5, | ||||
| 	REFRESH_TEXTUREFORMAT_A1R5G5B5, | ||||
| 	REFRESH_TEXTUREFORMAT_B4G4R4A4, | ||||
|  | @ -585,7 +585,11 @@ typedef struct Refresh_GraphicsPipelineCreateInfo | |||
| 
 | ||||
| typedef struct Refresh_ColorAttachmentInfo | ||||
| { | ||||
| 	Refresh_RenderTarget *pRenderTarget; | ||||
| 	Refresh_Texture *texture; /* We can't use TextureSlice because render passes take a single rectangle. */ | ||||
| 	uint32_t depth; | ||||
| 	uint32_t layer; | ||||
| 	uint32_t level; | ||||
| 	Refresh_SampleCount sampleCount; | ||||
| 	Refresh_Vec4 clearColor; /* Can be ignored by RenderPass */ | ||||
| 	Refresh_LoadOp loadOp; | ||||
| 	Refresh_StoreOp storeOp; | ||||
|  | @ -593,8 +597,11 @@ typedef struct Refresh_ColorAttachmentInfo | |||
| 
 | ||||
| typedef struct Refresh_DepthStencilAttachmentInfo | ||||
| { | ||||
| 	Refresh_RenderTarget *pDepthStencilTarget; | ||||
| 	Refresh_DepthStencilValue depthStencilValue; /* Can be ignored by RenderPass */ | ||||
| 	Refresh_Texture *texture; /* We can't use TextureSlice because render passes take a single rectangle. */ | ||||
| 	uint32_t depth; | ||||
| 	uint32_t layer; | ||||
| 	uint32_t level; | ||||
| 	Refresh_DepthStencilValue depthStencilClearValue; /* Can be ignored by RenderPass */ | ||||
| 	Refresh_LoadOp loadOp; | ||||
| 	Refresh_StoreOp storeOp; | ||||
| 	Refresh_LoadOp stencilLoadOp; | ||||
|  | @ -831,17 +838,6 @@ REFRESHAPI Refresh_Texture* Refresh_CreateTexture( | |||
| 	Refresh_TextureCreateInfo *textureCreateInfo | ||||
| ); | ||||
| 
 | ||||
| /* Creates a color target.
 | ||||
|  * | ||||
|  * textureSlice: 		The texture slice that the color target will resolve to. | ||||
|  * multisampleCount:	The MSAA value for the color target. | ||||
|  */ | ||||
| REFRESHAPI Refresh_RenderTarget* Refresh_CreateRenderTarget( | ||||
| 	Refresh_Device *device, | ||||
| 	Refresh_TextureSlice *textureSlice, | ||||
| 	Refresh_SampleCount multisampleCount | ||||
| ); | ||||
| 
 | ||||
| /* Creates a buffer.
 | ||||
|  * | ||||
|  * usageFlags:	Specifies how the buffer will be used. | ||||
|  | @ -1053,19 +1049,6 @@ REFRESHAPI void Refresh_QueueDestroyBuffer( | |||
| 	Refresh_Buffer *buffer | ||||
| ); | ||||
| 
 | ||||
| /* Sends a color target to be destroyed by the renderer. Note that we call it
 | ||||
|  * "QueueDestroy" because it may not be immediately destroyed by the renderer if | ||||
|  * this is not called from the main thread (for example, if a garbage collector | ||||
|  * deletes the resource instead of the programmer). | ||||
|  * | ||||
|  * renderTarget: The Refresh_ColorTarget to be destroyed. | ||||
|  */ | ||||
| REFRESHAPI void Refresh_QueueDestroyRenderTarget( | ||||
| 	Refresh_Device *device, | ||||
| 	Refresh_CommandBuffer *commandBuffer, | ||||
| 	Refresh_RenderTarget *renderTarget | ||||
| ); | ||||
| 
 | ||||
| /* Sends a shader module to be destroyed by the renderer. Note that we call it
 | ||||
|  * "QueueDestroy" because it may not be immediately destroyed by the renderer if | ||||
|  * this is not called from the main thread (for example, if a garbage collector | ||||
|  | @ -1244,23 +1227,18 @@ REFRESHAPI Refresh_CommandBuffer* Refresh_AcquireCommandBuffer( | |||
| 	uint8_t fixed | ||||
| ); | ||||
| 
 | ||||
| /* Queues an image to be presented to a window.
 | ||||
|  * The image will be presented upon the next Refresh_Submit call. | ||||
| /* Acquires a texture to use for presentation.
 | ||||
|  * May return NULL under certain conditions. | ||||
|  * If NULL, the user must ensure to not present. | ||||
|  * Once a swapchain texture is acquired, | ||||
|  * it will automatically be presented on command buffer submission. | ||||
|  * | ||||
|  * NOTE: | ||||
|  *		It is an error to call this function in headless mode. | ||||
|  * | ||||
|  * textureSlice:			The texture slice to present. | ||||
|  * destinationRectangle:	The region of the window to update. Can be NULL. | ||||
|  * filter:					The filter to use if scaling is required. | ||||
|  * windowHandle:			The window to present to. | ||||
|  * 	It is not recommended to hold a reference to this texture long term. | ||||
|  */ | ||||
| REFRESHAPI void Refresh_QueuePresent( | ||||
| REFRESHAPI Refresh_Texture* Refresh_AcquireSwapchainTexture( | ||||
| 	Refresh_Device *device, | ||||
| 	Refresh_CommandBuffer *commandBuffer, | ||||
| 	Refresh_TextureSlice *textureSlice, | ||||
| 	Refresh_Rect *destinationRectangle, | ||||
| 	Refresh_Filter filter, | ||||
| 	void *windowHandle | ||||
| ); | ||||
| 
 | ||||
|  |  | |||
|  | @ -305,19 +305,6 @@ Refresh_Texture* Refresh_CreateTexture( | |||
| 	); | ||||
| } | ||||
| 
 | ||||
| Refresh_RenderTarget* Refresh_CreateRenderTarget( | ||||
| 	Refresh_Device *device, | ||||
| 	Refresh_TextureSlice *textureSlice, | ||||
| 	Refresh_SampleCount multisampleCount | ||||
| ) { | ||||
| 	NULL_RETURN_NULL(device); | ||||
| 	return device->CreateRenderTarget( | ||||
| 		device->driverData, | ||||
| 		textureSlice, | ||||
| 		multisampleCount | ||||
| 	); | ||||
| } | ||||
| 
 | ||||
| Refresh_Buffer* Refresh_CreateBuffer( | ||||
| 	Refresh_Device *device, | ||||
| 	Refresh_BufferUsageFlags usageFlags, | ||||
|  | @ -557,19 +544,6 @@ void Refresh_QueueDestroyBuffer( | |||
| 	); | ||||
| } | ||||
| 
 | ||||
| void Refresh_QueueDestroyRenderTarget( | ||||
| 	Refresh_Device *device, | ||||
| 	Refresh_CommandBuffer *commandBuffer, | ||||
| 	Refresh_RenderTarget *renderTarget | ||||
| ) { | ||||
| 	NULL_RETURN(device); | ||||
| 	device->QueueDestroyRenderTarget( | ||||
| 		device->driverData, | ||||
| 		commandBuffer, | ||||
| 		renderTarget | ||||
| 	); | ||||
| } | ||||
| 
 | ||||
| void Refresh_QueueDestroyShaderModule( | ||||
| 	Refresh_Device *device, | ||||
| 	Refresh_CommandBuffer *commandBuffer, | ||||
|  | @ -738,21 +712,15 @@ Refresh_CommandBuffer* Refresh_AcquireCommandBuffer( | |||
| 	); | ||||
| } | ||||
| 
 | ||||
| void Refresh_QueuePresent( | ||||
| Refresh_Texture* Refresh_AcquireSwapchainTexture( | ||||
| 	Refresh_Device *device, | ||||
| 	Refresh_CommandBuffer *commandBuffer, | ||||
| 	Refresh_TextureSlice* textureSlice, | ||||
| 	Refresh_Rect *destinationRectangle, | ||||
| 	Refresh_Filter filter, | ||||
| 	void *windowHandle | ||||
| ) { | ||||
| 	NULL_RETURN(device); | ||||
| 	device->QueuePresent( | ||||
| 	NULL_RETURN_NULL(device); | ||||
| 	return device->AcquireSwapchainTexture( | ||||
| 		device->driverData, | ||||
| 		commandBuffer, | ||||
| 		textureSlice, | ||||
| 		destinationRectangle, | ||||
| 		filter, | ||||
| 		windowHandle | ||||
| 	); | ||||
| } | ||||
|  |  | |||
|  | @ -154,6 +154,7 @@ static inline int32_t BytesPerImage( | |||
| #define MAX_BUFFER_BINDINGS			16 | ||||
| 
 | ||||
| #define MAX_COLOR_TARGET_BINDINGS	4 | ||||
| #define MAX_PRESENT_COUNT			16 | ||||
| 
 | ||||
| /* Refresh_Device Definition */ | ||||
| 
 | ||||
|  | @ -243,12 +244,6 @@ struct Refresh_Device | |||
| 		Refresh_TextureCreateInfo *textureCreateInfo | ||||
| 	); | ||||
| 
 | ||||
| 	Refresh_RenderTarget* (*CreateRenderTarget)( | ||||
| 		Refresh_Renderer *driverData, | ||||
| 		Refresh_TextureSlice *textureSlice, | ||||
| 		Refresh_SampleCount multisampleCount | ||||
| 	); | ||||
| 
 | ||||
| 	Refresh_Buffer* (*CreateBuffer)( | ||||
| 		Refresh_Renderer *driverData, | ||||
| 		Refresh_BufferUsageFlags usageFlags, | ||||
|  | @ -367,12 +362,6 @@ struct Refresh_Device | |||
| 		Refresh_Buffer *buffer | ||||
| 	); | ||||
| 
 | ||||
| 	void(*QueueDestroyRenderTarget)( | ||||
| 		Refresh_Renderer *driverData, | ||||
| 		Refresh_CommandBuffer *commandBuffer, | ||||
| 		Refresh_RenderTarget *renderTarget | ||||
| 	); | ||||
| 
 | ||||
| 	void(*QueueDestroyShaderModule)( | ||||
| 		Refresh_Renderer *driverData, | ||||
| 		Refresh_CommandBuffer *commandBuffer, | ||||
|  | @ -453,12 +442,9 @@ struct Refresh_Device | |||
| 		uint8_t fixed | ||||
| 	); | ||||
| 
 | ||||
| 	void(*QueuePresent)( | ||||
| 	Refresh_Texture* (*AcquireSwapchainTexture)( | ||||
| 		Refresh_Renderer *driverData, | ||||
| 		Refresh_CommandBuffer *commandBuffer, | ||||
| 		Refresh_TextureSlice *textureSlice, | ||||
| 		Refresh_Rect *destinationRectangle, | ||||
| 		Refresh_Filter filter, | ||||
| 		void *windowHandle | ||||
| 	); | ||||
| 
 | ||||
|  | @ -490,7 +476,6 @@ struct Refresh_Device | |||
| 	ASSIGN_DRIVER_FUNC(CreateSampler, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(CreateShaderModule, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(CreateTexture, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(CreateRenderTarget, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(CreateBuffer, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(SetTextureData, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(SetTextureDataYUV, name) \ | ||||
|  | @ -506,7 +491,6 @@ struct Refresh_Device | |||
| 	ASSIGN_DRIVER_FUNC(QueueDestroyTexture, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(QueueDestroySampler, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(QueueDestroyBuffer, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(QueueDestroyRenderTarget, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(QueueDestroyShaderModule, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(QueueDestroyComputePipeline, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(QueueDestroyGraphicsPipeline, name) \ | ||||
|  | @ -519,7 +503,7 @@ struct Refresh_Device | |||
| 	ASSIGN_DRIVER_FUNC(BindComputeBuffers, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(BindComputeTextures, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(AcquireCommandBuffer, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(QueuePresent, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(AcquireSwapchainTexture, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(Submit, name) \ | ||||
| 	ASSIGN_DRIVER_FUNC(Wait, name) | ||||
| 
 | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue