| 
									
										
										
										
											2016-10-13 04:22:28 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * ***** BEGIN GPL LICENSE BLOCK ***** | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  |  * of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software Foundation, | 
					
						
							|  |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The Original Code is Copyright (C) 2005 Blender Foundation. | 
					
						
							|  |  |  |  * All rights reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The Original Code is: all of this file. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Contributor(s): | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ***** END GPL LICENSE BLOCK ***** | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** \file GPU_viewport.h
 | 
					
						
							|  |  |  |  *  \ingroup gpu | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef __GPU_VIEWPORT_H__
 | 
					
						
							|  |  |  | #define __GPU_VIEWPORT_H__
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-21 20:50:00 +00:00
										 |  |  | #include <stdbool.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-07 11:20:15 +01:00
										 |  |  | #include "DNA_vec_types.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "GPU_framebuffer.h"
 | 
					
						
							|  |  |  | #include "GPU_texture.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-04 15:46:09 +02:00
										 |  |  | #define GPU_INFO_SIZE 512 /* IMA_MAX_RENDER_TEXT */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-13 04:22:28 +00:00
										 |  |  | typedef struct GPUViewport GPUViewport; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-07 11:20:15 +01:00
										 |  |  | /* All FramebufferLists are just the same pointers with different names */ | 
					
						
							|  |  |  | typedef struct FramebufferList { | 
					
						
							| 
									
										
										
										
											2017-04-12 19:49:19 +10:00
										 |  |  | 	struct GPUFrameBuffer *framebuffers[0]; | 
					
						
							| 
									
										
										
										
											2017-02-07 11:20:15 +01:00
										 |  |  | } FramebufferList; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct TextureList { | 
					
						
							| 
									
										
										
										
											2017-04-12 19:49:19 +10:00
										 |  |  | 	struct GPUTexture *textures[0]; | 
					
						
							| 
									
										
										
										
											2017-02-07 11:20:15 +01:00
										 |  |  | } TextureList; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct PassList { | 
					
						
							| 
									
										
										
										
											2017-04-12 19:49:19 +10:00
										 |  |  | 	struct DRWPass *passes[0]; | 
					
						
							| 
									
										
										
										
											2017-02-07 11:20:15 +01:00
										 |  |  | } PassList; | 
					
						
							| 
									
										
										
										
											2016-10-13 04:22:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-08 21:44:13 +01:00
										 |  |  | typedef struct StorageList { | 
					
						
							| 
									
										
										
										
											2017-04-12 19:49:19 +10:00
										 |  |  | 	void *storage[0]; /* custom structs from the engine */ | 
					
						
							| 
									
										
										
										
											2017-02-08 21:44:13 +01:00
										 |  |  | } StorageList; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-08 20:00:09 +01:00
										 |  |  | typedef struct ViewportEngineData { | 
					
						
							| 
									
										
										
										
											2017-04-03 19:32:05 +02:00
										 |  |  | 	void *engine_type; | 
					
						
							| 
									
										
										
										
											2017-02-07 11:20:15 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-08 20:00:09 +01:00
										 |  |  | 	FramebufferList *fbl; | 
					
						
							|  |  |  | 	TextureList *txl; | 
					
						
							|  |  |  | 	PassList *psl; | 
					
						
							|  |  |  | 	StorageList *stl; | 
					
						
							| 
									
										
										
										
											2017-05-04 15:46:09 +02:00
										 |  |  | 	char info[GPU_INFO_SIZE]; | 
					
						
							| 
									
										
										
										
											2017-03-26 19:25:45 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-28 04:33:58 +10:00
										 |  |  | 	/* we may want to put this elsewhere */ | 
					
						
							|  |  |  | 	struct DRWTextStore *text_draw_cache; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-26 19:25:45 +02:00
										 |  |  | 	/* Profiling data */ | 
					
						
							|  |  |  | 	double init_time; | 
					
						
							|  |  |  | 	double cache_time; | 
					
						
							|  |  |  | 	double render_time; | 
					
						
							|  |  |  | 	double background_time; | 
					
						
							| 
									
										
										
										
											2017-03-08 20:00:09 +01:00
										 |  |  | } ViewportEngineData; | 
					
						
							| 
									
										
										
										
											2017-02-07 11:20:15 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-12 19:49:19 +10:00
										 |  |  | typedef struct ViewportEngineData_Info { | 
					
						
							|  |  |  | 	int fbl_len; | 
					
						
							|  |  |  | 	int txl_len; | 
					
						
							|  |  |  | 	int psl_len; | 
					
						
							|  |  |  | 	int stl_len; | 
					
						
							|  |  |  | } ViewportEngineData_Info; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-07 11:20:15 +01:00
										 |  |  | GPUViewport *GPU_viewport_create(void); | 
					
						
							| 
									
										
										
										
											2017-03-08 20:00:09 +01:00
										 |  |  | void GPU_viewport_bind(GPUViewport *viewport, const rcti *rect); | 
					
						
							| 
									
										
										
										
											2017-02-07 11:20:15 +01:00
										 |  |  | void GPU_viewport_unbind(GPUViewport *viewport); | 
					
						
							| 
									
										
										
										
											2016-10-13 04:22:28 +00:00
										 |  |  | void GPU_viewport_free(GPUViewport *viewport); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-03 02:50:29 +10:00
										 |  |  | GPUViewport *GPU_viewport_create_from_offscreen(struct GPUOffScreen *ofs); | 
					
						
							|  |  |  | void GPU_viewport_clear_from_offscreen(GPUViewport *viewport); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-03 19:32:05 +02:00
										 |  |  | void *GPU_viewport_engine_data_create(GPUViewport *viewport, void *engine_type); | 
					
						
							|  |  |  | void *GPU_viewport_engine_data_get(GPUViewport *viewport, void *engine_type); | 
					
						
							| 
									
										
										
										
											2017-03-08 20:00:09 +01:00
										 |  |  | void *GPU_viewport_framebuffer_list_get(GPUViewport *viewport); | 
					
						
							|  |  |  | void *GPU_viewport_texture_list_get(GPUViewport *viewport); | 
					
						
							| 
									
										
										
										
											2017-04-26 04:39:25 +10:00
										 |  |  | void  GPU_viewport_size_get(const GPUViewport *viewport, int size[2]); | 
					
						
							|  |  |  | void  GPU_viewport_size_set(GPUViewport *viewport, const int size[2]); | 
					
						
							| 
									
										
										
										
											2017-03-08 20:00:09 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 02:59:25 +02:00
										 |  |  | /* Texture pool */ | 
					
						
							|  |  |  | GPUTexture *GPU_viewport_texture_pool_query(GPUViewport *viewport, void *engine, int width, int height, int channels, int format); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-26 19:25:45 +02:00
										 |  |  | bool GPU_viewport_cache_validate(GPUViewport *viewport, unsigned int hash); | 
					
						
							| 
									
										
										
										
											2017-02-07 11:20:15 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-21 20:50:00 +00:00
										 |  |  | /* debug */ | 
					
						
							| 
									
										
										
										
											2017-01-10 18:17:29 +01:00
										 |  |  | bool GPU_viewport_debug_depth_create(GPUViewport *viewport, int width, int height, char err_out[256]); | 
					
						
							| 
									
										
										
										
											2016-10-21 20:50:00 +00:00
										 |  |  | void GPU_viewport_debug_depth_free(GPUViewport *viewport); | 
					
						
							|  |  |  | void GPU_viewport_debug_depth_store(GPUViewport *viewport, const int x, const int y); | 
					
						
							|  |  |  | void GPU_viewport_debug_depth_draw(GPUViewport *viewport, const float znear, const float zfar); | 
					
						
							|  |  |  | bool GPU_viewport_debug_depth_is_valid(GPUViewport *viewport); | 
					
						
							|  |  |  | int GPU_viewport_debug_depth_width(const GPUViewport *viewport); | 
					
						
							|  |  |  | int GPU_viewport_debug_depth_height(const GPUViewport *viewport); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-13 04:22:28 +00:00
										 |  |  | #endif // __GPU_VIEWPORT_H__
 |