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