Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mesa
Path: blob/21.2-virgl/src/gallium/targets/haiku-softpipe/GalliumContext.h
4565 views
1
/*
2
* Copyright 2009, Haiku, Inc. All Rights Reserved.
3
* Distributed under the terms of the MIT License.
4
*
5
* Authors:
6
* Alexander von Gluck IV, [email protected]
7
*/
8
#ifndef GALLIUMCONTEXT_H
9
#define GALLIUMCONTEXT_H
10
11
12
#include <stddef.h>
13
#include <kernel/image.h>
14
15
#include "pipe/p_compiler.h"
16
#include "pipe/p_screen.h"
17
#include "postprocess/filters.h"
18
#include "hgl_context.h"
19
#include "sw/hgl/hgl_sw_winsys.h"
20
21
22
class BBitmap;
23
24
class GalliumContext {
25
public:
26
GalliumContext(ulong options);
27
~GalliumContext();
28
29
void Lock();
30
void Unlock();
31
32
context_id CreateContext(HGLWinsysContext *wsContext);
33
void DestroyContext(context_id contextID);
34
context_id GetCurrentContext() { return fCurrentContext; };
35
status_t SetCurrentContext(bool set, context_id contextID);
36
37
status_t SwapBuffers(context_id contextID);
38
void Draw(context_id contextID, BRect updateRect);
39
40
bool Validate(uint32 width, uint32 height);
41
void Invalidate(uint32 width, uint32 height);
42
43
private:
44
status_t CreateDisplay();
45
void DestroyDisplay();
46
void Flush();
47
48
ulong fOptions;
49
static int32 fDisplayRefCount;
50
static hgl_display* fDisplay;
51
52
// Context Management
53
struct hgl_context* fContext[CONTEXT_MAX];
54
context_id fCurrentContext;
55
mtx_t fMutex;
56
};
57
58
59
#endif /* GALLIUMCONTEXT_H */
60
61