本文整理汇总了C++中D3DPS_VERSION函数的典型用法代码示例。如果您正苦于以下问题:C++ D3DPS_VERSION函数的具体用法?C++ D3DPS_VERSION怎么用?C++ D3DPS_VERSION使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了D3DPS_VERSION函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fixup_caps
void fixup_caps(WINED3DCAPS *caps)
{
/* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */
if (caps->PixelShaderVersion)
caps->PixelShaderVersion = D3DPS_VERSION(1,4);
else
caps->PixelShaderVersion = D3DPS_VERSION(0,0);
if (caps->VertexShaderVersion)
caps->VertexShaderVersion = D3DVS_VERSION(1,1);
else
caps->VertexShaderVersion = D3DVS_VERSION(0,0);
caps->MaxVertexShaderConst = min(D3D8_MAX_VERTEX_SHADER_CONSTANTF, caps->MaxVertexShaderConst);
caps->StencilCaps &= ~WINED3DSTENCILCAPS_TWOSIDED;
}
示例2: test_get_shader_version
static void test_get_shader_version(void)
{
DWORD shader_version;
shader_version = D3DXGetShaderVersion(simple_vs);
ok(shader_version == D3DVS_VERSION(1, 1), "Got shader version 0x%08x, expected 0x%08x\n",
shader_version, D3DVS_VERSION(1, 1));
shader_version = D3DXGetShaderVersion(simple_ps);
ok(shader_version == D3DPS_VERSION(1, 1), "Got shader version 0x%08x, expected 0x%08x\n",
shader_version, D3DPS_VERSION(1, 1));
shader_version = D3DXGetShaderVersion(NULL);
ok(shader_version == 0, "Got shader version 0x%08x, expected 0\n", shader_version);
}
示例3: Clear
//=============================================================================================================
void Game::Reset(const std::string& stagefile)
{
Clear();
UnapplyPowerup();
savedvars.health = avatar.Health;
savedvars.maxhealth = avatar.MaxHealth;
savedvars.integrity = avatar.Integrity;
savedvars.maxintegrity = avatar.MaxIntegrity;
savedvars.score = hud.Score;
avatar.InitialPosition = D3DXVECTOR2(0, (GameVariables::ScreenHeight - avatar.Image->Size.y) * 0.5f);
avatar.Bounds = D3DXVECTOR4(0, hud.Panel->Size.y, GameVariables::ScreenWidth, GameVariables::ScreenHeight - hud.Panel->Size.y);
if( !distort && rendertarget && rendersurface && GameVariables::EnableShaders )
{
if( game->DeviceCaps.VertexShaderVersion >= D3DVS_VERSION(2, 0) &&
game->DeviceCaps.PixelShaderVersion >= D3DPS_VERSION(2, 0) )
{
distort = game->Content.LoadMaterial("distort.fx");
GameVariables::EnableShaders = (distort != NULL);
}
}
if( !script.Compile(stagefile, *this) )
game->Application.Close();
RestartLevel();
}
示例4: UNREFERENCED_PARAMETER
//-------------------------------------------------------------
// Name: ConfirmDevice()
// Desc: �ʱ�ȭ�� ȣ���. �ʿ��� �ɷ�(caps)üũ
//-------------------------------------------------------------
HRESULT CMyD3DApplication::ConfirmDevice( D3DCAPS9* pCaps,
DWORD dwBehavior, D3DFORMAT Format )
{
UNREFERENCED_PARAMETER( Format );
BOOL bCapsAcceptable;
// ���Ⱥ��尡 ���α��� ������ �ɷ��� �ִ°� Ȯ��
bCapsAcceptable = TRUE;
// �� �ȼ����̴� ����Ȯ��
if( pCaps->PixelShaderVersion < D3DPS_VERSION(1,1) )
bCapsAcceptable = FALSE;
// �������̴� ����Ȯ��
if( (dwBehavior & D3DCREATE_HARDWARE_VERTEXPROCESSING ) ||
(dwBehavior & D3DCREATE_MIXED_VERTEXPROCESSING ) )
{
if( pCaps->VertexShaderVersion < D3DVS_VERSION(1,1) )
bCapsAcceptable = FALSE;
}
if( bCapsAcceptable )
return S_OK;
else
return E_FAIL;
}
示例5:
void D3D9VideoInfo::SetupShaderProfile()
{
if (m_caps.VertexShaderVersion >= D3DVS_VERSION(1,1))
m_lastVertexProfile = Shader::SP_MODEL_1;
if (m_caps.VertexShaderVersion >= D3DVS_VERSION(2,0))
m_lastVertexProfile = Shader::SP_MODEL_2;
if (m_caps.VertexShaderVersion >= D3DVS_VERSION(3,0))
m_lastVertexProfile = Shader::SP_MODEL_3;
if (m_caps.PixelShaderVersion >= D3DPS_VERSION(1,0))
m_lastPixelProfile = Shader::SP_MODEL_1;
if (m_caps.PixelShaderVersion >= D3DPS_VERSION(2,0))
m_lastPixelProfile = Shader::SP_MODEL_2;
if (m_caps.PixelShaderVersion >= D3DPS_VERSION(3,0))
m_lastPixelProfile = Shader::SP_MODEL_3;
}
示例6: IsD3D9DeviceAcceptable
//--------------------------------------------------------------------------------------
// Rejects any D3D9 devices that aren't acceptable to the app by returning false
//--------------------------------------------------------------------------------------
bool CALLBACK IsD3D9DeviceAcceptable( D3DCAPS9* pCaps, D3DFORMAT AdapterFormat,
D3DFORMAT BackBufferFormat, bool bWindowed, void* pUserContext )
{
// No fallback defined by this app, so reject any device that
// doesn't support at least ps2.0
if( pCaps->PixelShaderVersion < D3DPS_VERSION( 2, 0 ) )
return false;
return true;
}
示例7: init
bool init() {
term();
RECT rd;
GetClientRect(settings.handle, &rd);
state.width = rd.right;
state.height = rd.bottom;
lpd3d = Direct3DCreate9(D3D_SDK_VERSION);
if(!lpd3d) return false;
memset(&presentation, 0, sizeof(presentation));
presentation.Flags = D3DPRESENTFLAG_VIDEO;
presentation.SwapEffect = D3DSWAPEFFECT_FLIP;
presentation.hDeviceWindow = settings.handle;
presentation.BackBufferCount = 1;
presentation.MultiSampleType = D3DMULTISAMPLE_NONE;
presentation.MultiSampleQuality = 0;
presentation.EnableAutoDepthStencil = false;
presentation.AutoDepthStencilFormat = D3DFMT_UNKNOWN;
presentation.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
presentation.Windowed = true;
presentation.BackBufferFormat = D3DFMT_UNKNOWN;
presentation.BackBufferWidth = 0;
presentation.BackBufferHeight = 0;
if(lpd3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, settings.handle,
D3DCREATE_FPU_PRESERVE | D3DCREATE_SOFTWARE_VERTEXPROCESSING, &presentation, &device) != D3D_OK) {
return false;
}
device->GetDeviceCaps(&d3dcaps);
caps.dynamic = bool(d3dcaps.Caps2 & D3DCAPS2_DYNAMICTEXTURES);
caps.shader = d3dcaps.PixelShaderVersion > D3DPS_VERSION(1, 4);
if(caps.dynamic == true) {
flags.t_usage = D3DUSAGE_DYNAMIC;
flags.v_usage = D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC;
flags.t_pool = D3DPOOL_DEFAULT;
flags.v_pool = D3DPOOL_DEFAULT;
flags.lock = D3DLOCK_NOSYSLOCK | D3DLOCK_DISCARD;
} else {
flags.t_usage = 0;
flags.v_usage = D3DUSAGE_WRITEONLY;
flags.t_pool = D3DPOOL_MANAGED;
flags.v_pool = D3DPOOL_MANAGED;
flags.lock = D3DLOCK_NOSYSLOCK | D3DLOCK_DISCARD;
}
lost = false;
recover();
return true;
}
示例8: switch
int D3D9DeviceCaps::PixelShaderVersion()
{
switch (mCaps.PixelShaderVersion)
{
case D3DPS_VERSION(3, 0):
return (int)SP_PS;
default:
return 0;
}
}
示例9: HR
bool StencilMirrorDemo::checkDeviceCaps()
{
D3DCAPS9 caps;
HR(gd3dDevice->GetDeviceCaps(&caps));
if (caps.VertexShaderVersion < D3DVS_VERSION(2,0))
return false;
if (caps.PixelShaderVersion < D3DPS_VERSION(2,0))
return false;
return true;
}
示例10: getVertexTextureSupport
// Only Direct3D 10 ready devices support all the necessary vertex texture formats.
// We test this using D3D9 by checking support for the R16F format.
bool Display::getVertexTextureSupport() const
{
if (!isInitialized() || mDeviceCaps.PixelShaderVersion < D3DPS_VERSION(3, 0))
{
return false;
}
D3DDISPLAYMODE currentDisplayMode;
mD3d9->GetAdapterDisplayMode(mAdapter, ¤tDisplayMode);
HRESULT result = mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_R16F);
return SUCCEEDED(result);
}
示例11: HR
bool MultiTexDemo::checkDeviceCaps()
{
D3DCAPS9 caps;
HR(gd3dDevice->GetDeviceCaps(&caps));
// Check for vertex shader version 2.0 support.
if( caps.VertexShaderVersion < D3DVS_VERSION(2, 0) )
return false;
// Check for pixel shader version 2.0 support.
if( caps.PixelShaderVersion < D3DPS_VERSION(2, 0) )
return false;
return true;
}
示例12: switch
void CWinRenderer::SelectRenderMethod()
{
if (CONF_FLAGS_FORMAT_MASK(m_flags) == CONF_FLAGS_FORMAT_DXVA)
{
m_renderMethod = RENDER_DXVA;
}
else
{
int requestedMethod = g_guiSettings.GetInt("videoplayer.rendermethod");
CLog::Log(LOGDEBUG, __FUNCTION__": Requested render method: %d", requestedMethod);
switch(requestedMethod)
{
case RENDER_METHOD_AUTO:
case RENDER_METHOD_D3D_PS:
// Try the pixel shaders support
if (m_deviceCaps.PixelShaderVersion >= D3DPS_VERSION(2, 0))
{
CTestShader* shader = new CTestShader;
if (shader->Create())
{
m_renderMethod = RENDER_PS;
shader->Release();
break;
}
else
{
CLog::Log(LOGNOTICE, "D3D: unable to load test shader - D3D installation is most likely incomplete");
g_application.m_guiDialogKaiToast.QueueNotification(CGUIDialogKaiToast::Warning, "DirectX", g_localizeStrings.Get(2101));
shader->Release();
}
}
else
{
CLog::Log(LOGNOTICE, "D3D: graphics adapter does not support Pixel Shaders 2.0");
}
CLog::Log(LOGNOTICE, "D3D: falling back to SW mode");
// drop through to software
case RENDER_METHOD_SOFTWARE:
default:
// So we'll do the color conversion in software.
m_renderMethod = RENDER_SW;
break;
}
}
RenderMethodDetail *rmdet = FindRenderMethod(m_renderMethod);
CLog::Log(LOGDEBUG, __FUNCTION__": Selected render method %d: %s", m_renderMethod, rmdet != NULL ? rmdet->name : "unknown");
}
示例13: InitD3D
/**-----------------------------------------------------------------------------
* Direct3D 초기화
*------------------------------------------------------------------------------
*/
HRESULT InitD3D( HWND hWnd )
{
// 디바이스를 생성하기위한 D3D객체 생성
if( NULL == ( g_pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) )
return E_FAIL;
// 디바이스를 생성할 구조체
// 복잡한 오브젝트를 그릴것이기때문에, 이번에는 Z버퍼가 필요하다.
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
D3DCAPS9 caps;
DWORD dwPSProcess;
// 디바이스의 능력값(caps)을 읽어온다
g_pD3D->GetDeviceCaps( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps );
// 지원하는 픽셀쉐이더 버전이 1.0이하라면 REF드라이버를, 1.0이상이면 HW드라이버를 생성한다.
dwPSProcess = ( caps.PixelShaderVersion < D3DPS_VERSION(1,0) ) ? 0 : 1;
if( dwPSProcess )
{
if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd,
D3DCREATE_HARDWARE_VERTEXPROCESSING,
&d3dpp, &g_pd3dDevice ) ) )
return E_FAIL;
}
else
{
if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp, &g_pd3dDevice ) ) )
return E_FAIL;
}
// 기본컬링, CCW
g_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
// Z버퍼기능을 켠다.
g_pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE );
return S_OK;
}
示例14: IsDeviceAcceptable
//--------------------------------------------------------------------------------------
// Rejects any D3D9 devices that aren't acceptable to the app by returning false
//--------------------------------------------------------------------------------------
bool CALLBACK IsDeviceAcceptable( D3DCAPS9* pCaps, D3DFORMAT AdapterFormat,
D3DFORMAT BackBufferFormat, bool bWindowed, void* pUserContext )
{
// No fallback, so need ps2.0
if( pCaps->PixelShaderVersion < D3DPS_VERSION( 2, 0 ) )
return false;
// Skip backbuffer formats that don't support alpha blending
IDirect3D9* pD3D = DXUTGetD3D9Object();
if( FAILED( pD3D->CheckDeviceFormat( pCaps->AdapterOrdinal, pCaps->DeviceType,
AdapterFormat, D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING,
D3DRTYPE_TEXTURE, BackBufferFormat ) ) )
return false;
return true;
}
示例15: IsD3D9DeviceAcceptable
/*==============================================================
* 设备能力检查。如果任何一项返回 false,则拒绝 HAL 设备
* IsD3D9DeviceAcceptable()
*==============================================================*/
bool CALLBACK IsD3D9DeviceAcceptable( D3DCAPS9* pCaps, D3DFORMAT AdapterFormat, D3DFORMAT BackBufferFormat,
bool /*bWindowed*/, void* /*pUserContext*/ )
{
// Typically want to skip back buffer formats that don't support alpha blending
IDirect3D9* pD3D = NNN::DXUTGetD3D9Object();
if( FAILED( pD3D->CheckDeviceFormat(pCaps->AdapterOrdinal, pCaps->DeviceType,
AdapterFormat, D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING,
D3DRTYPE_TEXTURE, BackBufferFormat) ) )
return false;
// No fallback defined by this app, so reject any device that doesn't support at least ps2.0
if( pCaps->PixelShaderVersion < D3DPS_VERSION( 2, 0 ) )
return false;
return true;
}