1af69d88dSmrg/*
2af69d88dSmrg * Copyright 2006-2012, Haiku, Inc. All rights reserved.
3af69d88dSmrg * Distributed under the terms of the MIT License.
4af69d88dSmrg *
5af69d88dSmrg * Authors:
6af69d88dSmrg *		Jérôme Duval, korli@users.berlios.de
7af69d88dSmrg * 		Philippe Houdoin, philippe.houdoin@free.fr
8af69d88dSmrg * 		Artur Wyszynski, harakash@gmail.com
9af69d88dSmrg *		Alexander von Gluck IV, kallisti5@unixzen.com
10af69d88dSmrg */
11af69d88dSmrg#ifndef SOFTWARERENDERER_H
12af69d88dSmrg#define SOFTWARERENDERER_H
13af69d88dSmrg
14af69d88dSmrg
15af69d88dSmrg#include <kernel/image.h>
16af69d88dSmrg
17af69d88dSmrg#include "GLRenderer.h"
18af69d88dSmrg#include "GalliumContext.h"
19af69d88dSmrg
20af69d88dSmrg
217ec681f3Smrgclass SoftwareRenderer : public BGLRenderer, public HGLWinsysContext {
22af69d88dSmrgpublic:
23af69d88dSmrg								SoftwareRenderer(BGLView *view,
247ec681f3Smrg									ulong bgl_options);
25af69d88dSmrg	virtual						~SoftwareRenderer();
26af69d88dSmrg
277ec681f3Smrg			void				LockGL();
287ec681f3Smrg			void				UnlockGL();
29af69d88dSmrg
307ec681f3Smrg			void				Display(BBitmap* bitmap, BRect* updateRect);
31af69d88dSmrg
327ec681f3Smrg			void				SwapBuffers(bool vsync = false);
337ec681f3Smrg			void				Draw(BRect updateRect);
347ec681f3Smrg			status_t			CopyPixelsOut(BPoint source, BBitmap *dest);
357ec681f3Smrg			status_t			CopyPixelsIn(BBitmap *source, BPoint dest);
367ec681f3Smrg			void				FrameResized(float width, float height);
37af69d88dSmrg
387ec681f3Smrg			void				EnableDirectMode(bool enabled);
397ec681f3Smrg			void				DirectConnected(direct_buffer_info *info);
40af69d88dSmrg
417ec681f3Smrgprivate:
42af69d88dSmrg			GalliumContext*		fContextObj;
43af69d88dSmrg			context_id			fContextID;
44af69d88dSmrg
45af69d88dSmrg			bool				fDirectModeEnabled;
46af69d88dSmrg			direct_buffer_info*	fInfo;
47af69d88dSmrg			BLocker				fInfoLocker;
487ec681f3Smrg			ulong				fOptions;
49af69d88dSmrg			GLuint				fWidth;
50af69d88dSmrg			GLuint				fHeight;
51af69d88dSmrg			color_space			fColorSpace;
52af69d88dSmrg};
53af69d88dSmrg
54af69d88dSmrg#endif	// SOFTPIPERENDERER_H
55