mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	output: add wlr_output_begin_render_pass()
This commit is contained in:
		
							parent
							
								
									95062904c7
								
							
						
					
					
						commit
						93a6acae9f
					
				
					 2 changed files with 30 additions and 0 deletions
				
			
		| 
						 | 
					@ -582,6 +582,13 @@ void wlr_output_state_set_buffer(struct wlr_output_state *state,
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
bool wlr_output_configure_primary_swapchain(struct wlr_output *output,
 | 
					bool wlr_output_configure_primary_swapchain(struct wlr_output *output,
 | 
				
			||||||
	const struct wlr_output_state *state, struct wlr_swapchain **swapchain);
 | 
						const struct wlr_output_state *state, struct wlr_swapchain **swapchain);
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Begin a render pass on this output.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * Same as wlr_output_attach_render(), but returns a struct wlr_render_pass.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					struct wlr_render_pass *wlr_output_begin_render_pass(struct wlr_output *output,
 | 
				
			||||||
 | 
						struct wlr_output_state *state, int *buffer_age);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -247,3 +247,26 @@ uint32_t wlr_output_preferred_read_format(struct wlr_output *output) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return fmt;
 | 
						return fmt;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct wlr_render_pass *wlr_output_begin_render_pass(struct wlr_output *output,
 | 
				
			||||||
 | 
							struct wlr_output_state *state, int *buffer_age) {
 | 
				
			||||||
 | 
						if (!wlr_output_configure_primary_swapchain(output, state, &output->swapchain)) {
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct wlr_buffer *buffer = wlr_swapchain_acquire(output->swapchain, buffer_age);
 | 
				
			||||||
 | 
						if (buffer == NULL) {
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct wlr_renderer *renderer = output->renderer;
 | 
				
			||||||
 | 
						assert(renderer != NULL);
 | 
				
			||||||
 | 
						struct wlr_render_pass *pass = wlr_renderer_begin_buffer_pass(renderer, buffer);
 | 
				
			||||||
 | 
						if (pass == NULL) {
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						wlr_output_state_set_buffer(state, buffer);
 | 
				
			||||||
 | 
						wlr_buffer_unlock(buffer);
 | 
				
			||||||
 | 
						return pass;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue