本文整理汇总了C++中D3DPipelineManager::GetD3DObject方法的典型用法代码示例。如果您正苦于以下问题:C++ D3DPipelineManager::GetD3DObject方法的具体用法?C++ D3DPipelineManager::GetD3DObject怎么用?C++ D3DPipelineManager::GetD3DObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类D3DPipelineManager
的用法示例。
在下文中一共展示了D3DPipelineManager::GetD3DObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
/*
* Class: sun_java2d_d3d_D3DGraphicsDevice
* Method: getCurrentDisplayModeNative
* Signature: (I)Ljava/awt/DisplayMode;
*/
JNIEXPORT jobject JNICALL
Java_sun_java2d_d3d_D3DGraphicsDevice_getCurrentDisplayModeNative
(JNIEnv *env, jclass gdc, jint gdiScreen)
{
D3DPipelineManager *pMgr;
IDirect3D9 *pd3d9;
jobject ret = NULL;
D3DDISPLAYMODE mode;
UINT adapter;
J2dTraceLn(J2D_TRACE_INFO, "D3DGD_getCurrentDisplayModeNative");
RETURN_STATUS_IF_NULL(pMgr = D3DPipelineManager::GetInstance(), NULL);
RETURN_STATUS_IF_NULL(pd3d9 = pMgr->GetD3DObject(), NULL);
adapter = pMgr->GetAdapterOrdinalForScreen(gdiScreen);
if (SUCCEEDED(pd3d9->GetAdapterDisplayMode(adapter, &mode))) {
int bitDepth = -1;
// these are the only three valid screen formats
switch (mode.Format) {
case D3DFMT_X8R8G8B8: bitDepth = 32; break;
case D3DFMT_R5G6B5:
case D3DFMT_X1R5G5B5: bitDepth = 16; break;
}
J2dTraceLn4(J2D_TRACE_VERBOSE,
" current dm: %dx%dx%[email protected]%d",
mode.Width, mode.Height, bitDepth, mode.RefreshRate);
ret = CreateDisplayMode(env, mode.Width, mode.Height, bitDepth,
mode.RefreshRate);
}
return ret;
}
示例2: HIWORD
/*
* Class: sun_java2d_d3d_D3DGraphicsDevice
* Method: getDeviceIdNative
* Signature: (I)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_java2d_d3d_D3DGraphicsDevice_getDeviceIdNative
(JNIEnv *env, jclass d3dsdc, jint gdiScreen)
{
D3DPipelineManager *pMgr;
UINT adapter;
D3DADAPTER_IDENTIFIER9 aid;
IDirect3D9 *pd3d9;
J2dTraceLn(J2D_TRACE_INFO, "D3DGD_getDeviceIdNative");
pMgr = D3DPipelineManager::GetInstance();
RETURN_STATUS_IF_NULL(pMgr, NULL);
pd3d9 = pMgr->GetD3DObject();
RETURN_STATUS_IF_NULL(pd3d9, NULL);
adapter = pMgr->GetAdapterOrdinalForScreen(gdiScreen);
if (FAILED(pd3d9->GetAdapterIdentifier(adapter, 0, &aid))) {
return NULL;
}
// ('%d.' will take no more than 6+1 chars since we are printing a WORD)
// AAAA&BBBB MAX_DEVICE_IDENTIFIER_STRING (%d.%d.%d.%d)0
size_t len = (4+1+4 +1+MAX_DEVICE_IDENTIFIER_STRING+1 +1+(6+1)*4+1 +1);
WCHAR *pAdapterId = new WCHAR[len];
RETURN_STATUS_IF_NULL(pAdapterId, NULL);
_snwprintf(pAdapterId, len, L"%x&%x %S (%d.%d.%d.%d)",
0xffff & aid.VendorId, 0xffff & aid.DeviceId, aid.Description,
HIWORD(aid.DriverVersion.HighPart),
LOWORD(aid.DriverVersion.HighPart),
HIWORD(aid.DriverVersion.LowPart),
LOWORD(aid.DriverVersion.LowPart));
// _snwprintf doesn't add 0 at the end if the formatted string didn't fit
// in the buffer so we have to make sure it is null terminated
pAdapterId[len-1] = (WCHAR)0;
J2dTraceLn1(J2D_TRACE_VERBOSE, " id=%S", pAdapterId);
jstring ret = JNU_NewStringPlatform(env, pAdapterId);
delete pAdapterId;
return ret;
}
示例3: if
/*
* Class: sun_java2d_d3d_D3DGraphicsDevice
* Method: configDisplayModeNative
* Signature: (IJIIII)V
*/
JNIEXPORT void JNICALL
Java_sun_java2d_d3d_D3DGraphicsDevice_configDisplayModeNative
(JNIEnv *env, jclass gdc, jint gdiScreen, jlong window,
jint width, jint height, jint bitDepth, jint refreshRate)
{
HRESULT res;
D3DPipelineManager *pMgr;
D3DContext *pCtx;
D3DPRESENT_PARAMETERS newParams, *pCurParams;
UINT adapter;
J2dTraceLn(J2D_TRACE_INFO, "D3DGD_configDisplayModeNative");
RETURN_IF_NULL(pMgr = D3DPipelineManager::GetInstance());
adapter = pMgr->GetAdapterOrdinalForScreen(gdiScreen);
if (FAILED(res = pMgr->GetD3DContext(adapter, &pCtx))) {
D3DRQ_MarkLostIfNeeded(res, D3DRQ_GetCurrentDestination());
return;
}
pCurParams = pCtx->GetPresentationParams();
newParams = *pCurParams;
newParams.BackBufferWidth = width;
newParams.BackBufferHeight = height;
newParams.FullScreen_RefreshRateInHz = refreshRate;
newParams.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
// we leave the swap effect so that it's more likely
// to be the one user selected initially
// newParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
if (bitDepth == 32) {
newParams.BackBufferFormat = D3DFMT_X8R8G8B8;
} else if (bitDepth == 16) {
UINT modeNum;
D3DDISPLAYMODE mode;
IDirect3D9 *pd3d9;
UINT modesCount;
RETURN_IF_NULL(pd3d9 = pMgr->GetD3DObject());
modesCount = pd3d9->GetAdapterModeCount(adapter, D3DFMT_R5G6B5);
if (modesCount == 0) {
modesCount = pd3d9->GetAdapterModeCount(adapter, D3DFMT_X1R5G5B5);
}
newParams.BackBufferFormat = D3DFMT_UNKNOWN;
for (modeNum = 0; modeNum < modesCount; modeNum++) {
if (SUCCEEDED(pd3d9->EnumAdapterModes(adapter, D3DFMT_R5G6B5,
modeNum, &mode)))
{
if (mode.Width == width && mode.Height == height &&
mode.RefreshRate == refreshRate)
{
// prefer 565 over 555
if (mode.Format == D3DFMT_R5G6B5) {
newParams.BackBufferFormat = D3DFMT_R5G6B5;
break;
} else if (mode.Format == D3DFMT_X1R5G5B5) {
newParams.BackBufferFormat = D3DFMT_X1R5G5B5;
}
}
}
}
if (newParams.BackBufferFormat == D3DFMT_UNKNOWN) {
J2dRlsTraceLn(J2D_TRACE_ERROR,
"D3DGD_configDisplayModeNative: no 16-bit formats");
return;
}
} else {
J2dRlsTraceLn1(J2D_TRACE_ERROR,
"D3DGD_configDisplayModeNative: unsupported depth: %d",
bitDepth);
return;
}
J2dTraceLn4(J2D_TRACE_VERBOSE, " changing to dm: %dx%dx%[email protected]%d",
newParams.BackBufferWidth, newParams.BackBufferHeight,
bitDepth, refreshRate);
J2dTraceLn1(J2D_TRACE_VERBOSE, " selected backbuffer format: %d",
newParams.BackBufferFormat);
res = pCtx->ConfigureContext(&newParams);
if (SUCCEEDED(res)) {
// the full screen window doesn't receive WM_SIZE event when
// the display mode changes (it does get resized though) so we need to
// generate the event ourselves
::SendMessage(newParams.hDeviceWindow, WM_SIZE, width, height);
}
D3DRQ_MarkLostIfNeeded(res, D3DRQ_GetCurrentDestination());
}