blob: 88e9f81238e8c0ac01c6a41358c9002ffc9db71a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*
* Copyright 2009, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Alexander von Gluck IV, kallisti5@unixzen.com
*/
#ifndef GALLIUMCONTEXT_H
#define GALLIUMCONTEXT_H
#include <stddef.h>
#include <kernel/image.h>
extern "C" {
#include "state_tracker/st_api.h"
#include "pipe/p_compiler.h"
#include "pipe/p_screen.h"
#include "postprocess/filters.h"
#include "os/os_thread.h"
}
#include "bitmap_wrapper.h"
#include "GalliumFramebuffer.h"
#define CONTEXT_MAX 32
typedef int64 context_id;
struct hgl_context
{
struct st_api* api;
// State Tracker API
struct st_manager* manager;
// State Tracker Manager
struct st_context_iface* st;
// State Tracker Interface Object
struct st_visual* stVisual;
// State Tracker Visual
struct pipe_resource* textures[ST_ATTACHMENT_COUNT];
// Post processing
struct pp_queue_t* postProcess;
unsigned int postProcessEnable[PP_FILTERS];
Bitmap* bitmap;
color_space colorSpace;
GalliumFramebuffer* draw;
GalliumFramebuffer* read;
};
class GalliumContext {
public:
GalliumContext(ulong options);
~GalliumContext();
context_id CreateContext(Bitmap* bitmap);
void DestroyContext(context_id contextID);
context_id GetCurrentContext() { return fCurrentContext; };
status_t SetCurrentContext(Bitmap *bitmap,
context_id contextID);
status_t SwapBuffers(context_id contextID);
private:
status_t CreateScreen();
void Flush();
ulong fOptions;
struct hgl_context* fContext[CONTEXT_MAX];
context_id fCurrentContext;
struct pipe_screen* fScreen;
pipe_mutex fMutex;
};
#endif /* GALLIUMCONTEXT_H */
|