当前位置: 首页>>代码示例>>C++>>正文


C++ SAFE_RELEASE函数代码示例

本文整理汇总了C++中SAFE_RELEASE函数的典型用法代码示例。如果您正苦于以下问题:C++ SAFE_RELEASE函数的具体用法?C++ SAFE_RELEASE怎么用?C++ SAFE_RELEASE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SAFE_RELEASE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SAFE_RELEASE

int CDVDOverlayCodecText::Decode(DemuxPacket *pPacket)
{
  if(m_pOverlay)
    SAFE_RELEASE(m_pOverlay);

  if(!pPacket)
    return OC_ERROR;
  
  uint8_t *data = pPacket->pData;
  int      size = pPacket->iSize;
  
  m_pOverlay = new CDVDOverlayText();
  CDVDOverlayCodec::GetAbsoluteTimes(m_pOverlay->iPTSStartTime, m_pOverlay->iPTSStopTime, pPacket, m_pOverlay->replace);

  char *start, *end, *p;
  start = (char*)data;
  end   = (char*)data + size;
  p     = (char*)data;

  if (m_bIsSSA)
  {
    // currently just skip the prefixed ssa fields (8 fields)
    int nFieldCount = 8;
    while (nFieldCount > 0 && start < end)
    {
      if (*start == ',')
        nFieldCount--;

      start++;
      p++;
    }
  }

  CDVDSubtitleTagSami TagConv;
  bool Taginit = TagConv.Init();

  while(p<end)
  {
    if(*p == '{')
    {
      if(p>start)
      {
        if(Taginit)
          TagConv.ConvertLine(m_pOverlay, start, p-start);
        else
          m_pOverlay->AddElement(new CDVDOverlayText::CElementText(start, p-start));
      }
      start = p+1;

      while(*p != '}' && p<end)
        p++;

      char* override = (char*)malloc(p-start + 1);
      memcpy(override, start, p-start);
      override[p-start] = '\0';
      CLog::Log(LOGINFO, "%s - Skipped formatting tag %s", __FUNCTION__, override);
      free(override);

      start = p+1;
    }
    p++;
  }
开发者ID:7orlum,项目名称:xbmc,代码行数:62,代码来源:DVDOverlayCodecText.cpp

示例2: SAFE_RELEASE

void GdsResTexture::vClear()
{
	SAFE_RELEASE( m_pTexture );
}
开发者ID:rodrigobmg,项目名称:choding,代码行数:4,代码来源:GdsResTexture.cpp

示例3: SAFE_RELEASE

    m_pD3DRenderTargetSurface->GetDesc(&desc);
    m_uiSurfaceSizeX = desc.Width;
    m_uiSurfaceSizeY = desc.Height;

    m_iMemoryKBUsed = CRenderItemManager::CalcD3DResourceMemoryKBUsage(m_pD3DRenderTargetSurface);
}

////////////////////////////////////////////////////////////////
//
// CWebBrowserItem::ReleaseUnderlyingData
//
//
//
////////////////////////////////////////////////////////////////
void CWebBrowserItem::ReleaseUnderlyingData()
{
    SAFE_RELEASE(m_pD3DRenderTargetSurface)
    SAFE_RELEASE(m_pD3DTexture)
}

void CWebBrowserItem::Resize(const CVector2D& size)
{
    // Update size
    m_uiSizeX = static_cast<uint>(size.fX);
    m_uiSizeY = static_cast<uint>(size.fY);

    // Recreate texture
    ReleaseUnderlyingData();
    CreateUnderlyingData();
}
开发者ID:ccw808,项目名称:mtasa-blue,代码行数:30,代码来源:CRenderItem.WebBrowser.cpp

示例4: Direct3DCreate9


//.........这里部分代码省略.........
    if( pD3D9 == NULL )
        return E_FAIL;

    D3DPRESENT_PARAMETERS pp;
    pp.BackBufferWidth = 320;
    pp.BackBufferHeight = 240;
    pp.BackBufferFormat = D3DFMT_X8R8G8B8;
    pp.BackBufferCount = 1;
    pp.MultiSampleType = D3DMULTISAMPLE_NONE;
    pp.MultiSampleQuality = 0;
    pp.SwapEffect = D3DSWAPEFFECT_DISCARD;
    pp.hDeviceWindow = GetShellWindow();
    pp.Windowed = true;
    pp.Flags = 0;
    pp.FullScreen_RefreshRateInHz = 0;
    pp.PresentationInterval = D3DPRESENT_INTERVAL_DEFAULT;
    pp.EnableAutoDepthStencil = false;

    hr = pD3D9->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_NULLREF, NULL, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &pp, &pDev9 );
    if(FAILED(hr))
        goto Error;

    if( szFileName )
    {
        hr = D3DXLoadMeshFromX( szFileName, 0, pDev9, NULL, &pMat, NULL, &cMat, &pRawMesh );
        if(FAILED(hr))
            goto Error;
    }

    D3DVERTEXELEMENT9 declTanBi[] = 
    {
        { 0, 0,  D3DDECLTYPE_FLOAT3,   D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
        { 0, 12, D3DDECLTYPE_FLOAT3,   D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL,   0 },
        { 0, 24, D3DDECLTYPE_FLOAT2,   D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
        { 0, 32, D3DDECLTYPE_FLOAT3,   D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT,  0 },
        { 0, 44, D3DDECLTYPE_FLOAT3,   D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BINORMAL,  0 },
        D3DDECL_END()
    };
    D3DVERTEXELEMENT9* pdecl = declTanBi;

    // Make a clone with the desired vertex format.
    if( SUCCEEDED( pRawMesh->CloneMesh( D3DXMESH_32BIT | D3DXMESH_DYNAMIC, pdecl, pDev9, &m_pMesh ) ) )
    {
        // Optimize
        pAdjBuffer = new DWORD[ 3*m_pMesh->GetNumFaces() ];
        if( !pAdjBuffer )
        {
            hr = E_OUTOFMEMORY;
            goto Error;
        }
        m_pMesh->GenerateAdjacency( 0.001f, pAdjBuffer );
        m_pMesh->OptimizeInplace( D3DXMESHOPT_ATTRSORT,
                                    pAdjBuffer,
                                    NULL,
                                    NULL,
                                    NULL );

        // Attributes
        m_pMesh->GetAttributeTable( NULL, &m_dwNumAttr );
        if( m_dwNumAttr > 0 )
        {
            m_pAttr = new D3DXATTRIBUTERANGE[m_dwNumAttr];
            m_pMesh->GetAttributeTable( m_pAttr, &m_dwNumAttr );
        }

        // Materials
        m_dwNumMaterials = cMat;
        if( m_dwNumMaterials > 0 )
        {
            D3DXMATERIAL* pMaterialBuffer = (D3DXMATERIAL*)pMat->GetBufferPointer();
            m_pMats = new D3DXMATERIAL[ m_dwNumMaterials ];
            if( !m_pMats )
            {
                hr = E_OUTOFMEMORY;
                goto Error;
            }

            for( DWORD m=0; m<m_dwNumMaterials; m++ )
            {
                CopyMemory( &m_pMats[m], &pMaterialBuffer[m], sizeof(D3DXMATERIAL) );
            }
        }

        // Create the intermediate mesh
        hr = CreateIntermediateMesh( declTanBi, 6 );
        if(FAILED(hr))
            goto Error;
    }

    hr = S_OK;
Error:
    SAFE_RELEASE( pMat );
    SAFE_RELEASE( pRawMesh );
    SAFE_RELEASE( pMesh );
    SAFE_RELEASE( pDev9 );
    SAFE_RELEASE( pD3D9 );
    SAFE_DELETE_ARRAY( pAdjBuffer );

    return hr;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:101,代码来源:LoaderXFile.cpp

示例5: lock

// Format negotiation
HRESULT CWASAPIRenderFilter::NegotiateFormat(const WAVEFORMATEXTENSIBLE* pwfx, int nApplyChangesDepth, ChannelOrder* pChOrder)
{
  if (!pwfx)
    return VFW_E_TYPE_NOT_ACCEPTED;

  if (FormatsEqual(pwfx, m_pInputFormat))
  {
    *pChOrder = m_chOrder;
    return S_OK;
  }

  bool bApplyChanges = nApplyChangesDepth != 0;

  bool bitDepthForced = (m_pSettings->GetForceBitDepth() != 0 && m_pSettings->GetForceBitDepth() != pwfx->Format.wBitsPerSample);
  bool sampleRateForced = (m_pSettings->GetForceSamplingRate() != 0 && m_pSettings->GetForceSamplingRate() != pwfx->Format.nSamplesPerSec);
  
  if ((bitDepthForced || sampleRateForced) &&
       pwfx->SubFormat == KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL ||
       pwfx->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT && bitDepthForced)
    return VFW_E_TYPE_NOT_ACCEPTED;
  
  if (((bitDepthForced && m_pSettings->GetForceBitDepth() != pwfx->Format.wBitsPerSample) ||
       (sampleRateForced && m_pSettings->GetForceSamplingRate() != pwfx->Format.nSamplesPerSec)))
    return VFW_E_TYPE_NOT_ACCEPTED;

  CAutoLock lock(&m_csResources);

  HRESULT hr = CreateAudioClient();
  if (FAILED(hr))
  {
    Log("CWASAPIRenderFilter::NegotiateFormat Error, audio client not initialized: (0x%08x)", hr);
    return VFW_E_CANNOT_CONNECT;
  }

  WAVEFORMATEXTENSIBLE* pwfxAccepted = NULL;
  WAVEFORMATEXTENSIBLE outFormat = *pwfx;
  hr = IsFormatSupported(pwfx, &pwfxAccepted);

  // Try different speaker setup
  if (FAILED(hr))
  {
    DWORD dwSpeakers = pwfx->dwChannelMask;
    if (dwSpeakers == KSAUDIO_SPEAKER_5POINT1)
      dwSpeakers = KSAUDIO_SPEAKER_5POINT1_SURROUND;
    else if (dwSpeakers == KSAUDIO_SPEAKER_5POINT1_SURROUND)
      dwSpeakers = KSAUDIO_SPEAKER_5POINT1;
    else if (dwSpeakers == KSAUDIO_SPEAKER_7POINT1)
      dwSpeakers = KSAUDIO_SPEAKER_7POINT1_SURROUND;
    else if (dwSpeakers == KSAUDIO_SPEAKER_7POINT1_SURROUND)
      dwSpeakers = KSAUDIO_SPEAKER_7POINT1;

    if (dwSpeakers != pwfx->dwChannelMask)
    {
      outFormat.dwChannelMask = dwSpeakers;
      hr = IsFormatSupported(&outFormat, &pwfxAccepted);
    }
  }

  if (FAILED(hr))
  {
    SAFE_DELETE_WAVEFORMATEX(pwfxAccepted);
    return hr;
  }

  if (bApplyChanges)
  {
    LogWaveFormat(&outFormat, "REN - applying  ");

    // Stop and discard audio client
    StopAudioClient();
    SAFE_RELEASE(m_pRenderClient);
    SAFE_RELEASE(m_pAudioClock);
    SAFE_RELEASE(m_pAudioClient);

    // We must use incoming format so the WAVEFORMATEXTENSIBLE to WAVEFORMATEXT difference
    // that some audio drivers require is not causing an infinite loop of format changes
    SetInputFormat(pwfx);
    SetOutputFormat(&outFormat);

    // Reinitialize audio client
    hr = CreateAudioClient(true);
  }
  else
    LogWaveFormat(pwfx, "Input format    ");

  m_chOrder = *pChOrder = DS_ORDER;
  SAFE_DELETE_WAVEFORMATEX(pwfxAccepted);

  return hr;
}
开发者ID:Azzuro,项目名称:MediaPortal-1,代码行数:91,代码来源:WASAPIRenderFilter.cpp

示例6: getSettings

bool SceneService::onInit()
{
    _scene.reset(gameplay::Scene::create());
    _scene->setAmbientColor(0.1f, 0.1f, 0.1f);

    _camera.reset(gameplay::Camera::createPerspective(30.0f, gameplay::Game::getInstance()->getAspectRatio(), 5.0f, 30.0f));
    _scene->setActiveCamera(_camera.get());

    _light.reset(gameplay::Light::createDirectional(0.9f, 0.9f, 0.9f));

    gameplay::Node * cameraNode = _scene->addNode("Camera");
    cameraNode->setCamera(_camera.get());

    gameplay::Node * lightNode = _scene->addNode("Light");
    lightNode->setLight(_light);
    lightNode->setRotation(gameplay::Vector3(1.0f, 0.0f, 0.0f), -MATH_PIOVER4);

    ServiceManager::getInstance()->signals.inputTouchEvent.connect(10, sigc::mem_fun(this, &SceneService::onTouchEvent));
    ServiceManager::getInstance()->signals.inputMouseEvent.connect(10, sigc::mem_fun(this, &SceneService::onMouseEvent));
    ServiceManager::getInstance()->signals.inputGesturePinchEvent.connect(10, sigc::mem_fun(this, &SceneService::onGesturePinchEvent));

    getSettings()->sidebarWidthChangedSignal.connect(sigc::mem_fun(this, &SceneService::onSidebarWidthChanged));

    _renderService = _manager->findService<RenderService>();

    gameplay::Game::getInstance()->registerGesture(gameplay::Gesture::GESTURE_PINCH);

    PrimitivesPool::getInstance()->generatePrimitives();

    _moleculeModel.reset(MoleculeModel::create(getSettings()->getMolecule()));
    insertNode(_moleculeModel->getRootNode());
    _moleculeModel->modelChangedSignal.connect(sigc::mem_fun(this, &SceneService::moleculeChanged));

    updateCamera();
    _lastTime = static_cast< float >(gameplay::Game::getInstance()->getGameTime() * 0.001f);

    float vpwidth = static_cast<float>(gameplay::Game::getInstance()->getWidth());
    float vpheight = static_cast<float>(gameplay::Game::getInstance()->getHeight());
    float sidebarWidth = getSettings()->getSidebarWidth();
    _camera->setAspectRatio((vpwidth - sidebarWidth) / vpheight);

    gameplay::Vector3 axisX[] = { gameplay::Vector3::zero(), gameplay::Vector3::unitX() };
    gameplay::Vector3 axisY[] = { gameplay::Vector3::zero(), gameplay::Vector3::unitY() };
    gameplay::Vector3 axisZ[] = { gameplay::Vector3::zero(), gameplay::Vector3::unitZ() };
    gameplay::Mesh * axisXMesh = gameplay::Mesh::createLines(axisX, 2);
    gameplay::Mesh * axisYMesh = gameplay::Mesh::createLines(axisY, 2);
    gameplay::Mesh * axisZMesh = gameplay::Mesh::createLines(axisZ, 2);
    _axisXModel.reset(gameplay::Model::create(axisXMesh));
    _axisYModel.reset(gameplay::Model::create(axisYMesh));
    _axisZModel.reset(gameplay::Model::create(axisZMesh));
    _axisXModel->setMaterial("materials/models/line.material");
    _axisYModel->setMaterial("materials/models/line.material");
    _axisZModel->setMaterial("materials/models/line.material");
    _axisXModel->getMaterial()->getParameter("u_modulateColor")->setVector4(gameplay::Vector4(1.0f, 0.0f, 0.0f, 1.0f));
    _axisYModel->getMaterial()->getParameter("u_modulateColor")->setVector4(gameplay::Vector4(0.0f, 1.0f, 0.0f, 1.0f));
    _axisZModel->getMaterial()->getParameter("u_modulateColor")->setVector4(gameplay::Vector4(0.0f, 0.0f, 1.0f, 1.0f));
    SAFE_RELEASE(axisXMesh);
    SAFE_RELEASE(axisYMesh);
    SAFE_RELEASE(axisZMesh);

    gameplay::Node * axisXNode = _scene->addNode("AxisX");
    gameplay::Node * axisYNode = _scene->addNode("AxisY");
    gameplay::Node * axisZNode = _scene->addNode("AxisZ");
    axisXNode->setDrawable(_axisXModel.get());
    axisYNode->setDrawable(_axisYModel.get());
    axisZNode->setDrawable(_axisZModel.get());

    return true;
}
开发者ID:reven86,项目名称:vsu-mol-db,代码行数:69,代码来源:scene_service.cpp

示例7: Objects_Init

//-----------------------------------【Object_Init( )函数】--------------------------------------
//	描述:渲染资源初始化函数,在此函数中进行要被渲染的物体的资源的初始化
//--------------------------------------------------------------------------------------------------
HRESULT Objects_Init(HWND hwnd)
{
	//创建字体
	if(FAILED(D3DXCreateFont(g_pd3dDevice, 36, 0, 0, 1000, false, DEFAULT_CHARSET, 
		OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, 0, _T("Calibri"), &g_pTextFPS)))
		return E_FAIL;
	if (FAILED(D3DXCreateFont(g_pd3dDevice, 20, 0, 1000, 0, false, DEFAULT_CHARSET,
		OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, 0, _T("华文中宋"), &g_pTextAdaperName)))
		return E_FAIL;
	if (FAILED(D3DXCreateFont(g_pd3dDevice, 23, 0, 1000, 0, false, DEFAULT_CHARSET,
		OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, 0, _T("微软雅黑"), &g_pTextHelper)))
		return E_FAIL;
	if (FAILED(D3DXCreateFont(g_pd3dDevice, 26, 0, 1000, 0, false, DEFAULT_CHARSET,
		OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, 0, _T("黑体"), &g_pTextInfo)))
		return E_FAIL;

	LPD3DXBUFFER pAdjBuffer = NULL;
	LPD3DXBUFFER pMtrlBuffer = NULL;

	if (FAILED(D3DXLoadMeshFromX(L"Warden.X", D3DXMESH_MANAGED, g_pd3dDevice, &pAdjBuffer, &pMtrlBuffer, NULL, &g_dwNumMtrls, &g_pMesh)))
	//if (FAILED(D3DXLoadMeshFromX(L"WYJ.X", D3DXMESH_MANAGED, g_pd3dDevice, &pAdjBuffer, &pMtrlBuffer, NULL, &g_dwNumMtrls, &g_pMesh)))
		return E_FAIL;

	D3DXMATERIAL *pMtrls = (D3DXMATERIAL *)pMtrlBuffer->GetBufferPointer();
	g_pMaterials = new D3DMATERIAL9[g_dwNumMtrls];
	g_pTextures = new LPDIRECT3DTEXTURE9[g_dwNumMtrls];

	for (DWORD i = 0; i < g_dwNumMtrls; i++)
	{
		g_pMaterials[i] = pMtrls[i].MatD3D;
		g_pMaterials[i].Ambient = g_pMaterials[i].Diffuse;

		g_pTextures[i] = NULL;
		D3DXCreateTextureFromFileA(g_pd3dDevice, pMtrls[i].pTextureFilename, &g_pTextures[i]);
	}

	SAFE_RELEASE(pAdjBuffer);
	SAFE_RELEASE(pMtrlBuffer);

	g_pd3dDevice->CreateVertexBuffer(4 * sizeof(CUSTOMVERTEX), 0, D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED, &g_pVertexBuffer, 0);
	CUSTOMVERTEX *pVertices = NULL;
	g_pVertexBuffer->Lock(0, 0, (void **)&pVertices, 0);
	pVertices[0] = CUSTOMVERTEX(-500.0f, 0.0f, -500.0f, 0.0f, 1.0f, 0.0f, 0.0f, 50.0f);
	pVertices[1] = CUSTOMVERTEX(-500.0f, 0.0f, 500.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f);
	pVertices[2] = CUSTOMVERTEX(500.0f, 0.0f, -500.0f, 0.0f, 1.0f, 0.0f, 50.0f, 50.0f);
	pVertices[3] = CUSTOMVERTEX(500.0f, 0.0f, 500.0f, 0.0f, 1.0f, 0.0f, 50.0f, 0.0f);
	g_pVertexBuffer->Unlock();

	D3DXCreateTextureFromFile(g_pd3dDevice, L"grass.jpg", &g_pTexture);

	D3DXCreateCylinder(g_pd3dDevice, 10.0f, 10.0f, 500.0f, 60, 60, &g_cylinder, 0);

	g_MaterialCylinder.Ambient = D3DXCOLOR(0.9f, 0.0f, 0.8f, 1.0f);
	g_MaterialCylinder.Diffuse = D3DXCOLOR(0.9f, 0.0f, 0.8f, 1.0f);
	g_MaterialCylinder.Specular = D3DXCOLOR(0.9f, 0.2f, 0.9f, 0.9f);
	g_MaterialCylinder.Emissive = D3DXCOLOR(0.0f, 0.0f, 0.9f, 1.0f);

	D3DLIGHT9 light;
	ZeroMemory(&light, sizeof(light));
	light.Type = D3DLIGHT_DIRECTIONAL;
	light.Ambient = D3DXCOLOR(0.7f, 0.7f, 0.7f, 1.0f);
	light.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
	light.Specular = D3DXCOLOR(0.5f, 0.5f, 0.5f, 1.0f);
	light.Direction = D3DXVECTOR3(1.0f, 0.0f, 0.0f);
	g_pd3dDevice->SetLight(0, &light);
	g_pd3dDevice->LightEnable(0, true);
	g_pd3dDevice->SetRenderState(D3DRS_NORMALIZENORMALS, true);
	g_pd3dDevice->SetRenderState(D3DRS_SPECULARENABLE, true);

	g_pCamera = new CameraClass(g_pd3dDevice);
	g_pCamera->SetCameraPosition(&D3DXVECTOR3(0.0f, 200.0f, -300.0f));
	g_pCamera->SetTargetPosition(&D3DXVECTOR3(0.0f, 300.0f, 0.0f));
	g_pCamera->SetViewMatrix();
	g_pCamera->SetProjMatrix();

	g_pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
	g_pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
	g_pd3dDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);


	//g_pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW);

	return S_OK;
}
开发者ID:chenyingjing,项目名称:WindowsGameProgrammingFromZero,代码行数:87,代码来源:main.cpp

示例8: Cleanup

VOID Cleanup()
{
    SAFE_RELEASE(g_pSphereMesh) ;
    SAFE_RELEASE(g_pd3dDevice) ;
    SAFE_RELEASE(g_pD3D) ;
}
开发者ID:BillyKim,项目名称:directxcode,代码行数:6,代码来源:MaterialOnly.cpp

示例9: SAFE_RELEASE

Heightmap::~Heightmap()
{
	SAFE_RELEASE(vertextBuffer);
	SAFE_RELEASE(indexBuffer);
}
开发者ID:jarllarsson,项目名称:PA2505-Stort-Spelprojekt-Prototyp,代码行数:5,代码来源:Heightmap.cpp

示例10: Create_Internal

  HRESULT Create_Internal(IUnknown *pAdapter, D3D_FEATURE_LEVEL MinimumFeatureLevel, REFIID riid,
                          void **ppDevice)
  {
    // if we're already inside a wrapped create i.e. this function, then DON'T do anything
    // special. Just grab the trampolined function and call it.
    if(m_InsideCreate)
    {
      PFN_D3D12_CREATE_DEVICE createFunc = NULL;

      // shouldn't ever get in here if we're in the case without hooks but let's be safe.
      if(m_HasHooks)
      {
        createFunc = CreateDevice();
      }
      else
      {
        HMODULE d3d12 = GetModuleHandleA("d3d12.dll");

        if(d3d12)
        {
          createFunc = (PFN_D3D12_CREATE_DEVICE)GetProcAddress(d3d12, "D3D12CreateDevice");
        }
        else
        {
          RDCERR("Something went seriously wrong, d3d12.dll couldn't be loaded!");
          return E_UNEXPECTED;
        }
      }

      return createFunc(pAdapter, MinimumFeatureLevel, riid, ppDevice);
    }

    m_InsideCreate = true;

    if(riid != __uuidof(ID3D12Device))
    {
      RDCERR("Unsupported UUID %s for D3D12CreateDevice", ToStr::Get(riid).c_str());
      return E_NOINTERFACE;
    }

    RDCDEBUG("Call to Create_Internal Feature Level %x", MinimumFeatureLevel,
             ToStr::Get(riid).c_str());

    bool reading = RenderDoc::Inst().IsReplayApp();

    if(reading)
    {
      RDCDEBUG("In replay app");
    }

    const bool EnableDebugLayer =
#if 1    // toggle on/off if you want debug layer during replay
        RenderDoc::Inst().IsReplayApp() ||
#endif
        (m_EnabledHooks && !reading && RenderDoc::Inst().GetCaptureOptions().APIValidation);

    if(EnableDebugLayer)
    {
      PFN_D3D12_GET_DEBUG_INTERFACE getfn = GetDebugInterface();

      if(getfn == NULL)
        getfn = (PFN_D3D12_GET_DEBUG_INTERFACE)GetProcAddress(GetModuleHandleA("d3d12.dll"),
                                                              "D3D12GetDebugInterface");

      if(getfn)
      {
        ID3D12Debug *debug = NULL;
        HRESULT hr = getfn(__uuidof(ID3D12Debug), (void **)&debug);

        if(SUCCEEDED(hr) && debug)
        {
          debug->EnableDebugLayer();

          RDCDEBUG("Enabling debug layer");

// enable this to get GPU-based validation, where available, whenever we enable API validation
#if 0
          ID3D12Debug1 *debug1 = NULL;
          hr = debug->QueryInterface(__uuidof(ID3D12Debug1), (void **)&debug1);

          if(SUCCEEDED(hr) && debug1)
          {
            RDCDEBUG("Enabling GPU-based validation");
            debug1->SetEnableGPUBasedValidation(true);
            SAFE_RELEASE(debug1);
          }
          else
          {
            RDCDEBUG("GPU-based validation not available");
          }
#endif
        }
        else
        {
          RDCERR("Couldn't enable debug layer: %x", hr);
        }

        SAFE_RELEASE(debug);
      }
      else
//.........这里部分代码省略.........
开发者ID:kvark,项目名称:renderdoc,代码行数:101,代码来源:d3d12_hooks.cpp

示例11: DEBUG_MSG

//-------------------------------------------------------------------------------------
void Loginapp::onReqCreateMailAccountResult(Network::Channel* pChannel, MemoryStream& s)
{
	SERVER_ERROR_CODE failedcode;
	std::string accountName;
	std::string password;
	std::string retdatas = "";

	s >> failedcode >> accountName >> password;
	s.readBlob(retdatas);

	DEBUG_MSG(fmt::format("Loginapp::onReqCreateMailAccountResult: accountName={}, failedcode={}.\n",
		accountName.c_str(), failedcode));

	if(failedcode == SERVER_SUCCESS)
	{
		Components::COMPONENTS& loginapps = Components::getSingleton().getComponents(LOGINAPP_TYPE);

		std::string http_host = "localhost";
		if(startGroupOrder_ == 1)
		{
			if(strlen((const char*)&g_kbeSrvConfig.getLoginApp().externalAddress) > 0)
				http_host = g_kbeSrvConfig.getBaseApp().externalAddress;
			else
				http_host = inet_ntoa((struct in_addr&)Loginapp::getSingleton().networkInterface().extaddr().ip);
		}
		else
		{
			Components::COMPONENTS::iterator iter = loginapps.begin();
			for(; iter != loginapps.end(); ++iter)
			{
				if((*iter).groupOrderid == 1)
				{
					if(strlen((const char*)&(*iter).externalAddressEx) > 0)
						http_host = (*iter).externalAddressEx;
					else
						http_host = inet_ntoa((struct in_addr&)(*iter).pExtAddr->ip);
				}
			}
		}

		threadPool_.addTask(new SendActivateEMailTask(accountName, retdatas, 
			http_host, 
			g_kbeSrvConfig.getLoginApp().http_cbport));
	}

	PendingLoginMgr::PLInfos* ptinfos = pendingCreateMgr_.remove(accountName);
	if(ptinfos == NULL)
		return;

	Network::Channel* pClientChannel = this->networkInterface().findChannel(ptinfos->addr);
	if(pClientChannel == NULL)
		return;

	pClientChannel->extra("");
	retdatas = "";

	Network::Bundle* pBundle = Network::Bundle::ObjPool().createObject();
	(*pBundle).newMessage(ClientInterface::onCreateAccountResult);
	(*pBundle) << failedcode;
	(*pBundle).appendBlob(retdatas);

	pClientChannel->send(pBundle);

	SAFE_RELEASE(ptinfos);
}
开发者ID:JustDo1989,项目名称:kbengine,代码行数:66,代码来源:loginapp.cpp

示例12: GP_ASSERT


//.........这里部分代码省略.........
        {
            if (centerSpecified)
            {
                shape = sphere(radius, center, centerIsAbsolute);
            }
            else
            {
                shape = sphere(radius);
            }
        }
        else
        {
            shape = sphere();
        }
        break;

    case SHAPE_CAPSULE:
        if (radius != -1.0f && height != -1.0f)
        {
            if (centerSpecified)
            {
                shape = capsule(radius, height, center, centerIsAbsolute);
            }
            else
            {
                shape = capsule(radius, height);
            }
        }
        else
        {
            shape = capsule();
        }
        break;

    case SHAPE_MESH:
        {
            // Mesh is required on node.
            Mesh* nodeMesh = node->getDrawable() ? dynamic_cast<Model*>(node->getDrawable())->getMesh() : NULL;
            if (nodeMesh == NULL)
            {
                GP_ERROR("Cannot create mesh collision object for node without model/mesh.");
            }
            else
            {
                // Check that the node's mesh's primitive type is supported.
                switch (nodeMesh->getPrimitiveType())
                {
                case Mesh::TRIANGLES:
                    shape = mesh(nodeMesh);
                    break;
                case Mesh::LINES:
                case Mesh::LINE_STRIP:
                case Mesh::POINTS:
                case Mesh::TRIANGLE_STRIP:
                    GP_ERROR("Mesh collision objects are currently only supported on meshes with primitive type equal to TRIANGLES.");
                    break;
                }
            }
        }
        break;

    case SHAPE_HEIGHTFIELD:
        {
            if (imagePath == NULL)
            {
                // Node requires a valid terrain
                if (dynamic_cast<Terrain*>(node->getDrawable()) == NULL)
                {
                    GP_ERROR("Heightfield collision objects can only be specified on nodes that have a valid terrain, or that specify an image path.");
                }
                else
                {
                    shape = PhysicsCollisionShape::heightfield();
                }
            }
            else
            {
                std::string ext = FileSystem::getExtension(imagePath);
                HeightField* heightfield = NULL;
                if (ext == ".PNG")
                    heightfield = HeightField::createFromImage(imagePath, minHeight, maxHeight);
                else if (ext == ".RAW" || ext == ".R16")
                    heightfield = HeightField::createFromRAW(imagePath, (unsigned int)width, (unsigned int)height, minHeight, maxHeight);

                if (heightfield)
                {
                    shape = PhysicsCollisionShape::heightfield(heightfield);
                    SAFE_RELEASE(heightfield);
                }
            }
        }
        break;

    default:
        GP_ERROR("Unsupported physics collision shape type (%d).", type);
        break;
    }

    return shape;
}
开发者ID:dtbinh,项目名称:Game3D,代码行数:101,代码来源:PhysicsCollisionShape.cpp

示例13: SAFE_RELEASE

//-------------------------------------------------------------------------------------
bool ForwardComponent_MessageBuffer::process()
{
	if(pMap_.size() <= 0)
	{
		start_ = false;
		return false;
	}
	
	MSGMAP::iterator iter = pMap_.begin();
	for(; iter != pMap_.end(); )
	{
		Components::ComponentInfos* cinfos = Components::getSingleton().findComponent(iter->first);
		if(cinfos == NULL || cinfos->pChannel == NULL)
			return true;

		// 如果是mgr类组件需要判断是否已经初始化完成
		if(g_componentType == CELLAPPMGR_TYPE || g_componentType == BASEAPPMGR_TYPE)
		{
			if(cinfos->state != COMPONENT_STATE_RUN)
				return true;
		}

		if(iter->second.size() == 0)
		{
			pMap_.erase(iter++);
		}
		else
		{
			int icount = 5;

			std::vector<ForwardItem*>::iterator itervec = iter->second.begin();

			for(; itervec != iter->second.end(); )
			{
				if (!(*itervec)->isOK())
					return true;

				cinfos->pChannel->send((*itervec)->pBundle);
				(*itervec)->pBundle = NULL;

				if((*itervec)->pHandler != NULL)
				{
					(*itervec)->pHandler->process();
					SAFE_RELEASE((*itervec)->pHandler);
				}
				
				SAFE_RELEASE((*itervec));

				itervec = iter->second.erase(itervec);

				if(--icount <= 0)
					return true;
			}
			
			DEBUG_MSG(fmt::format("ForwardComponent_MessageBuffer::process(): size:{}.\n", iter->second.size()));
			iter->second.clear();
			++iter;
		}
	}

	return true;
}
开发者ID:1564143452,项目名称:kbengine,代码行数:63,代码来源:forward_messagebuffer.cpp

示例14: SAFE_RELEASE

void Axis::Release()
{
	SAFE_RELEASE(m_pVB);
	SAFE_DELETE(m_pVtxs);	
}
开发者ID:JangYeongin,项目名称:JPortfolio,代码行数:5,代码来源:Axis.cpp

示例15: return

///////////////////////////////////////////////////////////////
//// Retrieve video and audio stream numbers from profile
////
HRESULT CSVPWMVReader::GetStreamNumbers(IWMProfile* pProfile)
{
    HRESULT             hr = S_OK;
    IWMStreamConfig*    pStream = NULL;
    DWORD               dwStreams = 0;
    GUID                pguidStreamType;

    if ( NULL == pProfile )
    {
        return( E_INVALIDARG );
    }

    hr = pProfile->GetStreamCount( &dwStreams );
    if ( FAILED( hr ) )
    {
        _tprintf( _T(  "GetStreamCount on IWMProfile failed (hr=0x%08x).\n" ), hr );
        return( hr );
    }

    m_wAudioStreamNum = 0;
    m_wVideoStreamNum = 0;

    for ( DWORD i = 0; i < dwStreams; i++ )
    {
        hr = pProfile->GetStream( i, &pStream );
        if ( FAILED( hr ) )
        {
            _tprintf( _T(  "Could not get Stream %d of %d from IWMProfile (hr=0x%08x).\n" ),
                    i, dwStreams, hr );
            break;
        }

        WORD wStreamNumber = 0 ;

        //
        //  Get the stream number of the current stream
        //

        hr = pStream->GetStreamNumber( &wStreamNumber );
        if ( FAILED( hr ) )
        {
            _tprintf( _T(  "Could not get stream number from IWMStreamConfig %d of %d (hr=0x%08x).\n" ),
                    i, dwStreams, hr );
            break;
        }

        hr = pStream->GetStreamType( &pguidStreamType );
        if ( FAILED( hr ) )
        {
            _tprintf( _T("Could not get stream type of stream %d of %d from IWMStreamConfig (hr=0x%08x).\n" ),
                i, dwStreams, hr ) ;
            break ;
        }
        
        if( WMMEDIATYPE_Audio == pguidStreamType )
        {
            m_wAudioStreamNum = wStreamNumber;
        }
        else if( WMMEDIATYPE_Video == pguidStreamType )
        {
            m_wVideoStreamNum = wStreamNumber;
        }

        SAFE_RELEASE( pStream );
    }

    return( hr );
}
开发者ID:Strongc,项目名称:playasa,代码行数:71,代码来源:reader.cpp


注:本文中的SAFE_RELEASE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。