jdk/src/windows/native/sun/java2d/d3d/D3DPipelineManager.h
author ohair
Tue, 28 Dec 2010 15:53:50 -0800
changeset 7668 d4a77089c587
parent 7491 ba3dc59cd2fd
permissions -rw-r--r--
6962318: Update copyright year Reviewed-by: xdono
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
     1
/*
7668
d4a77089c587 6962318: Update copyright year
ohair
parents: 7491
diff changeset
     2
 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
     4
 *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 887
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 887
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    10
 *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    15
 * accompanied this code).
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    16
 *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 887
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 887
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 887
diff changeset
    23
 * questions.
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    24
 */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    25
#pragma once
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    26
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    27
#include "D3DPipeline.h"
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    28
#include "D3DContext.h"
7004
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
    29
#include "awt_Toolkit.h"
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    30
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    31
typedef class D3DPipelineManager *LPD3DPIPELINEMANAGER;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    32
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    33
typedef struct D3DAdapter
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    34
{
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    35
    D3DContext *pd3dContext;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    36
    DWORD state;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    37
    HWND fsFocusWindow;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    38
} D3DAdapter;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    39
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    40
class D3DPIPELINE_API D3DPipelineManager
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    41
{
7004
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
    42
    friend class D3DInitializer;
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
    43
private:
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    44
    // creates and initializes instance of D3DPipelineManager, may return NULL
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    45
    static D3DPipelineManager* CreateInstance(void);
7004
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
    46
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    47
    // deletes the single instance of the manager
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    48
    static void DeleteInstance();
7004
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
    49
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
    50
public:
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    51
    // returns the single instance of the manager, may return NULL
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    52
    static D3DPipelineManager* GetInstance(void);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    53
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    54
    HRESULT GetD3DContext(UINT adapterOrdinal, D3DContext **ppd3dContext);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    55
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    56
    HRESULT HandleLostDevices();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    57
    // Checks if adapters were added or removed, or if the order had changed
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    58
    // (which may happen with primary display is changed). If that's the case
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    59
    // releases current adapters and d3d9 instance, reinitializes the pipeline.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    60
    // @param *monHds list of monitor handles retrieved from GDI
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    61
    // @param monNum number of gdi monitors
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    62
    static
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    63
    HRESULT HandleAdaptersChange(HMONITOR *monHds, UINT monNum);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    64
    // returns depth stencil buffer format matching adapterFormat and render target
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    65
    // format for the device specified by adapterOrdinal/devType
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    66
    D3DFORMAT GetMatchingDepthStencilFormat(UINT adapterOrdinal,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    67
                                            D3DFORMAT adapterFormat,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    68
                                            D3DFORMAT renderTargetFormat);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    69
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    70
    HWND GetCurrentFocusWindow();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    71
    // returns previous fs window
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    72
    HWND SetFSFocusWindow(UINT, HWND);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    73
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    74
    LPDIRECT3D9 GetD3DObject() { return pd3d9; }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    75
    D3DDEVTYPE GetDeviceType() { return devType; }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    76
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    77
    // returns the d3d adapter ordinal given GDI screen number:
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    78
    // these may differ depending on which display is primary
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    79
    UINT GetAdapterOrdinalForScreen(jint gdiScreen);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    80
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    81
    // notifies adapter event listeners by calling
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    82
    // AccelDeviceEventNotifier.eventOccured()
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    83
    static
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    84
    void NotifyAdapterEventListeners(UINT adapter, jint eventType);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    85
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    86
private:
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    87
    D3DPipelineManager(void);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    88
   ~D3DPipelineManager(void);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    89
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    90
    // Creates a Direct3D9 object and initializes adapters.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    91
    HRESULT InitD3D(void);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    92
    // Releases adapters, Direct3D9 object and the d3d9 library.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    93
    HRESULT ReleaseD3D();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    94
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    95
    // selects the device type based on user input and available
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    96
    // device types
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    97
    D3DDEVTYPE SelectDeviceType();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    98
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    99
    // creates array of adapters (releases the old one first)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   100
    HRESULT InitAdapters();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   101
    // releases each adapter's context, and then releases the array
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   102
    HRESULT ReleaseAdapters();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   103
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   104
    HWND    CreateDefaultFocusWindow();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   105
    // returns S_OK if the adapter is capable of running the Direct3D
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   106
    // pipeline
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   107
    HRESULT D3DEnabledOnAdapter(UINT Adapter);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   108
    // returns adapterOrdinal given a HMONITOR handle
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   109
    UINT    GetAdapterOrdinalByHmon(HMONITOR hMon);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   110
    HRESULT CheckAdaptersInfo();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   111
    HRESULT CheckDeviceCaps(UINT Adapter);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   112
    // Check the OS, succeeds if the OS is XP or newer client-class OS
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   113
static HRESULT CheckOSVersion();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   114
    // used to check attached adapters using GDI against known bad hw database
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   115
    // prior to the instantiation of the pipeline manager
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   116
static HRESULT GDICheckForBadHardware();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   117
    // given VendorId, DeviceId and driver version, checks against a database
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   118
    // of known bad hardware/driver combinations.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   119
    // If the driver version is not known MAX_VERSION can be used
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   120
    // which is guaranteed to satisfy the check
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   121
static HRESULT CheckForBadHardware(DWORD vId, DWORD dId, LONGLONG version);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   122
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   123
private:
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   124
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   125
    // current adapter count
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   126
    UINT adapterCount;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   127
    // Pointer to Direct3D9 Object mainained by the pipeline manager
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   128
    LPDIRECT3D9 pd3d9;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   129
    // d3d9.dll lib
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   130
    HINSTANCE hLibD3D9;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   131
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   132
    int currentFSFocusAdapter;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   133
    HWND defaultFocusWindow;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   134
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   135
    D3DDEVTYPE devType;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   136
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   137
    D3DAdapter *pAdapters;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   138
    // instance of this object
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   139
    static LPD3DPIPELINEMANAGER pMgr;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   140
};
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   141
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   142
#define OS_UNDEFINED    (0 << 0)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   143
#define OS_VISTA        (1 << 0)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   144
#define OS_WINSERV_2008 (1 << 1)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   145
#define OS_WINXP        (1 << 2)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   146
#define OS_WINXP_64     (1 << 3)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   147
#define OS_WINSERV_2003 (1 << 4)
7491
ba3dc59cd2fd 7005896: Java2D D3D pipeline doesn't recognise latest Windows OSes
prr
parents: 7004
diff changeset
   148
#define OS_WINDOWS7     (1 << 5)
ba3dc59cd2fd 7005896: Java2D D3D pipeline doesn't recognise latest Windows OSes
prr
parents: 7004
diff changeset
   149
#define OS_WINSERV_2008R2 (1 << 6)
ba3dc59cd2fd 7005896: Java2D D3D pipeline doesn't recognise latest Windows OSes
prr
parents: 7004
diff changeset
   150
#define OS_ALL (OS_VISTA|OS_WINSERV_2008|OS_WINXP|OS_WINXP_64|OS_WINSERV_2003|\
ba3dc59cd2fd 7005896: Java2D D3D pipeline doesn't recognise latest Windows OSes
prr
parents: 7004
diff changeset
   151
                OS_WINDOWS7|OS_WINSERV_2008R2)
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   152
#define OS_UNKNOWN      (~OS_ALL)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   153
BOOL D3DPPLM_OsVersionMatches(USHORT osInfo);
7004
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   154
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   155
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   156
class D3DInitializer : public AwtToolkit::PreloadAction {
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   157
private:
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   158
    D3DInitializer();
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   159
    ~D3DInitializer();
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   160
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   161
protected:
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   162
    // PreloadAction overrides
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   163
    virtual void InitImpl();
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   164
    virtual void CleanImpl(bool reInit);
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   165
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   166
public:
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   167
    static D3DInitializer& GetInstance() { return theInstance; }
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   168
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   169
private:
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   170
    // single instance
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   171
    static D3DInitializer theInstance;
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   172
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   173
    // adapter initializer class
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   174
    class D3DAdapterInitializer : public AwtToolkit::PreloadAction {
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   175
    public:
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   176
        void setAdapter(UINT adapter) { this->adapter = adapter; }
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   177
    protected:
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   178
        // PreloadAction overrides
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   179
        virtual void InitImpl();
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   180
        virtual void CleanImpl(bool reInit);
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   181
    private:
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   182
        UINT adapter;
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   183
    };
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   184
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   185
    // the flag indicates success of COM initialization
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   186
    bool bComInitialized;
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   187
    D3DAdapterInitializer *pAdapterIniters;
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   188
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   189
};
3f92ea1ffcac 6867515: Reduce impact of D3D initializion on startup time
amenkov
parents: 5506
diff changeset
   190