source file REDIGraphicDevice.h

Go to the documentation of this file.

#ifndef RED_IGRAPHIC_DEVICE_H
#define RED_IGRAPHIC_DEVICE_H

//************************************************************************************************************
// Copyright (c) 2005 Redway3D. All rights reserved. Redway3D is a registered trademark. Any reproduction and /
// or utilization of any material from this document without Redway3D?s express authorization are prohibited.
//************************************************************************************************************

#include "REDIObject.h"
#include "REDSTL.h"

namespace RED
{
  class String;
};


//******************************************************************************
//*** RED::IGraphicDevice runtime platform identifiers helpers *****************
//******************************************************************************

#define REDIsNVIDIA( platformid )\
\
  ( platformid & ( RED::HW_NVIDIA_GENERIC |\
                   RED::HW_NVIDIA_NV30    |\
                   RED::HW_NVIDIA_NV40    |\
                   RED::HW_NVIDIA_G80     |\
                   RED::HW_NVIDIA_G200    |\
                   RED::HW_NVIDIA_G400 ) )


#define REDIsATI( platformid )\
\
  ( platformid & ( RED::HW_ATI_GENERIC |\
                   RED::HW_ATI_R300    |\
                   RED::HW_ATI_R400    |\
                   RED::HW_ATI_R500    |\
                   RED::HW_ATI_R600    |\
                   RED::HW_ATI_R700    |\
                   RED::HW_ATI_R800 ) )


#define REDIsINTEL( platformid )\
\
  ( platformid & ( RED::HW_INTEL_GENERIC  |\
                   RED::HW_INTEL_GMA_3000 |\
                   RED::HW_INTEL_GMA_4000 |\
                   RED::HW_INTEL_GMA_GEN7 ) )


#define REDIsUSER( platformid )\
\
  ( platformid & ( RED::HW_USER_GENERIC |\
                   RED::HW_USER_01      |\
                   RED::HW_USER_02      |\
                   RED::HW_USER_03 ) )


#define REDIsSOFTWARE( platformid )\
\
  ( platformid & ( RED::HW_SOFT_TRACER ) )


#define REDIsVIRTUAL( platformid )\
\
  ( platformid & ( RED::HW_VIRTUAL_GENERIC |\
                   RED::HW_VIRTUAL_01      |\
                   RED::HW_VIRTUAL_02      |\
                   RED::HW_VIRTUAL_03 ) )


#define RED_HW_UNSUPPORTED_CONFIGURATION                "Unsupported hardware configuration"
#define RED_HW_USE_OEM_VERSION                          "Use OEM recommended driver"
#define RED_HW_VIRTUAL_SOFTWARE_DRIVER                  "Virtual software driver"
#define RED_HW_UNKNOWN_NVIDIA_GRAPHICS_ADAPTER          "Unknown NVIDIA graphics adapter"
#define RED_HW_UNKNOWN_INTEL_GRAPHICS_ADAPTER           "Unknown INTEL graphics adapter"
#define RED_HW_UNKNOWN_ATI_GRAPHICS_ADAPTER             "Unknown ATI graphics adapter"
#define RED_HW_UNKNOWN_GRAPHICS_ADAPTER                 "Unknown graphics adapter"
#define RED_HW_OS_PROPRIETARY_DRIVER                    "Operating system proprietary graphic driver"


#define RED_NVIDIA_VENDORID                0x10DE
#define RED_ATI_VENDORID                   0x1002
#define RED_INTEL_VENDORID                 0x8086
#define RED_VMWARE_VENDORID                0x15AD
#define RED_VIRTUALBOX_VENDORID            0x80EE
#define RED_REMOTE_DESKTOP_VENDORID        0xBAAD
#define RED_PARALLELS_DESKTOP_VENDORID     0x1AB8


#define RED_NVIDIA_VENDORID_STRING                "0x10DE"
#define RED_ATI_VENDORID_STRING                   "0x1002"
#define RED_INTEL_VENDORID_STRING                 "0x8086"
#define RED_VMWARE_VENDORID_STRING                "0x15AD"
#define RED_VIRTUALBOX_VENDORID_STRING            "0x80EE"
#define RED_REMOTE_DESKTOP_VENDORID_STRING        "0xBAAD"
#define RED_PARALLELS_DESKTOP_VENDORID_STRING     "0x1AB8"


//******************************************************************************
//*** RED::IGraphicDevice interface ********************************************
//******************************************************************************

namespace RED
{
  // IGraphicDevice types - Hardware platform identifiers:
  // -----------------------------------------------------
  
  enum HARDWARE_PLATFORM { HW_GENERIC         = 0x00000000,
                           
                           HW_NVIDIA_GENERIC  = 0x00000001,
                           HW_NVIDIA_NV30     = 0x00000002,
                           HW_NVIDIA_NV40     = 0x00000004,
                           HW_NVIDIA_G80      = 0x00000008,
                           HW_NVIDIA_G200     = 0x00000010,
                           HW_NVIDIA_G400     = 0x00000020,
                           
                           HW_ATI_GENERIC     = 0x00000100,
                           HW_ATI_R300        = 0x00000200,
                           HW_ATI_R400        = 0x00000400,
                           HW_ATI_R500        = 0x00000800,
                           HW_ATI_R600        = 0x00001000,
                           HW_ATI_R700        = 0x00002000,
                           HW_ATI_R800        = 0x00004000,
                           
                           HW_INTEL_GENERIC   = 0x00010000,
                           HW_INTEL_GMA_3000  = 0x00020000,
                           HW_INTEL_GMA_4000  = 0x00040000,
                           HW_INTEL_GMA_GEN7  = 0x00080000,
                           
                           HW_SOFT_TRACER     = 0x00100000,
                           
                           HW_USER_GENERIC    = 0x01000000,
                           HW_USER_01         = 0x02000000,
                           HW_USER_02         = 0x04000000,
                           HW_USER_03         = 0x08000000,
                           
                           HW_VIRTUAL_GENERIC = 0x10000000,
                           HW_VIRTUAL_01      = 0x20000000,
                           HW_VIRTUAL_02      = 0x40000000,
                           HW_VIRTUAL_03      = 0x80000000 };
  
  
  // IGraphicDevice types - List of operating systems:
  // -------------------------------------------------
  
  enum OPERATING_SYSTEM { OS_NOT_SUPPORTED = 0,
                          OS_WIN_2000      = 1,
                          OS_WIN_XP_32     = 2,
                          OS_WIN_XP_64     = 3,
                          OS_WIN_VISTA_32  = 4,
                          OS_WIN_VISTA_64  = 5,
                          OS_WIN_SEVEN_32  = 6,
                          OS_WIN_SEVEN_64  = 7,
                          OS_WIN_EIGHT_32  = 8,
                          OS_WIN_EIGHT_64  = 9,
                          OS_WIN_TEN_32    = 10,
                          OS_WIN_TEN_64    = 11,
                          OS_LIN_32        = 12,
                          OS_LIN_64        = 13,
                          OS_MAC_OSX_64    = 14 };
  
  
  // IGraphicDevice types - Driver certification level:
  // --------------------------------------------------
  
  enum DRIVER_VALIDATION { DR_OK                     = 0,
                           DR_OK_NEWER               = 1,
                           DR_NOT_CERTIFIED          = 2,
                           DR_KNOWN_ERRORS           = 3,
                           DR_NO_DRIVER_INSTALLED    = 4,
                           DR_OK_SOFTWARE_RENDERING  = 5 };
  
  
  // IGraphicDevice types - Graphic card information structure:
  // ----------------------------------------------------------
  
  typedef struct
  {
    int _vendorID;
    
    int _asicID;
    
    char _name[128];
    
    char _chipset[16];
    
    RED::HARDWARE_PLATFORM _redclass;
    
    char _driver_win_2000[64];
    
    char _driver_win_xp_32[64];
    
    char _driver_win_xp_64[64];
    
    char _driver_win_vista_32[64];
    
    char _driver_win_vista_64[64];
    
    char _driver_win_seven_32[64];
    
    char _driver_win_seven_64[64];
    
    char _driver_win_eight_32[64];
    
    char _driver_win_eight_64[64];
    
    char _driver_win_ten_32[64];
    
    char _driver_win_ten_64[64];
    
    char _driver_lin_32[64];
    
    char _driver_lin_64[64];
    
  } GPUID;
  
  
  // IGraphicDevice interface:
  // -------------------------
  
  class REDFullExp IGraphicDevice : public IREDObject
  {
    public:
    
    // Typing information:
    // -------------------
    
    SET_CID( CID_class_REDIGraphicDevice );
    
    
    // Access the operating system:
    // ----------------------------
    
    virtual RED_RC GetOperatingSystem( RED::OPERATING_SYSTEM& oOS ) const = 0;
    
    
    // Accessing all supported graphic cards:
    // --------------------------------------
    
    virtual RED_RC GetSupportedGPUs( RED::Vector< RED::GPUID >& oGPUList ) const = 0;
    
    
    // Look for all available graphic cards on the local computer:
    // -----------------------------------------------------------
    
    virtual RED_RC GetLocalGPUs( RED::Vector< RED::GPUID >& oGPUList,
                                 bool                       iPrimaryOnly = false ) const = 0;
    
    
    // Look for the installed driver for a graphic card on the local computer:
    // -----------------------------------------------------------------------
    
    virtual RED_RC GetLocalGPUDriver( RED::String&      oDriver,
                                      RED::String&      oDLLVersion,
                                      bool&             oNewer,
                                      bool&             oOlder,
                                      const RED::GPUID& iGPU ) const = 0;
    
    
    virtual RED_RC CheckLocalGPUDriver( bool&                   oUpdate,
                                        RED::DRIVER_VALIDATION& oCertification,
                                        const RED::GPUID&       iGPU ) const = 0;
    
    
    // Screen saver control API:
    // -------------------------
    
    virtual RED_RC GetScreenSaver( bool& oOnOff ) const = 0;
    
    
    virtual RED_RC SetScreenSaver( bool iOnOff ) const = 0;
    
    
    // Miscellaneous:
    // --------------
    
    virtual RED_RC IsNVIDIAAntiAliasingModeOverride( bool& oOverride ) const = 0;
    
    
    virtual RED_RC ResetNVIDIAAntiAliasingMode() const = 0;
  };
};


#endif