2 * Copyright 2009, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Alexander von Gluck IV, kallisti5@unixzen.com
8 #ifndef GALLIUMCONTEXT_H
9 #define GALLIUMCONTEXT_H
13 #include <kernel/image.h>
16 #include "state_tracker/st_api.h"
17 #include "pipe/p_compiler.h"
18 #include "pipe/p_screen.h"
19 #include "postprocess/filters.h"
20 #include "os/os_thread.h"
22 #include "bitmap_wrapper.h"
23 #include "GalliumFramebuffer.h"
26 #define CONTEXT_MAX 32
29 typedef int64 context_id
;
35 struct st_manager
* manager
;
36 // State Tracker Manager
37 struct st_context_iface
* st
;
38 // State Tracker Interface Object
39 struct st_visual
* stVisual
;
40 // State Tracker Visual
42 struct pipe_resource
* textures
[ST_ATTACHMENT_COUNT
];
45 struct pp_queue_t
* postProcess
;
46 unsigned int postProcessEnable
[PP_FILTERS
];
49 color_space colorSpace
;
51 GalliumFramebuffer
* draw
;
52 GalliumFramebuffer
* read
;
56 class GalliumContext
{
58 GalliumContext(ulong options
);
64 struct st_visual
* CreateVisual();
66 context_id
CreateContext(Bitmap
* bitmap
);
67 void DestroyContext(context_id contextID
);
68 context_id
GetCurrentContext() { return fCurrentContext
; };
69 status_t
SetCurrentContext(Bitmap
*bitmap
,
70 context_id contextID
);
72 status_t
SwapBuffers(context_id contextID
);
73 void ResizeViewport(int32 width
, int32 height
);
76 status_t
CreateScreen();
80 struct pipe_screen
* fScreen
;
83 struct hgl_context
* fContext
[CONTEXT_MAX
];
84 context_id fCurrentContext
;
89 #endif /* GALLIUMCONTEXT_H */