1/* 2 * Copyright 2006-2012 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7#include <stdio.h> 8 9#include <Screen.h> 10#include <GLRenderer.h> 11 12 13extern "C" _EXPORT BGLRenderer* 14instanciate_gl_renderer(BGLView* view, ulong options, BGLDispatcher* dispatcher) 15{ 16 if (!view) { 17 printf("view = NULL!\n"); 18 return NULL; 19 } 20 21 BWindow* window = view->Window(); 22 if (!window) { 23 printf("view's window = NULL!\n"); 24 return NULL; 25 } 26 27 BScreen screen(window); 28 if (!screen.IsValid()) { 29 printf("Failed to get window's screen!\n"); 30 return NULL; 31 } 32 33 accelerant_device_info adi; 34 if (screen.GetDeviceInfo(&adi) != B_OK) { 35 printf("screen.GetDeviceInfo() failed!\n"); 36 return NULL; 37 } 38 39 printf("Accelerant device info:\n" 40 " version: %ud\n" 41 " name: %s\n" 42 " chipset: %s\n" 43 " serial#: %s\n", 44 (unsigned int) adi.version, adi.name, adi.chipset, adi.serial_no); 45 46 // Check the view is attached to a screen driven by a Radeon chip: 47 if (strcasecmp(adi.chipset, "radeon") == 0 || 48 strcasecmp(adi.chipset, "radeon") == 0) { 49 // return new RadeonHardwareRenderer(view, options, dispatcher); 50 return NULL; 51 } 52 53 // We can't be a renderer for this view, sorry. 54 return NULL; 55} 56