• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2009-2014, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Alexander von Gluck IV, kallisti5@unixzen.com
7  */
8 #ifndef HGL_CONTEXT_H
9 #define HGL_CONTEXT_H
10 
11 
12 #include "pipe/p_format.h"
13 #include "pipe/p_compiler.h"
14 #include "pipe/p_screen.h"
15 #include "postprocess/filters.h"
16 
17 #include "frontend/api.h"
18 #include "frontend/st_manager.h"
19 #include "os/os_thread.h"
20 
21 #include "bitmap_wrapper.h"
22 
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 
29 #define CONTEXT_MAX 32
30 
31 typedef int64 context_id;
32 
33 
34 struct hgl_buffer
35 {
36 	struct st_framebuffer_iface *stfbi;
37 	struct st_visual* visual;
38 
39 	unsigned width;
40 	unsigned height;
41 	unsigned mask;
42 
43 	struct pipe_screen* screen;
44 	struct pipe_surface* surface;
45 
46 	enum pipe_texture_target target;
47 	struct pipe_resource* textures[ST_ATTACHMENT_COUNT];
48 
49 	void *map;
50 
51 	//struct hgl_buffer *next;  /**< next in linked list */
52 };
53 
54 
55 struct hgl_context
56 {
57 	struct st_api* api;
58 		// API
59 	struct st_manager* manager;
60 		// Manager
61 	struct st_context_iface* st;
62 		// Interface Object
63 	struct st_visual* stVisual;
64 		// Visual
65 
66 	struct pipe_screen* screen;
67 
68 	//struct pipe_resource* textures[ST_ATTACHMENT_COUNT];
69 
70 	// Post processing
71 	struct pp_queue_t* postProcess;
72 	unsigned int postProcessEnable[PP_FILTERS];
73 
74 	// Desired viewport size
75 	unsigned width;
76 	unsigned height;
77 
78 	Bitmap* bitmap;
79 	color_space colorSpace;
80 
81 	mtx_t fbMutex;
82 
83 	struct hgl_buffer* draw;
84 	struct hgl_buffer* read;
85 };
86 
87 // hgl_buffer from statetracker interface
88 struct hgl_buffer* hgl_st_framebuffer(struct st_framebuffer_iface *stfbi);
89 
90 // hgl frontend
91 struct st_api* hgl_create_st_api(void);
92 
93 // hgl framebuffer
94 struct hgl_buffer* hgl_create_st_framebuffer(struct hgl_context* context);
95 
96 // hgl manager
97 struct st_manager* hgl_create_st_manager(struct hgl_context* screen);
98 void hgl_destroy_st_manager(struct st_manager *manager);
99 
100 // hgl visual
101 struct st_visual* hgl_create_st_visual(ulong options);
102 void hgl_destroy_st_visual(struct st_visual* visual);
103 
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif /* HGL_CONTEXT_H */
110