aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/targets/haiku-softpipe/GalliumContext.h
blob: d8d75b91c06004b79ed6ce499af3f4e51f130702 (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
/*
 * 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>

#include "pipe/p_compiler.h"
#include "pipe/p_screen.h"
#include "postprocess/filters.h"
#include "hgl_context.h"

#include "bitmap_wrapper.h"



class GalliumContext {
public:
							GalliumContext(ulong options);
							~GalliumContext();

		void				Lock();
		void				Unlock();

		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);

		bool				Validate(uint32 width, uint32 height);
		void				Invalidate(uint32 width, uint32 height);

private:
		status_t			CreateScreen();
		void				Flush();

		ulong				fOptions;
		struct pipe_screen*	fScreen;

		// Context Management
		struct hgl_context*	fContext[CONTEXT_MAX];
		context_id			fCurrentContext;
		mtx_t			fMutex;
};


#endif /* GALLIUMCONTEXT_H */