1848b8605Smrg/*
2848b8605Smrg * Copyright 2006-2012, Haiku, Inc. All rights reserved.
3848b8605Smrg * Distributed under the terms of the MIT License.
4848b8605Smrg *
5848b8605Smrg * Authors:
6848b8605Smrg *		Jérôme Duval, korli@users.berlios.de
7848b8605Smrg * 		Philippe Houdoin, philippe.houdoin@free.fr
8848b8605Smrg * 		Artur Wyszynski, harakash@gmail.com
9848b8605Smrg *		Alexander von Gluck IV, kallisti5@unixzen.com
10848b8605Smrg */
11848b8605Smrg#ifndef SOFTWARERENDERER_H
12848b8605Smrg#define SOFTWARERENDERER_H
13848b8605Smrg
14848b8605Smrg
15848b8605Smrg#include <kernel/image.h>
16848b8605Smrg
17848b8605Smrg#include "GLRenderer.h"
18848b8605Smrg#include "GalliumContext.h"
19848b8605Smrg
20848b8605Smrg
21848b8605Smrgclass SoftwareRenderer : public BGLRenderer {
22848b8605Smrgpublic:
23848b8605Smrg								SoftwareRenderer(BGLView *view,
24848b8605Smrg									ulong bgl_options,
25848b8605Smrg									BGLDispatcher *dispatcher);
26848b8605Smrg	virtual						~SoftwareRenderer();
27848b8605Smrg
28848b8605Smrg	virtual	void				LockGL();
29848b8605Smrg	virtual	void				UnlockGL();
30848b8605Smrg
31848b8605Smrg	virtual	void				SwapBuffers(bool vsync = false);
32848b8605Smrg	virtual	void				Draw(BRect updateRect);
33848b8605Smrg	virtual	status_t			CopyPixelsOut(BPoint source, BBitmap *dest);
34848b8605Smrg	virtual	status_t			CopyPixelsIn(BBitmap *source, BPoint dest);
35848b8605Smrg	virtual	void				FrameResized(float width, float height);
36848b8605Smrg
37848b8605Smrg	virtual	void				EnableDirectMode(bool enabled);
38848b8605Smrg	virtual	void				DirectConnected(direct_buffer_info *info);
39848b8605Smrg
40848b8605Smrgprivate:
41848b8605Smrg
42848b8605Smrg			void				_AllocateBitmap();
43848b8605Smrg
44848b8605Smrg			GalliumContext*		fContextObj;
45848b8605Smrg			BBitmap*			fBitmap;
46848b8605Smrg			context_id			fContextID;
47848b8605Smrg
48848b8605Smrg			bool				fDirectModeEnabled;
49848b8605Smrg			direct_buffer_info*	fInfo;
50848b8605Smrg			BLocker				fInfoLocker;
51848b8605Smrg			ulong				fOptions;
52848b8605Smrg			GLuint				fWidth;
53848b8605Smrg			GLuint				fHeight;
54848b8605Smrg			color_space			fColorSpace;
55848b8605Smrg};
56848b8605Smrg
57848b8605Smrg#endif	// SOFTPIPERENDERER_H
58